/* ── Design tokens — cùng ngôn ngữ với admin Solatech: nền slate, thẻ trắng,
      nút hành động AMBER, dữ liệu/link xanh cobalt. Dark theo hệ điều hành. ── */
:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --fg: #1e293b;
  --muted: #64748b;
  --faint: #94a3b8;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --amber: #f59e0b;
  --amber-h: #d97706;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --run-soft: #eff6ff;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #020617;
    --card: #0f172a;
    --border: #1e293b;
    --fg: #f1f5f9;
    --muted: #94a3b8;
    --faint: #64748b;
    --accent: #60a5fa;
    --accent-soft: rgba(59, 130, 246, .12);
    --danger: #f87171;
    --danger-soft: rgba(239, 68, 68, .12);
    --ok: #34d399;
    --ok-soft: rgba(16, 185, 129, .12);
    --run-soft: rgba(59, 130, 246, .12);
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: Roboto, 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--fg);
  background: var(--bg);
  margin: 0;
  line-height: 1.6;
}

.wrap { max-width: 1060px; margin: 0 auto; padding: 20px 16px 48px; }

/* ── Thanh trên cùng ── */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: .95rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: .8rem;
  flex: none;
}
.brand-tag {
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  border-radius: 4px;
  padding: 2px 6px;
}
.who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .85rem;
}
.who .avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--amber);
  color: #fff;
  font-weight: 700;
  font-size: .75rem;
}

/* ── Đầu trang dự án ── */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 6px 0 18px;
}
.back {
  font-size: .82rem;
  color: var(--muted);
}
h1 { font-size: 1.35rem; margin: 2px 0 0; letter-spacing: -.02em; }
.muted { color: var(--muted); font-size: .85rem; }

/* ── Lưới 2 cột: soạn liệu trái, tiến độ/kết quả phải ── */
.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 860px) {
  .grid2 { grid-template-columns: 1fr; }
}

/* ── Thẻ ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 0; }
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--faint);
}
.card-title svg { width: 15px; height: 15px; flex: none; }
.card-hint { margin: 0 0 12px; font-size: .82rem; color: var(--muted); }

/* ── Nút ── */
button, .btn {
  font: inherit;
  font-size: .875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
button:hover, .btn:hover { background: var(--bg); text-decoration: none; }
button.primary, .btn.primary {
  background: var(--amber);
  border-color: var(--amber);
  color: #fff;
  font-weight: 600;
}
button.primary:hover, .btn.primary:hover { background: var(--amber-h); border-color: var(--amber-h); }
button.danger { color: var(--danger); }
button.danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ── Ô nhập ── */
input[type=text], input[type=password], input[type=email], textarea, select {
  width: 100%;
  font: inherit;
  font-size: .875rem;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--fg);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 18%, transparent);
}
input[type=email], select { width: auto; }
textarea { min-height: 130px; font-family: Consolas, monospace; font-size: .82rem; line-height: 1.55; }
input[type=checkbox] { accent-color: var(--amber); width: 15px; height: 15px; }
label { display: inline-flex; align-items: center; gap: 7px; font-size: .85rem; color: var(--fg); cursor: pointer; }
input[type=file] { font-size: .82rem; color: var(--muted); }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Badge trạng thái ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .7rem;
  font-weight: 700;
  padding: 2.5px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.badge.ok  { background: var(--ok-soft); color: var(--ok); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
.badge.run { background: var(--run-soft); color: var(--accent); }
.badge.run::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 99px;
  background: currentColor;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .3; } }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Khối log: kiểu console tối ở cả hai theme ── */
pre.log {
  background: #0f172a;
  color: #cbd5e1;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: .78rem;
  line-height: 1.55;
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
  margin: 10px 0 0;
}

/* ── Danh sách dự án ── */
.project-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  transition: border-color .15s, box-shadow .15s;
}
.project-item:hover { border-color: var(--faint); }
.project-item .info { min-width: 0; }
.project-item .name { font-weight: 600; font-size: .95rem; color: var(--fg); }
.project-item .name:hover { color: var(--accent); }
.project-item .right { display: flex; align-items: center; gap: 10px; flex: none; }
.project-item .chev { color: var(--faint); font-size: 1.05rem; }

/* ── File list ── */
ul.files { margin: 6px 0 12px; padding: 0; list-style: none; }
ul.files li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 2px;
  font-size: .85rem;
  border-bottom: 1px dashed var(--border);
}
ul.files li:last-child { border-bottom: 0; }
ul.files li::before { content: '🎬'; font-size: .8rem; }
ul.files li.empty::before { content: none; }

.error-msg { color: var(--danger); font-size: .85rem; min-height: 1.2em; margin: 8px 0; }

/* ── Đăng nhập ── */
.login-box { max-width: 380px; margin: 14vh auto 0; padding: 28px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 18px; text-align: center; }
.login-brand .brand-mark { width: 46px; height: 46px; border-radius: 12px; font-size: 1.15rem; }
.login-brand h1 { font-size: 1.15rem; margin: 0; }
.login-box input { margin-bottom: 10px; }
