/* ===========================================================================
   Filesoft — interface stylesheet
   Palette: white surfaces, blue for action, green for positive, red for
   errors, amber/brown for notifications. Light + dark, mobile first.
   =========================================================================== */

/* ---------------------------------------------------------------- 1. tokens */

:root {
  color-scheme: light;

  --white:      #ffffff;
  --blue:       #2563eb;
  --blue-700:   #1d4ed8;
  --blue-soft:  #eff6ff;
  --blue-line:  #bfdbfe;
  --green:      #15803d;
  --green-700:  #166534;
  --green-soft: #f0fdf4;
  --green-line: #bbf7d0;
  --red:        #dc2626;
  --red-soft:   #fef2f2;
  --red-line:   #fecaca;
  --amber:      #b45309;
  --amber-soft: #fffbeb;
  --amber-line: #fde68a;
  --brown:      #7c4a21;

  --bg:           #f6f8fb;
  --surface:      #ffffff;
  --surface-2:    #f8fafc;
  --surface-3:    #eef2f7;
  --border:       #e4e9f0;
  --border-strong:#cbd5e1;
  --text:         #0f1c2e;
  --text-2:       #475569;
  --muted:        #7c8ba1;

  --r-xs: 6px;
  --r-sm: 9px;
  --r:    13px;
  --r-lg: 18px;

  --sh-sm: 0 1px 2px rgba(15, 28, 46, .05);
  --sh:    0 1px 3px rgba(15, 28, 46, .06), 0 10px 28px -20px rgba(15, 28, 46, .35);

  --sidebar-w: 250px;
  --topbar-h:  62px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans Bengali", "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;

  --blue:       #60a5fa;
  --blue-700:   #3b82f6;
  --blue-soft:  #0f2440;
  --blue-line:  #1e3a5f;
  --green:      #4ade80;
  --green-700:  #22c55e;
  --green-soft: #0b2417;
  --green-line: #1c4a30;
  --red:        #f87171;
  --red-soft:   #2a1415;
  --red-line:   #5a2626;
  --amber:      #fbbf24;
  --amber-soft: #26200a;
  --amber-line: #5a4715;
  --brown:      #e0b083;

  --bg:           #070d15;
  --surface:      #0e1620;
  --surface-2:    #0b131c;
  --surface-3:    #16212e;
  --border:       #1d2937;
  --border-strong:#2c3b4d;
  --text:         #e8eff8;
  --text-2:       #b5c3d3;
  --muted:        #8496a9;

  --sh-sm: 0 1px 2px rgba(0, 0, 0, .45);
  --sh:    0 1px 3px rgba(0, 0, 0, .5), 0 14px 32px -22px rgba(0, 0, 0, .95);
}

/* ----------------------------------------------------------------- 2. base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.28; letter-spacing: -.012em; font-weight: 700; }
p  { margin: 0; }
ul { margin: 0; padding: 0; }

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

svg.ic { flex: none; display: block; }
img  { max-width: 100%; height: auto; }

code, kbd, samp {
  font-family: var(--mono);
  font-size: .875em;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: .08em .38em;
  color: var(--text-2);
}

hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

::selection { background: var(--blue-soft); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ---------------------------------------------------------------- 3. shell */

.shell { display: flex; min-height: 100vh; }

/* sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 38px; height: 38px;
  flex: none;
  border-radius: 11px;
  display: grid; place-items: center;
  background: var(--blue);
  color: #fff;
}

.brand-text { min-width: 0; }
.brand-text b { display: block; font-size: 15.5px; font-weight: 800; letter-spacing: -.02em; }
.brand-text span { display: block; font-size: 11.5px; color: var(--muted); margin-top: -1px; }

.sidebar__nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }

.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 550;
  text-decoration: none;
  transition: background .13s, color .13s;
}
.nav-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-link.is-active { background: var(--blue-soft); color: var(--blue); font-weight: 650; }
.nav-link.is-active .ic { color: var(--blue); }
.nav-link .ic { color: var(--muted); }

.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
  padding: 16px 12px 6px;
}

.sidebar__foot { border-top: 1px solid var(--border); padding: 12px 14px; }

.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-avatar {
  width: 34px; height: 34px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--green-line);
}
.user-meta { min-width: 0; flex: 1; }
.user-meta b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { display: block; font-size: 11.5px; color: var(--muted); }

.sidebar-scrim {
  display: none;
  position: fixed; inset: 0;
  background: rgba(9, 15, 25, .5);
  z-index: 39;
  backdrop-filter: blur(2px);
}

/* main column */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  flex: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar__title { font-size: 16px; font-weight: 700; letter-spacing: -.015em; }
.topbar__sub { font-size: 12.5px; color: var(--muted); margin-top: -1px; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.content { flex: 1; padding: 24px 20px 40px; width: 100%; max-width: 1280px; margin: 0 auto; }

.foot {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  color: var(--muted);
  font-size: 12.5px;
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  max-width: 1280px; margin: 0 auto; width: 100%;
}
.foot .spacer { margin-left: auto; }

/* ------------------------------------------------------------------ 4. bare */

.bare {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(1100px 460px at 50% -12%, var(--blue-soft), transparent 70%),
    var(--bg);
}

.bare__card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  padding: 30px 28px;
}

.bare__brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 22px; text-align: center; }
.bare__brand .brand-mark { width: 50px; height: 50px; border-radius: 15px; }
.bare__brand h1 { font-size: 20px; }
.bare__brand p { font-size: 13.5px; color: var(--muted); }

.bare__wide { max-width: 720px; }

.bare__foot { text-align: center; margin-top: 18px; font-size: 12px; color: var(--muted); }

/* ----------------------------------------------------------------- 5. cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
}

.card__head {
  display: flex; align-items: center; gap: 11px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.card__head h2 { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.card__head .ic { color: var(--blue); }
.card__head .spacer { margin-left: auto; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); }

.grid { display: grid; gap: 16px; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.section { margin-bottom: 18px; }
.section:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------- 6. stat cards */

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 17px;
  display: flex;
  gap: 13px;
  align-items: flex-start;
}

.stat__icon {
  width: 40px; height: 40px; flex: none;
  border-radius: 11px;
  display: grid; place-items: center;
  background: var(--blue-soft); color: var(--blue);
}
.stat__icon--green { background: var(--green-soft); color: var(--green); }
.stat__icon--amber { background: var(--amber-soft); color: var(--amber); }

