/* ByteBlock Studio: owner app. Phone first, one thumb. */

:root {
  --navy: #0b1430;
  --blue: #1240e0;

  --bg: #f3f5fb;
  --bg-grad: radial-gradient(1200px 500px at 50% -200px, rgba(18, 64, 224, .10), transparent 70%);
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --surface-3: #e3e8f4;
  --elev: #ffffff;
  --text: #0b1430;
  --text-2: #3a4566;
  --muted: #66708f;
  --line: rgba(11, 20, 48, .09);
  --line-strong: rgba(11, 20, 48, .16);
  --accent: #1240e0;
  --accent-hover: #0d34c2;
  --accent-ink: #ffffff;
  --accent-soft: rgba(18, 64, 224, .10);
  --accent-text: #1240e0;
  --green: #0f9d58;
  --green-soft: rgba(15, 157, 88, .12);
  --amber: #d98a00;
  --amber-soft: rgba(217, 138, 0, .14);
  --red: #e0353b;
  --red-soft: rgba(224, 53, 59, .11);
  --draft: #e59b00;
  --approved: #1240e0;
  --posted: #0f9d58;
  --failed: #e0353b;
  --manual: #8b5cf6;
  --shadow-1: 0 1px 2px rgba(11, 20, 48, .06), 0 1px 1px rgba(11, 20, 48, .04);
  --shadow-2: 0 6px 20px -6px rgba(11, 20, 48, .18), 0 2px 6px rgba(11, 20, 48, .06);
  --shadow-3: 0 24px 60px -16px rgba(11, 20, 48, .35), 0 8px 18px rgba(11, 20, 48, .10);
  --skeleton: linear-gradient(90deg, #e8ecf5 0%, #f4f6fb 40%, #e8ecf5 80%);
  --bar-bg: rgba(255, 255, 255, .82);
  --backdrop: rgba(7, 12, 30, .45);

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --tab-h: 64px;
  --top-h: 56px;
  --gutter: 16px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070d22;
    --bg-grad: radial-gradient(1200px 520px at 50% -220px, rgba(36, 84, 255, .22), transparent 70%);
    --surface: #0f1937;
    --surface-2: #16214a;
    --surface-3: #1e2b5a;
    --elev: #142049;
    --text: #eef2ff;
    --text-2: #c5cde8;
    --muted: #97a3c7;
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .16);
    --accent: #2f5bff;
    --accent-hover: #4a70ff;
    --accent-soft: rgba(61, 102, 255, .18);
    --accent-text: #8ba6ff;
    --green: #2fc27a;
    --green-soft: rgba(47, 194, 122, .16);
    --amber: #f2a93b;
    --amber-soft: rgba(242, 169, 59, .16);
    --red: #ff5a5f;
    --red-soft: rgba(255, 90, 95, .15);
    --draft: #f2a93b;
    --approved: #5b80ff;
    --posted: #2fc27a;
    --failed: #ff5a5f;
    --manual: #a78bfa;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-2: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-3: 0 28px 70px -18px rgba(0, 0, 0, .8), 0 8px 20px rgba(0, 0, 0, .4);
    --skeleton: linear-gradient(90deg, #16214a 0%, #1f2c5c 40%, #16214a 80%);
    --bar-bg: rgba(10, 17, 42, .82);
    --backdrop: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #070d22;
  --bg-grad: radial-gradient(1200px 520px at 50% -220px, rgba(36, 84, 255, .22), transparent 70%);
  --surface: #0f1937;
  --surface-2: #16214a;
  --surface-3: #1e2b5a;
  --elev: #142049;
  --text: #eef2ff;
  --text-2: #c5cde8;
  --muted: #97a3c7;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --accent: #2f5bff;
  --accent-hover: #4a70ff;
  --accent-soft: rgba(61, 102, 255, .18);
  --accent-text: #8ba6ff;
  --green: #2fc27a;
  --green-soft: rgba(47, 194, 122, .16);
  --amber: #f2a93b;
  --amber-soft: rgba(242, 169, 59, .16);
  --red: #ff5a5f;
  --red-soft: rgba(255, 90, 95, .15);
  --draft: #f2a93b;
  --approved: #5b80ff;
  --posted: #2fc27a;
  --failed: #ff5a5f;
  --manual: #a78bfa;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-3: 0 28px 70px -18px rgba(0, 0, 0, .8), 0 8px 20px rgba(0, 0, 0, .4);
  --skeleton: linear-gradient(90deg, #16214a 0%, #1f2c5c 40%, #16214a 80%);
  --bar-bg: rgba(10, 17, 42, .82);
  --backdrop: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  font-feature-settings: 'cv11', 'ss01';
}
img, video, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 18px; height: 18px; }
.ico.xs { width: 14px; height: 14px; }
.ico.lg { width: 28px; height: 28px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { height: 16px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Layout ---------- */
.app { min-height: 100dvh; }
.main { min-width: 0; }
.rail, #side { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px;
  height: calc(var(--top-h) + var(--safe-t));
  padding: var(--safe-t) calc(8px + var(--safe-r)) 0 calc(8px + var(--safe-l));
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-left { display: flex; align-items: center; min-width: 44px; }
.topbar-left:empty { min-width: 0; width: 8px; }
.topbar-title { font-weight: 700; font-size: 17px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 2px; }
.brandmark { display: flex; align-items: center; gap: 8px; padding-left: 6px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brandmark img { width: 28px; height: 28px; }
.brandmark b { color: var(--accent-text); font-weight: 700; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 14px;
  display: inline-grid; place-items: center; color: var(--text-2);
  transition: background .15s, transform .15s var(--ease);
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.94); }
.avatar-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #5b80ff);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line-strong);
}

.view {
  outline: none;
  padding: 8px calc(var(--gutter) + var(--safe-r)) calc(var(--tab-h) + var(--safe-b) + 28px) calc(var(--gutter) + var(--safe-l));
  max-width: 760px; margin: 0 auto;
  animation: view-in .28s var(--ease);
}
.view.flush { padding: 0; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tab-h) + var(--safe-b));
  padding: 0 calc(6px + var(--safe-r)) var(--safe-b) calc(6px + var(--safe-l));
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}
.tab {
  height: 100%; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .01em;
  position: relative; transition: color .15s;
}
.tab .ico { width: 24px; height: 24px; transition: transform .2s var(--ease); }
.tab.on { color: var(--accent-text); }
.tab.on .ico { transform: translateY(-1px); stroke-width: 2.2; }
.tab:active .ico { transform: scale(.9); }
.tab-plus {
  justify-self: center;
  width: 56px; height: 56px; border-radius: 20px; margin-top: -18px;
  background: linear-gradient(160deg, #3a66ff, var(--blue));
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 24px -6px rgba(18, 64, 224, .65), 0 0 0 5px var(--bg);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.tab-plus .ico { width: 28px; height: 28px; stroke-width: 2.4; }
.tab-plus:active { transform: scale(.92); }
.badge {
  position: absolute; top: 6px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
  font-variant-numeric: tabular-nums;
}
.badge:empty { display: none; }

/* ---------- Desktop ---------- */
@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
  .tabbar { display: none; }
  .rail {
    display: flex; flex-direction: column; gap: 6px;
    position: sticky; top: 0; height: 100dvh; padding: 18px 14px;
    border-right: 1px solid var(--line); background: var(--surface);
  }
  .rail-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font-weight: 700; font-size: 16px; }
  .rail-brand b { color: var(--accent-text); }
  .rail-new { margin: 0 4px 14px; }
  .rail-links { display: flex; flex-direction: column; gap: 2px; }
  .rail-link {
    display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 12px;
    color: var(--text-2); font-weight: 600; font-size: 14px; position: relative;
  }
  .rail-link:hover { background: var(--surface-2); }
  .rail-link.on { background: var(--accent-soft); color: var(--accent-text); }
  .rail-link .count { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 1px 7px; }
  .rail-link .count:empty { display: none; }
  .rail-sep { height: 1px; background: var(--line); margin: 10px 8px; }
  .view { padding-bottom: 48px; padding-top: 16px; }
  .topbar { padding-left: 24px; padding-right: 20px; }
  .topbar .brandmark { display: none; }
  .hide-desktop { display: none !important; }
}
@media (min-width: 1240px) {
  .app { grid-template-columns: 240px minmax(0, 1fr) 360px; }
  #side {
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100dvh;
    border-left: 1px solid var(--line); background: var(--surface);
  }
  .app.claude-route #side { display: none; }
  .app.claude-route { grid-template-columns: 240px minmax(0, 1fr); }
  .hide-wide { display: none !important; }
}
@media (max-width: 959px) { .hide-mobile { display: none !important; } }

