/* ------------------------------------------------------------------
   Taxi KPI — design tokens
   Πάντα φωτεινό θέμα (σκόπιμα, όχι σκοτεινό) — παλέτα γραφημάτων
   επικυρωμένη για daltonism.
------------------------------------------------------------------- */
:root {
  color-scheme: light;
  --surface-0:  #f4f0e8;   /* φόντο σελίδας — ζεστό κρεμ */
  --surface-1:  #fffdf9;   /* κάρτες / επιφάνεια γραφημάτων */
  --surface-2:  #eeece3;   /* ήπια γεμίσματα, zebra */
  --border:     #dfe4df;
  --border-str: #cfd3ce;

  --text-primary:   #1e2b2b;
  --text-secondary: #45534f;
  --text-muted:     #71807d;

  --series-1: #2a78d6;  /* μπλε   — τζίρος */
  --series-2: #eb6834;  /* πορτ.  — έξοδα  */
  --series-3: #1baf7a;  /* aqua   — κέρδος */
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;

  --good:     #1baf7a;
  --warning:  #eda100;
  --critical: #e34948;

  --accent:      #176b69;  /* πετρόλ — ταυτίζεται με το tsiakardonis-reservations */
  --accent-ink:  #ffffff;
  --accent-gold: #e9b949;  /* χρυσό — κύριες ενέργειες (login, αποθήκευση) */
  --accent-gold-ink: #1e2b2b;
  --grid:        #e6e2d6;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(30,43,43,.04), 0 4px 14px rgba(30,43,43,.06);
  --shadow-hover: 0 2px 4px rgba(30,43,43,.05), 0 10px 22px rgba(30,43,43,.09);
  --font: "DM Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

/* Σκόπιμα ΧΩΡΙΣ @media (prefers-color-scheme: dark): η εφαρμογή μένει πάντα
   φωτεινή, ανεξάρτητα από τη ρύθμιση του συστήματος του επισκέπτη. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  background:
    radial-gradient(900px 520px at 86% 4%, color-mix(in srgb, var(--accent-gold) 26%, transparent), transparent 45%),
    var(--surface-0);
  background-attachment: fixed;
  min-height: 100vh;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.011em; }
h1 { font-size: 1.25rem; }
h2 { font-size: 1.0rem; }
h3 { font-size: .875rem; color: var(--text-secondary); font-weight: 600; }
a { color: var(--accent); }

/* ------------------------------------------------------------ σκελετός */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 18px;
  background: color-mix(in srgb, var(--surface-1) 92%, transparent);
  backdrop-filter: saturate(1.3) blur(8px);
  -webkit-backdrop-filter: saturate(1.3) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand {
  display: flex; align-items: center; gap: 9px; font-weight: 650;
  min-width: 0; overflow: hidden;
}
.topbar .brand svg { display: block; flex: none; }
.topbar .brand .brand-logo {
  display: block; flex: none; width: 34px; height: 34px;
  border-radius: 50%; object-fit: cover;
  box-shadow: 0 1px 3px rgba(30,43,43,.25);
}
.topbar .brand span.label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; min-width: 8px; }
.topbar .who { color: var(--text-secondary); font-size: .875rem; white-space: nowrap; flex: none; }

.wrap { max-width: 1220px; margin: 0 auto; padding: 18px; }
.wrap.narrow { max-width: 760px; }

.row  { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 14px; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card > header {
  display: flex; align-items: baseline; gap: 10px;
  margin: -2px 0 14px;
}
.card > header .sub { color: var(--text-muted); font-size: .8125rem; margin-left: auto; }

.section-title {
  font-size: .75rem; font-weight: 650; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-muted);
  margin: 26px 0 10px;
}
.section-title:first-child { margin-top: 0; }

/* -------------------------------------------------------------- στοιχεία */

button, .btn {
  font: inherit; font-weight: 550;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-str);
  background: var(--surface-1); color: var(--text-primary);
  cursor: pointer; transition: background .12s, border-color .12s, transform .1s;
}
button:hover, .btn:hover { background: var(--surface-2); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
button.primary, .btn.primary {
  background: var(--accent-gold); border-color: var(--accent-gold); color: var(--accent-gold-ink);
  font-weight: 700;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent-gold) 35%, transparent);
}
button.primary:hover { filter: brightness(1.05); }
button.ghost { border-color: transparent; background: transparent; color: var(--text-secondary); }
button.ghost:hover { background: var(--surface-2); }
button.danger { color: var(--critical); border-color: var(--border); }
button.sm { padding: 4px 9px; font-size: .8125rem; }
button.big { padding: 13px 20px; font-size: 1rem; width: 100%; }

label { display: block; font-size: .8125rem; color: var(--text-secondary); margin-bottom: 4px; }

input, select, textarea {
  font: inherit; width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-str); border-radius: var(--radius-sm);
  background: var(--surface-1); color: var(--text-primary);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 1px; border-color: var(--accent);
}
input[type="number"] { text-align: right; font-variant-numeric: tabular-nums; }
textarea { min-height: 68px; resize: vertical; }

