:root {
  --ink: #0b1321;
  --ink-2: #142033;
  --ink-3: #26344a;
  --paper: #eef0e8;
  --paper-2: #e1e5da;
  --white: #fafbf6;
  --acid: #b9ff4c;
  --acid-dark: #74a71d;
  --signal: #ff7147;
  --warning: #ffc44d;
  --danger: #ff5263;
  --muted: #758094;
  --line: rgba(11, 19, 33, .14);
  --shadow: 0 22px 60px rgba(6, 12, 21, .14);
  --radius: 4px;
  --display: "Avenir Next Condensed", "DIN Condensed", "PingFang SC", sans-serif;
  --body: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", "Noto Sans Mono CJK SC", monospace;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body { margin: 0; min-width: 320px; font-family: var(--body); background: var(--paper); }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.grain { position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .035; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E"); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px 1fr; }

.rail { position: fixed; inset: 0 auto 0 0; width: 236px; background: var(--ink); color: var(--white); padding: 28px 18px 22px; display: flex; flex-direction: column; z-index: 30; border-right: 1px solid rgba(255,255,255,.1); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand strong { display: block; font: 800 26px/1 var(--display); letter-spacing: .08em; }
.brand small { display: block; margin-top: 3px; font: 700 8px/1 var(--mono); letter-spacing: .24em; opacity: .55; }
.brand-mark { width: 38px; height: 38px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; transform: skew(-9deg); }
.brand-mark i { display: block; background: var(--acid); }
.brand-mark i:nth-child(2) { height: 72%; align-self: end; }
.brand-mark i:nth-child(3) { height: 43%; align-self: end; }
.system-label { margin: 42px 8px 16px; font: 700 9px/1 var(--mono); letter-spacing: .18em; color: rgba(255,255,255,.36); }
.nav { display: grid; gap: 4px; }
.nav-item { position: relative; border: 0; background: transparent; color: rgba(255,255,255,.62); text-align: left; padding: 13px 13px; cursor: pointer; display: flex; align-items: center; gap: 13px; font-weight: 650; border-radius: 2px; transition: .2s ease; }
.nav-item span { font: 700 9px/1 var(--mono); color: rgba(255,255,255,.28); }
.nav-item:hover { color: var(--white); background: rgba(255,255,255,.05); transform: translateX(2px); }
.nav-item.active { background: var(--acid); color: var(--ink); }
.nav-item.active span { color: var(--ink); }
.nav-item.active::after { content: ""; position: absolute; right: -18px; width: 4px; height: 100%; background: var(--acid); }
.rail-foot { margin-top: auto; padding: 16px 10px 2px; border-top: 1px solid rgba(255,255,255,.1); display: flex; gap: 10px; align-items: center; }
.rail-foot b, .rail-foot small { display: block; }
.rail-foot b { font: 700 10px/1.2 var(--mono); letter-spacing: .1em; }
.rail-foot small { margin-top: 4px; color: rgba(255,255,255,.45); font-size: 10px; }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 0 0 rgba(185,255,76,.7); animation: pulse 2s infinite; }

