:root {
  color-scheme: light;
  --paper: #f2f5f3;
  --white: #fff;
  --ink: #22313a;
  --muted: #72818a;
  --line: #e1e7e4;
  --line-dark: #d1dad6;
  --nav: #23313a;
  --nav-muted: #a5b1b6;
  --teal: #238c7b;
  --teal-light: #dff1eb;
  --amber: #bf7b25;
  --rose: #bc5b62;
  --shadow: 0 18px 60px rgba(21, 42, 47, .14);
  font-family: "Noto Sans SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); font-size: 13px; }
button, input { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.login-screen { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 8%, #e1eee7 0, #f2f5f3 42%, #edf1ef 100%); }
.login-form { width: min(100%, 380px); padding: 35px 34px 29px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); box-shadow: var(--shadow); }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 7px; background: var(--teal); color: white; font-size: 25px; font-weight: 700; }
.eyebrow { margin: 20px 0 6px; color: var(--teal); font: 600 9px/1.4 "DM Mono", monospace; letter-spacing: 1px; }
.login-form h1 { margin: 0 0 27px; font-size: 23px; font-weight: 700; }
.login-form label, .level-dialog label { display: grid; gap: 8px; margin: 0 0 16px; color: #4c5e67; font-size: 12px; font-weight: 600; }
.login-form input, .level-dialog input[type="text"], .level-dialog input[type="number"], .placement-input { width: 100%; height: 41px; padding: 0 12px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; color: var(--ink); outline: 0; }
.login-form input:focus, .level-dialog input:focus, .placement-input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(35, 140, 123, .10); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 37px; gap: 8px; padding: 0 14px; border: 1px solid transparent; border-radius: 5px; cursor: pointer; font-size: 12px; font-weight: 600; transition: background .16s, border-color .16s, transform .16s; }
.button:active { transform: translateY(1px); }
.button-primary { color: #fff; background: var(--teal); }
.button-primary:hover { background: #187766; }
.button-subtle { border-color: var(--line-dark); color: #42545d; background: #fff; }
.button-subtle:hover { background: #f4f7f5; }
.button-danger { color: #fff; background: var(--rose); }
.button-danger:hover { background: #a94d55; }
.button:disabled { border-color: var(--line); color: #aab3af; background: #f3f6f4; cursor: default; transform: none; }
.login-submit { width: 100%; height: 42px; margin-top: 8px; }
.login-error, .form-error { min-height: 17px; margin: 10px 0 0; color: var(--rose); font-size: 11px; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 3; display: flex; width: 220px; flex-direction: column; padding: 23px 14px 17px; color: white; background: var(--nav); }
.brand-lockup { display: flex; align-items: center; gap: 11px; padding: 0 10px 30px; }
.brand-lockup .brand-mark { width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.2); background: rgba(52, 161, 137, .88); font-size: 21px; }
.brand-lockup strong, .brand-lockup span { display: block; }
.brand-lockup strong { font-size: 14px; }
.brand-lockup span { margin-top: 3px; color: var(--nav-muted); font-size: 10px; }
.primary-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 11px; border: 0; border-radius: 5px; color: #c0c9ca; background: transparent; cursor: pointer; text-align: left; font-size: 12px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.065); }
.nav-item.active { color: white; background: #344850; box-shadow: inset 2px 0 var(--teal); }
.nav-symbol { display: inline-grid; width: 19px; place-items: center; color: #8bcab5; font-size: 16px; }
.sidebar-bottom { display: grid; gap: 9px; margin-top: auto; padding: 13px 9px 0; border-top: 1px solid rgba(255,255,255,.1); }
.service-status { display: flex; align-items: center; gap: 7px; color: #d0dbd7; font-size: 10px; }
.service-status i { width: 7px; height: 7px; border-radius: 50%; background: #6bd1a4; box-shadow: 0 0 0 3px rgba(107,209,164,.13); }
.sidebar-version { color: #829397; font-size: 9px; }
.workspace { width: calc(100% - 220px); margin-left: 220px; }
.topbar { position: sticky; top: 0; z-index: 2; display: flex; height: 81px; align-items: center; justify-content: space-between; padding: 0 34px; border-bottom: 1px solid var(--line); background: rgba(248,250,248,.92); backdrop-filter: blur(10px); }
.topbar-kicker { color: #84928f; font: 500 8px "DM Mono", monospace; letter-spacing: .8px; }
.topbar h2 { margin: 3px 0 0; font-size: 17px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 11px; }
.updated-at { color: #86928f; font-size: 10px; }
.icon-button { display: grid; width: 31px; height: 31px; place-items: center; border: 1px solid var(--line); border-radius: 5px; color: #5b6b72; background: #fff; cursor: pointer; font-size: 18px; }
.icon-button:hover { border-color: #a9beb7; color: var(--teal); }
.profile-button { min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; color: #64747a; background: transparent; cursor: pointer; font-size: 10px; }
.main-content { max-width: 1320px; margin: 0 auto; padding: 25px 34px 50px; }
.view { display: none; }
.view.active { display: block; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.section-heading h3 { margin: 0; font-size: 16px; font-weight: 700; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.date-chip { padding: 6px 9px; border: 1px solid var(--line); border-radius: 4px; color: #62736e; background: #f8faf8; font: 500 9px "DM Mono", monospace; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 10px; }
.metric-card { position: relative; overflow: hidden; min-height: 97px; padding: 13px 14px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); }
.metric-label { color: #788781; font-size: 10px; }
.metric-value { margin-top: 12px; color: #273b43; font: 700 23px/1 "DM Mono", monospace; }
.metric-note { margin-top: 7px; color: #94a09b; font-size: 9px; }
.metric-accent { position: absolute; top: 0; right: 0; width: 29px; height: 29px; border-bottom-left-radius: 22px; background: var(--teal-light); }
.metric-accent.amber { background: #f6ead9; }
.metric-accent.rose { background: #f5e1e2; }
.overview-grid { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(235px,.86fr); gap: 12px; margin-top: 13px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--white); }
.chart-panel, .quick-panel { min-height: 223px; padding: 14px 16px 10px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-heading h3 { margin: 0; font-size: 12px; font-weight: 700; }
.panel-heading p { margin: 5px 0 0; color: #8a9691; font-size: 9px; }
.legend-dot { display: flex; align-items: center; gap: 6px; color: #84918b; font-size: 9px; }
.legend-dot::before { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); content: ""; }
#activity-chart { display: block; width: 100%; height: 152px; margin-top: 5px; }
.quick-list { display: grid; margin: 18px 0 0; }
.quick-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #edf0ee; }
.quick-row:last-child { border: 0; }
.quick-row dt { color: #74827d; font-size: 10px; }
.quick-row dd { margin: 0; color: #35494f; font-size: 10px; font-weight: 600; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 20px; color: #78827d; background: #f0f3f1; font-size: 9px; font-weight: 500; }
.status-pill::before { width: 5px; height: 5px; border-radius: 50%; background: #8e9994; content: ""; }
.status-pill.on { color: #167261; background: #e2f3ec; }
.status-pill.on::before { background: #24977e; }
.table-panel { margin-top: 13px; overflow: hidden; }
.table-panel > .panel-heading { padding: 14px 16px 11px; }
.table-toolbar { display: flex; justify-content: space-between; padding: 11px 15px; color: #84918d; font-size: 10px; }
.table-toolbar span:first-child { color: #4d625d; font-weight: 600; }
.level-toolbar { align-items: center; gap: 14px; }
.level-toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 11px; min-width: 0; }
.level-selection-status { overflow: hidden; color: #84918d !important; font-size: 9px; font-weight: 400 !important; text-overflow: ellipsis; white-space: nowrap; }
.level-toolbar .button { min-height: 29px; padding: 0 10px; font-size: 10px; }
.table-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 15px; border-top: 1px solid #edf0ee; color: #7f8c87; font-size: 10px; }
.pagination-controls { display: flex; align-items: center; gap: 7px; }
.pagination-controls select { height: 29px; padding: 0 22px 0 8px; border: 1px solid var(--line); border-radius: 4px; color: #43535a; background: white; font: inherit; }
.pagination-button { min-height: 29px; padding: 0 9px; border: 1px solid var(--line); border-radius: 4px; color: #52636a; background: white; cursor: pointer; font: inherit; }
.pagination-button:hover:not(:disabled) { border-color: #9bbdb3; color: var(--teal); }
.pagination-button:disabled { color: #aab3af; background: #f7f9f7; cursor: default; }
.pagination-page { min-width: 38px; color: #52636a; text-align: center; font-variant-numeric: tabular-nums; }
.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th { height: 34px; padding: 0 14px; border-top: 1px solid #edf0ee; border-bottom: 1px solid #edf0ee; color: #7f8c87; background: #f7f9f7; font-size: 9px; font-weight: 600; }
td { height: 40px; padding: 0 14px; border-bottom: 1px solid #edf0ee; color: #43535a; font-size: 10px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcfb; }
.level-number { color: #354a50; font: 600 10px "DM Mono", monospace; }
.level-select-column { width: 38px; padding-right: 4px; }
.level-select-cell { width: 38px; padding-right: 4px; }
.level-checkbox { width: 15px; height: 15px; margin: 0; accent-color: var(--teal); cursor: pointer; vertical-align: middle; }
.level-checkbox:disabled { cursor: not-allowed; opacity: .45; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; padding: 0; border: 0; margin: -1px; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.rate-cell { display: flex; align-items: center; gap: 8px; }
.rate-track { width: 62px; height: 4px; overflow: hidden; border-radius: 4px; background: #e9eeeb; }
.rate-track i { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.text-button { padding: 4px 0; border: 0; color: var(--teal); background: transparent; cursor: pointer; font-size: 10px; }
.align-right { text-align: right; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.small-action { padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; color: #52636a; background: white; cursor: pointer; font-size: 9px; }
.small-action:hover { border-color: #9bbdb3; color: var(--teal); }
.small-action.danger:hover { border-color: #ddb4b7; color: var(--rose); }
.small-action:disabled { border-color: var(--line); color: #aab3af; background: #f7f9f7; cursor: default; }
.notice-line { display: flex; align-items: flex-start; gap: 9px; margin-top: 13px; color: #76857f; font-size: 10px; line-height: 1.65; }
.notice-icon { display: inline-grid; flex: 0 0 16px; height: 16px; place-items: center; border: 1px solid #b8c9c1; border-radius: 50%; color: #5b8274; font: 600 10px Georgia, serif; }
.compact-metrics { grid-template-columns: repeat(4, minmax(0,1fr)); margin-bottom: 13px; }
.compact-metrics .metric-card { min-height: 88px; }
.monetization-banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 19px; border: 1px solid #d8e5df; border-radius: 6px; background: linear-gradient(105deg, #e8f2ec, #f4f7f2 58%, #faf6ed); }
.banner-kicker { color: #648577; font: 600 8px "DM Mono", monospace; letter-spacing: 1px; }
.monetization-banner h3 { margin: 7px 0 5px; color: #283d43; font-size: 15px; }
.monetization-banner p { max-width: 700px; margin: 0; color: #70817b; font-size: 10px; line-height: 1.6; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; white-space: nowrap; }
.switch input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.switch-track { position: relative; width: 36px; height: 21px; border-radius: 20px; background: #c6d0cb; transition: background .18s; }
.switch-track::after { position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: white; box-shadow: 0 1px 3px #38514829; content: ""; transition: transform .18s; }
.switch input:checked + .switch-track { background: var(--teal); }
.switch input:checked + .switch-track::after { transform: translateX(15px); }
.switch input:focus-visible + .switch-track { outline: 3px solid #7ab5a3; outline-offset: 2px; }
.switch-label { color: #74837c; font-size: 9px; }
.large-switch .switch-track { width: 42px; height: 24px; }
.large-switch .switch-track::after { width: 18px; height: 18px; }
.large-switch input:checked + .switch-track::after { transform: translateX(18px); }
.placement-list { display: grid; gap: 9px; margin-top: 12px; }
.placement-row { display: grid; grid-template-columns: minmax(190px,.85fr) minmax(180px,1.35fr) minmax(220px,2fr); align-items: center; gap: 18px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.placement-title { display: flex; align-items: center; gap: 10px; }
.placement-icon { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 5px; color: #3f8f7d; background: #eaf4ef; font-size: 14px; }
.placement-title strong, .placement-title small { display: block; }
.placement-title strong { font-size: 11px; }
.placement-title small { margin-top: 3px; color: #929e99; font-size: 9px; }
.placement-id label { display: block; margin-bottom: 5px; color: #7e8c87; font-size: 9px; }
.placement-input { height: 34px; font: 10px "DM Mono", monospace; }
.placement-hint { color: #84908b; font-size: 9px; line-height: 1.6; }
.save-feedback { min-height: 20px; margin-top: 9px; color: var(--teal); font-size: 10px; }
.level-dialog { width: min(100% - 30px, 450px); padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; box-shadow: var(--shadow); }
.level-dialog::backdrop { background: rgba(26,40,45,.48); backdrop-filter: blur(2px); }
.level-dialog form { padding: 20px 22px 18px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 21px; }
.dialog-heading .eyebrow { margin: 0 0 5px; }
.dialog-heading h2 { margin: 0; font-size: 17px; }
.dialog-heading .icon-button { border: 0; font-size: 22px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.level-dialog label small { display: inline; color: #8a9691; font-size: 9px; font-weight: 400; }
.check-label { display: flex !important; align-items: center; gap: 8px !important; margin-top: 2px !important; }
.check-label input { accent-color: var(--teal); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.toast { position: fixed; right: 22px; bottom: 20px; z-index: 12; padding: 10px 14px; border: 1px solid #cbd9d2; border-radius: 5px; color: #29453c; background: #eff7f2; box-shadow: 0 6px 22px #263d3524; opacity: 0; pointer-events: none; transform: translateY(6px); transition: opacity .16s, transform .16s; }
.toast.visible { opacity: 1; transform: translateY(0); }
.empty-state { padding: 30px; color: #84918d; text-align: center; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .placement-row { grid-template-columns: minmax(160px,.8fr) minmax(190px,1.3fr); }
  .placement-hint { grid-column: 2; margin-top: -10px; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; min-height: 0; padding: 10px 12px 0; }
  .app-shell { display: block; }
  .brand-lockup { padding: 0 4px 11px; }
  .brand-lockup .brand-mark { width: 29px; height: 29px; font-size: 18px; }
  .brand-lockup strong { font-size: 12px; }
  .brand-lockup span, .sidebar-bottom { display: none; }
  .primary-nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 8px; }
  .nav-item { flex: 0 0 auto; height: 34px; gap: 6px; padding: 0 9px; font-size: 10px; }
  .nav-symbol { width: 14px; font-size: 13px; }
  .workspace { width: 100%; margin: 0; }
  .topbar { height: 66px; padding: 0 14px; }
  .topbar-kicker { font-size: 7px; }
  .topbar h2 { font-size: 15px; }
  .updated-at { display: none; }
  .main-content { padding: 20px 13px 34px; }
  .section-heading { align-items: flex-start; }
  .section-heading p { max-width: 245px; line-height: 1.55; }
  .section-heading .button { flex: 0 0 auto; min-height: 33px; padding: 0 9px; font-size: 10px; }
  .date-chip { display: none; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
  .metric-card { min-height: 84px; padding: 11px; }
  .metric-value { margin-top: 10px; font-size: 20px; }
  .overview-grid { grid-template-columns: 1fr; gap: 8px; }
  .chart-panel { min-height: 205px; }
  #activity-chart { height: 135px; }
  .quick-panel { min-height: unset; }
  .compact-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .placement-row { grid-template-columns: 1fr; gap: 11px; }
  .placement-hint { grid-column: auto; margin: 0; }
  .monetization-banner { align-items: flex-start; padding: 14px; }
  .large-switch { gap: 7px; }
  .level-toolbar { align-items: flex-start; flex-wrap: wrap; }
  .level-toolbar-actions { width: 100%; justify-content: space-between; }
  .table-panel > .panel-heading, th, td { padding-right: 10px; padding-left: 10px; }
  .table-pagination { align-items: flex-start; flex-direction: column; }
  .pagination-controls { width: 100%; justify-content: flex-end; gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
