/* ── Form controls ───────────────────────────────────────────
   Native <option> dropdowns ignore translucent/inherited colors in most
   browsers and fall back to a white popup — pair color-scheme with an
   explicit solid background/color on every option so the open list stays
   readable regardless of page theme. */
select { color-scheme: dark; }
select option { background: #151a21; color: #f0f4f8; }

/* ── App shell ───────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  background: rgba(6,10,15,0.95);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 14px 10px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto; overflow-x: hidden;
  width: 260px; min-width: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar .brand { padding: 4px 8px 14px; }

.side-group {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-3); font-weight: 700; padding: 10px 12px 4px;
}

.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; font-size: 13.5px;
  margin-bottom: 1px; transition: all .14s;
  border: 1px solid transparent;
  position: relative;
}
.nav-link svg { width: 16px; height: 16px; flex: none; opacity: .8; }
.nav-link:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.nav-link.active {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent-line);
  font-weight: 600;
}
.nav-link.active svg { opacity: 1; }

.sidebar .spacer { flex: 1; min-height: 8px; }

.side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  margin-top: 6px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--grad-accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 12px;
  font-family: var(--font-display);
  box-shadow: 0 0 0 2px rgba(255,107,53,0.3);
}
.side-user .u-name { font-size: 13px; font-weight: 700; }
.side-user .u-mail { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }

/* ── Main content ────────────────────────────────────────── */
.content { min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: rgba(6,10,15,0.8);
  backdrop-filter: blur(20px);
  z-index: 30;
}
.topbar h1 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 800;
  background: linear-gradient(135deg, var(--text) 40%, var(--text-2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.topbar .sub { color: var(--text-3); font-size: 13px; margin-top: 1px; }

.credit-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border-2);
  font-size: 13.5px; font-weight: 600; transition: all .15s;
}
.credit-chip:hover { border-color: var(--accent-line); background: var(--accent-bg); }
.credit-chip svg { width: 15px; height: 15px; opacity: .7; }
.credit-chip b { color: var(--accent); font-family: var(--font-mono); }

.page { padding: 28px; max-width: 1140px; }

/* ── Grid ────────────────────────────────────────────────── */
.grid   { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3,1fr); }
.grid-2 { grid-template-columns: repeat(2,1fr); }

/* ── Stat cards ──────────────────────────────────────────── */
.stat .k { font-size: 12px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.stat .v { font-size: 32px; font-weight: 800; margin-top: 8px; letter-spacing: -0.03em; font-family: var(--font-mono); color: var(--text); }
.stat .sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ── Section titles ──────────────────────────────────────── */
.section-title {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .12em;
  margin: 28px 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.section-title::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Lists & rows ────────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: 10px; }

.row-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all .14s;
}
.row-card:hover { border-color: var(--border-2); background: var(--surface-2); }
.row-card .grow { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta  { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.empty { text-align: center; padding: 52px 20px; color: var(--text-3); font-size: 14px; }

/* ── Task card (Tasks page) ──────────────────────────────── */
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: all .18s;
  position: relative;
  overflow: hidden;
}
.task-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}
.task-card:hover { border-color: var(--border-2); background: var(--surface-2); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.task-card.is-completed { border-left: 3px solid var(--green); }
.task-card.is-failed    { border-left: 3px solid var(--red); }
.task-card.is-processing{ border-left: 3px solid var(--accent); }

.task-card .tc-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.task-card .tc-text { font-weight: 600; font-size: 15px; line-height: 1.4; }
.task-card .tc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.task-card .tc-meta span { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.task-card .tc-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }
.task-card .tc-progress { margin-top: 14px; }
.task-card .tc-pct { font-family: var(--font-mono); font-size: 12px; font-weight: 700; }
.task-card .tc-actions { margin-top: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Chips ───────────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  position: relative; padding: 10px 16px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-2);
  text-align: center; transition: all .15s; min-width: 86px;
}
.chip:hover { border-color: var(--border-3); }
.chip.sel { border-color: var(--accent); background: var(--accent-bg); box-shadow: 0 0 0 1px var(--accent-line) inset; }
.chip .chip-tag {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  background: var(--grad-accent); color: #fff;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.chip .chip-name { font-weight: 700; font-size: 13px; }

/* ── Counter ─────────────────────────────────────────────── */
.counter { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-3); }
.counter.over { color: var(--red); font-weight: 700; }

/* ── Mobile hamburger ────────────────────────────────────── */
.menu-btn {
  display: none; background: var(--surface); border: 1px solid var(--border-2);
  color: var(--text); width: 38px; height: 38px; border-radius: var(--radius-sm);
  cursor: pointer; align-items: center; justify-content: center;
}
.scrim { display: none; }

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 268px; z-index: 60; height: 100vh;
    transform: translateX(-110%); transition: transform .22s cubic-bezier(.4,0,.2,1);
  }
  .shell.open .sidebar { transform: translateX(0); }
  .scrim {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
    z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .shell.open .scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-flex; }
  .page { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}
