/* Campaign OS — design tokens adapted from the original product mockup ("Ink" theme). */
:root {
  --bg: #F1EDE2;
  --surface: #FFFFFF;
  --surface-2: #F8F5EC;
  --surface-3: #EDE8DA;
  --ink: #14161A;
  --ink-2: #2E2F32;
  --muted: #6E6B61;
  --muted-2: #9A968A;
  --hairline: #E1DCCB;
  --hairline-strong: #C9C3AF;
  --accent: #9D2235;
  --accent-ink: #FFFFFF;
  --accent-soft: #F5E4E6;
  --good: #2E6B3C; --good-soft: #DDEBE0;
  --warn: #B8761E; --warn-soft: #F5E7CC;
  --bad: #9D2235;  --bad-soft: #F5E0E2;
  --info: #1F4E78; --info-soft: #DCE7F0;
  --radius: 8px; --radius-lg: 12px;
  --sidebar-w: 240px; --topbar-h: 56px;
  --shadow-1: 0 1px 0 rgba(20,22,26,.04), 0 1px 2px rgba(20,22,26,.04);
  --shadow-2: 0 2px 4px rgba(20,22,26,.05), 0 8px 24px rgba(20,22,26,.08);
  --font-sans: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 var(--font-sans); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-serif); letter-spacing: -0.01em; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }

/* ---- App shell (internal + admin) ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--hairline); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--hairline); }
.sidebar-brand .mark { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--font-serif); font-weight: 700; }
.sidebar-brand .name { font-weight: 600; font-size: 13px; line-height: 1.25; }
.sidebar-brand .name small { display:block; color: var(--muted); font-weight: 400; font-size: 11px; }
.nav-group { padding: 10px 10px 2px; }
.nav-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); padding: 6px 10px; font-weight: 600; }
.nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: var(--radius); color: var(--ink-2); font-size: 13px; margin-bottom: 1px; }
.nav-item:hover { background: var(--surface-2); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-badge { background: var(--surface-3); color: var(--muted); font-size: 10.5px; padding: 1px 6px; border-radius: 20px; }
.nav-item.active .nav-badge { background: var(--accent); color: #fff; }
.sidebar-footer { margin-top: auto; padding: 12px; border-top: 1px solid var(--hairline); font-size: 12px; color: var(--muted); }

.topbar { height: var(--topbar-h); border-bottom: 1px solid var(--hairline); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; background: var(--surface); position: sticky; top:0; z-index:5; }
.topbar .crumbs { font-size: 13px; color: var(--muted); }
.topbar .crumbs b { color: var(--ink); }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display:flex; align-items:center; justify-content:center; font-size:11.5px; font-weight:700; color:#fff; }

.main { flex: 1; min-width: 0; }
.content { padding: 24px 28px 60px; max-width: 1280px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header h1 { font-size: 22px; }
.page-header .desc { color: var(--muted); font-size: 13px; max-width: 640px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Components ---- */
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-lg); padding: 16px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.kpi .value { font-size: 26px; font-weight: 700; font-family: var(--font-serif); }
.kpi .label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.btn { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius); border: 1px solid var(--hairline-strong); background: var(--surface); color: var(--ink); padding: 7px 13px; font-size: 13px; cursor: pointer; font-family: inherit; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #7e1c2b; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-danger { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--hairline); }
.table td { padding: 10px 10px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.table tr:hover td { background: var(--surface-2); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--surface-3); color: var(--muted); }

.pill { display:inline-flex; align-items:center; gap:6px; padding:3px 10px 3px 6px; border-radius:20px; font-size:12px; font-weight:600; color:#fff; }
.pill .dot { width:7px;height:7px;border-radius:50%; background:currentColor; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.form-row .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=url], textarea, select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--hairline-strong); border-radius: var(--radius); font: inherit; background: var(--surface); color: var(--ink);
}
textarea { resize: vertical; min-height: 90px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
fieldset { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 10px 12px; }

.flash { position: fixed; top: 16px; right: 16px; z-index: 100; display:flex; flex-direction:column; gap:8px; }
.flash-item { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius); font-size: 13px; box-shadow: var(--shadow-2); }
.flash-item.error { background: var(--bad); }
.flash-item.success { background: var(--good); }
.flash-item.warn { background: var(--warn); }