.field { margin-bottom: 12px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.fields.two { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.hint { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }

/* segmented control (επιλογή περιόδου / καρτέλες) */
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: none; background: transparent; padding: 6px 12px;
  border-radius: 6px; font-size: .875rem; color: var(--text-secondary);
}
.seg button[aria-pressed="true"] {
  background: var(--surface-1); color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600;
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button {
  border: none; background: transparent; border-radius: 0;
  border-bottom: 2px solid transparent; padding: 9px 13px;
  color: var(--text-secondary);
}
.tabs button[aria-pressed="true"] { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: 600; }

/* ------------------------------------------------------------ stat tiles */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; }
.tile {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 14px;
}
.tile .label { font-size: .75rem; color: var(--text-secondary); margin-bottom: 3px; }
.tile .value {
  font-size: 1.5rem; font-weight: 620; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.tile .foot { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.tile.hero { grid-column: span 2; }
.tile.hero .value { font-size: 2.6rem; line-height: 1.1; }
@media (max-width: 560px) { .tile.hero { grid-column: span 1; } .tile.hero .value { font-size: 2rem; } }

.pos { color: var(--good); }
.neg { color: var(--critical); }

/* κατάσταση με τελεία (π.χ. ενεργός/ανενεργός οδηγός) */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .75rem; font-weight: 650; padding: 3px 10px 3px 8px;
  border-radius: 999px; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.badge.pos { background: color-mix(in srgb, var(--good) 12%, transparent); color: color-mix(in srgb, var(--good) 85%, black); }
.badge.pos .dot { background: var(--good); }
.badge.muted { background: var(--surface-2); color: var(--text-muted); }
.badge.muted .dot { background: var(--text-muted); }

.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8125rem; color: var(--text-secondary); }
.legend span.item { display: inline-flex; align-items: center; gap: 6px; }

/* ------------------------------------------------------------------ ρεκόρ */

.records { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.record {
  position: relative; overflow: hidden;
  background:
    radial-gradient(120px 90px at 100% 0%, color-mix(in srgb, var(--accent-gold) 12%, transparent), transparent 70%),
    var(--surface-1);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.record:hover { box-shadow: var(--shadow-hover); border-color: var(--border-str); }
.record .record-icon {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px; margin-bottom: 9px;
  background: color-mix(in srgb, var(--accent-gold) 20%, transparent);
  color: color-mix(in srgb, var(--accent-gold) 55%, var(--text-primary));
}
.record .record-icon svg { width: 16px; height: 16px; }
.record .label { font-size: .75rem; color: var(--text-secondary); margin-bottom: 3px; }
.record .value {
  font-size: 1.375rem; font-weight: 700; letter-spacing: -.015em;
  font-variant-numeric: tabular-nums;
}
.record .date { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }

/* --------------------------------------------------------------- πίνακες */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { padding: 8px 10px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th.l, td.l { text-align: left; }
thead th {
  font-size: .75rem; font-weight: 600; color: var(--text-muted);
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--surface-1); cursor: default;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--text-primary); }
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody td { font-variant-numeric: tabular-nums; }
tfoot td { border-top: 1px solid var(--border-str); font-weight: 650; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- γραφήματα */

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; }
.chart .tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--surface-1); border: 1px solid var(--border-str);
  border-radius: var(--radius-sm); padding: 8px 10px;
  font-size: .8125rem; box-shadow: var(--shadow);
  white-space: nowrap; opacity: 0; transition: opacity .1s;
}
.chart .tip.on { opacity: 1; }
.chart .tip .t-row { display: flex; align-items: center; gap: 7px; }
.chart .tip .t-row .v { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.chart .tip .t-head { font-weight: 650; margin-bottom: 5px; }

/* ---------------------------------------------------------------- λοιπά */

.empty { text-align: center; color: var(--text-muted); padding: 34px 16px; font-size: .9375rem; }
.notice {
  border-radius: var(--radius-sm); padding: 10px 13px; font-size: .875rem;
  border: 1px solid var(--border-str); background: var(--surface-2);
}
.notice.err  { border-color: var(--critical); color: var(--critical); background: color-mix(in srgb, var(--critical) 8%, transparent); }
.notice.good { border-color: var(--good); color: var(--good); background: color-mix(in srgb, var(--good) 10%, transparent); }
.hidden { display: none !important; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(12px);
  background: var(--text-primary); color: var(--surface-1);
  padding: 10px 18px; border-radius: 999px; font-size: .875rem; font-weight: 550;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 60;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--critical); color: #fff; }

#login.login-screen {
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  background:
    radial-gradient(560px 320px at 50% 0%, color-mix(in srgb, var(--accent-gold) 16%, transparent), transparent 70%),
    radial-gradient(420px 260px at 85% 100%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%);
}
.login {
  max-width: 380px; margin: 0 auto;
  text-align: center;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(30,43,43,.05), 0 12px 32px rgba(30,43,43,.09);
  animation: loginIn .4s cubic-bezier(.2,.7,.3,1) both;
}
.login-badge {
  width: 64px; height: 64px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden;
  box-shadow: 0 6px 18px rgba(30,43,43,.3);
}
.login-badge img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login h1 { font-size: 1.375rem; }
.login .field { text-align: left; }
.login .hint a { font-weight: 600; }
@keyframes loginIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.pinpad button { padding: 15px 0; font-size: 1.125rem; font-weight: 550; }

.stack > * + * { margin-top: 14px; }
.mt { margin-top: 14px; }
.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
