:root {
  --bg: #ffffff; --panel: #ffffff; --ink: #1a1d1f; --muted: #5b6164; --line: #e4e7e7;
  --accent: #1f6f5c; --accent-ink: #ffffff; --accent-soft: #e6f2ee; --warn: #b5651d; --ok: #147c3f; --bad: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161615; --panel: #201f1d; --ink: #ecebe7; --muted: #a29f98; --line: #34322f;
    --accent: #5cc0a4; --accent-ink: #0d1f1a; --accent-soft: #1d3530; --warn: #e0a060; --ok: #6fcf97; --bad: #ef8a80; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted, .sub { color: var(--muted); }
.small { font-size: 13px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%; }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
label { display: block; font-weight: 600; margin: 10px 0 4px; }
label.inline { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; }
.hint { font-size: 13px; color: var(--muted); font-weight: 400; margin-top: 3px; }
.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px;
  padding: 9px 16px; font-weight: 600; cursor: pointer; text-decoration: none; font-size: 14px; }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.linkbtn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; white-space: nowrap; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.card b { display: block; font-size: 18px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table-wrap { overflow-x: auto; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.online { background: var(--ok); } .dot.offline { background: var(--warn); }
.tag { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--panel); }
.flash.success { border-color: var(--ok); } .flash.error { border-color: var(--bad); color: var(--bad); }
.alerts li { margin-bottom: 4px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.inline-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.inline-form input { width: auto; min-width: 130px; flex: 1; }
.inline-form select { width: auto; max-width: 180px; }

/* App layout */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.app nav { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; }
.brand { font-weight: 700; font-size: 16px; margin: 0 8px 20px; color: var(--ink); text-decoration: none; display: block; }
.brand img { display: block; height: 28px; width: auto; margin-bottom: 6px; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.app nav a.nav { display: block; padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; margin-bottom: 2px; }
.app nav a.nav.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.app nav form { margin-top: 18px; padding: 0 10px; }
.app main { padding: 24px 28px; min-width: 0; max-width: 1200px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }

/* Designer */
.designer { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; align-items: start; }
.designer > *, .designer fieldset { min-width: 0; min-inline-size: 0; }
.block { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--panel); }
.block-head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.block-head .name { flex: 1; }
.block-head button { background: none; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); cursor: pointer; padding: 1px 7px; }
.block .fields { margin-top: 6px; }
.block .fields label { font-size: 13px; margin: 6px 0 3px; }
.block.off .fields { display: none; }
.block.off .name { color: var(--muted); }
.eink-frame { background: #3a3a3a; padding: 14px; border-radius: 14px; max-width: 600px; }
.eink-frame img { width: 100%; height: auto; aspect-ratio: 800 / 480; display: block; border-radius: 3px; background: #fff; }
.tv-frame { background: #111; padding: 10px 10px 16px; border-radius: 10px; max-width: 600px; }
.tv-frame iframe { width: 100%; aspect-ratio: 16/9; border: 0; display: block; border-radius: 3px; background: #000; }
.sticky { position: sticky; top: 16px; }

/* Auth + public */
.auth { max-width: 400px; margin: 60px auto; padding: 0 16px; }
.site-head { display: flex; justify-content: space-between; align-items: center; max-width: 1080px; margin: 0 auto; padding: 18px 16px; }
.site-head .brand { margin: 0; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: center; padding: 40px 0 30px; }
.hero h1 { font-size: 40px; line-height: 1.15; margin-bottom: 14px; }
.hero p { font-size: 18px; color: var(--muted); }
.section { padding: 34px 0; border-top: 1px solid var(--line); }
.section h2 { font-size: 26px; margin-bottom: 18px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.price { font-size: 30px; font-weight: 700; }
.footer { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13px; }
details { border-bottom: 1px solid var(--line); padding: 12px 0; }
summary { cursor: pointer; font-weight: 600; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .app nav { display: flex; overflow-x: auto; gap: 4px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); align-items: center; }
  .app nav .brand { display: none; }
  .app nav a.nav { white-space: nowrap; }
  .app nav form { margin: 0; padding: 0; }
  .app main { padding: 16px; }
  .designer, .hero, .features, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: 30px; }
}

/* Text only screen readers hear (e.g. a label for an icon-only column). */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
