/* Shared look of the three web apps (room server, controller, central server).
   Palette and type follow the product site mock-up: navy header and navigation,
   warm light ground, white cards, teal for "on / normal", amber for highlights,
   red for "Oprește tot" and "Necesită service". Each app adds its own app.css. */

/* Fonts bundled with the apps (work offline). Variable woff2 files from Google Fonts, SIL Open Font
   License 1.1 (see ../fonts/OFL-*.txt). latin-ext holds the Romanian diacritics (ș ț ă î â). */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url("../fonts/space-grotesk-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url("../fonts/space-grotesk-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* navy chrome */
  --ink: #14162b;
  --ink-2: #2a2d52;
  --ink-3: #3a3e68;
  --ink-line: #4a4e73;
  --on-ink: #d5d7e8;
  --on-ink-strong: #ffffff;

  /* content */
  --bg: #f6f5f1;
  --card: #ffffff;
  --sunken: #ecebe5;
  --line: #dddcd5;
  --line-soft: #ecebe5;
  --text: #1b1d33;
  --text-2: #40435c;
  --muted: #555872;

  /* meaning */
  --teal: #1fa595;          /* dots, switches, bars */
  --teal-strong: #12796e;   /* fills with white text (5:1) */
  --teal-text: #0f6b62;     /* teal text on light ground */
  --teal-soft: #e2f3f0;
  --teal-light: #5fd3c4;    /* on navy */
  --amber: #f2b544;
  --amber-soft: #fcefd3;
  --amber-text: #7a5207;
  --red: #b3261e;
  --red-soft: #f9e4e2;
  --red-text: #9c1f18;

  --primary: var(--ink);
  --primary-text: #ffffff;
  --focus: #2c8fd6;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(20 22 43 / 6%), 0 4px 16px rgb(20 22 43 / 5%);
  --touch: 56px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #0b0c1a;
    --ink-2: #23264a;
    --ink-3: #343861;
    --ink-line: #3c4068;
    --bg: #12142a;
    --card: #1b1e3a;
    --sunken: #23264a;
    --line: #2f335c;
    --line-soft: #272a50;
    --text: #eceef7;
    --text-2: #c4c7dc;
    --muted: #a3a6c2;
    --teal-strong: #1a8f82;
    --teal-text: #5fd3c4;
    --teal-soft: #173a3d;
    --amber-soft: #3a3020;
    --amber-text: #f2c66d;
    --red: #d6453b;
    --red-soft: #3d1f27;
    --red-text: #ff9b92;
    --primary: #f2b544;
    --primary-text: #14162b;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
a { color: var(--teal-text); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- navy top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap;
  padding: 14px 24px; background: var(--ink); color: var(--on-ink-strong);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { margin: 0; font-size: 1.35rem; color: var(--on-ink-strong); }
.topbar .muted, .topbar .who { color: var(--on-ink); }
.topbar__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.topbar .btn { background: transparent; color: var(--on-ink-strong); border-color: var(--ink-line); }
.topbar .btn:hover { background: var(--ink-2); }
.topbar .btn--accent { background: var(--amber); border-color: var(--amber); color: #14162b; }
.topbar .btn--accent:hover { background: #f5c362; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { flex: none; width: 40px; height: 40px; display: block; }
.topbar__title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar__sub { color: var(--on-ink); font-size: 0.9rem; }
.brand-plate { background: #ffffff; border-radius: var(--radius); padding: 16px 22px; display: flex; justify-content: center; }
.brand-logo { display: block; width: 100%; max-width: 340px; height: auto; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; min-width: 48px; padding: 0 18px;
  font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none;
  border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  background: var(--card); color: var(--text); cursor: pointer; touch-action: manipulation;
  transition: background-color 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn--primary:hover { border-color: var(--primary); filter: brightness(1.15); }
.btn--accent { background: var(--amber); border-color: var(--amber); color: #14162b; }
.btn--small { min-height: 40px; padding: 0 14px; font-size: 0.92rem; }
.btn--wide { width: 100%; }
.btn--danger { background: transparent; color: var(--red-text); border-color: var(--red); }
.btn--danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn--stop { background: var(--red); border-color: var(--red); color: #ffffff; }
.btn--stop:hover { border-color: var(--red); filter: brightness(1.08); }

/* ---------- chips, badges, banners ---------- */
.chip, .badge {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 0.82rem; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--sunken); color: var(--text-2);
}
.chip.ok, .badge--on { background: var(--teal-soft); color: var(--teal-text); }
.chip.bad, .badge--offline, .badge--service { background: var(--red-soft); color: var(--red-text); }
.chip.warn { background: var(--amber-soft); color: var(--amber-text); }
.badge--off { background: var(--sunken); color: var(--muted); }

.banner { margin: 16px auto 0; max-width: 1400px; padding: 14px 18px; border-radius: 12px; font-weight: 600; line-height: 1.4; }
.banner--warn { background: var(--amber-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--amber) 55%, transparent); }
.banner--bad { background: var(--red-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--red) 45%, transparent); }

/* ---------- forms ---------- */
.field, .form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; font-weight: 500; color: var(--text-2); }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
select, textarea {
  font: inherit; color: var(--text); background: var(--card);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); min-height: 48px; padding: 0 12px; width: 100%;
}
textarea { padding: 10px 12px; min-height: auto; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 25%, transparent); }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; accent-color: var(--teal-strong); }
input[type="range"] { accent-color: var(--teal-strong); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--text); font-weight: 500; }
.hint { color: var(--muted); font-size: 0.92rem; margin: 4px 0 12px; }
.hint.warn { color: var(--amber-text); }
.muted { color: var(--muted); font-weight: normal; }

