:root {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #18253a;
  background: #f4f7fb;
  font-synthesis: none;
  font-size: 14px;
  --ink: #18253a;
  --muted: #52637a;
  --line: #dbe3ee;
  --accent: #194b9a;
  --accent-soft: #edf4ff;
  --danger: #9c2631;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea, a { touch-action: manipulation; }
:focus-visible { outline: 3px solid #3a79df; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(26px, 4vw, 36px); letter-spacing: -.045em; line-height: 1.15; }
h2 { font-size: 18px; line-height: 1.35; }
h3 { font-size: 14px; }
p { line-height: 1.55; }
button {
  border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 7px;
  min-height: 36px; padding: 6px 13px; cursor: pointer; font-weight: 600;
}
button:hover { border-color: #8fa4c1; background: #f6f9fd; }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: white; }
button.primary:hover { background: #123a79; }
button.danger { color: var(--danger); }
button.plain { border-color: transparent; background: transparent; }
input, select, textarea {
  min-height: 38px; min-width: 0; color: var(--ink); border: 1px solid #c9d5e5;
  border-radius: 7px; padding: 7px 9px; background-color: white;
}
input[type="checkbox"] { min-height: 0; width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
input[type="file"] { max-width: 100%; }
textarea { resize: vertical; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 600; }
label.check { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 22px; font-weight: 750; letter-spacing: -.045em; }
.brand-mark {
  display: inline-block; position: relative; width: 28px; height: 28px; background: #3971cd; border-radius: 8px;
}
.brand-mark::before {
  content: ""; position: absolute; inset: 6px; border: 2px solid white; border-radius: 50%;
  transform: rotate(-36deg) scaleY(.7);
}
.brand-mark::after { content: ""; position: absolute; top: 8px; right: 8px; width: 4px; height: 4px; background: white; border-radius: 50%; }
.login-page { display: grid; place-items: center; padding: 24px; background: #edf3fb; }
.login-layout { display: grid; gap: 22px; width: min(100%, 410px); }
.login-card { padding: clamp(24px, 5vw, 38px); border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 16px 40px #263e6812; }
.login-card h1 { font-size: 25px; margin-bottom: 26px; }
.login-card .primary { margin-top: 7px; min-height: 42px; }
.form-stack { display: grid; gap: 17px; }

.sidebar {
  display: flex; flex-direction: column; gap: 37px; position: fixed; inset: 0 auto 0 0; width: 222px;
  padding: 33px 16px 19px; background: #13253e; color: #eef4ff;
}
.sidebar .brand { padding-inline: 12px; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a { border-radius: 7px; padding: 12px; color: #d0def5; font-weight: 600; }
.nav a:hover, .nav a[aria-current="page"] { background: #294b78; color: white; }
.account { display: flex; align-items: center; gap: 6px; justify-content: space-between; margin-top: auto; padding: 0 9px; }
.account-name { color: #d0def5; overflow: hidden; text-overflow: ellipsis; }
.account button { color: white; white-space: nowrap; }
.account button:hover { background: #294b78; }
.workspace { margin-left: 222px; padding: 0 clamp(20px, 3.1vw, 52px) 36px; max-width: 1650px; }
.topbar { min-height: 76px; display: flex; gap: 15px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.app-switcher { display: flex; gap: 10px; align-items: center; }
.app-switcher label { white-space: nowrap; }
.app-switcher select { width: clamp(150px, 19vw, 270px); }
.context { color: var(--muted); font-size: 13px; }
.view-heading { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 15px; margin-bottom: 20px; }
.view-heading p, .section-heading p { color: var(--muted); margin-top: 5px; }
.actions { display: flex; align-items: end; gap: 9px; flex-wrap: wrap; }
.actions.end { justify-content: end; }
.actions label { font-size: 12px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; margin-bottom: 14px; }
.metric, .panel { background: white; border: 1px solid var(--line); border-radius: 11px; }
.metric { padding: 17px 16px; }
.metric p { color: var(--muted); font-weight: 600; }
.metric strong { display: block; margin-top: 5px; font-size: 27px; font-variant-numeric: tabular-nums; }
.panel { margin-bottom: 14px; padding: clamp(14px, 2.2vw, 23px); }
.panel.empty { text-align: center; padding: 46px 16px; }
.panel.empty p { margin: 8px 0 15px; color: var(--muted); }
.section-heading { display: flex; justify-content: space-between; align-items: start; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.two-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-variant-numeric: tabular-nums; }
thead { background: #f0f4fa; color: #455875; }
th, td { padding: 10px 11px; vertical-align: middle; white-space: nowrap; }
th { font-size: 12px; }
tbody tr + tr { border-top: 1px solid #e8edf5; }
td .actions { flex-wrap: nowrap; }
td button { min-height: 29px; padding-inline: 8px; font-size: 12px; }
.device-cell-detail { margin-top: 3px; font-size: 12px; }
.device-pagination { margin-top: 12px; }
.facts { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(0, auto); gap: 11px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.facts.inline-facts { margin-bottom: 16px; }
.trend { display: grid; gap: 6px; max-width: 620px; margin-bottom: 16px; }
.trend-day { display: grid; grid-template-columns: 65px 1fr 1fr; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.trend progress { width: 100%; height: 11px; accent-color: #285eac; }
.trend progress + progress { accent-color: #2a866b; }
.distributions { display: grid; gap: 17px; }
.distributions h3 { margin-bottom: 7px; }
.reporting-subheading { margin: 17px 0 11px; border-top: 1px solid var(--line); padding-top: 14px; }
.message { color: #194b74; background: #e9f5fc; border-radius: 7px; padding: 11px 13px; margin-bottom: 13px; overflow-wrap: anywhere; }
.message.error { background: #feeff0; color: var(--danger); }
.muted { color: var(--muted); }
.sr-only { clip-path: inset(50%); position: absolute; width: 1px; height: 1px; overflow: hidden; }
#ad-stats-filters, #upload-asset { margin-bottom: 16px; }

.editor-group + .editor-group { margin-top: 25px; border-top: 1px solid var(--line); padding-top: 16px; }
.editor-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.editor-cards { display: grid; gap: 10px; }
.editor-card { border: 1px solid var(--line); background: #f8fafc; border-radius: 8px; padding: 12px; min-width: 0; }
.editor-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); align-items: end; gap: 10px; }
.editor-card .long { grid-column: 1 / -1; }
.editor-card details { margin-top: 12px; }
.editor-card details .editor-fields { margin-top: 9px; }
.editor-card summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.editor-card footer { display: flex; justify-content: end; margin-top: 11px; }
.asset-grid, .preview-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
.asset, .preview-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow-wrap: anywhere; }
.asset img, .preview-item img { width: 100%; height: 110px; object-fit: contain; background: #edf2f9; border-radius: 5px; }
.asset .muted, .preview-item .muted { font-size: 12px; }
.asset p, .preview-item p { margin: 4px 0 9px; }
.preview-item .preview-text { white-space: pre-wrap; }
.preview-dialog { width: min(760px, calc(100% - 30px)); }
.preview-dialog .actions.end { margin-top: 16px; }
dialog { width: min(440px, calc(100% - 30px)); max-height: 90dvh; overflow: auto; padding: 22px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); }
dialog::backdrop { background: #18253a8a; }

@media (max-width: 900px) {
  .two-columns { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 680px) {
  .sidebar { position: static; width: 100%; gap: 8px 10px; padding: 11px 14px; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .sidebar .brand { padding: 0; font-size: 19px; }
  .nav { order: 3; width: 100%; flex-direction: row; }
  .nav a { padding: 7px 8px; }
  .account { margin: 0 0 0 auto; padding: 0; }
  .account-name { max-width: 126px; }
  .workspace { margin-left: 0; padding: 0 13px 20px; }
  .topbar { padding-block: 11px; margin-bottom: 18px; flex-wrap: wrap; }
  .app-switcher { width: 100%; gap: 6px; }
  .app-switcher select { flex: 1; }
  .app-switcher button { white-space: nowrap; padding-inline: 8px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
}
