:root {
  color-scheme: light;
  --ink: #17221f;
  --muted: #6b7772;
  --faint: #9ca6a1;
  --paper: #f3f2ec;
  --surface: #fff;
  --line: #dfe4df;
  --green: #173b32;
  --green-2: #2f735f;
  --mint: #dcebe3;
  --gold: #d09a42;
  --red: #b94b43;
  --shadow: 0 18px 55px rgba(26, 48, 40, .09);
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

.ops-topbar { position: sticky; z-index: 20; top: 0; height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1240px) / 2)); color: #fff; background: rgba(16, 44, 38, .97); box-shadow: 0 1px rgba(255,255,255,.08); backdrop-filter: blur(16px); }
.ops-brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; letter-spacing: .08em; }
.ops-brand span, .login-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: var(--green); background: #e7ca7c; font: 800 19px Georgia, serif; }
.ops-brand strong { font-size: 15px; }
.ops-top-actions { display: flex; align-items: center; gap: 9px; }
.freshness { margin-right: 5px; color: rgba(255,255,255,.56); font-size: 11px; }

.button { min-height: 38px; padding: 0 15px; border: 0; border-radius: 11px; color: #fff; background: var(--green); font-size: 12px; font-weight: 750; cursor: pointer; transition: .15s ease; }
.button:hover { transform: translateY(-1px); background: #235749; }
.button.ghost { border: 1px solid rgba(255,255,255,.24); color: #fff; background: rgba(255,255,255,.08); }
.button.subtle { border: 1px solid var(--line); color: var(--muted); background: #fff; }
.ops-topbar .button.subtle { border-color: rgba(255,255,255,.16); color: rgba(255,255,255,.7); background: transparent; }
.button.wide { width: 100%; min-height: 46px; }
.button.danger { background: var(--red); }
.button.danger:hover { background: #9e3c36; }
.button:disabled { opacity: .45; transform: none; cursor: default; }

.ops-shell { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 38px 0 70px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 25px; }
.eyebrow, .kicker { margin: 0 0 7px; color: var(--green-2); font-size: 10px; font-weight: 850; letter-spacing: .15em; }
.page-heading h1 { margin: 0 0 7px; font: 700 clamp(28px, 4vw, 42px) Georgia, "Songti SC", serif; letter-spacing: -.035em; }
.page-heading > div > p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.range-control { display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 700; }
.range-control select { min-width: 145px; height: 40px; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #fff; }

.metric-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 13px; margin-bottom: 18px; }
.metric-card { min-height: 116px; padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: 0 5px 20px rgba(40,52,46,.025); }
.metric-card span { color: var(--muted); font-size: 11px; }
.metric-card strong { display: block; margin: 12px 0 5px; font: 700 30px Georgia, serif; }
.metric-card small { color: var(--faint); font-size: 9px; }

.dashboard-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; }
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 5px 20px rgba(40,52,46,.025); }
.panel.span-two { grid-column: span 2; }
.panel-heading { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 20px; border-bottom: 1px solid #edf0ed; }
.panel-heading h2 { margin: 0; font-size: 15px; }
.panel-heading span { color: var(--faint); font-size: 10px; }
.kicker { margin-bottom: 4px; font-size: 8px; }
.panel-note { margin: 0; padding: 0 20px 18px; color: var(--faint); font-size: 9px; }

.trend-chart { height: 250px; display: flex; align-items: stretch; gap: 7px; overflow-x: auto; padding: 25px 20px 8px; }
.trend-day { min-width: 25px; flex: 1; display: grid; grid-template-rows: 1fr 25px; gap: 7px; }
.trend-bars { display: flex; align-items: flex-end; justify-content: center; gap: 3px; border-bottom: 1px solid var(--line); }
.trend-bar { width: min(9px, 42%); min-height: 2px; border-radius: 4px 4px 0 0; }
.trend-bar.new { background: #d1a353; }
.trend-bar.active { background: var(--green-2); }
.trend-day small { overflow: hidden; color: var(--faint); text-align: center; font-size: 8px; white-space: nowrap; }
.chart-legend { display: flex; gap: 18px; padding: 0 20px 18px; color: var(--muted); font-size: 10px; }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; }
.chart-legend .new-users { background: #d1a353; }
.chart-legend .dau { background: var(--green-2); }

.hours-chart { height: 225px; display: flex; align-items: flex-end; gap: 4px; padding: 24px 16px 14px; }
.hour { min-width: 0; flex: 1; display: grid; grid-template-rows: 1fr 18px; gap: 6px; align-items: end; }
.hour-bar-wrap { height: 100%; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line); }
.hour-bar { width: 100%; min-height: 2px; border-radius: 4px 4px 1px 1px; background: linear-gradient(#4c927d, #245748); }
.hour small { color: var(--faint); text-align: center; font-size: 7px; }

.push-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; padding: 20px 20px 8px; }
.push-stat { padding: 12px; border-radius: 12px; background: #f5f7f4; }
.push-stat span, .push-stat strong { display: block; }
.push-stat span { color: var(--muted); font-size: 9px; }
.push-stat strong { margin-top: 6px; font: 700 21px Georgia, serif; }
.push-chart { height: 145px; display: flex; align-items: flex-end; gap: 4px; overflow: hidden; padding: 12px 20px 19px; }
.push-day { min-width: 3px; flex: 1; border-radius: 3px 3px 0 0; background: #7eaa9b; }

.manual-push-panel, .watchlist-panel { margin-top: 18px; }
.manual-tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 18px; }
.manual-tool { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: #fafbf9; }
.manual-tool.danger-tool { border-color: #ead2cf; background: #fffafa; }
.manual-tool > div:first-child { display: flex; align-items: center; gap: 9px; }
.manual-tool h3 { margin: 0; font-size: 13px; }
.manual-tool > p { min-height: 34px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.tool-index { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; color: var(--green); background: var(--mint); font: 700 10px Georgia, serif; }
.manual-tool label { display: grid; gap: 6px; color: var(--muted); font-size: 9px; font-weight: 700; }
.manual-tool input, .manual-tool textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; outline: none; }
.manual-tool input { height: 38px; }
.manual-tool textarea { min-height: 72px; resize: vertical; }
.manual-tool input:focus, .manual-tool textarea:focus { border-color: #91b7aa; box-shadow: 0 0 0 3px rgba(47,115,95,.08); }
.manual-tool code { color: var(--red); font-size: 9px; }
.manual-tool .button { margin-top: auto; }
.manual-result { display: flex; align-items: center; gap: 14px; min-height: 48px; margin: 0 18px 18px; padding: 11px 14px; border-radius: 12px; color: var(--muted); background: #edf3ef; font-size: 10px; }
.manual-result strong { color: var(--green); font-size: 11px; white-space: nowrap; }
.watchlist-heading { flex-wrap: wrap; }
.search-form { display: flex; gap: 7px; }
.search-form input { width: min(330px, 52vw); height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; outline: none; }
.search-form input:focus { border-color: #91b7aa; box-shadow: 0 0 0 3px rgba(47,115,95,.08); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 18px; color: var(--faint); background: #fafbf9; text-align: left; font-size: 9px; letter-spacing: .08em; }
td { padding: 15px 18px; border-top: 1px solid #edf0ed; vertical-align: middle; font-size: 11px; }
.user-id { display: block; max-width: 150px; overflow: hidden; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; }
.cell-muted { display: block; margin-top: 4px; color: var(--faint); font-size: 9px; }
.stock-list { display: flex; flex-wrap: wrap; gap: 5px; }
.stock-pill { padding: 5px 8px; border-radius: 99px; color: #285748; background: #e7f0eb; font-size: 9px; white-space: nowrap; }
.empty-row { padding: 35px; color: var(--muted); text-align: center; }
.table-footer { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; border-top: 1px solid #edf0ed; color: var(--muted); font-size: 10px; }
.table-footer > div { display: flex; gap: 7px; }
.table-footer .button { min-height: 32px; padding: 0 11px; }
.tracking-note { margin: 18px 3px 0; color: var(--faint); font-size: 10px; line-height: 1.7; }

.login-layer { position: fixed; z-index: 50; inset: 68px 0 0; display: grid; place-items: center; padding: 25px; background: radial-gradient(circle at 50% 20%, #e4ede7 0, var(--paper) 48%); }
.login-card { width: min(430px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: var(--shadow); }
.login-mark { width: 46px; height: 46px; margin-bottom: 24px; border-radius: 14px; font-size: 23px; }
.login-card h1 { margin: 0 0 9px; font: 700 29px Georgia, "Songti SC", serif; }
.login-card > p:not(.eyebrow):not(.form-error) { margin: 0 0 24px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.login-card label { display: grid; gap: 7px; margin-bottom: 14px; color: var(--muted); font-size: 10px; font-weight: 750; }
.login-card input { height: 45px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; outline: none; }
.login-card input:focus { border-color: #91b7aa; box-shadow: 0 0 0 3px rgba(47,115,95,.08); }
.form-error { min-height: 16px; margin: 12px 0 0; color: var(--red); font-size: 10px; }
.loading { position: fixed; z-index: 80; inset: 0; display: grid; place-content: center; justify-items: center; color: var(--muted); background: rgba(243,242,236,.76); backdrop-filter: blur(4px); }
.loading span { width: 28px; height: 28px; border: 3px solid #cad7d1; border-top-color: var(--green); border-radius: 50%; animation: spin .7s linear infinite; }
.loading p { font-size: 11px; }
.toast { position: fixed; z-index: 90; right: 22px; bottom: 22px; max-width: 330px; padding: 12px 16px; border-radius: 11px; color: #fff; background: var(--green); box-shadow: var(--shadow); font-size: 11px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .panel.span-two { grid-column: auto; }
  .manual-tool-grid { grid-template-columns: 1fr; }
  .manual-tool > p { min-height: 0; }
}
@media (max-width: 620px) {
  .ops-topbar { padding: 0 14px; }
  .ops-brand strong, .freshness, .ops-topbar .button.subtle { display: none; }
  .ops-shell { width: min(100% - 24px, 1240px); padding-top: 25px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-card { min-height: 100px; padding: 14px; }
  .metric-card strong { font-size: 25px; }
  .trend-chart { height: 210px; }
  .hours-chart { overflow-x: auto; }
  .hour { min-width: 12px; }
  .login-card { padding: 27px; }
  .manual-result { align-items: flex-start; flex-direction: column; gap: 4px; }
}
