:root {
  --paper: #f3efe8;
  --sidebar: #e8e2d8;
  --surface: #fffdf8;
  --ink: #1b1814;
  --muted: #746c61;
  --line: rgba(27, 24, 20, 0.08);
  --line-strong: rgba(27, 24, 20, 0.14);
  --accent: #385246;
  --ok: #2f6b48;
  --warn: #9a6b24;
  --err: #a33b2b;
  --shadow: 0 1px 0 rgba(27, 24, 20, 0.04), 0 10px 28px -18px rgba(27, 24, 20, 0.28);
  --radius: 16px;
  --sans: "Outfit", ui-sans-serif, system-ui, sans-serif;
  --serif: "Fraunces", ui-serif, Georgia, serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* ---------- sidebar ---------- */
.sidebar {
  width: 248px;
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 28px 18px 20px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px 28px;
}
.mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 15px;
}
.brand strong {
  display: block;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.brand em {
  display: block;
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: rgba(255,253,248,.45); color: var(--ink); }
.nav-item.is-on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.sidebar-foot {
  margin-top: auto;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,253,248,.5);
}
.sidebar-foot .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #c4b9aa; flex: none;
}
.sidebar-foot.is-live .dot { background: var(--ok); }
.sidebar-foot b, .sidebar-foot small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
.sidebar-foot b { font-size: 13px; font-weight: 500; }
.sidebar-foot small { color: var(--muted); font-size: 12px; }

/* ---------- main ---------- */
.main {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: 36px 48px 64px;
}
.view { display: none; max-width: 1080px; }
.view.is-on { display: block; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
}
.kicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.lede { margin: 8px 0 0; color: var(--muted); max-width: 42em; line-height: 1.5; }
h2 {
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow);
}

.btn {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 500;
  transition: transform .12s, opacity .12s;
}
.btn:active { transform: translateY(1px); }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
}
.btn.tiny { padding: 6px 12px; font-size: 13px; }

/* ---------- accounts ---------- */
.live-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.live-empty { color: var(--muted); }
.live-top {
  display: flex;
  align-items: center;
  gap: 16px;
}
.avatar {
  width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--accent); color: #f4efe6;
  font-family: var(--serif); font-size: 22px;
}
.live-top h3 { margin: 0; font-size: 20px; font-weight: 500; }
.pill {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e7efe8;
  color: var(--ok);
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 22px;
}
.stat {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--paper);
}
.stat label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; letter-spacing: .06em; text-transform: uppercase; }
.stat b { font-weight: 500; }

.split {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
}
.account-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.account-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.account-list li.is-active { border-color: var(--ink); }
.account-list li > div { flex: 1; min-width: 0; }
.account-list li b { display: block; font-weight: 500; }
.account-list li small { color: var(--muted); }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; min-height: 220px; cursor: pointer;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255,253,248,.4);
  text-align: center;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.is-over { border-color: var(--ink); background: var(--surface); }
.drop-mark {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--paper);
  font-size: 20px; margin-bottom: 6px;
}
.drop small { color: var(--muted); }