/* ---------- surfaces ---------- */
.box, .panel-box, .unit {
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
details > summary { cursor: pointer; }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table th { color: var(--muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--sunken) 45%, transparent); }

.eyebrow { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: 24px; margin: 0 auto; max-width: 540px; z-index: 20;
  background: var(--ink); color: #ffffff; padding: 14px 18px; border-radius: 12px; text-align: center;
  box-shadow: 0 8px 30px rgb(0 0 0 / 25%);
}

.code, .code-box { font-family: var(--font-mono); }
.code-box { font-size: 0.85rem; word-break: break-all; background: var(--sunken); padding: 10px; border-radius: var(--radius-sm); user-select: all; }

/* ---------- navigation tabs (sidebar on wide screens) ---------- */
.layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.tabs { display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; background: var(--ink); }
.tabs .tab {
  font: inherit; font-size: 0.97rem; font-weight: 500; text-align: left; min-height: 46px; padding: 0 14px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--on-ink); cursor: pointer;
}
.tabs .tab:hover { background: var(--ink-2); color: #ffffff; }
.tabs .tab[aria-selected="true"] { background: var(--ink-2); color: #ffffff; font-weight: 600; box-shadow: inset 3px 0 0 var(--amber); }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; min-height: 0; }
  .tabs { flex-direction: row; overflow-x: auto; padding: 8px 12px; }
  .tabs .tab { white-space: nowrap; flex: none; }
  .tabs .tab[aria-selected="true"] { box-shadow: inset 0 -3px 0 var(--amber); }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .topbar { padding: 12px 16px; }
  .table { display: block; overflow-x: auto; }
}

/* ---------- colour tones (stage 11: friendlier, colourful look) ----------
   An element gets a tone with class .tone-<name> (or by setting --tone*), then uses
   var(--tone) for fills, var(--tone-soft) for tinted grounds and var(--tone-ink) for
   text on a fill. Fills are vivid; text on them is navy, so it reads well. */
:root {
  --c-teal: #2bb3a3;   --c-teal-deep: #0f6b62;
  --c-blue: #4ea4ea;   --c-blue-deep: #1d5f99;
  --c-amber: #f5b83d;  --c-amber-deep: #8a5a00;
  --c-purple: #a37ef0; --c-purple-deep: #5b33b0;
  --c-pink: #f07b93;   --c-pink-deep: #a3243f;
  --c-green: #7cc96a;  --c-green-deep: #2f6e22;
  --tone: var(--c-teal); --tone-deep: var(--c-teal-deep); --tone-ink: #14162b;
  --tone-soft: color-mix(in srgb, var(--tone) 16%, var(--card));
  --tone-line: color-mix(in srgb, var(--tone) 45%, var(--card));
  --radius: 20px;
}
.tone-teal   { --tone: var(--c-teal);   --tone-deep: var(--c-teal-deep); }
.tone-blue   { --tone: var(--c-blue);   --tone-deep: var(--c-blue-deep); }
.tone-amber  { --tone: var(--c-amber);  --tone-deep: var(--c-amber-deep); }
.tone-purple { --tone: var(--c-purple); --tone-deep: var(--c-purple-deep); }
.tone-pink   { --tone: var(--c-pink);   --tone-deep: var(--c-pink-deep); }
.tone-green  { --tone: var(--c-green);  --tone-deep: var(--c-green-deep); }
[class*="tone-"] {
  --tone-soft: color-mix(in srgb, var(--tone) 16%, var(--card));
  --tone-line: color-mix(in srgb, var(--tone) 45%, var(--card));
}
@media (prefers-color-scheme: dark) {
  :root, [class*="tone-"] {
    --tone-soft: color-mix(in srgb, var(--tone) 22%, var(--card));
    --tone-line: color-mix(in srgb, var(--tone) 55%, var(--card));
  }
  .tone-teal { --tone-deep: #7fe3d6; } .tone-blue { --tone-deep: #9ccdf5; } .tone-amber { --tone-deep: #f7cf7d; }
  .tone-purple { --tone-deep: #c9b1f7; } .tone-pink { --tone-deep: #f7a9b8; } .tone-green { --tone-deep: #a9e09c; }
}

/* five brand colours under the navy header, like the dots of the logo */
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 5px;
  background: linear-gradient(90deg, var(--c-teal) 0 20%, var(--c-blue) 20% 40%, var(--c-amber) 40% 60%,
                                     var(--c-purple) 60% 80%, var(--c-pink) 80% 100%);
}
.topbar { position: sticky; }
.topbar + * { margin-top: 5px; }

.icon-tile {
  flex: none; width: 56px; height: 56px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; background: var(--tone-soft); box-shadow: inset 0 0 0 2px var(--tone-line);
}
.icon-tile--sm { width: 40px; height: 40px; border-radius: 12px; font-size: 1.2rem; }
.btn--tone { background: var(--tone); border-color: var(--tone); color: var(--tone-ink); }
.btn--tone:hover { border-color: var(--tone-deep); filter: brightness(1.04); }

/* sidebar entries get an icon */
.tabs .tab[data-tab]::before { display: inline-block; width: 1.6em; }
.tabs .tab[data-tab="equipment"]::before { content: "🔌"; }
.tabs .tab[data-tab="zones"]::before { content: "🗺️"; }
.tabs .tab[data-tab="scenes"]::before { content: "✨"; }
.tabs .tab[data-tab="schedules"]::before { content: "⏰"; }
.tabs .tab[data-tab="users"]::before { content: "👥"; }
.tabs .tab[data-tab="events"]::before { content: "📋"; }
.tabs .tab[data-tab="license"]::before { content: "🔑"; }
.tabs .tab[data-tab="config"]::before { content: "⚙️"; }
.tabs .tab[data-tab="status"]::before { content: "🎛️"; }
.tabs .tab[data-tab="pairing"]::before { content: "🔗"; }
.tabs .tab[data-tab="backup"]::before { content: "💾"; }
.tabs .tab[data-tab="security"]::before { content: "🔒"; }
