/* ===== Tokens ===== */
:root {
  --ink: #16213A;        /* πλοήγηση, κείμενο */
  --ink-2: #2B3A5C;
  --canvas: #EEF1F5;     /* φόντο χώρου εργασίας */
  --panel: #FFFFFF;
  --line: #D6DCE5;
  --muted: #5E6B82;
  --amber: #F2A900;      /* κύριες ενέργειες */
  --amber-ink: #3A2A00;
  --live: #1FA971;       /* σε σύνδεση */
  --off: #9AA4B5;        /* εκτός σύνδεσης */
  --danger: #C8362F;
  --radius-s: 4px;
  --radius-m: 8px;
  --font: "Commissioner", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --step--1: .8125rem; --step-0: .9375rem; --step-1: 1.125rem; --step-2: 1.5rem;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 400 var(--step-0)/1.5 var(--font); color: var(--ink); background: var(--canvas); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
a { color: var(--ink-2); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: var(--step-1); font-weight: 600; }
h3 { font-size: var(--step-0); font-weight: 600; }
small, .muted { color: var(--muted); }
code, .mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .9em; }

/* ===== Shell ===== */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.rail { background: var(--ink); color: #DCE3EF; display: flex; flex-direction: column; padding: 20px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: var(--step-1); color: #fff; padding: 0 10px 22px; letter-spacing: .01em; }
.brand-mark { width: 22px; height: 15px; border: 2.5px solid var(--amber); border-radius: 3px; position: relative; }
.brand-mark::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 8px; height: 2.5px; background: var(--amber); transform: translateX(-50%); }
.brand-lg { color: var(--ink); font-size: var(--step-2); padding: 0 0 20px; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a { color: inherit; text-decoration: none; padding: 9px 12px; border-radius: var(--radius-s); font-weight: 500; }
#nav a:hover { background: var(--ink-2); }
#nav a.active { background: #fff; color: var(--ink); }
.rail-foot { margin-top: auto; padding: 12px; font-size: var(--step--1); display: flex; flex-direction: column; gap: 8px; color: #AEB9CC; border-top: 1px solid var(--ink-2); }
.me-box { display: flex; flex-direction: column; }
.me-box b { color: #fff; font-weight: 600; }
.me-actions { display: flex; justify-content: space-between; gap: 8px; }
.tenant { font-weight: 600; padding: 7px 12px; border-radius: 999px; background: var(--canvas); border: 1px solid var(--line); font-size: var(--step--1); }
.role-admin { background: #FDEFC4; color: var(--amber-ink); }
.linklike { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

.work { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 18px 28px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: var(--step-2); font-weight: 600; flex: 1; }
.filter { display: flex; align-items: center; gap: 8px; font-size: var(--step--1); color: var(--muted); }
.filter select { min-width: 200px; }
.menu-toggle { display: none; }
main { padding: 24px 28px 60px; max-width: 1400px; }
main:focus { outline: none; }

/* ===== Controls ===== */
.btn { font: 500 var(--step--1)/1 var(--font); padding: 9px 14px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
a.btn, label.btn { text-decoration: none; display: inline-flex; align-items: center; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.icon { padding: 6px 9px; }
.btn.small { padding: 6px 10px; }
.btn.wide { width: 100%; padding: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; color: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; min-width: 0; }
textarea { resize: vertical; min-height: 64px; }
input[type=color] { padding: 2px; width: 44px; height: 36px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--ink); }
label { display: flex; flex-direction: column; gap: 5px; font-size: var(--step--1); font-weight: 500; color: var(--ink-2); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { color: var(--danger); margin: 0; font-size: var(--step--1); flex: 1; }
.hint { font-size: var(--step--1); color: var(--muted); margin: 4px 0 0; font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px 14px; margin: 0; }
legend { font-size: var(--step--1); font-weight: 600; padding: 0 6px; }
.days { display: flex; flex-wrap: wrap; gap: 6px 14px; }

/* ===== Page bits ===== */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.section { margin-bottom: 32px; }
.section > h2 { margin-bottom: 12px; display: flex; align-items: baseline; gap: 10px; }
.section > h2 small { font-weight: 400; font-size: var(--step--1); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); }
.panel-pad { padding: 18px; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius-m); }
.empty p { margin: 0 0 14px; }
.notice { background: #FFF6DB; border: 1px solid #F0D58A; border-radius: var(--radius-m); padding: 14px 16px; margin-bottom: 22px; }
.notice h3 { margin-bottom: 8px; }
.summary-line { font-size: var(--step-1); margin: 0 0 22px; color: var(--ink-2); }
.summary-line b { color: var(--ink); }

table.data { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: var(--step--1); }
table.data th { background: #F6F8FB; font-weight: 600; color: var(--muted); white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.actions { white-space: nowrap; text-align: right; }
table.data td.actions .btn { margin-left: 4px; }
.cell-main { font-weight: 600; font-size: var(--step-0); }
.status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.lamp { width: 9px; height: 9px; border-radius: 50%; background: var(--off); display: inline-block; flex: none; }
.on .lamp, .lamp.on { background: var(--live); box-shadow: 0 0 0 3px rgba(31,169,113,.18); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #E6EAF1; font-size: .75rem; font-weight: 500; white-space: nowrap; }
.tag.amber { background: #FDEFC4; color: var(--amber-ink); }
.tag.live { background: #D9F3E8; color: #0E6B45; }

/* ===== Monitor tiles (το χαρακτηριστικό στοιχείο) ===== */
.monitors { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 22px 18px; }
.monitor { cursor: pointer; background: none; border: 0; padding: 0; text-align: left; font: inherit; color: inherit; }
.monitor .bezel { background: var(--ink); border-radius: 6px; padding: 6px; }
.monitor .glass { aspect-ratio: 16 / 9; border-radius: 2px; background: #2A3550; display: flex; align-items: flex-end; padding: 8px; color: #AEB9CC; font-size: .75rem; overflow: hidden; }
.monitor.on .glass { background: linear-gradient(160deg, #24406E, #16213A 70%); color: #fff; }
.monitor .stand { width: 26%; height: 6px; margin: 0 auto; background: #B7C0CF; border-radius: 0 0 4px 4px; }
.monitor .mlabel { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.monitor .mlabel b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.monitor .mlabel small { margin-left: auto; font-size: .72rem; }
.monitor:hover .bezel { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ===== Layout previews ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.lp { position: relative; aspect-ratio: 16 / 9; background: var(--ink); border-radius: 3px; overflow: hidden; }
.lp.portrait { aspect-ratio: 9 / 16; width: 146px; max-width: 100%; margin: 0 auto; }
.lp.big.portrait { width: 230px; }
.zone-editor .lp.portrait { width: 101px; margin: 0; }
.lp .lz { position: absolute; border: 1px solid var(--ink); background: #3E5585; color: #fff; font-size: .7rem; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2px; overflow: hidden; }
.lp .lz:nth-child(3n+2) { background: #56709F; }
.lp .lz:nth-child(3n) { background: #6F88B5; }
.lp .lz.hl { background: var(--amber); color: var(--amber-ink); font-weight: 600; }
.lp.big { max-width: 560px; }

.zone-rows { display: flex; flex-direction: column; gap: 6px; }
.zone-row { display: grid; grid-template-columns: 1.6fr repeat(4, .8fr) auto; gap: 6px; align-items: center; }
.zone-row.head { font-size: .75rem; color: var(--muted); font-weight: 600; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== Media ===== */
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius-m); padding: 22px; text-align: center; background: var(--panel); margin-bottom: 20px; }
.dropzone.drag { border-color: var(--amber); background: #FFFBEF; }
.dropzone p { margin: 0 0 10px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.media-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; display: flex; flex-direction: column; }
.media-card .thumb { aspect-ratio: 16 / 9; background: var(--ink); display: flex; align-items: center; justify-content: center; }
.media-card .thumb img, .media-card .thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-card .meta { padding: 10px; font-size: var(--step--1); display: flex; flex-direction: column; gap: 3px; }
.media-card .meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-card .meta .row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; width: 0; background: var(--amber); transition: width .2s; }

/* ===== Content editor ===== */
.editor-head { display: grid; grid-template-columns: 2fr 1fr 1.4fr auto auto; gap: 12px; align-items: end; margin-bottom: 22px; }
.zone-editor { display: grid; grid-template-columns: 180px 1fr; gap: 18px; padding: 16px; margin-bottom: 14px; }
.zone-editor .lp { width: 100%; }
.zone-editor h3 { margin: 10px 0 2px; }
.items { display: flex; flex-direction: column; gap: 8px; }
.item-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: #FAFBFD; }
.item-row .idx { font-weight: 600; color: var(--muted); padding-top: 8px; text-align: center; }
.item-row .fields { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: end; }
.item-row .fields > label { flex: 0 1 auto; }
.item-row .fields > label.grow { flex: 1 1 240px; }
.item-row .fields input[type=number] { width: 90px; }
.item-row .ctrl { display: flex; gap: 2px; }
.item-thumb { width: 72px; aspect-ratio: 16/9; object-fit: cover; border-radius: 3px; background: var(--ink); }
.add-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.add-row select { max-width: 260px; }

/* ===== Video wall grid ===== */
.wall-grid { display: grid; gap: 6px; margin-top: 8px; }
.wall-cell { background: var(--ink); border-radius: 4px; padding: 8px; aspect-ratio: 16 / 9; display: flex; flex-direction: column; justify-content: space-between; color: #fff; font-size: .72rem; }
.wall-cell select { font-size: .78rem; padding: 4px; }
.member-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow: auto; }

/* ===== Map ===== */
#map { height: 560px; border-radius: var(--radius-m); border: 1px solid var(--line); }

/* ===== Modal & toast ===== */
dialog { border: 0; border-radius: var(--radius-m); padding: 0; width: min(760px, 94vw); max-height: 90vh; color: var(--ink); box-shadow: 0 24px 60px rgba(22,33,58,.35); }
dialog::backdrop { background: rgba(22,33,58,.5); }
dialog form { display: flex; flex-direction: column; max-height: 90vh; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 20px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #F6F8FB; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; }
#toast div { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: var(--radius-s); box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: var(--step--1); max-width: 90vw; }
#toast div.error { background: var(--danger); }

/* ===== Login ===== */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: var(--canvas); }
.login-card { width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 28px; display: flex; flex-direction: column; gap: 14px; border-top: 5px solid var(--amber); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .app.menu-open .rail { transform: none; }
  .menu-toggle { display: inline-block; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .filter select { min-width: 140px; }
  main { padding: 16px; }
  .form-grid, .editor-head { grid-template-columns: 1fr; }
  .zone-editor { grid-template-columns: 1fr; }
  .zone-editor .lp { max-width: 220px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.monitor .mlabel small { white-space: nowrap; flex: none; }
.me-actions { flex-wrap: wrap; row-gap: 4px; }
.me-actions .linklike { white-space: nowrap; }

/* ===== Προσανατολισμός ===== */
.orient-ico { display: inline-block; width: 11px; height: 8px; border: 1.5px solid currentColor; border-radius: 1.5px; margin-right: 6px; vertical-align: -0.5px; }
.orient-portrait .orient-ico { width: 8px; height: 11px; vertical-align: -2px; }
.orient-any .orient-ico { border-style: dashed; }
.tag.warn { background: #FBE3E1; color: #8E211B; }
.orient-warn { margin: 0; padding: 10px 12px; border-radius: var(--radius-s); background: #FBE3E1; color: #8E211B; font-size: var(--step--1); font-weight: 400; }
.btn.chip-on { background: var(--ink); color: #fff; border-color: var(--ink); }
.monitor.portrait .bezel { width: 46%; margin: 0 auto; }
.monitor.portrait .glass { aspect-ratio: 9 / 16; font-size: .68rem; }
.monitor.portrait .stand { width: 16%; }
.monitors { align-items: end; }
.mwarn { margin-top: 4px; }
