/* ==========================================================================
   fireflyapi Console — design system
   White surface, Adobe Firefly red accent, near-black text. Vercel-like:
   calm surfaces, hairline borders, strong hierarchy, no ornament.
   ========================================================================== */

:root {
  /* brand */
  --red:        #EB1000;   /* Adobe Firefly red */
  --red-600:    #C90E00;
  --red-700:    #A30B00;
  --red-tint:   #FFF1EF;
  --red-tint-2: #FFE3DF;

  /* neutrals */
  --bg:         #FFFFFF;
  --bg-subtle:  #FAFAFA;
  --bg-sunken:  #F5F5F5;
  --surface:    #FFFFFF;
  --border:     #EAEAEA;
  --border-2:   #DCDCDC;
  --text:       #0A0A0A;
  --text-2:     #4B4B4B;
  --text-3:     #8A8A8A;

  /* status */
  --green:      #0A8A48;
  --green-tint: #E8F6EE;
  --amber:      #A66200;
  --amber-tint: #FFF5E6;
  --blue:       #0B65D8;
  --blue-tint:  #EAF2FD;
  --violet:     #6D3BEB;
  --violet-tint:#F2EDFE;
  --err:        #C90E00;
  --err-tint:   #FFF1EF;

  /* geometry */
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --sh-1: 0 1px 2px rgba(0,0,0,.04);
  --sh-2: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
  --sh-3: 0 12px 40px rgba(0,0,0,.14);

  --sidebar-w: 236px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-subtle);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.015em; }

::selection { background: var(--red-tint-2); }

/* --- utilities ----------------------------------------------------------- */
.mt-1{margin-top:4px}.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}.mt-6{margin-top:24px}
.mb-1{margin-bottom:4px}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}.mb-6{margin-bottom:24px}
.muted { color: var(--text-3); }
.grow  { flex: 1; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

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

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

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px;
}
.brand-mark {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--red) 0%, #FF6A3D 100%);
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -.03em;
}
.brand-name { font-weight: 650; letter-spacing: -.02em; font-size: 14.5px; }

.nav { padding: 4px 10px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: 13.5px; font-weight: 450;
  transition: background .12s, color .12s;
}
.nav a svg { width: 16px; height: 16px; flex: 0 0 16px; opacity: .75; }
.nav a:hover { background: var(--bg-sunken); color: var(--text); }
.nav a.active { background: var(--red-tint); color: var(--red-700); font-weight: 550; }
.nav a.active svg { opacity: 1; color: var(--red); }

.nav-section {
  padding: 14px 12px 4px; font-size: 10.5px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase; color: var(--text-3);
}

.sidebar-footer {
  margin-top: auto; padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}

.main {
  flex: 1; min-width: 0;
  padding: 26px 32px 60px;
  max-width: 1500px;
}

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 22px;
}
.page-title { font-size: 22px; letter-spacing: -.025em; }
.page-subtitle { color: var(--text-3); font-size: 13.5px; margin-top: 3px; max-width: 720px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* --- cards --------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 13.5px; font-weight: 600; letter-spacing: -.01em; }
.card-header .sub { font-size: 12px; color: var(--text-3); font-weight: 400; }
.card-body { padding: 16px; }
.card-footer { padding: 11px 16px; border-top: 1px solid var(--border); background: var(--bg-subtle); }

/* --- stat cards ---------------------------------------------------------- */
.stats-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px 15px; box-shadow: var(--sh-1);
  position: relative; overflow: hidden;
}
.stat .label {
  font-size: 11.5px; font-weight: 550; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .05em;
  display: flex; align-items: center; gap: 6px;
}
.stat .value {
  font-size: 26px; font-weight: 650; letter-spacing: -.035em;
  margin-top: 7px; line-height: 1.15;
}
.stat .value.sm { font-size: 19px; }
.stat .sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.stat.accent::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--red);
}

/* --- charts -------------------------------------------------------------- */
.chart-grid {
  display: grid; gap: 12px; margin-top: 12px;
  grid-template-columns: 2fr 1fr;
}
.chart-box { position: relative; height: 260px; padding: 4px; }
.chart-box.sm { height: 220px; }
@media (max-width: 1100px) { .chart-grid { grid-template-columns: 1fr; } }

.legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 10px 16px 14px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; }

/* --- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px; font-size: 13px; font-weight: 500; font-family: inherit;
  border-radius: var(--r-sm); border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: background .12s, border-color .12s, box-shadow .12s, opacity .12s;
  white-space: nowrap; line-height: 1.4;
}
.btn:hover { background: var(--bg-sunken); border-color: #C8C8C8; }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }

.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-600); border-color: var(--red-600); }

.btn-dark { background: var(--text); border-color: var(--text); color: #fff; }
.btn-dark:hover { background: #262626; border-color: #262626; }

.btn-danger { background: var(--surface); border-color: #F3BDB8; color: var(--err); }
.btn-danger:hover { background: var(--err-tint); border-color: #E9A29B; }

.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-sunken); color: var(--text); border-color: transparent; }

.btn-sm { padding: 4.5px 9px; font-size: 12px; }
.btn-lg { padding: 10px 18px; font-size: 14px; }
.btn-block { width: 100%; }

.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); margin-left: 0; }
.btn-group .btn:last-child  { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.btn-group .btn.on { background: var(--red-tint); border-color: #F3BDB8; color: var(--red-700); z-index: 1; }

/* --- forms --------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; min-width: 0; }
.field > label {
  font-size: 12px; font-weight: 550; color: var(--text-2);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.input, .select, .textarea {
  width: 100%; padding: 7.5px 10px; font-size: 13.5px; font-family: inherit;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-tint-2);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A8A8A' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  background-size: 15px; padding-right: 30px;
}
input[type=range] { padding: 0; accent-color: var(--red); border: none; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 150px; }
.row > .btn { margin-bottom: 13px; }
.hint { font-size: 12px; color: var(--text-3); line-height: 1.5; }

.check { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--red); width: 15px; height: 15px; }

/* --- pills / badges ------------------------------------------------------ */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 550; letter-spacing: .005em;
  border: 1px solid transparent; white-space: nowrap;
}
.pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill-plain::before { display: none; }

