:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #152033;
  --muted: #6f7c91;
  --line: #e6eaf1;
  --primary: #375dfb;
  --primary-dark: #2448dd;
  --green: #12a675;
  --red: #d84b5b;
  --amber: #d88a18;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 236px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 18px; color: #d9e0ee; background: #111827; display: flex; flex-direction: column; }
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 28px; color: white; }
.brand-mark { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; color: white; font-weight: 800; letter-spacing: -.05em; background: linear-gradient(145deg, #5a77ff, #304cd6); box-shadow: 0 9px 24px #1f3bc955; }
.brand-mark.large { width: 62px; height: 62px; border-radius: 19px; font-size: 22px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; }
.brand small { margin-top: 3px; color: #8e9bb0; font-size: 11px; }
nav { display: grid; gap: 7px; }
nav a { padding: 12px 14px; border-radius: 10px; color: #9ba7ba; font-size: 14px; font-weight: 600; }
nav a:hover, nav a.active { color: white; background: #27334a; }
nav a.active { box-shadow: inset 3px 0 #607dff; }
.sidebar-footer { margin-top: auto; padding: 18px 8px 4px; border-top: 1px solid #273248; color: #8e9bb0; font-size: 12px; }
.broker-state { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.state-dot { width: 8px; height: 8px; border-radius: 50%; background: #718096; }
.state-dot.online { background: #1fd19a; box-shadow: 0 0 0 4px #1fd19a22; }
.link-button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; }
.main { min-width: 0; padding: 34px 42px 60px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; }
.page-header h1 { margin: 4px 0 0; font-size: 27px; letter-spacing: -.03em; }
.eyebrow { margin: 0; color: #6680ea; font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.metric-card { position: relative; overflow: hidden; padding: 20px 22px; min-height: 145px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 5px 18px #1f29370a; }
.metric-card::after { content: ""; position: absolute; right: -24px; bottom: -34px; width: 110px; height: 110px; border-radius: 50%; background: currentColor; opacity: .07; }
.metric-card span, .metric-card small, .metric-card strong { display: block; }
.metric-card span { color: var(--muted); font-size: 13px; font-weight: 600; }
.metric-card strong { margin: 12px 0 5px; color: var(--ink); font-size: 34px; }
.metric-card small { color: #9aa4b5; font-size: 11px; }
.metric-card.blue { color: #4266ee; }.metric-card.green { color: #14a778; }.metric-card.purple { color: #8157d8; }.metric-card.amber { color: #df901a; }
.panel { margin-bottom: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 5px 18px #1f293708; }
.panel-heading { min-height: 75px; padding: 19px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.panel-heading h2 { margin: 0 0 4px; font-size: 16px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.text-link { color: var(--primary); font-size: 12px; font-weight: 700; }
.count { padding: 5px 9px; border-radius: 20px; background: #f0f3fa; color: #647087; font-size: 11px; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 12px 15px; color: #8b96a9; background: #fafbfc; font-size: 10px; letter-spacing: .04em; text-align: left; white-space: nowrap; }
td { padding: 15px; border-top: 1px solid #eef1f5; color: #566277; vertical-align: middle; white-space: nowrap; }
td strong, td small { display: block; } td strong { color: var(--ink); } td small { margin-top: 4px; color: #98a2b3; font-size: 10px; }
.empty { padding: 52px 20px; color: var(--muted); text-align: center; }
.empty strong { color: #47536a; }.empty p { margin: 8px 0 0; font-size: 12px; }
.status { display: inline-block; padding: 5px 9px; border-radius: 20px; font-size: 10px; font-weight: 700; background: #edf1f7; color: #65728a; }
.status.sent, .status.downloading, .status.installing { color: #3357dc; background: #eaf0ff; }
.status.success { color: #08835c; background: #e2f7ef; }
.status.failed { color: #bf3345; background: #fdebee; }
.progress { width: 80px; height: 5px; display: inline-block; overflow: hidden; border-radius: 5px; background: #e8ecf2; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.two-column { display: grid; grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); gap: 20px; align-items: start; }
.form-panel, .wide-panel { margin: 0; }
.stack-form { display: grid; gap: 17px; padding: 22px; }
label { display: grid; gap: 7px; color: #445067; font-size: 12px; font-weight: 700; }
label small, .form-hint { color: #929cad; font-size: 10px; font-weight: 400; }
input, select, textarea { width: 100%; border: 1px solid #dbe0e8; border-radius: 9px; padding: 10px 11px; outline: none; color: var(--ink); background: white; transition: border .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: #6681f2; box-shadow: 0 0 0 3px #526fe51a; }
textarea { resize: vertical; }
input[type="file"] { padding: 8px; color: #677389; font-size: 11px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 39px; padding: 0 17px; border: 0; border-radius: 9px; cursor: pointer; font-size: 12px; font-weight: 700; }
.button.primary { color: white; background: var(--primary); box-shadow: 0 6px 16px #375dfb33; }
.button.primary:hover { background: var(--primary-dark); }.button:disabled { opacity: .45; cursor: not-allowed; }
.button.secondary { color: #42506a; border: 1px solid #d9dfeb; background: white; }
.button.secondary:hover { border-color: #bdc7d8; background: #f8f9fc; }
.button.ghost { min-height: 31px; padding: 0 12px; color: #66738a; background: #eef1f6; }
.button.danger { color: #bd3245; border: 1px solid #f3ccd2; background: #fff5f6; }
.button.danger:hover { border-color: #e9aeb7; background: #ffecee; }
.button.compact { min-height: 31px; padding: 0 12px; }
.button.full { width: 100%; min-height: 44px; }
.device-delete-form { display: inline; }
.device-state { display: inline-flex; gap: 7px; align-items: center; color: #7a879a; }.device-state i { width: 7px; height: 7px; border-radius: 50%; background: #9aa4b5; }.device-state.online { color: #07855e; }.device-state.online i { background: #11b47d; box-shadow: 0 0 0 4px #11b47d1a; }
.firmware-list { padding: 3px 22px; }
.firmware-item { display: grid; grid-template-columns: 43px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 18px 0; border-bottom: 1px solid #edf0f4; }.firmware-item:last-child { border: 0; }
.file-icon { width: 43px; height: 48px; display: grid; place-items: center; border-radius: 9px; color: #3858d8; background: #edf1ff; font-size: 9px; font-weight: 800; }
.firmware-info { min-width: 0; }.firmware-info strong { margin-right: 9px; }.firmware-info span { color: #758197; font-size: 11px; }.firmware-info p { margin: 6px 0; color: #657187; font-size: 11px; }.firmware-info small { display: block; overflow: hidden; color: #a0a8b6; font-family: monospace; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { text-align: right; }.file-meta strong, .file-meta small { display: block; }.file-meta strong { font-size: 11px; }.file-meta small { margin-top: 5px; color: #9aa4b5; font-size: 9px; }
.task-create { padding-bottom: 3px; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 16px; align-items: end; padding: 20px 22px; }
.form-hint { margin: -8px 22px 17px; }
.flash-stack { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { padding: 11px 14px; border: 1px solid #dce4ff; border-radius: 9px; color: #3153d1; background: #f0f4ff; font-size: 12px; }
.flash.error { color: #b42e40; border-color: #fad8dd; background: #fff0f2; }.flash.success { color: #087d59; border-color: #ccefe3; background: #eaf9f4; }
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: white; }
.login-visual { position: relative; overflow: hidden; display: grid; place-items: center; padding: 60px; color: white; background: radial-gradient(circle at 30% 30%, #314b93, transparent 38%), linear-gradient(145deg, #111b38, #12182a 62%, #17213d); }
.login-copy { position: relative; z-index: 2; max-width: 510px; }.login-copy .eyebrow { margin-top: 32px; color: #829cff; }.login-copy h1 { margin: 13px 0 18px; font-size: clamp(32px, 4vw, 52px); line-height: 1.22; letter-spacing: -.05em; }.login-copy > p:last-child { color: #97a4c1; }
.signal-orbit { position: absolute; border: 1px solid #6179c63d; border-radius: 50%; }.orbit-one { width: 500px; height: 500px; left: -190px; top: -190px; }.orbit-two { width: 650px; height: 650px; right: -360px; bottom: -320px; }
.login-panel { display: grid; place-items: center; padding: 45px; }
.login-card { width: min(390px, 100%); display: grid; gap: 20px; }.login-card h2 { margin: 7px 0 6px; font-size: 29px; }.muted { margin: 0; color: var(--muted); font-size: 12px; }
.serial-layout { display: grid; grid-template-columns: minmax(270px, 330px) minmax(0, 1fr); gap: 20px; align-items: start; }
.serial-settings-panel, .serial-console-panel { margin: 0; }
.serial-settings { display: grid; gap: 18px; padding: 22px; }
.serial-actions { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.serial-inline-notice { margin: 0; padding: 10px 11px; border-radius: 9px; color: #52617a; background: #f3f5f9; font-size: 11px; line-height: 1.55; }
.serial-inline-notice.error { color: #ac3443; background: #fff0f2; }
.serial-topic-card { min-width: 0; display: grid; gap: 7px; padding: 13px; border: 1px solid #e5e9f1; border-radius: 10px; background: #f8f9fc; }
.serial-topic-card span { color: #7a879a; font-size: 10px; }
.serial-topic-card code { overflow: hidden; color: #33435e; font-size: 10px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.serial-console-panel { min-width: 0; }
.serial-console-heading { min-height: 75px; }
.serial-status { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 20px; color: #68758b; background: #f0f2f6; font-size: 11px; font-weight: 700; white-space: nowrap; }
.serial-status i { width: 7px; height: 7px; border-radius: 50%; background: #9aa4b5; }
.serial-status.connected { color: #087d59; background: #e6f8f1; }.serial-status.connected i { background: #11b47d; box-shadow: 0 0 0 4px #11b47d1a; }
.serial-status.error { color: #b42e40; background: #fff0f2; }.serial-status.error i { background: #d84b5b; }
.serial-toolbar { min-height: 57px; padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.mode-switch { margin: 0; padding: 0; border: 0; display: inline-flex; border-radius: 9px; background: #eef1f6; }
.mode-switch legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mode-switch label { display: block; color: #6c788d; font-size: 11px; font-weight: 700; cursor: pointer; }
.mode-switch input { position: absolute; opacity: 0; pointer-events: none; }
.mode-switch span { display: block; min-width: 60px; padding: 8px 13px; border-radius: 8px; text-align: center; }
.mode-switch input:checked + span { color: white; background: var(--primary); box-shadow: 0 4px 10px #375dfb2b; }
.serial-stats { display: flex; align-items: center; gap: 13px; color: #8792a5; font-size: 10px; }
.serial-stats strong { color: #4c5970; font-variant-numeric: tabular-nums; }
.serial-output { height: 460px; margin: 0; overflow: auto; padding: 18px; color: #cbd5e1; background: #111827; font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace; font-size: 12px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.serial-placeholder { color: #66748a; }
.serial-send-panel { display: grid; gap: 13px; padding: 17px 18px 18px; border-top: 1px solid var(--line); }
.serial-send-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.serial-send-heading strong, .serial-send-heading small { display: block; }
.serial-send-heading strong { color: var(--ink); font-size: 13px; }
.serial-send-heading small { margin-top: 4px; color: #929cad; font-size: 10px; }
.serial-send-panel textarea { min-height: 76px; font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.serial-send-actions { display: grid; grid-template-columns: minmax(145px, 190px) 1fr auto; align-items: end; gap: 12px; }
.serial-send-message { align-self: center; margin: 0; color: #7a879a; font-size: 10px; line-height: 1.5; }
.serial-browser-note { margin-top: 20px; padding: 15px 18px; border: 1px solid #dce4ff; border-radius: 12px; color: #52617a; background: #f3f6ff; }
.serial-browser-note strong { color: #3153d1; font-size: 12px; }.serial-browser-note p { margin: 5px 0 0; font-size: 11px; line-height: 1.6; }
@media (max-width: 1050px) { .metric-grid { grid-template-columns: repeat(2, 1fr); }.two-column { grid-template-columns: 1fr; }.form-panel, .wide-panel { margin-bottom: 0; } }
@media (max-width: 1050px) { .serial-layout { grid-template-columns: 1fr; }.serial-settings-panel, .serial-console-panel { margin-bottom: 0; } }
@media (max-width: 760px) { .shell { grid-template-columns: 1fr; }.sidebar { position: static; width: 100%; height: auto; }.sidebar nav { grid-template-columns: repeat(3, 1fr); }.sidebar-footer { display: none; }.brand { padding-bottom: 15px; }.main { padding: 24px 16px 45px; }.inline-form { grid-template-columns: 1fr; }.login-page { grid-template-columns: 1fr; }.login-visual { display: none; }.login-panel { min-height: 100vh; padding: 25px; }.serial-output { height: 380px; }.serial-send-actions { grid-template-columns: 1fr auto; }.serial-send-message { grid-column: 1 / -1; grid-row: 2; } }
@media (max-width: 520px) { .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }.metric-card { min-height: 125px; padding: 16px; }.metric-card strong { font-size: 28px; }.sidebar nav { grid-template-columns: repeat(2, 1fr); }.serial-toolbar, .serial-send-heading { align-items: stretch; flex-direction: column; }.serial-stats { justify-content: space-between; }.serial-actions, .serial-send-actions { grid-template-columns: 1fr; }.serial-send-message { grid-column: auto; grid-row: auto; } }
