/* Marketing app. Same palette as shinhanatech.com: ivory, ink and gold; a dark version follows the system setting. */
:root {
  --bg: #f6f2ea;
  --surface: #fcfaf6;
  --sunken: #efe9de;
  --ink: #141414;
  --soft: #5d5850;
  --line: rgba(20, 20, 20, 0.12);
  --accent: #94702f;
  --accent-ink: #fcfaf6;
  --accent-soft: rgba(201, 164, 92, 0.18);
  --ok: #2f7d4f;
  --ok-soft: rgba(47, 125, 79, 0.12);
  --warn: #9a5b12;
  --warn-soft: rgba(166, 97, 26, 0.12);
  --bad: #b3261e;
  --bad-soft: rgba(179, 38, 30, 0.1);
  --tiktok: #111;
  --facebook: #1b5fd1;
  --youtube: #d1221b;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Manrope', system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, Menlo, monospace;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1c1b19;
    --sunken: #171615;
    --ink: #f3eee4;
    --soft: rgba(243, 238, 228, 0.64);
    --line: rgba(232, 211, 160, 0.16);
    --accent: #e0c27e;
    --accent-ink: #141414;
    --accent-soft: rgba(224, 194, 126, 0.14);
    --ok: #6cc08b;
    --ok-soft: rgba(108, 192, 139, 0.14);
    --warn: #e3a857;
    --warn-soft: rgba(227, 168, 87, 0.14);
    --bad: #f08a80;
    --bad-soft: rgba(240, 138, 128, 0.14);
    --tiktok: #f3eee4;
    --facebook: #6ea2ff;
    --youtube: #ff6b63;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 var(--sans);
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- sidebar ---------- */
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 24px;
  padding: 22px 14px; border-right: 1px solid var(--line); background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; padding: 0 8px; }
.brand small { display: block; color: var(--soft); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.logo {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: #121212; color: #e0c27e; font: 600 20px var(--serif);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  color: var(--soft); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 600;
}
.nav a:hover { color: var(--ink); background: var(--sunken); }
.nav a[aria-current='page'] { color: var(--ink); background: var(--accent-soft); }
.side-foot { margin-top: auto; display: grid; gap: 14px; }
.stop { justify-self: start; margin-left: 8px; }
.switch-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; padding: 14px 0; border-top: 1px solid var(--line); }
.switch-row:first-of-type { border-top: 0; padding-top: 0; }
.switch-row p { margin: 2px 0 0; }
.stopped { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; text-align: center; grid-column: 1 / -1; }
.stopped .card { max-width: 480px; }
.conn { display: grid; gap: 6px; padding: 0 8px; font-size: 13px; color: var(--soft); }
.conn span { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--bad); }