.pill-completed, .pill-active, .pill-ok, .pill-valid {
  background: var(--green-tint); color: var(--green); border-color: #BFE3CE; }
.pill-failed, .pill-error, .pill-invalid, .pill-inactive {
  background: var(--err-tint); color: var(--err); border-color: #F3BDB8; }
.pill-running, .pill-generating {
  background: var(--blue-tint); color: var(--blue); border-color: #C3DBF8; }
.pill-queued, .pill-pending, .pill-cooling {
  background: var(--amber-tint); color: var(--amber); border-color: #F5DDB3; }
.pill-cancelled, .pill-disabled {
  background: var(--bg-sunken); color: var(--text-3); border-color: var(--border-2); }
.pill-video { background: var(--violet-tint); color: var(--violet); border-color: #D9CCFB; }
.pill-image { background: var(--bg-sunken); color: var(--text-2); border-color: var(--border-2); }
.pill-free  { background: var(--green-tint); color: var(--green); border-color: #BFE3CE; }
.pill-paid  { background: var(--amber-tint); color: var(--amber); border-color: #F5DDB3; }
.pill-role-admin { background: var(--red-tint); color: var(--red-700); border-color: #F3BDB8; }
.pill-role-user  { background: var(--bg-sunken); color: var(--text-2); border-color: var(--border-2); }

/* --- tables -------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 9px 14px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-3); background: var(--bg-subtle);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--bg-subtle); }
table.data tbody tr.clickable { cursor: pointer; }
table.data td.right, table.data th.right { text-align: right; }
.cell-mono { font-family: var(--mono); font-size: 12px; }
.cell-muted { color: var(--text-3); }
.cell-strong { font-weight: 550; }
td.empty, .empty {
  text-align: center; color: var(--text-3); padding: 40px 16px !important; font-size: 13px;
}
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty-state .big { font-size: 15px; color: var(--text-2); font-weight: 550; margin-bottom: 4px; }

/* row thumbnail */
.thumb {
  width: 40px; height: 40px; border-radius: var(--r-sm); object-fit: cover;
  border: 1px solid var(--border); background: var(--bg-sunken); display: block;
}
.thumb-ph {
  width: 40px; height: 40px; border-radius: var(--r-sm);
  border: 1px dashed var(--border-2); background: var(--bg-sunken);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 15px;
}

/* --- code / json --------------------------------------------------------- */
.code-block {
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 11px 13px;
  overflow-x: auto; white-space: pre; color: var(--text);
  max-height: 380px; overflow-y: auto;
}
.code-wrap { position: relative; }
.code-wrap .copy-btn {
  position: absolute; top: 7px; right: 7px;
  padding: 3px 8px; font-size: 11px; font-family: var(--font);
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 5px; color: var(--text-2); cursor: pointer; opacity: 0;
  transition: opacity .12s;
}
.code-wrap:hover .copy-btn { opacity: 1; }
.code-wrap .copy-btn:hover { background: var(--bg-sunken); color: var(--text); }
code {
  font-family: var(--mono); font-size: .9em;
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px;
}

/* --- callouts ------------------------------------------------------------ */
.callout {
  padding: 10px 13px; border-radius: var(--r-sm); font-size: 13px;
  background: var(--bg-sunken); border: 1px solid var(--border); color: var(--text-2);
}
.callout.ok   { background: var(--green-tint); border-color: #BFE3CE; color: var(--green); }
.callout.err  { background: var(--err-tint);   border-color: #F3BDB8; color: var(--err); }
.callout.warn { background: var(--amber-tint); border-color: #F5DDB3; color: var(--amber); }
.callout.info { background: var(--blue-tint);  border-color: #C3DBF8; color: var(--blue); }

.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash {
  padding: 10px 13px; border-radius: var(--r-sm); font-size: 13px;
  border: 1px solid var(--border); background: var(--bg-sunken);
}
.flash.success { background: var(--green-tint); border-color: #BFE3CE; color: var(--green); }
.flash.error   { background: var(--err-tint);   border-color: #F3BDB8; color: var(--err); }
.flash.info    { background: var(--blue-tint);  border-color: #C3DBF8; color: var(--blue); }

/* --- detail list --------------------------------------------------------- */
.detail-list {
  display: grid; grid-template-columns: 150px 1fr;
  gap: 0; margin: 0; font-size: 13px;
}
.detail-list dt {
  color: var(--text-3); padding: 7px 0; font-size: 12.5px;
  border-bottom: 1px solid var(--border);
}
.detail-list dd {
  margin: 0; padding: 7px 0; border-bottom: 1px solid var(--border);
  word-break: break-word;
}
.detail-list dt:last-of-type, .detail-list dd:last-of-type { border-bottom: none; }

/* --- media results ------------------------------------------------------- */
.dl-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.dl-card {
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 10px; background: var(--surface);
  display: flex; flex-direction: column; gap: 8px;
}
.dl-card img, .dl-card video {
  width: 100%; border-radius: var(--r-sm); display: block;
  background: var(--bg-sunken); border: 1px solid var(--border);
}
.dl-card .kind { font-size: 12px; font-weight: 600; }
.dl-card .desc { font-size: 11.5px; color: var(--text-3); }

/* --- reference-image uploader -------------------------------------------- */
.dropzone {
  border: 1.5px dashed var(--border-2); border-radius: var(--r);
  background: var(--bg-subtle); padding: 18px 14px; text-align: center;
  cursor: pointer; transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.over { border-color: var(--red); background: var(--red-tint); }
.dropzone .dz-title { font-size: 13px; font-weight: 550; }
.dropzone .dz-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.dropzone.disabled { opacity: .5; pointer-events: none; }

.ref-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.ref-chip {
  position: relative; width: 92px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  overflow: hidden; background: var(--surface);
}
.ref-chip img { width: 100%; height: 68px; object-fit: cover; display: block; }
.ref-chip .slot {
  font-size: 10.5px; font-weight: 550; padding: 3px 5px;
  color: var(--text-2); background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ref-chip .rm {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,.62); color: #fff; border: none; cursor: pointer;
  font-size: 12px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.ref-chip.uploading { opacity: .6; }
.ref-chip.err { border-color: #F3BDB8; }

/* --- timeline ------------------------------------------------------------ */
.timeline { list-style: none; margin: 14px 0 0; padding: 0; }
.timeline li {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 0; font-size: 12.5px; color: var(--text-3);
}
.timeline .dot {
  width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px;
  background: var(--border-2); position: relative;
}
.timeline li.done  { color: var(--text-2); }
.timeline li.done .dot { background: var(--green); }
.timeline li.active { color: var(--red-700); font-weight: 550; }
.timeline li.active .dot { background: var(--red); }
.timeline li.active .dot::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--red); opacity: .35; animation: ping 1.3s ease-out infinite;
}
.timeline li.err { color: var(--err); }
.timeline li.err .dot { background: var(--err); }
@keyframes ping { 0% { transform: scale(.7); opacity: .6; } 100% { transform: scale(1.5); opacity: 0; } }

.spinner {
  width: 12px; height: 12px; display: inline-block;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- modal / drawer ------------------------------------------------------ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,10,10,.42);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; z-index: 50; overflow-y: auto;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--sh-3); width: 100%; max-width: 860px;
  overflow: hidden; animation: rise .16s ease-out;
}
.modal.wide { max-width: 1080px; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

details > summary {
  cursor: pointer; font-size: 12.5px; color: var(--text-2);
  padding: 5px 0; user-select: none;
}
details > summary:hover { color: var(--red); }

/* --- tabs ---------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs a, .tabs button {
  padding: 8px 12px; font-size: 13px; font-weight: 500; color: var(--text-3);
  border: none; background: none; cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs a.active, .tabs button.active { color: var(--red-700); border-bottom-color: var(--red); }

/* --- test panel layout --------------------------------------------------- */
.test-layout {
  display: grid; gap: 14px;
  grid-template-columns: minmax(340px, 440px) 1fr;
  align-items: start;
}
@media (max-width: 980px) { .test-layout { grid-template-columns: 1fr; } }

/* --- login --------------------------------------------------------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background:
    radial-gradient(900px 420px at 50% -10%, var(--red-tint) 0%, transparent 65%),
    var(--bg-subtle);
}
.login-card {
  width: 100%; max-width: 372px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 28px; box-shadow: var(--sh-2);
}
.login-card .brand { padding: 0 0 18px; }
.login-card h1 { font-size: 19px; margin-bottom: 4px; }
.login-card p { color: var(--text-3); font-size: 13px; margin: 0 0 18px; }

/* --- docs ---------------------------------------------------------------- */
.docs-layout { display: grid; grid-template-columns: 1fr 200px; gap: 24px; align-items: start; }
@media (max-width: 1040px) { .docs-layout { grid-template-columns: 1fr; } .docs-toc { display: none; } }
.docs-toc {
  position: sticky; top: 26px; font-size: 12.5px;
  display: flex; flex-direction: column; gap: 1px;
}
.docs-toc a { padding: 4px 9px; border-radius: 5px; color: var(--text-3); }
.docs-toc a:hover { background: var(--bg-sunken); color: var(--text); }
.docs-toc .grp {
  padding: 12px 9px 3px; font-size: 10.5px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase; color: var(--text-3);
}
.doc-section { scroll-margin-top: 20px; }
.doc-section + .doc-section { margin-top: 14px; }
.doc-section h2 { font-size: 16px; margin-bottom: 3px; letter-spacing: -.02em; }
.doc-section p  { color: var(--text-2); font-size: 13.5px; line-height: 1.6; margin: 0 0 12px; }
.doc-section ul { color: var(--text-2); font-size: 13.5px; line-height: 1.7; padding-left: 20px; margin: 0 0 12px; }

.endpoint {
  display: flex; align-items: center; gap: 9px; font-family: var(--mono);
  font-size: 12.5px; padding: 8px 12px; background: var(--bg-subtle);
  border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 10px;
}
.method {
  font-weight: 700; font-size: 10.5px; padding: 2px 7px; border-radius: 4px;
  letter-spacing: .04em; font-family: var(--font);
}
.method.get    { background: var(--blue-tint);  color: var(--blue); }
.method.post   { background: var(--green-tint); color: var(--green); }
.method.patch  { background: var(--amber-tint); color: var(--amber); }
.method.delete { background: var(--err-tint);   color: var(--err); }

/* --- account management panel -------------------------------------------
   This used to live in the row's last cell, where a 340px-wide stack of forms
   had to fit a column sized for the word "Actions". Expanding it stretched the
   row and pushed the buttons out past the horizontal scroll edge, so half of
   them were unreachable. It now gets a row of its own spanning the full table
   width, which is the only place there is genuinely room for it. */
.manage-row > td { padding: 0 !important; background: var(--bg-subtle); }
.manage { border-top: 1px solid var(--border); }
.manage > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; font-size: 12.5px; font-weight: 550; color: var(--text-2);
}
.manage > summary::-webkit-details-marker { display: none; }
.manage > summary::before {
  content: "▸"; font-size: 10px; color: var(--text-3);
  transition: transform .15s; display: inline-block;
}
.manage[open] > summary::before { transform: rotate(90deg); }
.manage > summary:hover { color: var(--text); background: var(--bg-sunken); }
.manage[open] > summary { border-bottom: 1px solid var(--border); }
.manage-body {
  display: grid; gap: 14px; padding: 16px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  align-items: start;
}
.manage-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 13px 14px; min-width: 0;
}
.manage-box > h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); font-weight: 600; margin: 0 0 10px;
}
.manage-box .field:last-of-type { margin-bottom: 10px; }
.manage-box form { margin: 0; }
/* Buttons wrap instead of overflowing — the old failure mode. */
.manage-box .hstack { display: flex; flex-wrap: wrap; gap: 7px; }
.manage-box .btn { white-space: nowrap; }
.manage-note { font-size: 11.5px; color: var(--text-3); margin-top: 8px; line-height: 1.45; }

@media (max-width: 820px) {
  .sidebar { position: fixed; transform: translateX(-100%); z-index: 60; transition: transform .2s; }
  .sidebar.open { transform: none; }
  .main { padding: 18px 16px 50px; }
  .detail-list { grid-template-columns: 1fr; }
  .detail-list dt { padding-bottom: 0; border-bottom: none; }
}

/* --- account watch (dashboard) ------------------------------------------- */
.watch-alerts { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.watch-alert { padding: 8px 12px; border-radius: var(--r-sm); font-size: 13px;
  border: 1px solid #F5DDB3; background: var(--amber-tint); color: var(--amber); }
.watch-alert.err { border-color: #F3BDB8; background: var(--err-tint); color: var(--err); }
.watch-ok { padding: 8px 12px; border-radius: var(--r-sm); font-size: 13px; margin: 0 0 14px;
  border: 1px solid #BFE3CE; background: var(--green-tint); color: var(--green); }
.watch-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.watch-card .card-header { gap: 8px; }
.watch-rows { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.watch-rows dt { color: var(--text-3); }
.watch-rows dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.watch-rows dd.warn { color: var(--amber); font-weight: 600; }
.watch-rows dd.err { color: var(--err); font-weight: 600; }
.watch-events { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 12px;
  font-variant-numeric: tabular-nums; }
.watch-events th, .watch-events td { padding: 4px 6px; text-align: right; border-bottom: 1px solid var(--border); }
.watch-events th:first-child, .watch-events td:first-child { text-align: left; color: var(--text-3); font-weight: 400; }
.watch-events th { color: var(--text-3); font-weight: 500; }
.watch-events td.hot { color: var(--amber); font-weight: 600; }
.watch-bar { height: 6px; border-radius: 3px; background: var(--bg-sunken); overflow: hidden; margin-top: 4px; }
.watch-bar > span { display: block; height: 100%; background: var(--green); }
.watch-bar > span.warn { background: var(--amber); }
.watch-bar > span.err { background: var(--err); }
.watch-features { margin-top: 12px; font-size: 12.5px; }
.watch-features summary { cursor: pointer; color: var(--text-2); }
.watch-features ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.watch-features li { display: flex; justify-content: space-between; gap: 10px; }