.stat__body { min-width: 0; }
.stat__value { font-size: 23px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.stat__label { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.stat__hint  { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* ---------------------------------------------------------------- 7. buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .13s, border-color .13s, color .13s, opacity .13s;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--blue-700); }

.btn--success { background: var(--green); color: #fff; }
.btn--success:hover:not(:disabled) { background: var(--green-700); }

.btn--danger { background: var(--red); color: #fff; }
.btn--danger:hover:not(:disabled) { filter: brightness(1.08); }

.btn--ghost { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }

.btn--quiet { background: transparent; color: var(--text-2); border-color: transparent; }
.btn--quiet:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }

.btn--sm { padding: 6px 11px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn--block { width: 100%; }
.btn--lg { padding: 11px 20px; font-size: 14.5px; }

.iconbtn {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  padding: 0;
  transition: background .13s, color .13s;
}
.iconbtn:hover { background: var(--surface-3); color: var(--text); }

.btnrow { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

/* ----------------------------------------------------------------- 8. forms */

.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }

.field > label,
.label {
  display: block;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-2);
  margin-bottom: 6px;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color .13s, box-shadow .13s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.input::placeholder { color: var(--muted); }
.input--mono { font-family: var(--mono); font-size: 12.5px; }

.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group .input { flex: 1; min-width: 0; }

.field__hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.field__error { font-size: 12.5px; color: var(--red); margin-top: 6px; }

.checkline { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text-2); }
.checkline input { width: 16px; height: 16px; accent-color: var(--blue); }

/* ----------------------------------------------------------------- 9. alerts */

.alert {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px 15px;
  border-radius: var(--r-sm);
  border: 1px solid;
  font-size: 13.5px;
  margin-bottom: 14px;
}
.alert:last-child { margin-bottom: 0; }
.alert b { display: block; font-weight: 700; margin-bottom: 2px; }
.alert .ic { margin-top: 1px; }

.alert--success { background: var(--green-soft); border-color: var(--green-line); color: var(--green-700); }
.alert--error   { background: var(--red-soft);   border-color: var(--red-line);   color: var(--red); }
.alert--warning { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.alert--notice  { background: var(--amber-soft); border-color: var(--amber-line); color: var(--brown); }
.alert--info    { background: var(--blue-soft);  border-color: var(--blue-line);  color: var(--blue-700); }

html[data-theme="dark"] .alert--info { color: var(--blue); }

/* ---------------------------------------------------------------- 10. toasts */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 17px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  color: var(--brown);
  box-shadow: var(--sh);
  animation: toast-in .26s cubic-bezier(.2, .9, .3, 1);
  max-width: 100%;
}
.toast.is-out { animation: toast-out .22s ease forwards; }
.toast--success { background: var(--green-soft); border-color: var(--green-line); color: var(--green-700); }
.toast--error   { background: var(--red-soft);   border-color: var(--red-line);   color: var(--red); }

@keyframes toast-in  { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ----------------------------------------------------------------- 11. badge */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge--blue  { background: var(--blue-soft);  border-color: var(--blue-line);  color: var(--blue-700); }
.badge--green { background: var(--green-soft); border-color: var(--green-line); color: var(--green-700); }
.badge--amber { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.badge--red   { background: var(--red-soft);   border-color: var(--red-line);   color: var(--red); }

html[data-theme="dark"] .badge--blue { color: var(--blue); }

/* ----------------------------------------------------------------- 12. table */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}

.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }

.table .cell-title { font-weight: 650; }
.table .cell-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.table .cell-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .cell-actions { text-align: right; white-space: nowrap; }
.table .cell-actions .btn { margin-left: 5px; }

/* --------------------------------------------------------------- 13. dropzone */

.drop {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r);
  background: var(--surface-2);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover { border-color: var(--blue); background: var(--blue-soft); }
.drop.is-over { border-color: var(--blue); background: var(--blue-soft); }
.drop.is-ready { border-style: solid; border-color: var(--green); background: var(--green-soft); }

.drop__icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: grid; place-items: center;
  margin: 0 auto 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--blue);
}
.drop.is-ready .drop__icon { color: var(--green); border-color: var(--green-line); }

.drop h3 { font-size: 16px; font-weight: 700; }
.drop p  { font-size: 13.5px; color: var(--muted); margin-top: 5px; }

.drop__hint { font-size: 12px; color: var(--muted); margin-top: 13px; }

.detected {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  background: var(--blue-soft);
  border: 1px solid var(--blue-line);
  color: var(--blue-700);
}
html[data-theme="dark"] .detected { color: var(--blue); }
.detected.is-ready { background: var(--green-soft); border-color: var(--green-line); color: var(--green-700); }

