/* Advertise CNY Ad Server — design system extracted from the DC prototype */
:root {
  --bg: #f5f6f8;
  --ink: #15181d;
  --ink-2: #344054;
  --ink-3: #475467;
  --muted: #8a929e;
  --muted-2: #98a2b3;
  --line: #e6e8ec;
  --line-2: #f1f3f5;
  --blue: #2563eb;
  --blue-d: #1d4ed8;
  --card-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
.mono { font-family: 'IBM Plex Mono', monospace; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d4d8df; border-radius: 8px; border: 2px solid var(--bg); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; width: 100%; background: var(--bg); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.screen { flex: 1; padding: 32px; max-width: 1320px; width: 100%; }
.stack { display: flex; flex-direction: column; gap: 22px; }
.stack-sm { display: flex; flex-direction: column; gap: 18px; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 248px; flex: none; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 22px 22px 18px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid var(--line-2); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--blue); display: flex; align-items: center; justify-content: center; flex: none; }
.brand-mark > span { width: 13px; height: 13px; border: 2.5px solid #fff; border-radius: 3px; }
.brand-name { font: 700 15px 'IBM Plex Sans'; letter-spacing: -.01em; }
.brand-sub { font: 500 10.5px 'IBM Plex Mono'; color: var(--muted-2); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-section { font: 600 10.5px 'IBM Plex Mono'; color: #aeb6c2; text-transform: uppercase; letter-spacing: .08em; padding: 6px 12px 8px; }
.nav-section + .nav-section, .nav-item + .nav-section { padding-top: 16px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; cursor: pointer;
  font: 500 13.5px 'IBM Plex Sans'; border-left: 3px solid transparent; color: #5b6471;
}
.nav-item:hover { background: #f3f5f8; }
.nav-item.active { border-left-color: var(--blue); background: #eef3ff; color: var(--blue-d); }
.user-card { padding: 14px; border-top: 1px solid var(--line-2); }
.user-card-inner { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; background: #f7f8fa; }
.avatar { border-radius: 8px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; flex: none; }

/* ---------- Topbar ---------- */
.topbar {
  height: 66px; flex: none; background: rgba(255, 255, 255, .88); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; position: sticky; top: 0; z-index: 20;
}
.page-title { font: 600 19px 'IBM Plex Sans'; letter-spacing: -.01em; }
.page-sub { font: 500 12px 'IBM Plex Sans'; color: var(--muted); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.role-toggle { display: flex; background: #eef0f3; border-radius: 9px; padding: 3px; gap: 2px; }
.role-toggle a { border-radius: 7px; padding: 7px 14px; font: 600 12.5px 'IBM Plex Sans'; color: #667085; }
.role-toggle a.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }

/* ---------- Buttons ---------- */
.btn {
  border: none; cursor: pointer; border-radius: 8px; padding: 10px 16px; font: 600 13px 'IBM Plex Sans';
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, .35); }
.btn-primary:hover { background: var(--blue-d); }
.btn-ghost { border: 1px solid #d4d8df; background: #fff; color: var(--ink-2); }
.btn-ghost:hover { background: #f7f8fa; }

/* ---------- Cards ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--card-shadow); }
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line-2); }
.card-title { font: 600 15px 'IBM Plex Sans'; }
.link-blue { font: 600 12.5px 'IBM Plex Sans'; color: var(--blue); cursor: pointer; }

/* ---------- KPIs ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; box-shadow: var(--card-shadow); }
.kpi-label { font: 600 10.5px 'IBM Plex Mono'; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi-value { font: 600 30px/1.05 'IBM Plex Sans'; margin-top: 12px; letter-spacing: -.02em; }
.kpi-delta { margin-top: 9px; font: 600 12px 'IBM Plex Sans'; }

/* ---------- Chart bars ---------- */
.bars { display: flex; align-items: flex-end; gap: 7px; height: 188px; }
.bars-lg { gap: 12px; height: 200px; }
.bar-col { flex: 1; display: flex; align-items: flex-end; height: 100%; }
.bar-col.labeled { flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; }
.bar { width: 100%; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, #3b82f6, #2563eb); }
.bar-label { font: 500 11px 'IBM Plex Mono'; color: var(--muted-2); }

/* ---------- Progress / fill bars ---------- */
.track { height: 7px; border-radius: 5px; background: var(--line-2); overflow: hidden; }
.track.thin { height: 6px; }
.track.thick { height: 8px; }
.track > .fill { height: 100%; border-radius: 5px; }
.bar-meta { font: 500 11px 'IBM Plex Mono'; color: var(--muted-2); margin-top: 5px; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  font: 600 10.5px 'IBM Plex Mono'; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 12px 16px; text-align: left;
}
.table thead.shade tr { background: #fafbfc; }
.table th:first-child, .table td:first-child { padding-left: 24px; }
.table th:last-child, .table td:last-child { padding-right: 24px; }
.table td { padding: 14px 16px; border-top: 1px solid var(--line-2); font: 500 13px 'IBM Plex Sans'; color: var(--ink-3); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover { background: #fafbfc; }
.t-right { text-align: right; }
.cell-strong { font: 600 13.5px 'IBM Plex Sans'; color: var(--ink); }
.cell-sub { font: 500 12px 'IBM Plex Sans'; color: var(--muted); margin-top: 2px; }
.cell-num { font-family: 'IBM Plex Mono'; color: var(--ink-2); }
.cell-num-strong { font: 600 13px 'IBM Plex Mono'; color: var(--ink); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font: 600 11.5px 'IBM Plex Sans';
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.badge--active   { background: #e6f7ee; color: #0a7a42; } .badge--active .dot   { background: #16a35a; }
.badge--scheduled{ background: #eaf1ff; color: #1d4ed8; } .badge--scheduled .dot{ background: #2f6fed; }
.badge--ended    { background: #f1f3f5; color: #667085; } .badge--ended .dot    { background: #98a2b3; }
.badge--paused   { background: #fbf1e0; color: #b25e00; } .badge--paused .dot   { background: #dd8a1a; }
.badge--full     { background: #fdeceb; color: #b42318; } .badge--full .dot     { background: #e5483d; }

/* ---------- Filters / search ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid #d4d8df; background: #fff; color: var(--ink-3); border-radius: 8px; padding: 8px 15px; font: 600 12.5px 'IBM Plex Sans'; cursor: pointer; }
.chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.search { display: flex; align-items: center; gap: 9px; background: #fff; border: 1px solid #d4d8df; border-radius: 8px; padding: 8px 12px; width: 260px; }
.search input { border: none; outline: none; font: 14px 'IBM Plex Sans'; color: var(--ink); width: 100%; background: transparent; }

/* ---------- Creative cards ---------- */
.creative-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 18px; }
.creative-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--card-shadow); }
.creative-thumb {
  position: relative; height: 124px; display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(135deg, #eef1f5 0 11px, #e5e9f0 11px 22px);
}
.creative-size { font: 500 12px 'IBM Plex Mono'; color: var(--muted); background: #fff; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line); }
.creative-fmt { position: absolute; top: 10px; left: 10px; font: 600 11px 'IBM Plex Mono'; padding: 3px 8px; border-radius: 6px; }
.creative-body { padding: 14px 16px; }
.badge-pill { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font: 600 10.5px 'IBM Plex Sans'; }
.badge-pill .dot { width: 5px; height: 5px; border-radius: 50%; }
.creative-url { margin-top: 12px; border-top: 1px solid var(--line-2); padding-top: 11px; display: flex; align-items: center; gap: 7px; font: 500 12px 'IBM Plex Mono'; color: #5b6471; overflow: hidden; }
.creative-url span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.creative-stats { margin-top: 10px; display: flex; justify-content: space-between; font: 500 11.5px 'IBM Plex Mono'; color: var(--muted-2); }

/* ---------- Networks ---------- */
.net-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.net-icon { width: 42px; height: 42px; border-radius: 10px; background: #eef3ff; display: flex; align-items: center; justify-content: center; flex: none; }
.net-stat { text-align: right; }
.net-stat-label { font: 600 10.5px 'IBM Plex Mono'; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.net-stat-val { font: 600 15px 'IBM Plex Mono'; margin-top: 4px; }

/* ---------- Wizard ---------- */
.wizard { display: flex; flex-direction: column; gap: 24px; max-width: 980px; }
.stepper { display: flex; align-items: flex-start; justify-content: space-between; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 9px; cursor: pointer; }
.step-num { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #d4d8df; background: #fff; color: var(--muted-2); display: flex; align-items: center; justify-content: center; font: 600 14px 'IBM Plex Sans'; }
.step.done .step-num, .step.current .step-num { border-color: var(--blue); background: var(--blue); color: #fff; }
.step-label { font: 600 12.5px 'IBM Plex Sans'; color: var(--muted-2); text-align: center; }
.step.done .step-label, .step.current .step-label { color: var(--ink); }
.step.current .step-label { font-weight: 700; }
.step-rail { height: 4px; border-radius: 3px; background: #eef0f3; margin-top: -44px; margin-bottom: 40px; overflow: hidden; }
.step-rail > div { height: 100%; background: var(--blue); border-radius: 3px; transition: width .25s; }
.wiz-panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 28px; box-shadow: var(--card-shadow); min-height: 300px; }
.wiz-h { font: 700 17px 'IBM Plex Sans'; }
.wiz-sub { font: 500 13px 'IBM Plex Sans'; color: var(--muted); margin-top: 4px; margin-bottom: 22px; }
.pick-grid { display: grid; gap: 14px; }
.pick {
  border: 1.5px solid var(--line); background: #fff; border-radius: 11px; padding: 15px; cursor: pointer;
  display: flex; align-items: center; gap: 13px;
}
.pick.sel { border-color: var(--blue); background: #f5f8ff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.field label { display: block; font: 600 12px 'IBM Plex Sans'; color: var(--ink-2); margin-bottom: 7px; }
.field input { width: 100%; padding: 11px 13px; border: 1px solid #d4d8df; border-radius: 9px; font: 14px 'IBM Plex Sans'; color: var(--ink); outline: none; }
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.wiz-foot { display: flex; align-items: center; justify-content: space-between; }
.hint { display: flex; align-items: center; gap: 8px; font: 500 12px 'IBM Plex Sans'; color: var(--muted); background: #f7f8fa; border-radius: 8px; padding: 10px 13px; }
.empty { border: 1.5px dashed #d4d8df; border-radius: 11px; padding: 36px; text-align: center; color: var(--muted); font: 500 13px 'IBM Plex Sans'; }
.hidden { display: none; }

/* ---------- Users admin ---------- */
.u-input {
  width: 100%; max-width: 220px; padding: 8px 11px; border: 1px solid #d4d8df;
  border-radius: 8px; font: 500 13px 'IBM Plex Sans'; color: var(--ink);
  background: #fff; outline: none; cursor: pointer;
}
.u-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }

/* ---------- Create modals ---------- */
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15,20,30,.45);
  z-index: 200; align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px; padding: 28px 32px;
  width: 480px; max-width: calc(100vw - 32px);
  box-shadow: 0 8px 40px rgba(16,24,40,.18);
}
.modal-title { font: 700 18px 'IBM Plex Sans'; color: var(--ink); margin-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label { font: 600 12px 'IBM Plex Sans'; color: var(--ink-3); text-transform: uppercase; letter-spacing: .5px; }
.form-field input, .form-field select {
  width: 100%; padding: 10px 13px; border: 1px solid #d4d8df; border-radius: 9px;
  font: 14px 'IBM Plex Sans'; color: var(--ink); outline: none; background: #fff;
}
.form-field input:focus, .form-field select:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.btn-ghost { padding: 9px 18px; border-radius: 9px; border: 1px solid #d4d8df; background: #fff; font: 600 13px 'IBM Plex Sans'; color: var(--ink-3); cursor: pointer; }
.btn-ghost:hover { background: #f7f8fa; }
