/* ROBOTONIO EDU — βασικό στυλ εφαρμογής */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1c2733;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #e8600a;
  --accent-soft: #fdeee2;
  --sidebar: #1d2733;
  --sidebar-ink: #cbd5e1;
  --ok: #16803c;
  --ok-soft: #e3f4e9;
  --warn: #92400e;
  --warn-soft: #fef3e2;
  --gray-soft: #eef2f6;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--sidebar);
  color: var(--sidebar-ink); display: flex; flex-direction: column;
  padding: 1.2rem .9rem;
}
.brand { font-weight: 800; letter-spacing: .5px; color: #fff; font-size: 1.05rem; margin-bottom: 1.2rem; display: flex; justify-content: space-between; align-items: center; }
.brand a { color: #fff; }
.brand a:hover { text-decoration: none; }
.brand span { color: var(--accent); margin-left: .3em; }
.nav-toggle { display: none; background: none; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 6px; padding: .2rem .5rem; font: inherit; cursor: pointer; }
.nav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .6px; color: #7d8ea3; margin: .8rem .7rem .2rem; }
.sidebar-footer .role { font-size: .78rem; color: #94a3b8; }
.sidebar nav { display: flex; flex-direction: column; gap: .2rem; }
.sidebar nav a {
  color: var(--sidebar-ink); padding: .55rem .7rem; border-radius: 8px; font-weight: 500;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.sidebar-footer { margin-top: auto; font-size: .85rem; display: flex; flex-direction: column; gap: .3rem; }
.sidebar-footer .user { color: #fff; font-weight: 600; }
.sidebar-footer .muted { color: var(--sidebar-ink); }
.linklike {
  background: none; border: 0; color: var(--sidebar-ink); cursor: pointer;
  padding: 0; font: inherit; text-align: left;
}
.linklike:hover { color: #fff; }

/* ── Main / topbar ──────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .55rem 2rem; background: var(--card);
          border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.crumbs { flex: 1; font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.quick-search input { min-width: 320px; padding: .4rem .7rem; }
.topbar-user { font-size: .85rem; color: var(--muted); }
.env-banner { background: #fff7ed; color: #9a3412; border-bottom: 1px solid #fed7aa; padding: .35rem 2rem; font-size: .85rem; font-weight: 500; }
.content { flex: 1; padding: 1.4rem 2rem; max-width: 1280px; width: 100%; }
.page-actions { display: flex; gap: .5rem; align-items: center; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
h1 { font-size: 1.45rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 1.6rem 0 .6rem; }
.muted { color: var(--muted); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 1rem 1.2rem;
}

/* Ταμπλό: κάρτες ανά κατάστημα */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .9rem; }
.tile .label { font-size: .85rem; color: var(--muted); }
.tile .big { font-size: 1.9rem; font-weight: 700; line-height: 1.2; }
.tile .sub { font-size: .85rem; color: var(--muted); }

/* Πίνακες */
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; }
.card table { border-radius: 0; }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #fafbfc; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: 0; }
.table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; background: var(--card); }

/* Φίλτρα */
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
input[type=text], input[type=search], input[type=password], select {
  padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink);
}
input[type=search] { min-width: 260px; }
.filters label.check { font-size: .9rem; color: var(--muted); display: flex; gap: .35rem; align-items: center; }

/* Badges */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.gray { background: var(--gray-soft); color: var(--muted); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* Καρτέλες λεπτομερειών */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: .9rem; }
dl { margin: 0; }
dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-top: .6rem; }
dd { margin: 0; }

.btn {
  display: inline-block; background: var(--accent); color: #fff; border: 0;
  padding: .5rem .9rem; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn-secondary { background: var(--gray-soft); color: var(--ink); }
.btn-danger { background: #b91c1c; color: #fff; }
.btn-danger:hover { background: #991b1b; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Components */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1.1rem; margin-bottom: 1rem; }
.panel h2, .panel h3 { margin-top: 0; }
.form-row { display: grid; grid-template-columns: 180px 1fr; gap: .6rem 1rem; align-items: start; margin-bottom: .6rem; }
.form-row label { font-size: .85rem; font-weight: 600; color: var(--muted); padding-top: .45rem; }
.empty-state { padding: 1.4rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; background: var(--card); }
.alert { padding: .6rem .9rem; border-radius: 8px; margin-bottom: .8rem; font-size: .92rem; }
.alert-info { background: #eff6ff; color: #1e40af; }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-danger { background: #fee2e2; color: #b91c1c; }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.badge.danger { background: #fee2e2; color: #b91c1c; }
.badge.info { background: #eff6ff; color: #1e40af; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; }
.kpi .label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.kpi .value { font-size: 1.5rem; font-weight: 700; line-height: 1.25; }
.kpi .sub { font-size: .8rem; color: var(--muted); }
.warn-list { list-style: none; margin: 0; padding: 0; }
.warn-list li { padding: .4rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.warn-list li:last-child { border-bottom: 0; }
.status-403 { max-width: 520px; margin: 4rem auto; text-align: center; }
table.compact th, table.compact td { padding: .4rem .6rem; font-size: .9rem; }

/* Φόρμες */
.form-page { max-width: 640px; }
.form-section { margin-bottom: 1rem; }
.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .8rem; }
.field label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink); width: 100%;
}
.field input[type=checkbox] { width: auto; align-self: flex-start; }
.field.has-error input, .field.has-error select { border-color: #dc2626; }
.form-actions { display: flex; align-items: center; gap: 1rem; margin: 1rem 0 2rem; }
.errornote { color: #b91c1c; font-size: .88rem; }
.flash { padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 500; }
.flash.success { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: #fee2e2; color: #b91c1c; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.field-row .field { margin-bottom: .8rem; }
.field ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.2rem; flex-wrap: wrap; }
.field ul label { font-weight: 400; color: var(--ink); font-size: .95rem;
                  display: flex; gap: .35rem; align-items: center; }
.btn-plus {
  background: none; border: 1px dashed var(--accent); color: var(--accent);
  padding: .4rem .8rem; border-radius: 8px; font: inherit; font-weight: 600;
  cursor: pointer; margin-top: .6rem;
}
.btn-plus:hover { background: var(--accent-soft); }

/* Αναζήτηση κηδεμόνα (autocomplete) */
.guardian-search { position: relative; }
.gsearch-results {
  position: absolute; z-index: 20; top: 100%; left: 0; right: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.08); max-height: 260px; overflow-y: auto;
}
.gsearch-item { padding: .5rem .8rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.gsearch-item:last-child { border-bottom: 0; }
.gsearch-item:hover { background: var(--accent-soft); }
.gsearch-picked { padding: .5rem .7rem; background: var(--accent-soft); border-radius: 8px; }
.gsearch-picked .linklike { margin-left: .5rem; font-size: .85rem; }

/* Πληρωμές: λίστα οφειλών με checkboxes */
.charges-list { display: flex; flex-direction: column; gap: .3rem; }
.charge-row { display: flex; gap: .6rem; align-items: center; padding: .4rem .6rem;
              border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.charge-row:hover { background: #f8fafc; }
.charge-row input { width: auto; }
.settle-box { margin-top: 1rem; padding: .8rem 1rem; border: 1px dashed var(--accent);
              border-radius: 10px; background: var(--accent-soft); }
.settle-details { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: center; margin: .5rem 0 .3rem; }
.settle-details input { padding: .25rem .4rem; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.btn-sm { display: inline-block; padding: .2rem .6rem; border-radius: 6px; font-size: .8rem;
          font-weight: 600; background: var(--accent); color: #fff; }
.btn-sm:hover { text-decoration: none; filter: brightness(1.05); }

/* Radio «κάρτες»: κουμπί + ετικέτα σε μία γραμμή, ευδιάκριτη επιλογή */
.radio-cards { display: flex; flex-direction: column; gap: .4rem; }
.radio-card { display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem;
              border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
              font-weight: 500; color: var(--ink); }
.radio-card:hover { background: #f8fafc; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card input { width: auto; margin: 0; }

/* Radio buttons: ετικέτα δίπλα στο κουμπί, όχι από κάτω */
.field ul.radio, .field > ul { flex-direction: column; gap: .35rem; }
.field ul li label { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.field ul li input[type=radio] { width: auto; margin: 0; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--bg); }
.login-card { width: min(360px, 92vw); }
.login-card .brand { color: var(--ink); text-align: center; margin-bottom: 1rem; font-size: 1.2rem; }
.login-card form { display: flex; flex-direction: column; gap: .7rem; }
.errornote { color: #b91c1c; font-size: .9rem; }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; padding: .6rem .9rem; }
  .brand { margin: 0; }
  .nav-toggle { display: inline-block; }
  .sidebar nav, .sidebar-footer { display: none; }
  .sidebar.open nav { display: flex; margin-top: .6rem; }
  .sidebar.open .sidebar-footer { display: flex; margin-top: .6rem; }
  .topbar { padding: .5rem 1rem; flex-wrap: wrap; }
  .quick-search input { min-width: 0; width: 100%; }
  .content { padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
}


/* Phase 7.5A — suggestions / onboarding */
.quick-search { position: relative; }
.suggest-anchor { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; }
.suggest-box { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.1); max-height: 360px; overflow-y: auto; }
.suggest-box.static { position: static; box-shadow: none; margin-top: .3rem; }
.suggest-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: .4rem .8rem .1rem; }
.suggest-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: .45rem .8rem; color: var(--ink); font: inherit; cursor: pointer; border-bottom: 1px solid var(--line); }
.suggest-item:hover { background: var(--accent-soft); text-decoration: none; }
.suggest-item:last-child { border-bottom: 0; }
table.rows-link tbody tr:hover { background: #f1f5f9; }
.detail-grid dl dt { margin-top: .45rem; }


/* Phase 7.5A.1 — radio/checkbox alignment (Django div-based RadioSelect), 24h time input */
.field > div > div > label, .field div[id^="id_"] > div > label { display: flex; align-items: center; gap: .5rem; font-weight: 400; color: var(--ink); cursor: pointer; }
.field div[id^="id_"] > div { margin: .15rem 0; }
.field input[type=radio], .field input[type=checkbox] { width: auto; margin: 0; flex-shrink: 0; }
label.check { display: inline-flex; align-items: center; gap: .4rem; }
label.check input { width: auto; margin: 0; }
input.time24 { max-width: 7rem; }
.price-hint { font-size: .9rem; color: var(--ink); background: var(--accent-soft); border-radius: 6px; padding: .3rem .6rem; display: inline-block; margin-top: .3rem; }

/* Phase 7.5A.2 — KPI cards as links */
a.kpi-link { color: inherit; text-decoration: none; display: block; }
a.kpi-link:hover { border-color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.kpi-warn .value { color: #b91c1c; }
#levels-table input[type=text], #levels-table input[type=number], #levels-table select { min-width: 0; width: 100%; font-size: .85rem; padding: .25rem .4rem; }
#levels-table td { vertical-align: top; }

/* Phase 7.5B.3 — academic year selector (topbar) */
.year-select { margin-left: auto; margin-right: .8rem; font-size: .85rem; color: var(--muted); }
.year-select select { font-size: .85rem; padding: .15rem .3rem; }