.filelist {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.filelist__head {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.filelist__head b { font-weight: 650; }
.filelist__head .spacer { margin-left: auto; color: var(--muted); font-size: 12px; }
.filelist ul { list-style: none; max-height: 168px; overflow-y: auto; }
.filelist li {
  display: flex; gap: 10px; align-items: center;
  padding: 7px 14px;
  font-size: 12.5px;
  color: var(--text-2);
  border-top: 1px solid var(--border);
}
.filelist li:first-child { border-top: 0; }
.filelist li .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist li .size { margin-left: auto; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- 14. bars */

.bars { display: flex; flex-direction: column; gap: 13px; }

.bar__top { display: flex; align-items: baseline; gap: 8px; font-size: 13px; margin-bottom: 5px; }
.bar__top b { font-weight: 650; }
.bar__top .spacer { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; }

.bar__track { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar__fill  { height: 100%; border-radius: 999px; background: var(--blue); }
.bar__fill--green { background: var(--green); }
.bar__fill--amber { background: var(--amber); }

.meter { height: 9px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--blue); border-radius: 999px; transition: width .4s; }
.meter.is-high > span { background: var(--amber); }
.meter.is-full > span { background: var(--red); }

/* ----------------------------------------------------------------- 15. modal */

.modal {
  position: fixed; inset: 0;
  z-index: 80;
  display: grid; place-items: center;
  padding: 18px;
  background: rgba(9, 15, 25, .55);
  backdrop-filter: blur(3px);
}
.modal[hidden] { display: none; }

.modal__box {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 32px 70px -32px rgba(0, 0, 0, .6);
  padding: 22px;
}

.modal__head { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 18px; }
.modal__icon {
  width: 42px; height: 42px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--red-soft); color: var(--red);
}
.modal__head h3 { font-size: 16.5px; }
.modal__head p  { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.modal__actions { display: flex; gap: 9px; justify-content: flex-end; }

/* ----------------------------------------------------------- 16. empty state */

.empty { text-align: center; padding: 46px 22px; }
.empty__icon {
  width: 58px; height: 58px;
  border-radius: 17px;
  display: grid; place-items: center;
  margin: 0 auto 15px;
  background: var(--surface-3);
  color: var(--muted);
}
.empty h3 { font-size: 16.5px; }
.empty p  { font-size: 13.5px; color: var(--muted); margin-top: 6px; max-width: 46ch; margin-left: auto; margin-right: auto; }
.empty .btn { margin-top: 18px; }

/* ----------------------------------------------------------------- 17. misc */

.steps { display: flex; flex-direction: column; }
.step { display: flex; gap: 13px; padding: 13px 0; border-top: 1px solid var(--border); }
.step:first-child { border-top: 0; padding-top: 0; }
.step:last-child { padding-bottom: 0; }
.step__n {
  width: 27px; height: 27px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
  background: var(--blue-soft); color: var(--blue);
}
.step b { font-size: 14px; font-weight: 650; display: block; }
.step p { font-size: 13px; color: var(--muted); margin-top: 2px; }

.kv { display: grid; gap: 0; }
.kv__row {
  display: flex; gap: 12px; align-items: center;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.kv__row:last-child { border-bottom: 0; }
.kv__row .k { color: var(--text-2); }
.kv__row .v { margin-left: auto; font-weight: 650; text-align: right; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.dot--ok   { background: var(--green); }
.dot--warn { background: var(--amber); }
.dot--bad  { background: var(--red); }

details.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
}
details.panel > summary {
  cursor: pointer;
  padding: 15px 18px;
  font-size: 14px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 9px;
  list-style: none;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: "▾"; margin-left: auto; color: var(--muted); font-size: 12px; }
details.panel[open] > summary::after { content: "▴"; }
details.panel > summary .ic { color: var(--blue); }
details.panel .panel__body { padding: 0 18px 18px; border-top: 1px solid var(--border); padding-top: 14px; }

.doc h3 { font-size: 15px; margin-bottom: 9px; }
.doc h4 { font-size: 13.5px; margin: 16px 0 7px; }
.doc p, .doc li { font-size: 13.5px; color: var(--text-2); }
.doc ul { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.doc ul li::marker { color: var(--blue); }
.doc > *:first-child { margin-top: 0; }

.link-box {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 8px 8px 14px;
}
.link-box code {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  padding: 0;
  font-size: 12.5px;
  color: var(--text);
  overflow-x: auto;
  white-space: nowrap;
}

.text-muted { color: var(--muted); }
.text-sm { font-size: 12.5px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 14px; }
.mt-3 { margin-top: 20px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 14px; }
.mb-3 { margin-bottom: 20px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.row-between { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between .spacer { margin-left: auto; }

/* ------------------------------------------------------------- 18. responsive */

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.2, .9, .3, 1);
    box-shadow: 0 0 60px rgba(0, 0, 0, .28);
  }
  .sidebar.is-open { transform: none; }
  .sidebar-scrim.is-open { display: block; }

  .content { padding: 18px 15px 34px; }
  .topbar { padding: 0 15px; }
  .topbar__sub { display: none; }
}

@media (min-width: 901px) {
  .nav-toggle { display: none; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .grid--stats { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 13px; gap: 10px; }
  .stat__value { font-size: 19px; }
  .stat__icon { width: 34px; height: 34px; border-radius: 9px; }
  .card__body { padding: 15px; }
  .card__head { padding: 13px 15px; }
  .table th, .table td { padding: 10px 12px; }
  .bare__card { padding: 24px 20px; }
  .topbar__title { font-size: 15px; }
  .btn { padding: 9px 14px; }
  .toasts { bottom: 14px; }
}

@media (max-width: 420px) {
  .grid--stats { grid-template-columns: 1fr; }
}

/* ------------------------------------------------- 14. brand and controls */

.brand-mark--xl {
  width: 58px; height: 58px;
  border-radius: 17px;
  box-shadow: 0 14px 30px -16px rgba(37, 99, 235, .85);
}

.bare__card--auth { padding-top: 34px; }

/* password reveal: two icons, exactly one visible */
.reveal { width: 44px; }
.reveal__off { display: none; }
.reveal[aria-pressed="true"] .reveal__on  { display: none; }
.reveal[aria-pressed="true"] .reveal__off { display: block; }
.reveal[aria-pressed="true"] {
  background: var(--blue-soft);
  border-color: var(--blue-line);
  color: var(--blue);
}

.label__opt { font-weight: 500; color: var(--muted); }

/* input with a fixed prefix, e.g. https://host/s/ */
.input-group--prefix { gap: 0; }
.input-prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  max-width: 54%;
  border: 1px solid var(--border-strong);
  border-right: 0;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.input-group--prefix .input {
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-family: var(--mono);
  font-size: 13px;
}
.input-group--prefix.is-bad .input { border-color: var(--red); }
.input-group--prefix.is-good .input { border-color: var(--green); }

/* password strength meter */
.strength { margin-top: 9px; display: flex; align-items: center; gap: 10px; }
.strength__track {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.strength__bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--red);
  transition: width .25s ease, background .25s ease;
}
.strength[data-score="2"] .strength__bar { background: var(--amber); }
.strength[data-score="3"] .strength__bar { background: var(--blue); }
.strength[data-score="4"] .strength__bar { background: var(--green); }
.strength__label {
  min-width: 58px;
  text-align: right;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}

/* quiet text button, e.g. "sign out instead" */
.linkbtn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.linkbtn:hover { color: var(--text); }

details.panel--inline {
  border: 0;
  box-shadow: none;
  background: var(--surface-2);
}

/* ------------------------------------------------------ 15. documentation */

.tabs__list { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background .16s, color .16s, border-color .16s, transform .16s;
}
.tab:hover { background: var(--surface-3); }
.tab.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.tab__n {
  display: grid;
  place-items: center;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 800;
}
.tab.is-active .tab__n { background: rgba(255, 255, 255, .22); color: #fff; }

.tabs__panel { display: none; }
.tabs__panel.is-active { display: block; }

.flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 18px; }
.flow__node {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  font-size: 12.5px;
  font-weight: 650;
}
.flow__node .ic { color: var(--blue); }
.flow__link {
  flex: 1;
  min-width: 16px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--border-strong), var(--blue-line));
}

.tree {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.95;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  overflow-x: auto;
  white-space: pre;
}
.tree b { color: var(--blue); font-weight: 650; }
.tree i { color: var(--muted); font-style: normal; }

.anatomy { display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--mono); font-size: 13px; }
.anatomy span {
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.anatomy .a-host { color: var(--muted); }
.anatomy .a-code { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); font-weight: 700; }

/* -------------------------------------------------------- 16. smoothness */

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: no-preference) {
  @keyframes fs-rise {
    from { opacity: 0; transform: translateY(7px); }
    to   { opacity: 1; transform: none; }
  }

  .content > * { animation: fs-rise .3s cubic-bezier(.2, .8, .3, 1) both; }
  .content > *:nth-child(2) { animation-delay: .035s; }
  .content > *:nth-child(3) { animation-delay: .07s; }
  .content > *:nth-child(4) { animation-delay: .105s; }
  .content > *:nth-child(5) { animation-delay: .14s; }
  .bare__card { animation: fs-rise .3s cubic-bezier(.2, .8, .3, 1) both; }

  .btn {
    transition: background .15s, border-color .15s, color .15s, transform .12s, box-shadow .18s;
  }
  .btn:hover { transform: translateY(-1px); }
  .btn:active { transform: translateY(0) scale(.985); }

  .card { transition: box-shadow .2s ease, border-color .2s ease; }
  .card:hover { box-shadow: var(--sh); }

  .stat { transition: transform .18s ease; }
  .stat:hover { transform: translateY(-1px); }

  .nav-link { transition: background .15s, color .15s, padding-left .15s; }
  .nav-link:hover { padding-left: 15px; }

  .link-box { transition: border-color .18s ease; }
  .link-box:hover { border-color: var(--blue-line); }

  .tabs__panel.is-active { animation: fs-rise .26s ease both; }
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Respect a reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