/* ---------- Typography blocks ---------- */
.h1 { font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -.025em; }
.h2 { font-size: 20px; line-height: 1.2; font-weight: 700; letter-spacing: -.015em; }
.h3 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 10px; }
.section-head .link { font-size: 14px; font-weight: 600; color: var(--accent-text); min-height: 44px; display: inline-flex; align-items: center; margin: -12px 0; }
.small { font-size: 13px; }
.tiny { font-size: 12px; }

/* ---------- Surfaces ---------- */
.card {
  background: var(--surface); border-radius: var(--r-lg);
  border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.card.pad { padding: 16px; }
.list { background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--shadow-1); overflow: hidden; }
.list-row {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px;
  border-top: 1px solid var(--line); position: relative; width: 100%; text-align: left;
  transition: background .15s;
}
.list-row:first-child { border-top: 0; }
a.list-row:hover, button.list-row:hover { background: var(--surface-2); }
a.list-row:active, button.list-row:active { background: var(--surface-3); }
.list-row .chev { color: var(--muted); }
.row-title { font-weight: 600; font-size: 15px; }
.row-sub { font-size: 13px; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  min-height: 44px; padding: 0 18px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 650; font-size: 15px; letter-spacing: -.005em;
  background: var(--surface-2); color: var(--text);
  border: 1px solid transparent;
  transition: background .15s, transform .15s var(--ease), box-shadow .15s, opacity .15s;
  white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 18px -8px rgba(18, 64, 224, .8); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--accent-text); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-outline { background: transparent; border-color: var(--line-strong); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-success { background: var(--green); color: #fff; box-shadow: 0 8px 18px -8px rgba(15, 157, 88, .8); }
.btn-lg { min-height: 54px; border-radius: 18px; font-size: 16px; padding: 0 22px; }
.btn-sm { min-height: 36px; padding: 0 12px; border-radius: 11px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-light { background: #fff; color: var(--navy); }
.btn .ico { width: 20px; height: 20px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter); scroll-padding: 0 var(--gutter); }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  background: var(--surface); border: 1px solid var(--line-strong);
  font-weight: 600; font-size: 14px; color: var(--text-2);
  transition: background .15s, color .15s, border-color .15s, transform .15s var(--ease);
}
.chip:active { transform: scale(.96); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .n { font-size: 12px; opacity: .8; font-variant-numeric: tabular-nums; }
.pchip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 8px;
  font-size: 12px; font-weight: 650; background: var(--surface-2); color: var(--text-2);
}
.pchip .ico { width: 14px; height: 14px; }
.pchip.ig { background: linear-gradient(135deg, rgba(253, 29, 29, .12), rgba(131, 58, 180, .14)); color: #c0267a; }
.pchip.fb { background: rgba(24, 119, 242, .12); color: #1877f2; }
:root[data-theme="dark"] .pchip.ig { color: #ff7ab8; }
:root[data-theme="dark"] .pchip.fb { color: #7fb0ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pchip.ig { color: #ff7ab8; } :root:not([data-theme="light"]) .pchip.fb { color: #7fb0ff; } }

/* Status pills and dots */
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.dot.green { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.dot.amber { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.dot.red { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.dot.off { background: var(--muted); box-shadow: 0 0 0 3px var(--line); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 650; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
}
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.s-draft { background: var(--amber-soft); color: var(--amber); }
.pill.s-approved { background: var(--accent-soft); color: var(--accent-text); }
.pill.s-publishing { background: var(--accent-soft); color: var(--accent-text); }
.pill.s-posted { background: var(--green-soft); color: var(--green); }
.pill.s-failed, .pill.s-partial { background: var(--red-soft); color: var(--red); }
.pill.s-manual { background: rgba(139, 92, 246, .14); color: var(--manual); }
.pill.s-skipped { color: var(--muted); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 650; color: var(--text-2); }
.hint { font-size: 12.5px; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid transparent; color: var(--text);
  font-size: 16px; /* prevents iOS zoom */
  transition: border-color .15s, background .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366708f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 40px; }
.form-grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }

.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--surface-3); transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .22s var(--ease); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.seg { display: flex; padding: 4px; gap: 4px; background: var(--surface-2); border-radius: 14px; }
.seg button { flex: 1; min-height: 38px; border-radius: 10px; font-weight: 650; font-size: 14px; color: var(--muted); transition: background .15s, color .15s, box-shadow .15s; white-space: nowrap; padding: 0 10px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.seg.sticky { position: sticky; top: calc(var(--top-h) + var(--safe-t) + 6px); z-index: 5; box-shadow: var(--shadow-1); }

.stepper { display: inline-flex; align-items: center; background: var(--surface-2); border-radius: 14px; }
.stepper button { width: 44px; height: 44px; display: grid; place-items: center; color: var(--text-2); border-radius: 14px; }
.stepper output { min-width: 36px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.swatches { display: flex; gap: 12px; flex-wrap: wrap; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.swatch label { width: 52px; height: 52px; border-radius: 16px; border: 1px solid var(--line-strong); position: relative; overflow: hidden; cursor: pointer; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .25); }
.swatch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; }

/* ---------- Skeletons ---------- */
.sk { background: var(--skeleton); background-size: 300% 100%; animation: sk 1.3s ease-in-out infinite; border-radius: 12px; }
.sk.line { height: 14px; margin: 8px 0; }
.sk.block { height: 120px; border-radius: var(--r-lg); }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- Today ---------- */
.greet { margin: 6px 2px 16px; }
.greet .h1 { margin-top: 2px; }
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl); padding: 22px 20px 20px;
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(80, 120, 255, .55), transparent 60%),
    radial-gradient(300px 200px at 0% 120%, rgba(18, 64, 224, .55), transparent 70%),
    linear-gradient(160deg, #142561, #0b1430 70%);
  color: #fff; box-shadow: var(--shadow-3);
}
.hero::after {
  content: ''; position: absolute; right: -30px; top: -30px; width: 170px; height: 170px; opacity: .14;
  background: url("icons/icon.svg") center / contain no-repeat; transform: rotate(-12deg);
}
.hero .eyebrow { color: rgba(255, 255, 255, .7); }
.hero-num { font-size: 76px; line-height: .95; font-weight: 800; letter-spacing: -.045em; font-variant-numeric: tabular-nums; margin: 8px 0 4px; }
.hero-sub { color: rgba(255, 255, 255, .82); font-size: 15px; margin-bottom: 18px; max-width: 30ch; }
.hero .btn-light { min-height: 54px; border-radius: 18px; font-size: 16px; width: 100%; }
.hero .btn-light .ico { color: var(--blue); }
.hero-split { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; position: relative; z-index: 1; }
.hero-split span { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .14); padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.hero.calm { background: radial-gradient(400px 220px at 100% 0%, rgba(47, 194, 122, .45), transparent 60%), linear-gradient(160deg, #10306b, #0b1430 70%); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow-1); min-width: 0; }
.stat b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat.posted b { color: var(--green); }
.stat.failed b { color: var(--red); }
.stat.sched b { color: var(--accent-text); }

.alert {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r-lg);
  background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 25%, transparent);
}
.alert.manual { background: rgba(139, 92, 246, .1); border-color: rgba(139, 92, 246, .25); }
.alert + .alert { margin-top: 10px; }
.alert .thumb { width: 52px; height: 52px; border-radius: 12px; }
.alert .title { font-weight: 700; font-size: 14.5px; }
.alert .desc { font-size: 13.5px; color: var(--text-2); margin-top: 2px; }
.alert .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.timeline { position: relative; }
.tl-item { display: grid; grid-template-columns: 52px 56px 1fr; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); min-height: 76px; }
.tl-item:first-child { border-top: 0; }
.tl-time { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }
.tl-time small { display: block; font-weight: 600; color: var(--muted); font-size: 11.5px; }
.tl-item .thumb { width: 56px; height: 56px; border-radius: 12px; }
.tl-main { min-width: 0; }
.tl-main .row-title { font-size: 14.5px; }

.thumb { display: block; position: relative; overflow: hidden; background: var(--surface-2); flex: none; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .kind { position: absolute; right: 4px; top: 4px; width: 18px; height: 18px; border-radius: 6px; background: rgba(0, 0, 0, .5); color: #fff; display: grid; place-items: center; }
.thumb .kind .ico { width: 11px; height: 11px; stroke-width: 2.4; }

.health-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .health-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.health {
  display: flex; flex-direction: column; gap: 8px; padding: 12px; min-height: 92px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1);
  transition: transform .15s var(--ease);
}
.health:active { transform: scale(.98); }
.health .top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.health .name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health .meta { font-size: 12.5px; color: var(--muted); }
.health .waiting { font-weight: 700; color: var(--amber); }
.health .fix { margin-top: auto; }

/* ---------- Avatars ---------- */
.cav {
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 15px; letter-spacing: -.02em; color: #fff;
  background: var(--c, var(--accent)); position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}
.cav img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.cav.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }
.cav.lg { width: 64px; height: 64px; border-radius: 20px; font-size: 22px; }
.cav .hd { position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--surface); }
.cav .hd.green { background: var(--green); } .cav .hd.amber { background: var(--amber); } .cav .hd.red { background: var(--red); } .cav .hd.off { background: var(--muted); }

/* ---------- Approvals ---------- */
.approvals {
  display: flex; flex-direction: column;
  height: calc(100dvh - var(--top-h) - var(--safe-t) - var(--tab-h) - var(--safe-b));
  padding: 4px calc(var(--gutter) + var(--safe-r)) 10px calc(var(--gutter) + var(--safe-l));
  max-width: 640px; margin: 0 auto; overflow: hidden;
}
@media (min-width: 960px) { .approvals { height: calc(100dvh - var(--top-h)); padding-bottom: 20px; } }
.ap-filter { flex: none; margin-bottom: 8px; }
.ap-meta { flex: none; display: flex; align-items: center; gap: 10px; min-height: 48px; margin-bottom: 8px; }
.ap-meta .pchip { width: 30px; height: 30px; padding: 0; justify-content: center; border-radius: 10px; }
.ap-meta .pchip .ico { width: 16px; height: 16px; }
.ap-meta .pchip .t { display: none; }
.ap-meta .who { min-width: 0; flex: 1; }
.ap-meta .who b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-meta .who span { font-size: 12.5px; color: var(--muted); }
.ap-count { font-size: 12.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; background: var(--surface-2); padding: 4px 9px; border-radius: 999px; }
.ap-prow { display: flex; align-items: center; gap: 10px; flex: none; margin-bottom: 12px; }
.ap-progress { height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; flex: 1; }
.ap-progress i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .35s var(--ease); }
.stage { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; }
.stage-card {
  position: absolute; left: 0; right: 0; margin: 0 auto; top: 0;
  transform-origin: 50% 110%;
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
  will-change: transform;
}
.stage-card.back { pointer-events: none; transition: transform .3s var(--ease), opacity .3s; }
.stage-card.fly { transition: transform .36s cubic-bezier(.3, .7, .3, 1), opacity .36s; }
.stage-card.snap { transition: transform .32s var(--ease); }
.stage-card.enter { animation: card-enter .3s var(--ease); }
@keyframes card-enter { from { transform: translateY(12px) scale(.93); opacity: .6; } }
.stage-card .post-cap { height: 78px; flex: none; }
.stage-card .frame { box-shadow: var(--shadow-3); }
.stamp {
  position: absolute; top: 28px; z-index: 5; padding: 6px 14px; border-radius: 12px;
  font-weight: 800; font-size: 20px; letter-spacing: .06em; text-transform: uppercase;
  border: 3px solid currentColor; background: rgba(255, 255, 255, .9); opacity: 0; pointer-events: none;
}
.stamp.approve { left: 18px; color: var(--green); transform: rotate(-12deg); }
.stamp.redo { right: 18px; color: var(--amber); transform: rotate(12deg); }
.ap-actions { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; padding-top: 12px; }
.ap-btn {
  height: 56px; border-radius: 20px; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 15px; transition: transform .15s var(--ease), background .15s;
}
.ap-btn:active { transform: scale(.95); }
.ap-btn.redo { background: var(--surface); color: var(--amber); border: 1px solid var(--line-strong); box-shadow: var(--shadow-1); }
.ap-btn.approve { background: var(--green); color: #fff; box-shadow: 0 12px 24px -10px rgba(15, 157, 88, .8); }
.ap-btn.edit { width: 56px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--text-2); box-shadow: var(--shadow-1); }
.ap-btn .ico { width: 22px; height: 22px; stroke-width: 2.2; }
.ap-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 8px; flex: none; }
.kbd { display: inline-block; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: 0 5px; font-size: 11px; font-weight: 700; }

.done {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px;
  padding: 40px 20px; flex: 1; animation: view-in .4s var(--ease);
}
.done-badge {
  width: 96px; height: 96px; border-radius: 32px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(150deg, #34d08a, var(--green)); box-shadow: 0 20px 40px -14px rgba(15, 157, 88, .8);
  animation: pop .5s var(--ease);
}
.done-badge .ico { width: 48px; height: 48px; stroke-width: 2.6; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); } 100% { transform: none; opacity: 1; } }

.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .ill { width: 72px; height: 72px; border-radius: 24px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.empty .ill .ico { width: 34px; height: 34px; }
.empty h3 { color: var(--text); font-size: 17px; margin-bottom: 4px; }
.empty p { max-width: 32ch; margin: 0 auto 16px; font-size: 14px; }

/* ---------- Platform frames ---------- */
.frame {
  position: relative; overflow: hidden; background: #000; color: #fff;
  border-radius: 22px; box-shadow: var(--shadow-3);
  font-size: 13px;
}
.frame .media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #111; }
.frame.story, .frame.reel { aspect-ratio: 9 / 16; }
.frame .shade-top { position: absolute; left: 0; right: 0; top: 0; height: 120px; background: linear-gradient(rgba(0, 0, 0, .45), transparent); pointer-events: none; }
.frame .shade-bot { position: absolute; left: 0; right: 0; bottom: 0; height: 45%; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); pointer-events: none; }
.story-bars { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 4px; z-index: 2; }
.story-bars i { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(255, 255, 255, .38); overflow: hidden; }
.story-bars i b { display: block; height: 100%; width: 0; background: #fff; }
.story-bars i.done b { width: 100%; }
.story-bars i.cur b { animation: storybar 5s linear infinite; }
@keyframes storybar { from { width: 0; } to { width: 100%; } }
.frame-head { position: absolute; top: 20px; left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; z-index: 2; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.frame-head .cav { width: 30px; height: 30px; border-radius: 50%; font-size: 11px; box-shadow: 0 0 0 2px #fff; }
.frame-head .t { opacity: .75; font-weight: 500; }
.frame-head .sp { flex: 1; }
.frame-foot { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 10px; z-index: 2; }
.frame-foot .reply { flex: 1; height: 40px; border-radius: 20px; border: 1px solid rgba(255, 255, 255, .6); display: flex; align-items: center; padding: 0 14px; font-size: 13px; opacity: .9; }
.sticker {
  position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%) rotate(-2deg); z-index: 2;
  width: 72%; background: #fff; color: #111; border-radius: 16px; padding: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); text-align: center;
}
.sticker .q { font-weight: 800; font-size: 14px; margin-bottom: 8px; line-height: 1.25; }
.sticker .opt { border-radius: 10px; background: #f1f1f4; padding: 8px; font-weight: 700; font-size: 13px; margin-top: 6px; }
.sticker .tag { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #7c3aed; margin-bottom: 4px; }
.sticker input { width: 100%; }
.reel-side { position: absolute; right: 10px; bottom: 92px; display: flex; flex-direction: column; gap: 18px; z-index: 2; align-items: center; }
.reel-side .ico { width: 26px; height: 26px; stroke-width: 2; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.reel-cap { position: absolute; left: 12px; right: 56px; bottom: 16px; z-index: 2; }
.reel-cap .who { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 6px; }
.reel-cap .who .cav { width: 28px; height: 28px; border-radius: 50%; font-size: 10px; }
.reel-cap p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .95; font-size: 13px; line-height: 1.35; }
.play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3;
  width: 68px; height: 68px; border-radius: 50%; background: rgba(0, 0, 0, .38); display: grid; place-items: center;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); border: 1.5px solid rgba(255, 255, 255, .5);
  transition: opacity .2s, transform .2s var(--ease);
}
.play .ico { width: 30px; height: 30px; fill: #fff; stroke: none; margin-left: 4px; }
.frame.playing .play { opacity: 0; transform: translate(-50%, -50%) scale(.8); }

.frame.post { background: var(--surface); color: var(--text); display: flex; flex-direction: column; border: 1px solid var(--line); }
.post-head { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px; flex: none; }
.post-head .cav { width: 32px; height: 32px; border-radius: 50%; font-size: 11px; color: #fff; }
.post-head b { font-size: 13.5px; display: block; line-height: 1.2; }
.post-head span { font-size: 11.5px; color: var(--muted); }
.post-media { position: relative; aspect-ratio: 4 / 5; background: #111; flex: none; overflow: hidden; }
.post-media img, .post-media video { width: 100%; height: 100%; object-fit: cover; }
.post-media .count { position: absolute; top: 10px; right: 10px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.post-dots { display: flex; justify-content: center; gap: 4px; position: absolute; top: 50%; transform: translateY(-50%); left: 0; right: 0; pointer-events: none; }
.post-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.post-dots i.on { background: var(--accent); }
.post-icons { display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 12px; flex: none; position: relative; }
.post-icons .ico { width: 24px; height: 24px; }
.post-icons .sp { flex: 1; }
.post-cap { padding: 0 12px 14px; font-size: 13.5px; line-height: 1.4; flex: 1; min-height: 0; overflow: hidden; }
.post-cap p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.post-cap b { margin-right: 4px; }
.post-cap .more { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 4px; margin: 4px 0 10px; }
.cal-head .h2 { flex: 1; text-align: center; }
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px 6px 10px; box-shadow: var(--shadow-1); }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow span { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 4px 0 8px; letter-spacing: .03em; }
.cal-day {
  min-height: 54px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 2px;
  position: relative; transition: background .15s;
}
.cal-day .num { font-size: 14px; font-weight: 650; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.cal-day.out .num { color: var(--muted); opacity: .45; }
.cal-day.today .num { background: var(--accent-soft); color: var(--accent-text); font-weight: 800; }
.cal-day.sel { background: var(--accent); }
.cal-day.sel .num { color: #fff; background: transparent; }
.cal-day.sel .dots i { box-shadow: 0 0 0 1.5px rgba(255,255,255,.9); }
.cal-day.drop { background: var(--accent-soft); outline: 2px dashed var(--accent); }
.cal-day:active { background: var(--surface-2); }
.dots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; max-width: 40px; min-height: 6px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; }
.dots .more { font-size: 9px; font-weight: 800; color: var(--muted); line-height: 6px; }
.cal-day.sel .dots .more { color: #fff; }
.d-draft { background: var(--draft); } .d-approved, .d-publishing { background: var(--approved); } .d-posted { background: var(--posted); } .d-failed, .d-partial { background: var(--failed); } .d-manual { background: var(--manual); } .d-skipped { background: var(--muted); opacity: .5; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 4px 0; font-size: 12px; color: var(--muted); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; }
.day-panel { margin-top: 18px; }
.strip { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; padding: 2px var(--gutter) 8px; margin: 0 calc(-1 * var(--gutter)); scroll-snap-type: x mandatory; }
.strip::-webkit-scrollbar { display: none; }
.strip-item { flex: none; width: 128px; scroll-snap-align: start; position: relative; }
.strip-item .thumb { width: 128px; height: 170px; border-radius: 16px; box-shadow: var(--shadow-2); }
.strip-item .thumb.story, .strip-item .thumb.reel { height: 210px; }
.strip-item .cap { margin-top: 8px; font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.strip-item .cap .dot { width: 8px; height: 8px; box-shadow: none; }
.strip-item .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip-item .unap { margin-top: 8px; width: 100%; padding: 0 8px; gap: 4px; }
.tl-unap { margin-top: 8px; align-self: flex-start; }
.strip-item .move {
  position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; display: grid; place-items: center; z-index: 2;
}
.strip-item .move span { width: 30px; height: 30px; border-radius: 10px; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.strip-item .move .ico { width: 16px; height: 16px; }
.strip-item.holding .thumb { transform: scale(.95); outline: 3px solid var(--accent); }
.strip-item .thumb { transition: transform .2s var(--ease); }
.move-banner {
  position: sticky; top: calc(var(--top-h) + var(--safe-t) + 6px); z-index: 6; margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 16px;
  background: var(--accent); color: #fff; box-shadow: var(--shadow-2); font-weight: 600; font-size: 14px;
  animation: view-in .25s var(--ease);
}
.move-banner .btn { background: rgba(255, 255, 255, .18); color: #fff; }

/* ---------- Clients ---------- */
.search {
  position: relative; margin-bottom: 14px;
}
.search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 44px; }
.client-row .waiting-badge { background: var(--amber-soft); color: var(--amber); font-weight: 800; font-size: 13px; min-width: 30px; height: 26px; border-radius: 9px; display: grid; place-items: center; padding: 0 8px; font-variant-numeric: tabular-nums; }
.client-row .btn-sm { margin-left: auto; }
.client-hero { display: flex; align-items: center; gap: 14px; margin: 6px 0 14px; }
.client-hero .h1 { font-size: 24px; }
.qa { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.conn-card { display: flex; flex-direction: column; gap: 14px; }
.conn-line { display: flex; align-items: center; gap: 12px; }
.conn-line .pico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.conn-line .pico.ig { background: linear-gradient(135deg, #feda75, #d62976 45%, #4f5bd5); color: #fff; }
.conn-line .pico.fb { background: #1877f2; color: #fff; }
.uploads { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 560px) { .uploads { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.uploads .thumb { aspect-ratio: 1; border-radius: 12px; }
.logo-edit { display: flex; align-items: center; gap: 14px; }
.logo-edit .logo { width: 72px; height: 72px; border-radius: 20px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; border: 1px dashed var(--line-strong); color: var(--muted); }
.logo-edit .logo img { width: 100%; height: 100%; object-fit: contain; }
.setting-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line); min-height: 64px; }
.setting-row:first-child { border-top: 0; }
.setting-row .grow b { display: block; font-size: 15px; font-weight: 650; }
.setting-row .grow span { font-size: 13px; color: var(--muted); }
.savebar {
  position: fixed; left: 50%; transform: translate(-50%, 140%); z-index: 45;
  bottom: calc(var(--tab-h) + var(--safe-b) + 12px);
  width: min(calc(100% - 2 * var(--gutter)), 520px);
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 18px;
  background: var(--navy); color: #fff; box-shadow: var(--shadow-3); font-weight: 600; font-size: 14px;
  transition: transform .3s var(--ease);
}
.savebar { opacity: 0; visibility: hidden; transition: transform .3s var(--ease), opacity .2s, visibility .3s; }
.savebar.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.savebar .btn-ghost { color: rgba(255, 255, 255, .8); }
@media (min-width: 960px) { .savebar { bottom: 24px; left: calc(50% + 120px); } }
@media (min-width: 1240px) { .savebar { left: calc(50% - 60px); } }

/* ---------- New content ---------- */
.step { display: flex; gap: 14px; }
.step-n { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; font-size: 13px; font-weight: 800; flex: none; transition: background .2s, color .2s; }
.step.is-done .step-n { background: var(--green); color: #fff; }
.step.is-active .step-n { background: var(--accent); color: #fff; }
.step-body { flex: 1; min-width: 0; padding-bottom: 22px; }
.step-title { font-weight: 700; font-size: 16px; margin: 3px 0 12px; }
.pick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pick {
  display: flex; align-items: center; gap: 10px; padding: 10px; min-height: 60px; border-radius: 16px;
  background: var(--surface); border: 1.5px solid var(--line); text-align: left; transition: border-color .15s, background .15s, transform .15s var(--ease);
}
.pick:active { transform: scale(.98); }
.pick.on { border-color: var(--accent); background: var(--accent-soft); }
.pick b { font-size: 14px; display: block; line-height: 1.2; }
.pick .sub { font-size: 12px; color: var(--muted); display: block; }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 132px; border-radius: 20px; border: 2px dashed var(--line-strong); background: var(--surface);
  color: var(--text-2); position: relative; transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .ill { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.drop b { font-size: 15px; }
.drop span { font-size: 13px; color: var(--muted); }
.up-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.up { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.up img, .up video { width: 100%; height: 100%; object-fit: cover; }
.up .ring { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(7, 12, 30, .5); transition: opacity .3s; }
.up.ok .ring { opacity: 0; pointer-events: none; }
.up .ring svg { width: 40px; height: 40px; transform: rotate(-90deg); }
.up .ring circle { fill: none; stroke-width: 4; }
.up .ring .bgc { stroke: rgba(255, 255, 255, .25); }
.up .ring .fgc { stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset .2s; }
.up .x { position: absolute; top: 2px; right: 2px; width: 32px; height: 32px; display: grid; place-items: center; }
.up .x span { width: 22px; height: 22px; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; display: grid; place-items: center; }
.up .x .ico { width: 12px; height: 12px; stroke-width: 2.6; }
.up.err .ring { background: rgba(224, 53, 59, .7); }
.preset { min-height: 44px; }
.gen-cta { position: sticky; bottom: calc(var(--tab-h) + var(--safe-b)); z-index: 5; padding: 14px 0 10px; margin-top: 4px; background: linear-gradient(to bottom, transparent, var(--bg) 30%); }
.gen-cta .btn:disabled { opacity: 1; background: var(--surface-3); color: var(--muted); box-shadow: none; }
@media (min-width: 960px) { .gen-cta { bottom: 20px; } }
.gen-progress { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 30px 10px; gap: 22px; }
.orb { width: 120px; height: 120px; position: relative; }
.orb::before, .orb::after { content: ''; position: absolute; inset: 0; border-radius: 40px; background: linear-gradient(140deg, #4c74ff, var(--blue)); animation: orb 2.4s var(--ease) infinite; }
.orb::after { inset: 18px; border-radius: 28px; background: var(--navy); animation-delay: -.6s; opacity: .9; }
.orb img { position: absolute; inset: 34px; z-index: 1; width: 52px; height: 52px; animation: orb 2.4s var(--ease) infinite reverse; }
@keyframes orb { 0%, 100% { transform: rotate(0) scale(1); } 50% { transform: rotate(90deg) scale(.92); } }
.gen-steps { width: 100%; max-width: 340px; text-align: left; }
.gen-step { display: flex; align-items: center; gap: 12px; padding: 10px 0; color: var(--muted); font-weight: 600; transition: color .3s; }
.gen-step .st { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; flex: none; transition: all .3s; }
.gen-step.on { color: var(--text); }
.gen-step.on .st { border-color: var(--accent); border-top-color: transparent; animation: spin .9s linear infinite; }
.gen-step.ok { color: var(--text); }
.gen-step.ok .st { background: var(--green); border-color: var(--green); color: #fff; }
.gen-step .st .ico { width: 14px; height: 14px; stroke-width: 3; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Item page ---------- */
.item-layout { display: grid; gap: 18px; }
.item-preview { display: flex; justify-content: center; }
.item-preview .frame { width: min(100%, 340px); }
@media (min-width: 760px) { .item-layout { grid-template-columns: 340px 1fr; align-items: start; } .item-preview { position: sticky; top: calc(var(--top-h) + 16px); } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.caption-box { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; white-space: pre-wrap; font-size: 14.5px; line-height: 1.5; min-height: 60px; }
.problem { background: var(--red-soft); color: var(--text); border-radius: 16px; padding: 14px; display: flex; gap: 10px; }
.problem .ico { color: var(--red); }
.action-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action-bar .full { grid-column: 1 / -1; }
.action-bar > .btn { min-width: 0; }

/* ---------- Sheets ---------- */
.backdrop { position: fixed; inset: 0; z-index: 80; background: var(--backdrop); opacity: 0; transition: opacity .25s; }
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 81;
  max-height: calc(100dvh - var(--safe-t) - 24px); display: flex; flex-direction: column;
  background: var(--elev); border-radius: 26px 26px 0 0; box-shadow: var(--shadow-3);
  transform: translateY(105%); transition: transform .32s var(--ease);
  padding-bottom: var(--safe-b);
}
.sheet.show { transform: none; }
.sheet.tall { height: calc(100dvh - var(--safe-t) - 24px); }
.sheet-grab { width: 100%; height: 26px; display: grid; place-items: center; flex: none; touch-action: none; cursor: grab; }
.sheet-grab::before { content: ''; width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 0 12px 8px 20px; flex: none; }
.sheet-head h2 { flex: 1; font-size: 18px; font-weight: 750; letter-spacing: -.01em; }
.sheet-body { padding: 4px 20px 20px; overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 0; }
.sheet-foot { padding: 12px 20px 16px; border-top: 1px solid var(--line); flex: none; display: flex; gap: 10px; }
.sheet-foot .btn { flex: 1; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: 50%; width: min(600px, calc(100% - 48px)); border-radius: 26px; transform: translate(-50%, 60%) scale(.98); opacity: 0; transition: transform .28s var(--ease), opacity .2s; max-height: min(86dvh, 820px); padding-bottom: 0; }
  .sheet.show { transform: translate(-50%, 50%); opacity: 1; }
  .sheet.tall { height: min(86dvh, 820px); }
  .sheet-grab { height: 14px; }
  .sheet-grab::before { display: none; }
}
.reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.reason {
  min-height: 52px; border-radius: 14px; padding: 10px 12px; text-align: left; font-weight: 650; font-size: 14px;
  background: var(--surface-2); border: 1.5px solid transparent; display: flex; align-items: center; gap: 8px; transition: all .15s;
}
.reason.on { border-color: var(--amber); background: var(--amber-soft); color: var(--text); }
.reason .ico { color: var(--amber); }
.cap-cols { display: grid; gap: 12px; }
.cap-cols .lang { font-size: 12px; font-weight: 800; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
.cap-cols .textarea { min-height: 170px; }
@media (min-width: 640px) { .cap-cols.pair { grid-template-columns: 1fr 1fr; } }
.toggle-row { display: flex; gap: 8px; }
.ptoggle { flex: 1; min-height: 52px; border-radius: 14px; border: 1.5px solid var(--line-strong); display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 650; transition: all .15s; }
.ptoggle.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.menu-list .list-row { min-height: 56px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b) + 12px); z-index: 90; display: flex; justify-content: center; pointer-events: none; padding: 0 var(--gutter); }
@media (min-width: 960px) { #toast-root { bottom: 24px; } }
.toast {
  pointer-events: auto; position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 6px 6px 16px; border-radius: 16px;
  background: #0b1430; color: #fff; box-shadow: var(--shadow-3); width: min(100%, 440px);
  font-weight: 600; font-size: 14px;
  animation: toast-in .3s var(--ease);
}
:root[data-theme="dark"] .toast { background: #23315f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #23315f; } }
.toast.out { animation: toast-out .22s ease-in forwards; }
.toast .msg { flex: 1; min-width: 0; }
.toast .ico { flex: none; }
.toast.ok .lead { color: #48d597; }
.toast.err .lead { color: #ff7d82; }
.toast .btn { background: rgba(255, 255, 255, .14); color: #fff; min-height: 40px; }
.toast .timer { position: absolute; left: 0; bottom: 0; height: 3px; background: #4c74ff; width: 100%; transform-origin: left; }
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(20px); opacity: 0; } }
@keyframes shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- Claude ---------- */
.chat { display: flex; flex-direction: column; height: calc(100dvh - var(--top-h) - var(--safe-t) - var(--tab-h) - var(--safe-b)); max-width: 760px; margin: 0 auto; }
@media (min-width: 960px) { .chat { height: calc(100dvh - var(--top-h)); } }
#side .chat { height: 100dvh; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex: none; }
.chat-head b { font-size: 15px; }
.chat-logo { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(150deg, #ff9a62, #d9663a); color: #fff; flex: none; }
.chat-logo .ico { width: 20px; height: 20px; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px var(--gutter); display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; animation: view-in .2s var(--ease); overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.msg.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; box-shadow: var(--shadow-1); }
.msg .acts { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.msg .acts .btn { justify-content: flex-start; white-space: normal; text-align: left; min-height: 44px; padding: 8px 12px; }
.msg .acts .btn.applied { background: var(--green-soft); color: var(--green); pointer-events: none; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ctx { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: var(--accent-text); background: var(--accent-soft); border-radius: 999px; padding: 4px 10px; max-width: 100%; }
.ctx span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-suggest { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 0 var(--gutter) 10px; flex: none; }
.chat-suggest::-webkit-scrollbar { display: none; }
.chat-suggest .chip { font-size: 13px; min-height: 36px; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; padding: 10px var(--gutter) 12px; border-top: 1px solid var(--line); flex: none; background: var(--bar-bg); }
.chat-input .textarea { min-height: 48px; max-height: 140px; resize: none; padding: 12px 14px; border-radius: 16px; }
.chat-input .btn { width: 48px; height: 48px; padding: 0; border-radius: 16px; flex: none; }
.chat-empty { margin: auto 0; text-align: center; color: var(--muted); padding: 10px; }
.chat-empty .chat-logo { width: 56px; height: 56px; border-radius: 18px; margin: 0 auto 12px; }
.chat-empty .chat-logo .ico { width: 30px; height: 30px; }

/* ---------- Settings ---------- */
.usage { height: 10px; background: var(--surface-3); border-radius: 5px; overflow: hidden; margin-top: 8px; }
.usage i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #5b80ff); border-radius: 5px; }
.time-input { width: 132px; flex: none; min-height: 44px; padding: 8px 10px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Login ---------- */
.login {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(600px 400px at 80% -10%, rgba(60, 100, 255, .55), transparent 60%),
    radial-gradient(500px 400px at 0% 110%, rgba(18, 64, 224, .45), transparent 60%),
    #0b1430;
  color: #fff; animation: view-in .3s var(--ease);
}
.login form { width: min(100%, 360px); display: flex; flex-direction: column; gap: 14px; }
.login img { width: 72px; height: 72px; margin: 0 auto 6px; filter: drop-shadow(0 16px 30px rgba(18, 64, 224, .6)); }
.login h1 { text-align: center; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.login p { text-align: center; color: rgba(255, 255, 255, .7); margin-bottom: 10px; }
.login .input { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .14); }
.login .input::placeholder { color: rgba(255, 255, 255, .55); }
.login .input:focus { background: rgba(255, 255, 255, .14); border-color: #6d8dff; box-shadow: 0 0 0 4px rgba(61, 102, 255, .3); }
.login .err { color: #ff8a8f; font-size: 14px; text-align: center; min-height: 20px; }

/* Demo marker */
.demo-flag { position: fixed; top: calc(var(--safe-t) + 6px); left: 50%; transform: translateX(-50%); z-index: 50; background: var(--amber); color: #1b1300; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; padding: 2px 8px; border-radius: 0 0 8px 8px; pointer-events: none; text-transform: uppercase; display: none; }

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