:root {
  --ink: #171813;
  --paper: #f8f6e9;
  --paper-deep: #e8e3ce;
  --chrome: #d8d5c6;
  --red: #e43b2d;
  --yellow: #f3c928;
  --muted: #6f7068;
  --line: #b9b7aa;
  --shadow: 0 24px 60px rgba(34, 35, 27, .19);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #c8c6b9;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 1040px; min-height: 100vh; background: radial-gradient(circle at 50% 30%, #e7e4d7 0, #cac8bb 48%, #b5b3a8 100%); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid rgba(23,24,19,.25); background: rgba(237,235,223,.86); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.brand b { display: block; font-size: 18px; letter-spacing: .01em; }
.brand small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .18em; }
.brand-mark { width: 38px; height: 38px; display: grid; grid-template: 1fr 1fr / 1fr 1fr; gap: 2px; padding: 5px; background: var(--ink); border-radius: 9px 9px 9px 2px; }
.brand-mark i:nth-child(1) { background: var(--paper); }.brand-mark i:nth-child(2) { background: var(--red); }.brand-mark i:nth-child(3) { background: var(--yellow); }.brand-mark i:nth-child(4) { background: var(--ink); border: 1px solid var(--paper); }
.top-actions { display: flex; align-items: center; gap: 9px; }
.token-field { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.token-field input { width: 210px; }
input, select, textarea { border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.65); padding: 9px 10px; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23,24,19,.09); }
.button { border: 1px solid var(--ink); border-radius: 7px; padding: 9px 14px; font-weight: 650; cursor: pointer; background: transparent; }
.button:disabled { opacity: .35; cursor: default; }
.button.primary { background: var(--ink); color: var(--paper); }
.button.primary:not(:disabled):hover { background: var(--red); border-color: var(--red); }
.button.secondary:hover { background: rgba(23,24,19,.07); }
.button.tiny { padding: 6px 9px; font-size: 12px; }
.icon-button { border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; border-radius: 6px; padding: 4px 6px; }
.icon-button:hover { background: rgba(23,24,19,.08); }
.workspace { height: calc(100vh - 72px); display: grid; grid-template-columns: 230px minmax(570px, 1fr) 300px; }
.rail { background: rgba(235,233,220,.76); backdrop-filter: blur(12px); display: flex; flex-direction: column; min-height: 0; }
.devices-panel { border-right: 1px solid rgba(23,24,19,.24); }
.inspector-panel { border-left: 1px solid rgba(23,24,19,.24); }
.rail-heading { height: 58px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid rgba(23,24,19,.18); font-size: 12px; font-weight: 700; letter-spacing: .14em; }
.device-list { flex: 1; overflow: auto; padding: 10px; }
.device-item { width: 100%; display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; padding: 12px 9px; border: 0; border-radius: 9px; background: transparent; text-align: left; cursor: pointer; }
.device-item:hover { background: rgba(255,255,255,.35); }.device-item.active { background: var(--ink); color: var(--paper); }
.device-item i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }.device-item.online i { background: var(--red); }
.device-item b { display: block; font-size: 13px; }.device-item small { color: inherit; opacity: .65; font-size: 10px; }
.device-item em { font-style: normal; font: 11px "SFMono-Regular", Consolas, monospace; }
.rail-foot { height: 46px; flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 0 16px; color: var(--muted); border-top: 1px solid rgba(23,24,19,.18); font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }.status-dot.connected { background: var(--red); box-shadow: 0 0 0 3px rgba(228,59,45,.18); }
.stage { min-width: 0; padding: 30px clamp(24px, 5vw, 70px) 18px; display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; overflow: auto; }
.stage-meta, .stage-footer { width: min(100%, 720px); margin: 0 auto; display: flex; align-items: flex-end; justify-content: space-between; }
.eyebrow { display: block; color: var(--red); font-size: 10px; font-weight: 800; letter-spacing: .19em; text-transform: uppercase; }
h1 { font-size: clamp(24px, 3vw, 38px); margin: 3px 0 0; letter-spacing: -.045em; }
.screen-spec { text-align: right; }.screen-spec b { display: block; font: 13px "SFMono-Regular", Consolas, monospace; }.screen-spec span { color: var(--muted); font-size: 10px; }
.device-shell { width: min(100%, 720px); aspect-ratio: 1.18; min-height: 500px; margin: 26px auto; padding: 38px 54px 30px; border: 1px solid #88877e; border-radius: 44px; background: linear-gradient(145deg, #efeee8, #bcbab0); box-shadow: var(--shadow), inset 0 2px 3px white, inset 0 -2px 6px rgba(0,0,0,.22); display: flex; flex-direction: column; }
.screen-wrap { flex: 1; display: grid; place-items: center; min-height: 0; border: 10px solid #25251f; border-radius: 8px; background: #1a1b17; box-shadow: inset 0 0 0 1px #000, 0 1px 1px white; overflow: hidden; }
.screen { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 100%; background: #fff; overflow: hidden; touch-action: none; color: #000; }
.hardware-strip { height: 28px; display: flex; align-items: flex-end; justify-content: space-between; color: #6e6c65; font: 9px "SFMono-Regular", Consolas, monospace; letter-spacing: .13em; }.hardware-strip i { width: 7px; height: 7px; border-radius: 50%; background: #8c8a82; box-shadow: inset 0 1px 2px #555; }
.stage-footer { align-items: center; color: var(--muted); font-size: 11px; font-family: "SFMono-Regular", Consolas, monospace; }
.dashboard-screen-header { position: absolute; inset: 0 0 auto; height: 12%; display: flex; align-items: center; border-bottom: 2px solid #000; padding: 0 2%; background: #fff; z-index: 2; }
.dashboard-screen-header > i { width: 6%; aspect-ratio: 1; display: grid; place-items: center; background: var(--red); }
.dashboard-screen-header > i::before { content: ""; width: 48%; aspect-ratio: 1; border: 3px solid #fff; border-radius: 50%; }
.dashboard-screen-header strong { margin-left: 2.2%; font-size: clamp(11px, 2.2vw, 20px); font-weight: 900; letter-spacing: -.04em; }
.dashboard-screen-header em { margin-left: auto; padding: 1.1% 2.2%; background: var(--yellow); color: #000; font: 800 clamp(7px, 1.25vw, 12px) "SFMono-Regular", Consolas, monospace; font-style: normal; }
.widget { position: absolute; border: 0; border-radius: 0; background: #fff; overflow: hidden; cursor: pointer; user-select: none; }
.widget.selected { outline: 3px solid var(--red); outline-offset: -4px; z-index: 5; }
.widget-head { position: absolute; left: 5%; top: 5%; height: 10%; color: var(--red); font-size: clamp(8px, 1.25vw, 13px); font-weight: 800; line-height: 1; }
.widget-head::after { display: none; }
.widget-body { position: absolute; inset: 29% 5% 4%; font-size: clamp(7px, 1.15vw, 12px); line-height: 1.3; overflow: hidden; }
.widget-agenda { border-right: 2px solid #000; }
.widget-agenda .widget-head { left: 5%; top: 5%; }
.widget-agenda .widget-body { inset: 15% 5% 4% 5%; display: grid; grid-template-rows: repeat(4, 1fr); }
.widget-agenda .widget-body::before { content: ""; position: absolute; left: 4%; top: 12%; bottom: 13%; width: 2px; background: var(--red); }
.preview-line { position: relative; display: grid; grid-template-columns: 34% 1fr; gap: 6%; align-items: center; padding-left: 13%; white-space: nowrap; overflow: hidden; font-size: clamp(9px, 1.65vw, 17px); font-weight: 800; }
.preview-line::before { content: ""; position: absolute; left: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--red); }
.preview-line b { color: #000; }.preview-line span { overflow: hidden; text-overflow: ellipsis; }
.widget-weather .widget-head { left: 10%; top: 5%; color: var(--yellow); }
.widget-weather .widget-body { inset: 14% 8% 5%; display: grid; grid-template-rows: 38% 37% 25%; align-items: center; }
.preview-weather-symbol { position: relative; width: 76%; height: 78%; justify-self: center; }
.preview-weather-symbol::before, .preview-weather-symbol::after, .preview-weather-symbol i { content: ""; position: absolute; border: 2px solid #000; border-radius: 50%; background: #fff; }
.preview-weather-symbol::before { width: 35%; aspect-ratio: 1; left: 10%; top: 5%; }.preview-weather-symbol::after { width: 40%; aspect-ratio: 1; left: 34%; top: 0; }.preview-weather-symbol i { width: 62%; height: 30%; left: 10%; top: 25%; border-radius: 8px; }
.preview-weather-symbol b { position: absolute; left: 18%; top: 54%; color: #000; font-size: clamp(9px, 1.55vw, 15px); letter-spacing: .18em; transform: rotate(-20deg); }
.preview-weather-copy { align-self: center; text-align: center; }.preview-temp { font-size: clamp(20px, 4.2vw, 43px); font-weight: 500; line-height: 1; }.preview-location { margin-top: 15%; font-weight: 700; color: #000; }
.preview-weather-battery { align-self: end; display: flex; align-items: center; justify-content: center; gap: 10%; font-size: clamp(8px, 1.25vw, 13px); }
.preview-weather-battery > i { position: relative; display: block; width: 42%; height: 15px; padding: 2px; border: 2px solid #000; font-style: normal; }.preview-weather-battery > i::after { content: ""; position: absolute; right: -5px; top: 3px; width: 3px; height: 5px; background: #000; }.preview-weather-battery > i span { display: block; width: 77%; height: 100%; background: var(--yellow); }
.widget-todo .widget-head::after { background: var(--yellow); }
.widget-todo .widget-body { inset: 38% 7% 5%; display: grid; grid-template-rows: repeat(3, 1fr); }
.preview-todo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 800; }.preview-todo::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 9px; border: 1.5px solid #000; vertical-align: -2px; }
.widget-device .widget-head { display: none; }
.widget-device .widget-body { inset: 0; display: grid; grid-template-columns: 62% 38%; align-items: center; padding: 0 3%; }
.preview-sync, .preview-battery { display: flex; align-items: center; gap: 8px; font-size: clamp(7px, 1.2vw, 12px); }
.preview-sync i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; font-size: 14px; font-style: normal; }
.preview-battery { height: 65%; padding-left: 9%; border-left: 2px solid #000; }
.preview-battery > i { width: 33px; height: 14px; padding: 2px; display: flex; gap: 2px; border: 2px solid #000; font-style: normal; }.preview-battery > i span { flex: 1; background: var(--yellow); }
.template-note { margin-bottom: 18px; padding: 12px; border: 1px solid var(--line); border-left: 4px solid var(--red); background: rgba(255,255,255,.36); }.template-note b, .template-note span { display: block; }.template-note span { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.inspector { flex: 1; padding: 14px; overflow: auto; }
.empty-copy { color: var(--muted); font-size: 12px; line-height: 1.6; padding: 12px; }
.field { display: block; margin-bottom: 12px; }.field > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .08em; }.field input, .field select, .field textarea { width: 100%; }.field textarea { min-height: 90px; resize: vertical; font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }.field-grid .field { margin-bottom: 8px; }
.accent-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }.accent-picker button { height: 34px; border: 2px solid transparent; border-radius: 6px; cursor: pointer; }.accent-picker button.active { border-color: var(--ink); outline: 1px solid var(--paper); outline-offset: -3px; }.accent-black { background: var(--ink); }.accent-red { background: var(--red); }.accent-yellow { background: var(--yellow); }
.danger-link { width: 100%; margin-top: 10px; padding: 8px; border: 0; background: transparent; color: var(--red); cursor: pointer; font-size: 11px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 100; font-size: 12px; }.toast.show { opacity: 1; transform: translate(-50%, 0); }
dialog { width: min(460px, calc(100vw - 40px)); border: 1px solid var(--ink); border-radius: 14px; padding: 0; background: var(--paper); box-shadow: var(--shadow); }dialog::backdrop { background: rgba(22,22,18,.42); backdrop-filter: blur(3px); }dialog form, .token-result { padding: 24px; }.dialog-heading { display: flex; justify-content: space-between; margin-bottom: 20px; }.dialog-heading h2, .token-result h2 { margin: 3px 0 0; }.dialog-heading + label, dialog form > label { display: block; margin: 12px 0; font-size: 11px; font-weight: 700; }dialog label input { width: 100%; margin-top: 5px; }.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }.token-result code { display: block; word-break: break-all; margin: 16px 0; padding: 14px; border: 1px dashed var(--ink); background: var(--paper-deep); }
@media (max-width: 1200px) { .workspace { grid-template-columns: 190px minmax(540px, 1fr) 280px; }.stage { padding-left: 24px; padding-right: 24px; }.device-shell { min-height: 450px; padding: 30px 42px 24px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