/* ---------- composer ---------- */
.composer { margin-bottom: 32px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}
textarea, select, input[type="number"], input[type="text"] {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
textarea { resize: vertical; min-height: 108px; line-height: 1.55; }
textarea:focus, select:focus, input:focus { border-color: var(--ink); background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.chip {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chip small {
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.chip.is-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.is-on small { color: rgba(243,239,232,.7); }
.cost { margin: 4px 0 0; font-size: 13px; color: var(--accent); font-weight: 500; }
.params {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 4px;
}
.composer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.hint { margin: 0; color: var(--muted); font-size: 13px; }
.hint.is-busy { color: var(--accent); }
.hint.is-err { color: var(--err); }

.gallery-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 8px 2px 14px;
}
.gallery-head h2 { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.shot {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.shot img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #ddd6c8; }
.shot figcaption {
  padding: 10px 12px 12px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.empty {
  grid-column: 1 / -1;
  color: var(--muted);
  padding: 40px 8px;
}

/* ---------- logs ---------- */
.filters { display: flex; gap: 6px; }
.log-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}
.log-row {
  display: grid;
  grid-template-columns: 92px 72px 1fr;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.log-row:last-child { border-bottom: 0; }
.log-row time { color: var(--muted); font-variant-numeric: tabular-nums; }
.log-row .lvl { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.log-row .lvl.ok { color: var(--ok); }
.log-row .lvl.error { color: var(--err); }
.log-row .lvl.warn { color: var(--warn); }
.log-row .lvl.info { color: var(--muted); }

/* ---------- settings ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.toggle input { width: 16px; height: 16px; }
.help { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 20;
}

.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn.danger { color: var(--err); border-color: rgba(163,59,43,.3); }
.toolbar {
  display: flex; gap: 10px; align-items: center; margin-bottom: 14px;
}
.toolbar input[type="search"] {
  flex: 1; max-width: 320px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px;
}
.drop.mini {
  min-height: 0; padding: 10px 16px; border-radius: 999px;
  flex-direction: row; gap: 0;
}
.table-card { padding: 0; overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td {
  text-align: left; padding: 12px 14px;
  border-bottom: 1px solid var(--line); vertical-align: middle;
}
table.data th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
table.data tr:last-child td { border-bottom: 0; }
table.data .check { width: 36px; }
.health {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
}
.health::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: #c4b9aa;
}
.health.healthy::before { background: var(--ok); }
.health.expired::before { background: var(--warn); }
.health.error::before { background: var(--err); }
.pager {
  display: flex; gap: 6px; align-items: center; justify-content: flex-end;
  padding: 12px 14px; color: var(--muted); font-size: 13px;
}
.pager button {
  border: 1px solid var(--line); background: var(--paper);
  border-radius: 8px; padding: 6px 10px; cursor: pointer;
}
.pager button.is-on, .pager button:disabled { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pager button:disabled { opacity: .35; cursor: default; }

.mode-switch { display: flex; gap: 8px; margin-bottom: 16px; }
.i2i-box { margin-bottom: 16px; }
.ref-drop {
  border: 1.5px dashed var(--line-strong); border-radius: 14px;
  padding: 22px; text-align: center; cursor: pointer; background: var(--paper);
}
.ref-drop p { margin: 0; }
.ref-drop small { color: var(--muted); }
.ref-previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ref-previews img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.shot { position: relative; }
.shot .pick {
  position: absolute; top: 8px; left: 8px;
}
.shot .del {
  position: absolute; top: 8px; right: 8px;
  border: 0; background: rgba(27,24,20,.7); color: #fff;
  border-radius: 999px; padding: 4px 8px; font-size: 11px; cursor: pointer;
}

.req-list { display: flex; flex-direction: column; gap: 10px; }
.req {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow);
}
.req-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.req-top b { font-weight: 500; }
.req-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.req-error {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: #f8ece9; color: var(--err); font-size: 13px;
  white-space: pre-wrap; word-break: break-word;
}
.req-files { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.req-files img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; cursor: pointer; }
.req-actions { display: flex; gap: 8px; margin-top: 12px; }
.filters.slim { margin: -12px 0 16px; }

.docs { max-width: 820px; }
.docs h2 {
  margin: 28px 0 10px; font-family: var(--serif); font-size: 22px;
  text-transform: none; letter-spacing: -0.03em; color: var(--ink); font-weight: 600;
}
.docs h3 { margin: 18px 0 8px; font-size: 15px; font-weight: 500; }
.docs p, .docs li { color: #4d463e; line-height: 1.65; }
.docs code, code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12.5px; background: var(--paper); padding: 1px 6px; border-radius: 6px;
}
.docs pre {
  background: #1b1814; color: #f3efe8; padding: 16px 18px; border-radius: 14px;
  overflow: auto; font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12.5px; line-height: 1.55;
}
.docs .verb {
  display: inline-block; min-width: 52px; text-align: center;
  font-size: 11px; letter-spacing: .08em; border-radius: 6px;
  padding: 2px 6px; margin-right: 8px; background: var(--ink); color: var(--paper);
}
.docs .verb.get { background: var(--accent); }
.docs .verb.del { background: var(--err); }
.ep { margin: 14px 0; padding: 14px 0; border-top: 1px solid var(--line); }

.lightbox {
  position: fixed; inset: 0; background: rgba(27,24,20,.78);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 30; padding: 40px;
}
.lightbox[hidden] { display: none; }
.lightbox-track { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; max-width: 1100px; }
.lightbox-track img { max-height: 78vh; max-width: 90vw; border-radius: 12px; }
.lightbox-close {
  position: absolute; top: 18px; right: 18px;
  border: 0; background: #fff; border-radius: 999px; padding: 8px 14px; cursor: pointer;
}

@media (max-width: 960px) {
  .sidebar { width: 88px; padding-inline: 10px; }
  .brand div, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; }
  .sidebar-foot { display: none; }
  .main { padding: 24px; }
  .split, .settings-grid, .params, .stats { grid-template-columns: 1fr 1fr; }
}
