/* OSV Admin — design tokens live in admin/DESIGN.md. Soft-card productivity,
   Linear density, icon rail. Terracotta = meters only; blue = verified only. */
:root {
  --canvas: #F4F4F5;
  --surface: #FFFFFF;
  --surface-2: #FAFAFA;
  --border: #E4E4E7;
  --ink: #18181B;
  --ink-2: #3F3F46;
  --muted: #71717A;
  --muted-2: #A1A1AA;
  --terracotta: #E07A5F;
  --terracotta-soft: #FBEDE8;
  --blue: #3B82F6;
  --green: #16A34A;
  --amber: #D97706;
  --red: #DC2626;
  --radius-card: 12px;
  --radius-hero: 16px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.06);
  --rail: 56px;
  --font: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--font);
  font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow: auto; margin: 8px 0 0; white-space: pre-wrap; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.link { color: var(--ink); font-weight: 500; text-decoration: none; }
.link:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- shell */
.shell {
  display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh;
}
.rail {
  position: sticky; top: 0; height: 100vh; padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--canvas); border-right: 1px solid var(--border);
}
.rail-spacer { flex: 1; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--ink); color: #fff; display: grid; place-items: center;
  margin-bottom: 14px; text-decoration: none; flex-shrink: 0;
}
.rail-item {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted);
  border: 1px solid transparent; background: transparent; cursor: pointer; text-decoration: none; padding: 0;
}
.rail-item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rail-item:hover { color: var(--ink); background: rgb(0 0 0 / 0.04); }
.rail-item.active { color: var(--ink); background: var(--surface); border-color: var(--border); box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); }

.pane { min-width: 0; display: flex; flex-direction: column; }
.pane-header {
  display: flex; align-items: center; gap: 12px; padding: 22px 28px 18px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.pane-header h1 { font-size: 22px; font-weight: 500; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--muted-2); }
#page-meta { font-size: 20px; font-weight: 400; }
.toolbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.toolbar:empty { display: none; }
.toolbar .sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.content { padding: 22px 28px 40px; flex: 1; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: #27272A; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-danger { color: var(--red); }
.btn-block { width: 100%; justify-content: center; height: 42px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid transparent;
  background: transparent; color: var(--ink-2); cursor: pointer; font-weight: 500;
}
.chip svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chip .count { color: var(--muted); font-weight: 400; }
.chip:hover { background: var(--canvas); }
.chip.active { background: var(--canvas); border-color: var(--border); color: var(--ink); }

/* ---------------------------------------------------------------- inputs */
.input, textarea.input, select.input {
  height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); min-width: 0;
}
.input:focus, textarea.input:focus, select.input:focus { outline: 2px solid rgb(24 24 27 / 0.15); outline-offset: 0; border-color: var(--ink-2); }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 2; }
.search .input { padding-left: 34px; width: 280px; }
label { font-size: 13px; color: var(--ink-2); font-weight: 500; display: block; margin-bottom: 6px; }
.field { display: flex; flex-direction: column; margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error { color: var(--red); font-size: 13px; margin: 10px 0 0; }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow);
}
.card-pad { padding: 18px 20px; }
.card-hero { border-radius: var(--radius-hero); overflow: hidden; }
.stack { display: grid; gap: 16px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }

.hero { display: grid; grid-template-columns: 1fr; position: relative; min-height: 132px; }
.hero-art {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 100% 0%, #CFE5F7 0%, transparent 55%),
    radial-gradient(80% 80% at 0% 100%, #DCEBD2 0%, transparent 60%),
    linear-gradient(180deg, #EAF3FB 0%, #F7F4EC 100%);
}
.hero-art[data-season="fall"] { background: radial-gradient(120% 90% at 100% 0%, #F6D9C4 0%, transparent 55%), radial-gradient(80% 80% at 0% 100%, #EBD7A8 0%, transparent 60%), linear-gradient(180deg, #FBF1E6 0%, #F7F4EC 100%); }
.hero-art[data-season="winter"] { background: radial-gradient(120% 90% at 100% 0%, #D6E4F5 0%, transparent 55%), radial-gradient(80% 80% at 0% 100%, #E7ECF3 0%, transparent 60%), linear-gradient(180deg, #F0F5FB 0%, #F4F4F5 100%); }
.hero-art[data-season="spring"] { background: radial-gradient(120% 90% at 100% 0%, #F9DDE6 0%, transparent 55%), radial-gradient(80% 80% at 0% 100%, #D9EED0 0%, transparent 60%), linear-gradient(180deg, #F6FBF3 0%, #F7F4EC 100%); }
.hero-art[data-season="summer"] { background: radial-gradient(120% 90% at 100% 0%, #C9E7F5 0%, transparent 55%), radial-gradient(80% 80% at 0% 100%, #FBEBC2 0%, transparent 60%), linear-gradient(180deg, #EEF8FC 0%, #F7F4EC 100%); }
.hero-text { position: relative; padding: 30px 28px; }
.hero-text h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; font-size: 22px; letter-spacing: 0; }
.hero-text p { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; }

/* ---------------------------------------------------------------- meters */
.meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 980px) { .meters { grid-template-columns: 1fr; } }
.meter { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 16px 18px; }
.meter-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--terracotta-soft); color: var(--terracotta); display: grid; place-items: center; }
.meter-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.meter-title { font-weight: 600; font-size: 15px; display: flex; justify-content: space-between; gap: 8px; }
.meter-title .val { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 500; }
.meter-sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.meter-bar { margin-top: 10px; height: 26px; border-radius: 4px; position: relative; overflow: hidden;
  background: repeating-linear-gradient(90deg, #E9E9EB 0 6px, transparent 6px 9px); }
.meter-bar > i { position: absolute; inset: 0 auto 0 0; width: 0;
  background: repeating-linear-gradient(90deg, var(--terracotta) 0 6px, transparent 6px 9px); transition: width .5s ease; }

/* ---------------------------------------------------------------- lists */
.list-card { overflow: hidden; }
.list-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border);
  color: var(--muted); font-weight: 500;
}
.list-head .filter-ic { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; }
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--border); align-items: start;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, #A1A1AA, #71717A);
}
.avatar.a0 { background: linear-gradient(135deg, #93C5FD, #3B82F6); }
.avatar.a1 { background: linear-gradient(135deg, #C4B5FD, #8B5CF6); }
.avatar.a2 { background: linear-gradient(135deg, #FDBA74, #F97316); }
.avatar.a3 { background: linear-gradient(135deg, #86EFAC, #22C55E); }
.avatar.a4 { background: linear-gradient(135deg, #F9A8D4, #EC4899); }
.row-main { min-width: 0; }
.row-title { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15.5px; }
.row-title .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--ink-2); font-size: 14px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub.muted { color: var(--muted); }
.row-side { color: var(--ink-2); font-size: 13.5px; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.verified { width: 18px; height: 18px; flex-shrink: 0; }
.verified path.badge { fill: var(--blue); }
.verified path.check { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }

.status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-2); }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); }
.status.confirmed::before, .status.sent::before { background: var(--green); }
.status.pending::before, .status.test_sent::before, .status.scheduled::before { background: var(--amber); }
.status.unsubscribed::before, .status.failed::before { background: var(--red); }
.status.skipped::before { background: var(--muted-2); }
.status.draft::before { background: var(--muted-2); }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-2); }
.pill-dev { color: var(--amber); border-color: #FDE68A; background: #FFFBEB; }
.pill-blue { color: var(--blue); border-color: #BFDBFE; background: #EFF6FF; }

.row-actions { display: flex; gap: 6px; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; padding: 0; }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { color: var(--ink); background: var(--canvas); border-color: var(--border); }
.icon-btn.danger:hover { color: var(--red); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- status card */
.status-card { padding: 16px 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kv .v { font-weight: 500; display: flex; align-items: center; gap: 6px; }
.ok-dot, .warn-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ok-dot { background: var(--green); }
.warn-dot { background: var(--amber); }

/* ---------------------------------------------------------------- compose */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 1100px) { .compose { grid-template-columns: 1fr; } }
.compose textarea { min-height: 460px; font-family: var(--mono); font-size: 12.5px; }
.preview-frame { width: 100%; height: 560px; border: 0; background: #fff; border-radius: 0 0 var(--radius-card) var(--radius-card); }
.inline-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-actions .input { width: 260px; }

/* ---------------------------------------------------------------- assets */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.asset { overflow: hidden; }
.asset .thumb { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); border-bottom: 1px solid var(--border); overflow: hidden; }
.asset .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset .meta { padding: 10px 12px; font-size: 12.5px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.asset .meta .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { border: 1.5px dashed var(--border); border-radius: var(--radius-card); padding: 26px; text-align: center; color: var(--muted); background: var(--surface); }
.dropzone.drag { border-color: var(--ink-2); background: var(--surface-2); }

/* ---------------------------------------------------------------- notices */
.notice { border-radius: var(--radius-card); padding: 14px 16px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13.5px; }
.notice p { margin: 6px 0 0; }
.notice-warn { border-color: #FDE68A; background: #FFFBEB; }
.notice-ok { border-color: #BBF7D0; background: #F0FDF4; }
.notice-err { border-color: #FECACA; background: #FEF2F2; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 13.5px; box-shadow: var(--shadow); z-index: 50; max-width: 90vw;
}
.toast.err { background: var(--red); }

/* ---------------------------------------------------------------- login */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-hero); box-shadow: var(--shadow); padding: 32px; text-align: center; }
.login-card .brand-mark { margin: 0 auto 16px; }
.login-card h1 { font-size: 22px; }
.login-form { text-align: left; margin-top: 22px; }
.login-form input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; }
.login-form input:focus { outline: 2px solid rgb(24 24 27 / 0.15); border-color: var(--ink-2); }
.login-card .notice { text-align: left; margin-top: 20px; }
.footnote { margin-top: 22px; }

/* ---------------------------------------------------------------- table */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.table tr:last-child td { border-bottom: 0; }
.mono { font-family: var(--mono); font-size: 12.5px; }
