/* ================================================================
   Oks.1 Client Portal — OKS Technologies brand
   ================================================================ */
:root {
  --bg: #070A16;
  --bg-2: #0B0F20;
  --surface: #10152A;
  --surface-2: #151B34;
  --line: #1E2645;
  --line-2: #2A3458;
  --text: #EEF1FA;
  --muted: #8C95B4;
  --faint: #5D6689;

  --cyan: #3EE0F0;
  --violet: #7B5CFF;
  --coral: #FF7A6B;
  --arc: linear-gradient(120deg, var(--cyan) 0%, var(--violet) 55%, var(--coral) 100%);

  --success: #34D399;
  --danger: #FF6B7A;
  --warn: #FBBF24;

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;

  --font-display: "Bricolage Grotesque", "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --sidebar: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
.hidden, [hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }

/* ---------------- Layout ---------------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 26px 18px 22px;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
}

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 0 8px; }
/* Logo size: change width here (desktop sidebar) */
.logo-img { display: block; width: 128px; height: auto; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--r-sm);
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-link svg { width: 18px; height: 18px; }
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.active { background: var(--surface-2); color: var(--text); box-shadow: inset 3px 0 0 var(--violet); }
button.nav-link { width: 100%; border: 0; background: none; cursor: pointer; text-align: left; font-family: inherit; }
.nav-count {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 99px;
  background: var(--line-2); color: var(--text); font-size: 12px; text-align: center;
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; padding: 0 8px; }
.conn { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.conn[data-state="ok"] .conn-dot { background: var(--success); box-shadow: 0 0 0 4px rgba(52,211,153,.14); }
.conn[data-state="error"] .conn-dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(255,107,122,.14); }
.conn[data-state="error"] .conn-text { color: var(--danger); }
.powered { font-size: 12px; color: var(--faint); text-decoration: none; }
.powered strong { color: var(--muted); font-weight: 600; }
.powered:hover strong { color: var(--text); }

.main { min-width: 0; padding: 40px clamp(20px, 4vw, 56px) 32px; }

.page-head { max-width: 1180px; margin-bottom: 32px; }
.page-head h1 { font-size: clamp(32px, 4vw, 46px); font-weight: 800; line-height: 1.05; letter-spacing: -0.035em; }
.page-head p { margin-top: 12px; max-width: 62ch; color: var(--muted); font-size: 16px; }

.workspace {
  max-width: 1180px;
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; align-items: start;
}

/* ---------------- Composer ---------------- */
.composer { display: flex; flex-direction: column; gap: 18px; }

.step-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 26px;
  display: flex; flex-direction: column; gap: 18px;
}
.step-head { display: flex; gap: 14px; align-items: flex-start; }
.step-num {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  border: 1.5px solid var(--line-2); color: var(--muted);
  transition: border-color .2s, color .2s, background .2s;
}
.step-block.done .step-num { border-color: transparent; background: var(--arc); color: var(--bg); }
.step-head h2 { font-size: 20px; font-weight: 700; }
.step-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }

.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field label, .label-row label { font-size: 13px; font-weight: 600; color: #C9CFE4; }
.field b { color: var(--coral); font-weight: 700; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.counter { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.counter.near { color: var(--warn); }
.hint { font-size: 12.5px; color: var(--faint); }

input[type="text"], input[type="url"], textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 14.5px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, textarea:hover { border-color: #37426D; }
input:focus, textarea:focus {
  outline: none; border-color: var(--violet); background: #0D1226;
  box-shadow: 0 0 0 4px rgba(123,92,255,.18);
}
.field.invalid input, .field.invalid textarea { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(255,107,122,.14); }

.swatches { display: flex; gap: 6px; flex-wrap: wrap; min-height: 0; }
.swatch {
  width: 22px; height: 22px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.18);
}

/* Design choice */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  position: relative; display: flex; gap: 14px; align-items: flex-start;
  padding: 16px; border-radius: var(--r-md);
  background: var(--bg-2); border: 1px solid var(--line-2);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.choice:hover { border-color: #37426D; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:focus-visible) { outline: 2px solid var(--cyan); outline-offset: 3px; }
.choice-icon {
  flex: none; width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; background: var(--surface-2); color: var(--muted);
}
.choice-icon svg { width: 20px; height: 20px; }
.choice-body { display: flex; flex-direction: column; gap: 2px; }
.choice-body strong { font-size: 14.5px; }
.choice-body small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.choice.active { border-color: var(--violet); background: linear-gradient(180deg, rgba(123,92,255,.10), rgba(123,92,255,.03)); }
.choice.active .choice-icon { background: var(--violet); color: #fff; }

/* Dropzone */
.dropzone {
  position: relative;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-md);
  background: var(--bg-2);
  transition: border-color .15s, background .15s;
}
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dropzone.dragging { border-color: var(--cyan); background: rgba(62,224,240,.06); }
.dropzone.has-file input[type="file"] { pointer-events: none; }
.dropzone:has(input:focus-visible) { outline: 2px solid var(--cyan); outline-offset: 3px; }
.drop-empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 34px 20px; text-align: center; color: var(--muted); font-size: 13px;
}
.drop-empty svg { width: 26px; height: 26px; color: var(--cyan); margin-bottom: 4px; }
.drop-empty strong { color: var(--text); font-size: 14.5px; font-weight: 600; }
.drop-empty u { text-decoration-color: var(--cyan); text-underline-offset: 3px; }
.drop-file { position: relative; z-index: 2; display: flex; align-items: center; gap: 14px; padding: 14px; }
.drop-thumb {
  width: 64px; height: 64px; flex: none; border-radius: 10px; overflow: hidden;
  background: var(--surface-2);
}
.drop-thumb img, .drop-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.drop-meta { min-width: 0; display: flex; flex-direction: column; }
.drop-meta strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drop-meta span { color: var(--muted); font-size: 12.5px; }
.drop-file .btn-ghost { margin-left: auto; }

/* Platforms */
.platform-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.platform {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: var(--r-md);
  background: var(--bg-2); border: 1px solid var(--line-2);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.platform:hover { border-color: #37426D; }
.platform input { position: absolute; opacity: 0; pointer-events: none; }
.platform:has(input:focus-visible) { outline: 2px solid var(--cyan); outline-offset: 3px; }
.p-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; }
.p-icon svg { width: 20px; height: 20px; stroke-width: 2.2; }
.p-icon.linkedin { background: #0A66C2; }
.p-icon.facebook { background: #1877F2; }
.p-icon.instagram { background: linear-gradient(45deg, #F58529, #DD2A7B 50%, #8134AF); }
.p-name { font-weight: 600; font-size: 14px; }
.p-check {
  margin-left: auto; width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid var(--line-2); flex: none; position: relative;
}
.platform.selected { border-color: var(--violet); background: rgba(123,92,255,.07); }
.platform.selected .p-check { background: var(--violet); border-color: var(--violet); }
.platform.selected .p-check::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* Message */
.message {
  padding: 13px 16px; border-radius: var(--r-sm); font-size: 14px; font-weight: 500;
  border: 1px solid;
}
.message.error { color: #FFC2C9; background: rgba(255,107,122,.08); border-color: rgba(255,107,122,.35); }
.message.success { color: #B6F3D9; background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.35); }

/* Submit */
.submit-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 20px 18px 26px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.submit-note { color: var(--muted); font-size: 13.5px; max-width: 42ch; }

.btn-primary {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-width: 170px; padding: 14px 26px; border: 0; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-weight: 700; font-size: 15px; cursor: pointer;
  transition: transform .15s, box-shadow .2s;
}
.btn-primary::before {
  content: ""; position: absolute; inset: -2px; border-radius: inherit; z-index: -1;
  background: var(--arc); opacity: 0; transition: opacity .2s;
}
.btn-primary:hover { box-shadow: 0 10px 30px -10px rgba(123,92,255,.7); }
.btn-primary:hover::before { opacity: 1; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { cursor: wait; opacity: .85; }

.btn-secondary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s;
}
.btn-secondary { background: var(--surface-2); border: 1px solid var(--line-2); }
.btn-secondary:hover { border-color: var(--violet); }
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-ghost.small { padding: 6px 12px; font-size: 12.5px; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(7,10,22,.25); border-top-color: var(--bg);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Preview ---------------- */
.preview { position: sticky; top: 28px; }
.preview-sticky { display: flex; flex-direction: column; gap: 16px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.preview-head h2 { font-size: 16px; font-weight: 700; color: var(--muted); }
.preview-tabs { display: flex; gap: 4px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.preview-tabs button {
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.preview-tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); }

/* The signature: the Oks.1 arc wraps the preview */
.phone { position: relative; padding: 14px; border-radius: 28px; background: var(--bg-2); }
.arc-frame {
  position: absolute; inset: 0; border-radius: inherit; padding: 1.5px;
  background: var(--arc);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .55; pointer-events: none;
}
.phone[data-state="working"] .arc-frame { opacity: 1; animation: arcPulse 1.6s ease-in-out infinite; }
@keyframes arcPulse { 50% { opacity: .45; } }

.post-card {
  background: #fff; color: #0F1426; border-radius: 16px; overflow: hidden;
  font-size: 13.5px; transition: filter .3s;
}
.post-top { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; }
.post-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; color: #fff;
  background: var(--brand-a, #7B5CFF);
}
.post-card[data-platform="LinkedIn"] .post-avatar { border-radius: 8px; }
.post-who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.post-who strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-who small { color: #69708A; font-size: 12px; }
.post-text {
  padding: 0 14px 12px; color: #26304A; white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.post-text.placeholder { color: #9AA1B6; }
.post-card[data-platform="Instagram"] .post-text { order: 3; padding-top: 12px; }
.post-card[data-platform="Instagram"] { display: flex; flex-direction: column; }
.post-card[data-platform="Instagram"] .post-top { order: 1; }
.post-card[data-platform="Instagram"] .post-media { order: 2; aspect-ratio: 1 / 1; }
.post-card[data-platform="Instagram"] .post-actions { order: 4; }

.post-media { aspect-ratio: 4 / 3; background: #EEF0F6; position: relative; overflow: hidden; }
.post-media img, .post-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-ai {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background:
    radial-gradient(circle at 20% 20%, var(--brand-a, rgba(62,224,240,.35)), transparent 55%),
    radial-gradient(circle at 80% 80%, var(--brand-b, rgba(255,122,107,.35)), transparent 55%),
    #F3F4F9;
  color: #3A4260; font-size: 12.5px; font-weight: 600;
}
.media-ai span { background: rgba(255,255,255,.85); padding: 6px 12px; border-radius: 999px; }
.media-ai-swatches { display: flex; gap: 6px; }
.media-ai-swatches i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.post-actions {
  display: flex; justify-content: space-around; padding: 10px 8px; border-top: 1px solid #ECEEF4;
  color: #69708A; font-size: 12.5px; font-weight: 600;
}

.working {
  position: absolute; inset: 14px; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  padding: 24px; background: rgba(7,10,22,.86); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
}
.working strong { font-family: var(--font-display); font-size: 18px; }
.working span { color: var(--muted); font-size: 13px; max-width: 26ch; }
.working-arc {
  width: 56px; height: 56px; border-radius: 50%; margin-bottom: 6px;
  background: conic-gradient(from 0deg, var(--cyan), var(--violet), var(--coral), transparent 75%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  animation: spin 1s linear infinite;
}
.phone[data-state="working"] .working { opacity: 1; visibility: visible; }
.phone[data-state="working"] .post-card { filter: blur(2px) saturate(.6); }

/* Result */
.result {
  background: var(--surface); border: 1px solid rgba(52,211,153,.35); border-radius: var(--r-lg);
  padding: 20px; display: flex; flex-direction: column; gap: 16px;
}
.result-top { display: flex; gap: 12px; align-items: center; }
.result-tick { width: 36px; height: 36px; border-radius: 50%; background: rgba(52,211,153,.15); color: var(--success); display: grid; place-items: center; }
.result-tick svg { width: 20px; height: 20px; stroke-width: 2.6; }
.result-top strong { display: block; font-family: var(--font-display); font-size: 18px; }
.result-top small { color: var(--muted); font-size: 13px; }
.result-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; margin: 0; }
.result-grid div { background: var(--bg-2); border-radius: var(--r-sm); padding: 10px 12px; min-width: 0; }
.result-grid dt { color: var(--faint); font-size: 12px; }
.result-grid dd { margin: 2px 0 0; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- Posts dashboard ---------------- */
.history { max-width: 1180px; margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); scroll-margin-top: 24px; }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.history-head h2 { font-size: 22px; font-weight: 700; }
.sync { display: flex; align-items: center; gap: 6px; }
.sync-text { color: var(--faint); font-size: 12.5px; }
.sync-text.error { color: var(--danger); }
.sync.loading .sync-text::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px;
  border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--cyan); animation: spin .8s linear infinite;
}

.tabs { display: flex; gap: 6px; margin-top: 18px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; margin-bottom: -1px; white-space: nowrap; flex: none;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--violet); }
.tab-count {
  min-width: 22px; padding: 1px 7px; border-radius: 99px; text-align: center;
  background: var(--surface-2); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums;
}
.tab[aria-selected="true"] .tab-count { background: var(--violet); color: #fff; }
.tab-issue .tab-count { background: rgba(255,107,122,.15); color: var(--danger); }

.history-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.post-row { border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.post-row summary {
  list-style: none; cursor: pointer;
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 12px 14px;
}
.post-row summary::-webkit-details-marker { display: none; }
.post-row summary:hover { background: rgba(255,255,255,.015); }
.post-row[open] { border-color: var(--line-2); }

.h-thumb {
  width: 48px; height: 48px; border-radius: 10px; overflow: hidden; flex: none;
  display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-weight: 700;
}
.h-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.h-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.h-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.h-title strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-snippet { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.h-platforms { display: flex; gap: 4px; }
.h-platforms i {
  width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center;
  font-style: normal; font-size: 10px; font-weight: 700; color: #fff;
}
.h-platforms .li { background: #0A66C2; }
.h-platforms .fb { background: #1877F2; }
.h-platforms .ig { background: linear-gradient(45deg, #F58529, #DD2A7B 50%, #8134AF); }
.h-time { color: var(--faint); font-size: 12px; white-space: nowrap; }

.status-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: rgba(251,191,36,.12); color: var(--warn);
}
.status-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-chip.s-approved { background: rgba(62,224,240,.12); color: var(--cyan); }
.status-chip.s-published { background: rgba(52,211,153,.12); color: var(--success); }
.status-chip.s-issue { background: rgba(255,107,122,.12); color: var(--danger); }

.post-detail { padding: 4px 14px 16px 76px; display: flex; flex-direction: column; gap: 12px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 12.5px; }
.detail-meta b { color: var(--text); font-weight: 600; }
.detail-error { color: #FFC2C9; background: rgba(255,107,122,.08); border: 1px solid rgba(255,107,122,.3); border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; }
.captions { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.caption { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; min-width: 0; }
.caption-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.caption-head strong { font-size: 12.5px; color: var(--muted); }
.caption p {
  font-size: 13px; color: #C9CFE4; white-space: pre-wrap; word-break: break-word;
  max-height: 180px; overflow: auto;
}
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.history-empty { margin-top: 14px; padding: 32px; border: 1.5px dashed var(--line-2); border-radius: var(--r-md); color: var(--muted); text-align: center; font-size: 14px; }
.history-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.history-note { color: var(--faint); font-size: 12.5px; }

.mono-id { font-size: 13px !important; letter-spacing: .01em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

.page-foot {
  max-width: 1180px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 12px; color: var(--faint); font-size: 12.5px;
}
.page-foot a { text-decoration: none; }
.page-foot a:hover { color: var(--text); }

/* ---------------- Toasts ---------------- */
/* bottom: 96px keeps toasts above the chat button */
.toast-wrap { position: fixed; right: 20px; bottom: 96px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--line-2);
  box-shadow: 0 16px 40px -12px rgba(0,0,0,.6);
  animation: toastIn .25s ease-out;
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex: none; }
.toast.error::before { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- Chat assistant (oks-chat-widget.js) ----------------
   The widget reads these variables, so it always matches the portal theme. */
#oks-chat-root {
  --oks-bg: var(--bg-2);
  --oks-surface: var(--surface);
  --oks-surface-2: var(--surface-2);
  --oks-line: var(--line);
  --oks-text: var(--text);
  --oks-muted: var(--muted);
  --oks-accent: var(--violet);
  --oks-arc: var(--arc);
  --oks-font: var(--font-body);
  --oks-display: var(--font-display);
  --oks-launch-bottom: 22px;
  --oks-launch-side: 22px;
}

/* ---------------- Inputs used by login/admin ---------------- */
input[type="email"], input[type="password"], input[type="number"], input[type="date"], select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 14.5px;
  color: inherit; font: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input[type="email"]:focus, input[type="password"]:focus, input[type="number"]:focus, input[type="date"]:focus, select:focus {
  outline: none; border-color: var(--violet); background: #0D1226; box-shadow: 0 0 0 4px rgba(123,92,255,.18);
}
input[type="date"] { color-scheme: dark; }
select { appearance: auto; }

/* ---------------- Login / signup ---------------- */
.auth-page { min-height: 100vh; background:
  radial-gradient(900px 500px at 85% -10%, rgba(123,92,255,.18), transparent 60%),
  radial-gradient(700px 420px at -10% 110%, rgba(62,224,240,.10), transparent 60%), var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 32px 16px; }
.auth-logo img { width: 132px; height: auto; display: block; }
.auth-card {
  width: 100%; max-width: 460px; padding: 26px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.7);
  display: flex; flex-direction: column; gap: 18px;
}
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; }
.auth-tabs button { border: 0; background: transparent; color: var(--muted); padding: 9px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; cursor: pointer; }
.auth-tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form h1 { font-size: 24px; }
.auth-sub { color: var(--muted); font-size: 14px; margin-top: -8px; }
.auth-form .btn-primary { width: 100%; margin-top: 4px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--cyan); font-size: 13px; font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn.center { align-self: center; }
.plan-note { padding: 10px 14px; border-radius: var(--r-sm); background: rgba(123,92,255,.12); border: 1px solid rgba(123,92,255,.35); font-size: 13.5px; font-weight: 600; }
.result-tick.big { width: 52px; height: 52px; }
.result-tick.big svg { width: 26px; height: 26px; }
.auth-foot { color: var(--faint); font-size: 12.5px; }
.auth-foot a { text-decoration: none; color: var(--muted); }

/* ---------------- Boot state (until login is checked) ---------------- */
body.booting .app { visibility: hidden; }

/* ---------------- Account box in the sidebar ---------------- */
.account { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.account-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account-avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--arc); color: #fff; }
.account-name { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.account-name strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-name small { color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-plan { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.plan-chip { padding: 2px 9px; border-radius: 999px; background: rgba(123,92,255,.16); color: #C4B5FF; font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.plan-chip.off { background: rgba(255,107,122,.12); color: var(--danger); }
.usage { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.usage span { display: block; height: 100%; width: 0; background: var(--arc); border-radius: inherit; transition: width .4s; }
.account-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------- Account banner + modal ---------------- */
.banner {
  max-width: 1180px; margin-bottom: 22px; padding: 14px 18px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.35); color: #FDE6A8; font-size: 14px; font-weight: 500;
}
.banner.danger { background: rgba(255,107,122,.08); border-color: rgba(255,107,122,.35); color: #FFC2C9; }
.banner .btn-secondary { flex: none; }
.modal-back { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(4,6,14,.72); backdrop-filter: blur(6px); }
.modal { width: 100%; max-width: 420px; padding: 26px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 12px; text-align: center; }
.modal h2 { font-size: 22px; }
.modal p { color: var(--muted); font-size: 14.5px; }
.modal .btn-primary { margin-top: 8px; text-decoration: none; }

/* ---------------- Post actions + statuses ---------------- */
.status-chip.s-generating { background: rgba(123,92,255,.14); color: #C4B5FF; }
.status-chip.s-generating::before { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.btn-approve { background: var(--success); color: #06281C; border: 0; }
.btn-approve:hover { filter: brightness(1.08); }
.btn-reject { color: var(--danger); }
.seo-block { font-size: 12.5px; color: var(--muted); white-space: pre-wrap; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; }
.platform-note { margin-top: 12px; font-size: 13px; color: var(--warn); }
.mobile-only { display: none !important; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; }
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto;
    flex-direction: row; align-items: center; gap: 12px;
    padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line);
    background: rgba(11,15,32,.92); backdrop-filter: blur(10px);
  }
  .logo { padding: 0; }
  /* Logo size on tablet/mobile top bar */
  .logo-img { width: 72px; }
  .nav { flex-direction: row; margin-left: auto; }
  .nav-link { padding: 8px 12px; white-space: nowrap; }
  .nav-link.active { box-shadow: none; }
  .sidebar-foot { display: none; }
  .main { padding-top: 28px; }
  .workspace { grid-template-columns: 1fr; }
  .preview { position: static; }
  .phone { max-width: 420px; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .main { padding: 22px 14px 24px; }
  .nav-link svg { display: none; }
  .nav-link { font-size: 13px; padding: 8px 10px; }
  .step-block { padding: 20px 16px; border-radius: 16px; }
  .grid.two, .choice-grid { grid-template-columns: 1fr; }
  .platform-grid { grid-template-columns: 1fr; }
  .submit-bar {
    position: sticky; bottom: 10px; z-index: 10;
    flex-direction: column; align-items: stretch; gap: 10px; padding: 10px;
    background: rgba(16,21,42,.95); backdrop-filter: blur(10px);
  }
  .submit-note { display: none; }
  .btn-primary { width: 100%; }
  .post-row summary { grid-template-columns: 40px minmax(0, 1fr); }
  .h-thumb { width: 40px; height: 40px; }
  .h-side { grid-column: 2; flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px; }
  .post-detail { padding-left: 14px; }
  .tab { padding: 10px 10px; font-size: 13px; }
  .history-head .sync-text { display: none; }
  .page-foot { flex-direction: column; }
  .toast-wrap { left: 14px; right: 14px; bottom: 150px; }
  /* Keep the chat button above the sticky "Create post" bar */
  #oks-chat-root { --oks-launch-bottom: 92px; --oks-launch-side: 14px; }
  .nav-help { display: none; }
}

@media (max-width: 980px) {
  .mobile-only { display: inline-flex !important; }
  .banner { margin-bottom: 16px; }
}

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