/* Προσωπικό — calm, dense, light. System fonts; one petrol accent; rest days stay yellow like the old Excel. */
:root {
  --ground: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #17202a;
  --ink-2: #44525f;
  --ink-3: #5b6875;
  --line: #dde3e9;
  --line-2: #c6cfd8;
  --accent: #0a6a72;
  --accent-ink: #ffffff;
  --accent-soft: #dcefef;
  --accent-line: #8cc3c6;
  --shift: #e3f1f2;
  --shift-ink: #09484e;
  --off: #f6d84c;
  --off-ink: #5a4a00;
  --holiday: #fbe6cf;
  --warn: #a8420f;
  --warn-soft: #fbe3d6;
  --danger: #ab2018;
  --closed-stripe: #e4e8ec;
  --focus: #0a6a72;
  --radius: 6px;
  --shadow: 0 1px 2px rgb(20 30 40 / 0.08), 0 4px 14px rgb(20 30 40 / 0.07);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 14px/1.4 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 18px; } h2 { font-size: 15px; } h3 { font-size: 13px; }
.muted { color: var(--ink-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid var(--surface); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- frame ---------- */
.app { height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 0 16px; height: 48px; flex: none;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 650; font-size: 15px; letter-spacing: 0.01em; white-space: nowrap; }
.nav { display: flex; gap: 2px; height: 100%; }
.nav a {
  display: flex; align-items: center; padding: 0 12px; color: var(--ink-2); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.topbar .grow { flex: 1; }
.shell { flex: 1; display: flex; min-height: 0; }
main#view { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 14px 16px 16px; gap: 12px; overflow: auto; }
aside#inspector {
  width: 340px; flex: none; background: var(--surface); border-left: 1px solid var(--line);
  overflow: auto; display: flex; flex-direction: column;
}
aside#inspector[hidden] { display: none; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--radius);
  font-weight: 500; color: var(--ink); white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #085a61; }
.btn.danger { color: var(--danger); border-color: #e0b4b1; }
.btn.danger:hover { background: #fdf0ef; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn.icon { width: 32px; padding: 0; justify-content: center; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

input[type="text"], input[type="number"], input[type="time"], input[type="date"], input[type="password"], select, textarea {
  height: 32px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); min-width: 0;
}
textarea { height: auto; padding: 6px 8px; resize: vertical; }
input.time { width: 76px; text-align: center; font-variant-numeric: tabular-nums; }
td input.time, .hours-table input.time { width: 76px; }
input.bad { border-color: var(--danger); background: #fdf0ef; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
input[type="color"] { width: 36px; height: 28px; padding: 1px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--surface); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .title { font-size: 18px; font-weight: 650; min-width: 190px; text-align: center; }
.toolbar .sep { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 0 12px; height: 30px; font-weight: 500; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg button:not([aria-pressed="true"]):hover { background: var(--surface-2); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel > header { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.panel > .body { padding: 12px; }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 18px; padding: 0 5px;
  border-radius: 4px; font-size: 11px; font-weight: 650; color: #1b2a33; border: 1px solid rgb(0 0 0 / 0.08);
}
.chip.off { background: var(--off); color: var(--off-ink); }
.chip.shift { background: var(--shift); color: var(--shift-ink); }

/* ---------- planner grids (month / week) ---------- */
.gridwrap { flex: 1; min-height: 0; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
.grid th, .grid td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; }
.grid thead th {
  position: sticky; top: 0; z-index: 3; background: var(--surface-2); font-weight: 500; font-size: 12px; color: var(--ink-2);
  height: 44px; text-align: center; border-bottom-color: var(--line-2);
}
.grid thead th .dn { display: block; font-size: 13px; font-weight: 650; color: var(--ink); line-height: 1.1; }
.grid thead th .dw { display: block; font-size: 11px; line-height: 1.2; }
.grid th.name, .grid td.name {
  position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; padding: 0 10px; min-width: 188px; max-width: 188px;
  border-right: 1px solid var(--line-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 550;
}
.grid thead th.name { z-index: 4; background: var(--surface-2); font-weight: 500; }
.grid td.name small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11px; line-height: 1.1; }
.grid th.hol { background: var(--holiday); }
.grid th.today { box-shadow: inset 0 -3px 0 var(--accent); }
.grid th.closed, .grid td.closed {
  background-image: repeating-linear-gradient(135deg, transparent 0 5px, rgb(0 0 0 / 0.045) 5px 6px);
  background-color: var(--closed-stripe);
}
.grid thead th.closed { color: var(--ink-3); }
.grid td.c {
  width: 40px; min-width: 40px; height: 38px; text-align: center; cursor: pointer; position: relative;
  font-size: 11px; line-height: 1.1; user-select: none;
}
.grid td.c:hover { box-shadow: inset 0 0 0 1px var(--ink-3); }
.grid td.c.sel { box-shadow: inset 0 0 0 2px var(--accent); z-index: 1; }
.grid td.c.sel-range { background-image: linear-gradient(rgb(10 106 114 / 0.14), rgb(10 106 114 / 0.14)); }
.grid td.c.shift { background: var(--shift); color: var(--shift-ink); font-weight: 550; }
.grid td.c.off { background: var(--off); color: var(--off-ink); font-weight: 650; background-image: none; }
.grid td.c.leave { font-weight: 700; color: #1b2a33; font-size: 12px; background-image: none; }
.grid td.c .warn-dot { position: absolute; top: 2px; right: 2px; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.grid td.c .note-dot { position: absolute; bottom: 2px; right: 2px; width: 5px; height: 5px; background: var(--ink-3); transform: rotate(45deg); }
.grid td.c .t2 { display: block; }
.grid td.tot, .grid th.tot { width: 52px; min-width: 52px; text-align: center; font-size: 12px; color: var(--ink-2); background: var(--surface-2); }
.grid tfoot td, .grid tfoot th { background: var(--surface-2); height: 28px; font-size: 12px; text-align: center; }
.grid tfoot tr:first-child td, .grid tfoot tr:first-child th { border-top: 1px solid var(--line-2); }
.grid tfoot td.low { background: var(--warn-soft); color: var(--warn); font-weight: 700; }
.grid tfoot th.name { z-index: 2; font-weight: 500; color: var(--ink-2); }

/* week board */
.grid.week td.c { width: auto; min-width: 124px; height: 54px; font-size: 13px; }
.grid.week td.c .t1 { font-weight: 650; font-size: 13px; }
.grid.week td.c .sub { display: block; font-size: 11px; font-weight: 400; opacity: 0.85; }
.grid.week thead th { height: 62px; min-width: 124px; }
.grid.week thead th .open { display: block; font-size: 11px; font-weight: 400; color: var(--ink-3); margin-top: 1px; }
.grid.week td.tot, .grid.week th.tot { width: 92px; min-width: 92px; }
.grid.week tfoot td { height: 46px; vertical-align: middle; font-size: 12px; }
.grid.week tfoot td b { font-size: 13px; }
.over { color: var(--warn); font-weight: 700; }

.cover { display: flex; height: 14px; gap: 1px; margin: 3px 6px 0; align-items: flex-end; }
.cover i { flex: 1; min-width: 2px; background: var(--accent-line); border-radius: 1px; }
.cover i.x { background: var(--line); height: 3px !important; }
.cover i.low { background: #d8734a; }

/* ---------- day timeline ---------- */
.timeline { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 12px; }
.tl-row { display: grid; grid-template-columns: 188px 1fr 70px; align-items: center; min-height: 36px; border-bottom: 1px solid var(--line); }
.tl-row:last-child { border-bottom: 0; }
.tl-name { font-weight: 550; padding-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-track { position: relative; height: 36px; }
.tl-open { position: absolute; top: 0; bottom: 0; background: var(--accent-soft); opacity: 0.55; }
.tl-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.tl-bar {
  position: absolute; top: 7px; bottom: 7px; border-radius: 4px; background: var(--accent); color: var(--accent-ink);
  font-size: 12px; font-weight: 600; display: flex; align-items: center; padding: 0 6px; white-space: nowrap; overflow: hidden; cursor: pointer; border: 0;
}
.tl-bar:hover { background: #085a61; }
.tl-bar.sel { outline: 2px solid var(--ink); outline-offset: 1px; }
.tl-hours { text-align: right; color: var(--ink-3); font-size: 12px; }
.tl-ruler { display: grid; grid-template-columns: 188px 1fr 70px; font-size: 11px; color: var(--ink-3); }
.tl-ruler .track { position: relative; height: 18px; }
.tl-ruler .track span { position: absolute; transform: translateX(-50%); }
.tl-cover { display: grid; grid-template-columns: 188px 1fr 70px; align-items: end; margin-top: 8px; }
.tl-cover .track { position: relative; height: 46px; }
.tl-cover .slot { position: absolute; bottom: 0; background: var(--accent-line); border-right: 1px solid var(--surface); text-align: center; font-size: 11px; color: var(--ink); padding-top: 2px; }
.tl-cover .slot.x { background: var(--line); color: var(--ink-3); }
.tl-cover .slot.low { background: #e9a07d; color: #3a1500; font-weight: 700; }
.daycols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.daycols .panel .body { padding: 8px 12px 10px; }
.daycols ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.daycols li { display: flex; justify-content: space-between; gap: 10px; }
.daycols h3 .n { color: var(--accent); font-size: 16px; margin-left: 6px; }

/* ---------- tables ---------- */
table.data { border-collapse: collapse; width: 100%; background: var(--surface); }
.data th, .data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data thead th { font-size: 12px; font-weight: 500; color: var(--ink-2); background: var(--surface-2); border-bottom-color: var(--line-2); position: sticky; top: 0; }
.data td.num, .data th.num { text-align: right; }
.data tr:hover td { background: #fafcfd; }
.data tr.inactive td { color: var(--ink-3); }
.data .big { font-size: 16px; font-weight: 650; }
.data .sub { display: block; font-size: 11px; color: var(--ink-3); font-weight: 400; }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.tag.warn { background: var(--warn-soft); border-color: #e9bfa8; color: var(--warn); }
.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }

/* ---------- inspector ---------- */
.insp-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-start; }
.insp-head .t { flex: 1; min-width: 0; }
.insp-head .t h2 { font-size: 16px; }
.insp-body { padding: 14px 16px; display: grid; gap: 14px; }
.insp-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; margin-top: auto; position: sticky; bottom: 0; background: var(--surface); }
.field { display: grid; gap: 4px; }
.field > label, .field > .lab { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.row.tight > * { flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { border: 1px solid var(--line-2); background: var(--surface); border-radius: 16px; height: 28px; padding: 0 10px; font-size: 12px; font-weight: 500; }
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.leave-pick { display: grid; gap: 4px; }
.leave-pick label { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.leave-pick label:hover { border-color: var(--ink-3); }
.leave-pick input { position: absolute; opacity: 0; pointer-events: none; }
.leave-pick label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #f5fafa; }
.leave-pick label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.leave-pick .nm { flex: 1; }
.hint { font-size: 12px; color: var(--ink-3); }
.callout { padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.callout.warn { background: var(--warn-soft); border-color: #e9bfa8; color: #5d2308; }

/* ---------- misc ---------- */
.toast-host { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 9px 14px; border-radius: var(--radius); box-shadow: var(--shadow); max-width: 560px; animation: rise 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); pointer-events: auto; }
.toast.err { background: var(--danger); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
dialog { border: 0; border-radius: 8px; padding: 0; box-shadow: var(--shadow), 0 0 0 1px var(--line); max-width: 420px; width: calc(100% - 32px); }
dialog::backdrop { background: rgb(20 30 40 / 0.35); }
dialog form { padding: 18px; display: grid; gap: 14px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth form { width: min(360px, 100%); background: var(--surface); padding: 24px; border-radius: 8px; box-shadow: var(--shadow), 0 0 0 1px var(--line); display: grid; gap: 14px; }
.auth input { height: 38px; }
.err-text { color: var(--danger); font-size: 13px; min-height: 18px; }

.settings { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; }
.sidenav { display: grid; gap: 2px; position: sticky; top: 0; }
.sidenav a { padding: 8px 10px; border-radius: var(--radius); color: var(--ink-2); text-decoration: none; font-weight: 500; }
.sidenav a:hover { background: var(--surface); }
.sidenav a[aria-current="page"] { background: var(--surface); color: var(--accent); box-shadow: 0 0 0 1px var(--line); }
.stack { display: grid; gap: 14px; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.hours-table td, .hours-table th { padding: 4px 6px; }
.hours-table input { width: 92px; }
.empty { padding: 32px; text-align: center; color: var(--ink-3); }
td input[type="text"], td input[type="number"], td input[type="date"], td input[type="time"] { width: 100%; }

/* ---------- print ---------- */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff; font-size: 11px; }
  .topbar, .toolbar, aside#inspector, .legend .noprint, .noprint { display: none !important; }
  .app, .shell { display: block; height: auto; }
  main#view { overflow: visible; padding: 0; }
  .gridwrap, .timeline, .tablewrap { overflow: visible; border: 0; }
  .grid thead th, .grid tfoot td, .grid tfoot th, .grid th.name, .grid td.name { position: static; }
  .grid td.c.sel, .grid td.c.sel-range { box-shadow: none; background-image: none; }
  .grid td.c { height: 30px; }
  .printtitle { display: block !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.printtitle { display: none; font-size: 16px; font-weight: 650; }

@media (max-width: 1100px) {
  aside#inspector { position: fixed; right: 0; top: 48px; bottom: 0; z-index: 20; box-shadow: var(--shadow); }
  .settings { grid-template-columns: 1fr; }
  .sidenav { display: flex; flex-wrap: wrap; position: static; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