.workspace { grid-column: 2; min-width: 0; padding: 0 38px 48px; }
.topbar { height: 112px; display: flex; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 34px; }
.topbar h1 { margin: 3px 0 0; font: 800 28px/1 var(--display); letter-spacing: -.01em; }
.eyebrow { margin: 0; font: 750 9px/1.3 var(--mono); letter-spacing: .18em; color: var(--muted); text-transform: uppercase; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.clock { font: 700 12px/1 var(--mono); padding: 0 14px; letter-spacing: .08em; }
.button, .icon-button, .text-button { border: 0; cursor: pointer; }
.button { min-height: 42px; padding: 0 17px; border: 1px solid var(--ink); background: var(--ink); color: var(--white); font-weight: 750; border-radius: 2px; display: inline-flex; align-items: center; justify-content: center; gap: 16px; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.button:hover { transform: translateY(-2px); box-shadow: 4px 5px 0 rgba(11,19,33,.15); }
.button.acid { background: var(--acid); color: var(--ink); }
.button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.button.danger { background: var(--danger); color: var(--ink); }
.button.wide { width: 100%; justify-content: space-between; }
.button.small { min-height: 30px; padding: 0 10px; font-size: 11px; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); background: transparent; font: 800 19px/1 var(--display); border-radius: 2px; }
.icon-button:hover { background: var(--ink); color: var(--white); }
.text-button { background: transparent; color: var(--ink); font-size: 11px; font-weight: 750; }
.mobile-only { display: none; }

.page { display: none; animation: page-in .4s ease both; }
.page.active { display: block; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(270px, .9fr); gap: 15px; }
.hero-panel { min-height: 340px; position: relative; overflow: hidden; color: var(--white); background: var(--ink); padding: 35px; display: flex; align-items: flex-end; box-shadow: var(--shadow); }
.hero-panel::before { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, rgba(185,255,76,.07), transparent 47%), repeating-linear-gradient(90deg, transparent 0, transparent 78px, rgba(255,255,255,.035) 79px); }
.hero-copy { position: relative; z-index: 2; width: 60%; }
.status-chip { display: inline-flex; gap: 8px; align-items: center; border: 1px solid rgba(255,255,255,.16); padding: 7px 10px; font: 700 8px/1 var(--mono); letter-spacing: .12em; }
.status-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--acid); }
.hero-copy h2 { margin: 26px 0 14px; font: 800 clamp(37px, 4.1vw, 55px)/.9 var(--display); letter-spacing: -.035em; }
.hero-copy h2 em { color: var(--acid); font-style: normal; }
.hero-copy p { max-width: 600px; margin: 0; color: rgba(255,255,255,.54); line-height: 1.75; font-size: 12px; }
.hero-code { position: absolute; right: 20px; bottom: 18px; color: rgba(255,255,255,.08); font: 900 60px/.72 var(--display); text-align: right; }
.radar { width: 270px; aspect-ratio: 1; position: absolute; right: 5%; top: 8%; border-radius: 50%; background: radial-gradient(circle, rgba(185,255,76,.09), transparent 68%); }
.radar-ring { position: absolute; border: 1px solid rgba(185,255,76,.2); border-radius: 50%; inset: 10%; }
.radar-ring.r2 { inset: 27%; }.radar-ring.r3 { inset: 43%; }
.radar::before, .radar::after { content: ""; position: absolute; background: rgba(185,255,76,.12); }
.radar::before { width: 1px; top: 6%; bottom: 6%; left: 50%; }.radar::after { height: 1px; left: 6%; right: 6%; top: 50%; }
.radar-sweep { position: absolute; inset: 10%; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 80%, rgba(185,255,76,.17) 96%, rgba(185,255,76,.6)); animation: sweep 5s linear infinite; }
.radar-core { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--acid); left: calc(50% - 5px); top: calc(50% - 5px); box-shadow: 0 0 20px var(--acid); }
.quick-panel { background: var(--signal); padding: 30px; display: flex; flex-direction: column; min-height: 340px; }
.quick-panel .eyebrow { color: rgba(11,19,33,.55); }
.quick-panel h3 { margin: auto 0 12px; font: 800 34px/.95 var(--display); max-width: 260px; }
.quick-panel > p:not(.eyebrow) { font-size: 12px; line-height: 1.6; max-width: 280px; }
.quick-rule { display: flex; justify-content: space-between; border-top: 1px solid rgba(11,19,33,.25); margin-top: 19px; padding-top: 14px; font: 700 10px/1 var(--mono); }