.tabs { display:flex; gap:4px; border-bottom:1px solid var(--hairline); margin-bottom:16px; }
.tabs a { padding:8px 12px; font-size:13px; color:var(--muted); border-bottom:2px solid transparent; }
.tabs a.active { color: var(--ink); font-weight:600; border-color: var(--accent); }

.empty { text-align:center; padding: 40px 20px; color: var(--muted); }

/* ---- Mobile app shell (sidebar becomes an off-canvas drawer) ---- */
.sidebar-toggle { display: none; }
.sidebar-overlay { display: none; }
@media (max-width: 860px) {
  .sidebar-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--radius); border: 1px solid var(--hairline-strong);
    background: var(--surface); color: var(--ink); cursor: pointer; margin-right: 10px; flex-shrink: 0; font-size: 16px; line-height: 1;
  }
  .topbar { padding: 0 14px; }
  .topbar .crumbs { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 30;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-2);
  }
  .shell.sidebar-open .sidebar { transform: translateX(0); }
  .shell.sidebar-open .sidebar-overlay {
    display: block; position: fixed; inset: 0; background: rgba(20,22,26,.4); z-index: 25;
  }

  .content { padding: 16px 14px 40px; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-actions .btn { flex: 1; justify-content: center; }

  /* Let wide tables scroll horizontally inside their card instead of squeezing columns unreadably. */
  .card { overflow-x: auto; }
  table.table { min-width: 620px; }
}
@media (max-width: 420px) {
  .login-card { width: 90vw; padding: 24px; }
}

/* ---- Public site ---- */
.public-header { background: var(--surface); border-bottom: 1px solid var(--hairline); position:sticky; top:0; z-index:10; }
.public-nav { max-width: 1080px; margin: 0 auto; display:flex; align-items:center; justify-content:space-between; padding: 14px 24px; }
.public-nav .links { display:flex; gap:18px; font-size:13.5px; }
.public-hero { max-width: 1080px; margin: 0 auto; padding: 60px 24px; }
.public-section { max-width: 1080px; margin: 0 auto; padding: 40px 24px; }
.public-footer { border-top: 1px solid var(--hairline); padding: 30px 24px; margin-top: 40px; text-align:center; color: var(--muted); font-size:12.5px; }
.topic-card { display:block; border:1px solid var(--hairline); border-radius: var(--radius-lg); padding:18px; background: var(--surface); }
.topic-card .swatch { width:10px; height:10px; border-radius:50%; display:inline-block; margin-right:6px; }

.login-wrap { min-height: 100vh; display:flex; align-items:center; justify-content:center; background: var(--bg); }
.login-card { width: 380px; background: var(--surface); border:1px solid var(--hairline); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-2); }

/* Split-screen product landing + login */
.login-split { min-height: 100vh; display: flex; }
.login-marketing { flex: 1.2; background: var(--ink); color: var(--surface); padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; }
.login-marketing h1 { color: #fff; font-size: 30px; max-width: 480px; }
.login-marketing p.lead { color: #cfcac0; font-size: 14.5px; max-width: 440px; line-height: 1.6; }
.login-feature { display: flex; gap: 12px; margin-top: 18px; align-items: flex-start; }
.login-feature .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.login-feature b { font-size: 13.5px; color: #fff; }
.login-feature span { font-size: 12.5px; color: #b8b3a8; }
.login-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--bg); }
.sso-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 9px 14px; border-radius: var(--radius); border: 1px solid var(--hairline-strong); background: var(--surface); color: var(--ink); font-size: 13.5px; font-weight: 500; cursor: pointer; text-decoration: none; }
.sso-btn:hover { background: var(--surface-2); text-decoration: none; }
.divider-row { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted-2); font-size: 11.5px; }
.divider-row::before, .divider-row::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
@media (max-width: 860px) { .login-split { flex-direction: column; } .login-marketing { padding: 36px 24px; } }
