:root { --bg:#f3f4f6; --card:#fff; --ink:#111827; --muted:#6b7280; --line:#e5e7eb; --accent:#2563eb; --accent-ink:#fff; --warn:#b45309; --warn-bg:#fef3c7; --err:#b91c1c; --err-bg:#fee2e2; --ok:#047857; --ok-bg:#d1fae5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg:#0f1115; --card:#181b21; --ink:#e5e7eb; --muted:#9ca3af; --line:#2a2f3a; --accent:#3b82f6; --warn-bg:#3a2a08; --warn:#fbbf24; --err-bg:#3b1212; --err:#f87171; --ok-bg:#0b2f24; --ok:#34d399; } }
* { box-sizing:border-box; }
html, body { margin:0; background:var(--bg); color:var(--ink); font-family:"Sukhumvit Set","Thonburi",-apple-system,"Helvetica Neue",sans-serif; font-size:15px; }
body { padding:16px; }
header { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:12px; }
header h1 { font-size:20px; margin:0; }
header .spacer { flex:1; }
.pill { display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border-radius:999px; background:var(--card); border:1px solid var(--line); font-size:13px; color:var(--muted); }
.pill .dot { width:8px; height:8px; border-radius:50%; background:#9ca3af; }
.pill.ok .dot { background:#10b981; } .pill.err .dot { background:#ef4444; } .pill.busy .dot { background:#f59e0b; }
.layout { display:grid; grid-template-columns: minmax(0,1fr) 380px; gap:16px; }
@media (max-width: 860px) { .layout { grid-template-columns:1fr; } }
.card { background:var(--card); border:1px solid var(--line); border-radius:14px; padding:14px 16px; }
.card h2 { font-size:14px; margin:0 0 10px; color:var(--muted); font-weight:600; letter-spacing:.02em; }
.row { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin:8px 0; }
.row label { min-width:88px; color:var(--muted); font-size:13px; }
.grow { flex:1; min-width:120px; }
input[type=text], input[type=number], select, textarea { font:inherit; color:var(--ink); background:var(--bg); border:1px solid var(--line); border-radius:8px; padding:8px 10px; }
textarea { width:100%; min-height:88px; resize:vertical; font-size:18px; }
input[type=number] { width:84px; }
input[type=range] { flex:1; min-width:120px; }
button { font:inherit; border:1px solid var(--line); background:var(--card); color:var(--ink); border-radius:10px; padding:8px 14px; cursor:pointer; }
button:hover { border-color:var(--accent); }
button.primary { background:var(--accent); color:var(--accent-ink); border-color:var(--accent); font-weight:600; font-size:16px; padding:12px 20px; }
button:disabled { opacity:.5; cursor:default; }
.seg { display:inline-flex; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.seg button { border:0; border-radius:0; padding:6px 10px; font-size:13px; }
.seg button.on { background:var(--accent); color:var(--accent-ink); }
.chk { display:inline-flex; gap:6px; align-items:center; font-size:14px; }
.preview-wrap { overflow:auto; padding:18px 8px; background:repeating-linear-gradient(45deg,transparent 0 10px,rgba(127,127,127,.06) 10px 20px); border-radius:10px; border:1px dashed var(--line); }
.tape { display:inline-block; padding:0; border-radius:3px; box-shadow:0 1px 3px rgba(0,0,0,.3); image-rendering:pixelated; }
.tape canvas { display:block; image-rendering:pixelated; }
.meta { color:var(--muted); font-size:13px; margin-top:8px; display:flex; gap:14px; flex-wrap:wrap; }
.msg { margin-top:10px; padding:10px 12px; border-radius:10px; font-size:14px; display:none; white-space:pre-wrap; }
.msg.warn { display:block; background:var(--warn-bg); color:var(--warn); }
.msg.err { display:block; background:var(--err-bg); color:var(--err); }
.msg.ok { display:block; background:var(--ok-bg); color:var(--ok); }
.hist { display:flex; flex-direction:column; gap:4px; max-height:220px; overflow:auto; }
.hist button { text-align:left; font-size:13px; padding:6px 10px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.small { font-size:12px; color:var(--muted); }
.status-grid { display:grid; grid-template-columns:auto 1fr; gap:4px 12px; font-size:14px; }
.status-grid .k { color:var(--muted); }
.swatch { display:inline-block; width:14px; height:14px; border-radius:3px; border:1px solid rgba(0,0,0,.2); vertical-align:-2px; margin-right:4px; }
.sticky-print { position:sticky; bottom:8px; }
.login { position:fixed; inset:0; background:var(--bg); display:flex; align-items:center; justify-content:center; padding:16px; z-index:10; }
.login-card { background:var(--card); border:1px solid var(--line); border-radius:16px; padding:28px 24px; max-width:360px; width:100%; text-align:center; }
.login-card h1 { font-size:22px; margin:0 0 6px; }
.login-card #gbtn { display:flex; justify-content:center; margin:16px 0; min-height:44px; }
.login[hidden], #app[hidden] { display:none; }