.stats-grid { margin-top: 15px; display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.stat-card { min-height: 126px; padding: 18px; background: var(--white); display: flex; flex-direction: column; position: relative; }
.stat-card::before { content: ""; position: absolute; top: 0; left: 0; height: 3px; width: 0; background: var(--acid-dark); transition: width .3s ease; }
.stat-card:hover::before { width: 100%; }
.stat-card span { font-size: 11px; color: var(--muted); }
.stat-card b { margin: auto 0 5px; font: 850 37px/1 var(--display); }
.stat-card small { font: 700 8px/1 var(--mono); letter-spacing: .1em; color: var(--muted); }
.stat-card.accent b { color: var(--acid-dark); }.stat-card.warning b { color: #b37800; }.stat-card.danger b { color: var(--danger); }
.split-grid { margin-top: 15px; display: grid; grid-template-columns: 1.45fr 1fr; gap: 15px; }
.panel { background: var(--white); border: 1px solid var(--line); min-width: 0; }
.panel-head { min-height: 78px; padding: 18px 21px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.panel-head h3 { font: 800 22px/1 var(--display); margin: 4px 0 0; }
.data-area { min-height: 130px; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 680px; }
.data-table th { padding: 11px 15px; font: 700 8px/1 var(--mono); letter-spacing: .12em; text-align: left; color: var(--muted); background: var(--paper); border-bottom: 1px solid var(--line); }
.data-table td { padding: 14px 15px; font-size: 11px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: rgba(185,255,76,.1); }
.mono { font-family: var(--mono); font-size: 10px; }
.money { font: 800 17px/1 var(--display); white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; border: 1px solid var(--line); font: 700 8px/1 var(--mono); letter-spacing: .06em; white-space: nowrap; }
.tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }
.tag.PAID::before, .tag.MATCHED::before, .tag.SUCCEEDED::before, .tag.online::before { background: var(--acid-dark); }
.tag.PENDING::before, .tag.PROCESSING::before { background: var(--warning); }
.tag.EXPIRED::before, .tag.CLOSED::before { background: var(--muted); }
.tag.UNMATCHED::before, .tag.DEAD::before, .tag.offline::before { background: var(--danger); }
.empty-state { min-height: 170px; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 30px; }
.empty-state b { display: block; color: var(--ink); font: 800 22px/1 var(--display); margin-bottom: 8px; }
.loading { min-height: 140px; display: grid; place-items: center; color: var(--muted); font: 700 9px/1 var(--mono); letter-spacing: .15em; }
.event-feed { padding: 7px 20px 18px; }
.event-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: center; }
.event-row:last-child { border-bottom: 0; }
.event-pin { width: 9px; height: 9px; border: 2px solid var(--ink); background: var(--acid); transform: rotate(45deg); }
.event-row b, .event-row small { display: block; }.event-row b { font-size: 11px; }.event-row small { color: var(--muted); margin-top: 3px; font-size: 9px; }
.event-row strong { font: 800 17px/1 var(--display); }

.page-intro { min-height: 132px; display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.page-intro h2 { font: 850 43px/.95 var(--display); margin: 7px 0 9px; }
.page-intro > div > p:last-child { color: var(--muted); margin: 0; font-size: 12px; }
.channel-grid, .device-grid { display: grid; grid-template-columns: repeat(3, minmax(250px, 1fr)); gap: 15px; }
.channel-card, .device-card { background: var(--white); border: 1px solid var(--line); padding: 22px; position: relative; min-height: 225px; }
.channel-card::after { content: attr(data-provider); position: absolute; right: 13px; top: 12px; color: rgba(11,19,33,.045); font: 900 38px/1 var(--display); }
.card-head { display: flex; justify-content: space-between; gap: 12px; position: relative; z-index: 1; }
.card-head h3 { margin: 7px 0 0; font: 800 24px/1 var(--display); }
.card-meta { display: grid; gap: 8px; margin-top: 27px; }
.meta-row { display: flex; justify-content: space-between; gap: 15px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 10px; }
.meta-row span { color: var(--muted); }.meta-row b { text-align: right; max-width: 65%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-actions { display: flex; gap: 8px; margin-top: 18px; }
.device-illustration { height: 82px; margin: 10px 0 18px; border: 1px solid var(--line); background: repeating-linear-gradient(90deg, transparent 0 34px, var(--line) 35px), linear-gradient(135deg, rgba(185,255,76,.25), transparent); display: flex; align-items: center; padding: 15px; }
.device-illustration strong { font: 850 28px/1 var(--display); }

.login-screen { position: fixed; inset: 0; z-index: 80; background: var(--ink); color: var(--white); display: grid; place-items: center; overflow: hidden; transition: opacity .35s ease, visibility .35s ease; }
.login-screen.hidden { opacity: 0; visibility: hidden; }
.login-grid { position: absolute; inset: -20%; background-image: linear-gradient(rgba(185,255,76,.055) 1px, transparent 1px), linear-gradient(90deg, rgba(185,255,76,.055) 1px, transparent 1px); background-size: 54px 54px; transform: perspective(600px) rotateX(55deg) rotateZ(-14deg); animation: drift 16s linear infinite; }
.login-card { width: min(460px, calc(100% - 34px)); position: relative; background: var(--paper); color: var(--ink); padding: 38px; box-shadow: 14px 14px 0 var(--acid); }
.login-brand { margin-bottom: 62px; }.login-brand .brand-mark i { background: var(--ink); }
.login-card h2 { font: 850 47px/.95 var(--display); margin: 9px 0; }.login-card > p:not(.eyebrow) { color: var(--muted); font-size: 12px; }
.login-card form { margin-top: 32px; }.login-foot { display: flex; justify-content: space-between; margin-top: 31px; padding-top: 17px; border-top: 1px solid var(--line); font: 700 7px/1 var(--mono); letter-spacing: .08em; color: var(--muted); }
label { display: grid; gap: 7px; margin-bottom: 17px; font-size: 10px; font-weight: 750; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 1px; background: var(--white); color: var(--ink); padding: 12px 13px; outline: 0; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 3px 3px 0 var(--acid); }
textarea { resize: vertical; font-family: var(--mono); font-size: 10px; }
.form-error { min-height: 17px; color: #bc2038; font-size: 10px; margin: -7px 0 9px; }

.modal { width: min(680px, calc(100% - 28px)); max-height: calc(100vh - 30px); padding: 0; color: var(--ink); background: var(--paper); border: 1px solid var(--ink); box-shadow: 12px 12px 0 var(--acid); }
.modal::backdrop { background: rgba(5,10,18,.76); backdrop-filter: blur(5px); }
.modal > form, .modal > div:not(.modal-head), .modal.compact { padding: 28px; }
.modal.compact { width: min(560px, calc(100% - 28px)); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 20px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font: 850 29px/1 var(--display); margin: 5px 0 0; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.switch-row { display: flex; flex-direction: row; align-items: center; justify-content: space-between; padding: 12px 0; }
.switch-row b, .switch-row small { display: block; }.switch-row small { margin-top: 4px; color: var(--muted); font-weight: 400; }
.switch-row input { width: 42px; height: 22px; accent-color: var(--acid-dark); box-shadow: none; }
fieldset { border: 1px solid var(--line); margin: 0 0 17px; padding: 13px; } legend { font-size: 10px; font-weight: 750; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }.check-grid label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px; background: var(--white); }.check-grid input { width: 16px; box-shadow: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.secret-box { display: grid; grid-template-columns: 1fr auto; background: var(--ink); color: var(--acid); padding: 11px; align-items: center; gap: 10px; }
.secret-box code { padding: 8px; overflow-wrap: anywhere; font: 700 12px/1.5 var(--mono); }.secret-warning { color: var(--danger); font-size: 10px; }
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: grid; gap: 8px; }
.toast { max-width: 340px; background: var(--ink); color: var(--white); border-left: 4px solid var(--acid); padding: 13px 17px; box-shadow: var(--shadow); font-size: 11px; animation: toast-in .25s ease; }.toast.error { border-color: var(--danger); }

@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(185,255,76,0); } 100% { box-shadow: 0 0 0 0 rgba(185,255,76,0); } }
@keyframes sweep { to { transform: rotate(360deg); } }
@keyframes page-in { from { opacity: 0; transform: translateY(7px); } }
@keyframes drift { to { transform: perspective(600px) rotateX(55deg) rotateZ(-14deg) translate(54px,54px); } }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } }

@media (max-width: 1180px) { .stats-grid { grid-template-columns: repeat(3, 1fr); }.channel-grid, .device-grid { grid-template-columns: repeat(2, 1fr); }.hero-copy { width: 68%; } }
@media (max-width: 860px) {
  .app-shell { display: block; }.rail { transform: translateX(-100%); transition: transform .25s ease; }.rail.open { transform: translateX(0); box-shadow: 20px 0 60px rgba(0,0,0,.25); }
  .workspace { padding: 0 18px 38px; }.topbar { height: 88px; margin-bottom: 20px; }.topbar .eyebrow { display: none; }.topbar h1 { font-size: 22px; }.mobile-only { display: grid; margin-right: 12px; }.clock { display: none; }
  .hero-grid, .split-grid { grid-template-columns: 1fr; }.hero-panel { min-height: 380px; }.quick-panel { min-height: 250px; }.quick-panel h3 { margin-top: auto; }
  .channel-grid, .device-grid { grid-template-columns: 1fr; }.page-intro { min-height: 115px; }.page-intro h2 { font-size: 35px; }
}
@media (max-width: 580px) {
  .workspace { padding-inline: 12px; }.top-actions .ghost { display: none; }.hero-panel { min-height: 410px; padding: 25px; }.hero-copy { width: 100%; }.hero-copy h2 { font-size: 43px; }.radar { opacity: .42; right: -25%; }.hero-code { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }.stat-card { min-height: 108px; }.page-intro { align-items: flex-start; flex-direction: column; padding: 20px 0; }.field-grid { grid-template-columns: 1fr; gap: 0; }.check-grid { grid-template-columns: 1fr; }
  .login-card { padding: 27px; box-shadow: 8px 8px 0 var(--acid); }.login-brand { margin-bottom: 43px; }.login-card h2 { font-size: 40px; }.modal { box-shadow: 6px 6px 0 var(--acid); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