/* ---------- main ---------- */
.view { padding: 28px clamp(16px, 3vw, 48px) 80px; width: 100%; min-width: 0; outline: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.eyebrow { color: var(--soft); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; margin: 0 0 4px; }
.title { font: 600 clamp(30px, 4vw, 40px)/1.1 var(--serif); }
.hook { color: var(--soft); margin: 8px 0 0; font-style: italic; max-width: 70ch; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.muted { color: var(--soft); }
.small { font-size: 13px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.chip.product { background: var(--accent-soft); border-color: transparent; }
.chip .pdot { width: 7px; height: 7px; border-radius: 50%; }
.p-tiktok { background: var(--tiktok); }
.p-facebook { background: var(--facebook); }
.p-youtube { background: var(--youtube); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
.badge.auto { background: var(--ok-soft); color: var(--ok); }
.badge.manual { background: var(--warn-soft); color: var(--warn); }
.badge.skip { background: var(--sunken); color: var(--soft); }
.badge.posted { background: var(--accent-soft); color: var(--accent); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

.steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.steps li { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--soft);
  padding: 4px 10px; border-radius: 999px; background: var(--sunken); }
.steps li.done { color: var(--ok); background: var(--ok-soft); }

.grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.num { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px;
  background: var(--ink); color: var(--surface); flex: none; }
.empty { text-align: center; padding: 22px 8px; color: var(--soft); }
.empty p { margin: 0 0 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px;
  padding: 7px 16px; border-radius: 999px; border: 1px solid var(--ink); background: var(--ink); color: var(--bg);
  font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.gold { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { min-height: 28px; padding: 3px 11px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad-soft); }
.btn:disabled { opacity: 0.5; cursor: progress; }
.icon-btn { border: 1px solid var(--line); background: var(--surface); width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; display: inline-grid; place-items: center; text-decoration: none; color: var(--ink); }
.icon-btn[aria-disabled='true'] { opacity: 0.35; pointer-events: none; }

label.field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--soft); }
input[type='text'], input[type='password'], input[type='number'], input[type='date'], input[type='datetime-local'], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); padding: 8px 10px; font-weight: 400;
  color: var(--ink);
}
textarea { resize: vertical; line-height: 1.55; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }

/* ---------- markdown ---------- */
.md { overflow-wrap: anywhere; }
.md h1 { font: 600 24px/1.2 var(--serif); margin: 4px 0 10px; }
.md h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin: 22px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.md h3 { font-size: 15px; margin: 16px 0 6px; }
.md h4 { font-size: 14px; margin: 12px 0 4px; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li.task { list-style: none; margin-left: -22px; }
.md em { color: var(--soft); }
.md code { font: 13px var(--mono); background: var(--sunken); padding: 1px 5px; border-radius: 5px; }
.md blockquote { margin: 0 0 10px; padding: 4px 14px; border-left: 3px solid var(--accent); color: var(--soft); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.md .table { overflow-x: auto; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 10px; }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md th, .md td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.md th { background: var(--sunken); font-size: 13px; white-space: nowrap; }
.md > h2:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.md tr:last-child td { border-bottom: 0; }
.content-body { max-height: 70vh; overflow-y: auto; padding-right: 6px; }

/* ---------- media ---------- */
.drop {
  display: block;
  border: 1.5px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; color: var(--soft);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.drop strong { color: var(--ink); }
.media-list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.media-item { display: grid; gap: 6px; justify-items: start; }
.media-item video, .media-item img { width: 150px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 10px; background: #000; }
.media-item img { aspect-ratio: auto; max-height: 220px; }
.progress { height: 6px; border-radius: 6px; background: var(--sunken); overflow: hidden; margin-top: 10px; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

/* ---------- post text ---------- */
.ptext { display: grid; gap: 8px; padding: 14px 0; border-top: 1px solid var(--line); }
.ptext:first-of-type { border-top: 0; padding-top: 0; }
.ptext-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.count { font-size: 12px; color: var(--soft); font-variant-numeric: tabular-nums; }

/* ---------- publish ---------- */
.options { display: grid; gap: 12px; margin-bottom: 14px; }
.plan-item { display: grid; gap: 4px; padding: 10px 0; border-top: 1px solid var(--line); }
.plan-item:first-child { border-top: 0; }
.plan-item pre { margin: 4px 0 0; white-space: pre-wrap; font: 13px/1.5 var(--sans); color: var(--soft); max-height: 120px; overflow: auto;
  background: var(--sunken); border-radius: 8px; padding: 8px 10px; }
.result { padding: 10px 12px; border-radius: 10px; margin-top: 8px; font-size: 14px; }
.result.ok { background: var(--ok-soft); }
.result.bad { background: var(--bad-soft); }

/* ---------- calendar ---------- */
.week { margin-bottom: 22px; }
.week h2 { font-size: 15px; margin-bottom: 4px; }
.week p { margin: 0 0 10px; color: var(--soft); font-size: 14px; }
.days { display: grid; gap: 8px; }
.day-row {
  display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 4px 14px; align-items: center;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--ink); text-decoration: none;
}
.day-row:hover { border-color: var(--accent); }
.day-row.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.day-row.past { opacity: 0.72; }
.day-num { font-weight: 700; }
.day-num small { display: block; color: var(--soft); font-weight: 500; font-size: 12px; }
.day-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.marks { display: flex; gap: 4px; }
.mark { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--sunken); color: var(--soft); }
.mark.on { background: var(--ok-soft); color: var(--ok); }

/* ---------- results ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.form-grid .wide { grid-column: 1 / -1; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; background: var(--surface); }
table.data th, table.data td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.data td.num-cell, table.data th.num-cell { text-align: right; font-variant-numeric: tabular-nums; }
table.data th { background: var(--sunken); font-size: 13px; }
table.data td.note { white-space: normal; min-width: 200px; color: var(--soft); }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--soft); font-size: 13px; }

/* ---------- setup ---------- */
.connections { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 18px; }
.connections .card h2 { font-size: 16px; display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.connections p { margin: 4px 0; }
pre.cmd { background: var(--sunken); border-radius: 10px; padding: 10px 12px; overflow-x: auto; font: 13px var(--mono); margin: 6px 0 12px; }

/* ---------- management ---------- */
/* Section names (Management, Marketing) in the accent, their pages indented under a thin rule. */
.nav-group { margin: 18px 12px 6px; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.nav-group:first-child { margin-top: 0; }
.nav-group ~ a { margin-left: 12px; padding-left: 12px; border-left: 2px solid var(--line); border-radius: 0 8px 8px 0; }
.nav-group ~ a[aria-current='page'] { border-left-color: var(--accent); }
.notice { margin-bottom: 14px; }
.bad-notice { border-color: var(--bad); background: var(--bad-soft); }
.bad-text { color: var(--bad); }
.status { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status.ok { color: var(--ok); background: var(--ok-soft); }
.status.bad { color: var(--bad); background: var(--bad-soft); }
.delta { margin-left: 6px; font-size: 12px; font-weight: 700; color: var(--soft); }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.stat small { display: block; margin-top: 4px; color: var(--soft); font-size: 12px; }
.stat .small-b { font-size: 20px; }
.mgmt-group { margin-top: 26px; }
.mgmt-group > h2 { font: 600 24px var(--serif); margin: 0 0 10px; }
.prop-list { display: grid; gap: 8px; }
.prop-row { display: grid; grid-template-columns: minmax(180px, 1.3fr) minmax(150px, 1fr) minmax(170px, 1.2fr) 130px minmax(170px, 1.2fr);
  align-items: center; gap: 10px 18px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: inherit; text-decoration: none; }
.prop-row:hover { border-color: var(--accent); }
.prop-row > span { display: grid; gap: 4px; min-width: 0; justify-items: start; }
.prop-name .small, .prop-code .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.metric b { font-size: 18px; }
.spark { display: block; }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.mgmt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-top: 16px; }
.range { margin: 8px 0 14px; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.bar-track { grid-column: 1 / -1; height: 8px; }
.bar { display: block; height: 8px; border-radius: 0 4px 4px 0; background: var(--accent); }
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--soft); font-size: 12px; font-family: var(--sans); }
.chart .tick.strong { fill: var(--ink); font-weight: 700; }
.chart .cross { stroke: var(--soft); stroke-width: 1; }
.tip { position: absolute; transform: translate(-50%, -100%); pointer-events: none; background: var(--ink); color: var(--bg);
  padding: 6px 10px; border-radius: 8px; font-size: 13px; white-space: nowrap; }
.table-view { margin-top: 10px; }
.table-view summary { cursor: pointer; color: var(--soft); font-size: 13px; }
.howto { padding-left: 20px; margin: 0; display: grid; gap: 6px; }
@media (max-width: 1100px) {
  .prop-row { grid-template-columns: minmax(0, 1fr) auto; }
  .prop-metrics, .prop-code { grid-column: 1; }
  .prop-spark { grid-column: 2; grid-row: 1 / span 2; }
  .prop-status { grid-column: 2; }
}

/* ---------- per-platform publish settings ---------- */
.platform-settings { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.platform-settings .field { margin-top: 10px; }
.platform-settings select { max-width: 320px; }
.tt-account { display: inline-flex; align-items: center; gap: 8px; }
.tt-account img { border-radius: 50%; }
.disclose { margin: 6px 0 0 26px; display: grid; gap: 4px; }
.consent { margin: 10px 0 0; color: var(--soft); }
.consent a { color: inherit; text-decoration: underline; }

/* ---------- copy buttons on the video scripts ---------- */
.md h2.has-copy { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.md h2.has-copy .btn { text-transform: none; letter-spacing: normal; font-family: inherit; }
.md h2.has-copy .btn:first-of-type { margin-left: auto; }

/* ---------- idea and dialog ---------- */
.idea { margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); }
.modal { width: min(560px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  background: var(--surface); color: var(--ink); }
.modal::backdrop { background: rgba(0, 0, 0, 0.45); }
.modal h2 { font: 600 26px var(--serif); margin-bottom: 6px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 10; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 12px; font-size: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2); }
.toast.bad { background: var(--bad); color: #fff; }

.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* ---------- small screens ---------- */
@media (max-width: 980px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  body { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 10px 16px;
    border-right: 0; border-bottom: 1px solid var(--line); }
  .brand > span:last-child, .side-foot { display: none; }
  .nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .nav a { padding: 6px 10px; white-space: nowrap; }
  .nav-group { display: none; }
  .nav-group ~ a { margin-left: 0; padding-left: 10px; border-left: 0; border-radius: 10px; }
  .view { padding: 20px 16px 64px; }
  .day-row { grid-template-columns: 56px minmax(0, 1fr); }
  .marks { grid-column: 2; }
  .content-body { max-height: none; }
}

/* Phone pairing */
.login { width: min(380px, 100%); display: grid; gap: 10px; text-align: left; }
.login .logo { margin: 0 auto 4px; }
.login .title { text-align: center; margin: 0 0 8px; }
.login label { font-size: 13px; font-weight: 600; color: var(--soft); }
.login .bad-text { min-height: 1em; margin: 0; }

/* Leads */
.lead-list { display: grid; gap: 0; }
.lead { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 4px; min-width: 0; }
.lead:first-child { border-top: 0; padding-top: 4px; }
.lead-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; }
.lead-msg { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
#stats-card h3 { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; font-size: 15px; }
#stats-card h3:first-of-type { margin-top: 4px; }
/* The title takes the room the number columns leave. */
table.data td.title-cell { white-space: normal; min-width: 180px; width: 100%; overflow-wrap: anywhere; }

/* Tabs inside a page (Social: Facebook | YouTube) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--soft); font-weight: 700; text-decoration: none; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--accent); }
.social-body { display: grid; gap: 16px; min-width: 0; }
.social-body > .totals { margin-bottom: 0; }
/* Nothing of the dashboard shows until the server says this browser is signed in (app.js). */
body.locked .side, body.locked .view { visibility: hidden; }
