:root {
  --bg: #0e1714;
  --panel: #16231f;
  --panel2: #1d2d27;
  --line: #2d443b;
  --text: #e8f1ec;
  --muted: #8aa79b;
  --accent: #39c58a;
  --danger: #e06c75;
  --warn: #e5c07b;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; }
a { color: var(--accent); text-decoration: none; }
button, input, select { font: inherit; }
button { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select { background: #0f1b17; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 22px; border-bottom: 1px solid var(--line); background: #101d18; position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.topbar nav { display: flex; gap: 14px; flex-wrap: wrap; }
.layout { max-width: 1380px; margin: 0 auto; padding: 18px 22px 40px; }
.device-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0 14px; }
.device-head h1 { margin: 0 0 4px; font-size: 22px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.badge { border-radius: 999px; padding: 5px 12px; font-size: 13px; border: 1px solid var(--line); }
.badge.online { color: #0b2018; background: var(--accent); border-color: var(--accent); }
.badge.offline { color: var(--danger); background: #2a1719; border-color: #5d2b2f; }
.toolbar, .controlbar, .textbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.toolbar { padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.screen-panel { position: relative; background: #000; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; min-height: 220px; display: flex; align-items: center; justify-content: center; }
#screen { display: block; max-width: 100%; max-height: 72vh; width: auto; height: auto; touch-action: none; cursor: crosshair; }
.screen-hint { position: absolute; color: var(--muted); font-size: 14px; pointer-events: none; }
.controlbar { justify-content: space-between; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.lease { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.textbar { padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
#textInput { flex: 1; min-width: 220px; }
.message { min-height: 24px; color: var(--muted); white-space: pre-wrap; word-break: break-word; font: 12px/1.5 ui-monospace, Consolas, monospace; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 20; }
.modal[hidden] { display: none; }
.modal-card { width: min(1000px, 96vw); max-height: 86vh; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
#logsBody { overflow: auto; white-space: pre-wrap; font: 12px/1.5 ui-monospace, Consolas, monospace; color: #cfe3da; }
.login-body { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, #19352b, #0e1714 60%); }
.login-card { width: min(420px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-card h1 { margin: 0 0 6px; font-size: 22px; }
.login-card label { display: block; margin: 18px 0 8px; color: var(--muted); font-size: 13px; }
.login-card input { width: 100%; margin-top: 6px; padding: 11px 12px; }
.login-card button { width: 100%; margin-top: 22px; padding: 11px; background: var(--accent); color: #062018; border: 0; font-weight: 700; }
.error { color: var(--danger); margin-top: 14px; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 12px 0; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-row input, .form-row select { min-width: 150px; }
@media (max-width: 700px) {
  .topbar { padding: 10px 12px; }
  .layout { padding: 12px; }
  .device-head { align-items: flex-start; }
  #screen { max-height: 52vh; }
  .controlbar { align-items: flex-start; }
}

/* multi-device strip */
.device-strip { margin-bottom: 18px; }
.device-strip-head { display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.device-list { display:flex; gap:10px; overflow-x:auto; padding-bottom:4px; }
.device-card { min-width:190px; border:1px solid #d9e2dc; border-radius:10px; padding:10px 12px; background:#fff; cursor:pointer; }
.device-card.active { border-color:#1d7a55; box-shadow:0 0 0 2px rgba(29,122,85,.15); }
.device-card .row { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.device-card .name { font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.device-card .meta { font-size:12px; color:#667a70; margin-top:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.device-card .dot { width:8px; height:8px; border-radius:50%; background:#9aa; display:inline-block; }
.device-card .dot.online { background:#1d9a63; }
.device-card .dot.offline { background:#b5bdb8; }
.device-card .copy { margin-top:6px; font-size:12px; padding:2px 6px; }
.device-head-actions { display:flex; align-items:center; gap:10px; }
.small-btn { padding:4px 8px; font-size:12px; }
