/* Πύλη Συνδέσμου Γονέων — palette drawn from the school's pencil-tree logo.
   --primary / --secondary / --accent are overridden per school from Ρυθμίσεις. */
:root {
  --primary: #1F6FB2;
  --secondary: #29A8E0;
  --accent: #F2A23A;
  --graphite: #6E7378;
  --ink: #1D2B36;
  --muted: #5B6873;
  --line: #D8E1E8;
  --paper: #F5F8FA;
  --surface: #FFFFFF;
  --ok: #2E7D4F;
  --ok-bg: #E6F4EC;
  --warn: #9A5B00;
  --warn-bg: #FFF3DF;
  --bad: #B3261E;
  --bad-bg: #FDECEA;
  --radius: 6px;
  --font: "Commissioner", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5;
  color: var(--ink); background: var(--paper);
}
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--secondary); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; max-width: 72ch; }
small, .muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* The pencil: blue · graphite · orange bands, the one recurring brand device. */
.pencil {
  background: linear-gradient(90deg, var(--secondary) 0 33.33%, var(--graphite) 33.33% 66.66%, var(--accent) 66.66%);
}
.pencil-v {
  background: linear-gradient(180deg, var(--secondary) 0 33.33%, var(--graphite) 33.33% 66.66%, var(--accent) 66.66%);
}

/* ---------- staff layout ---------- */
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  display: grid; grid-template-columns: 6px 1fr;
}
.sidebar .pencil-v { height: 100%; }
.sidebar-inner { padding: 20px 16px; display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--ink); }
.brand img { width: 52px; height: 52px; object-fit: contain; }
.brand strong { display: block; font-size: .95rem; line-height: 1.2; }
.brand span { font-size: .8rem; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-radius: var(--radius); text-decoration: none; color: var(--ink); font-weight: 500;
}
.nav a:hover { background: var(--paper); }
.nav a.active { background: color-mix(in srgb, var(--secondary) 14%, white); color: var(--primary); font-weight: 700; }
.nav-group { font-size: .8rem; color: var(--muted); margin: 14px 10px 4px; }
.badge {
  display: inline-block; min-width: 1.6em; padding: 0 .45em; border-radius: 999px; text-align: center;
  font-size: .78rem; font-weight: 700; background: var(--accent); color: #fff; line-height: 1.6;
}
.who { margin-top: auto; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
.who strong { color: var(--ink); display: block; }

.main { padding: 28px clamp(16px, 4vw, 44px) 64px; max-width: 1180px; width: 100%; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.mobile-bar { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .mobile-bar {
    display: block; position: sticky; top: 0; z-index: 20; background: var(--surface);
    border-bottom: 1px solid var(--line);
  }
  .mobile-bar .pencil { height: 4px; }
  .mobile-bar details summary {
    list-style: none; display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; cursor: pointer;
  }
  .mobile-bar details summary::-webkit-details-marker { display: none; }
  .mobile-bar .nav { padding: 0 12px 14px; }
  .main { padding-top: 20px; }
}

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.panel > h2:first-child { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }

.figures { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 20px; }
.figure { flex: 1 1 140px; padding: 14px 18px; border-right: 1px solid var(--line); }
.figure:last-child { border-right: 0; }
.figure b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.figure span { font-size: .85rem; color: var(--muted); }
.figure.warn b { color: var(--warn); }
.figure.ok b { color: var(--ok); }

.classes-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.class-chip {
  display: inline-flex; gap: 8px; align-items: baseline; padding: 6px 12px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 600;
}
.class-chip small { font-weight: 500; }

.progress { height: 8px; background: var(--paper); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; background: var(--secondary); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .82rem; font-weight: 700; color: var(--muted); background: #FAFCFD; position: sticky; top: 0; }
tbody tr:hover { background: #FAFCFD; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
tr.total td { font-weight: 700; background: #F2F7FA; }
tr.group td { background: color-mix(in srgb, var(--secondary) 10%, white); font-weight: 700; color: var(--primary); }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix td.zero { color: #B5BEC6; }

/* ---------- status ---------- */
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.info { background: color-mix(in srgb, var(--secondary) 14%, white); color: var(--primary); }
.tag.plain { background: var(--paper); color: var(--muted); border: 1px solid var(--line); }

.messages { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.messages li { padding: 10px 14px; border-radius: var(--radius); border-left: 4px solid var(--secondary); background: var(--surface); border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.messages li.success { border-left-color: var(--ok); }
.messages li.error { border-left-color: var(--bad); }
.messages li.warning { border-left-color: var(--accent); }

/* ---------- forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius); border: 1px solid var(--primary);
  background: var(--primary); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  min-height: 42px;
}
.btn:hover { background: color-mix(in srgb, var(--primary) 85%, black); color: #fff; }
.btn.secondary { background: var(--surface); color: var(--primary); }
.btn.secondary:hover { background: var(--paper); color: var(--ink); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--primary); padding-inline: 8px; }
.btn.danger { background: var(--surface); color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.small { padding: 4px 10px; min-height: 32px; font-size: .88rem; }
.btn.block { width: 100%; }
.btn.paid { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.btn.unpaid { background: var(--surface); border-color: var(--line); color: var(--muted); }
form.inline { display: inline; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 5px; font-size: .95rem; }
.field .help { font-size: .84rem; color: var(--muted); margin-top: 4px; }
.field .errors { color: var(--bad); font-size: .88rem; margin-top: 4px; }
.field.check label { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=date], input[type=datetime-local],
input[type=password], input[type=url], input[type=search], select, textarea {
  width: 100%; font: inherit; padding: 9px 11px; border: 1px solid #C3CED7; border-radius: var(--radius);
  background: #fff; color: var(--ink); min-height: 42px;
}
textarea { min-height: 80px; resize: vertical; }
input[type=color] { width: 64px; height: 42px; padding: 2px; border: 1px solid #C3CED7; border-radius: var(--radius); background: #fff; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); flex: none; margin-top: 2px; }
.field ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.field ul label { display: flex; gap: 6px; align-items: center; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.filters > * { flex: 0 1 auto; }
.filters input[type=search] { min-width: 240px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

fieldset.field-row { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 2px; margin: 0 0 12px; background: #FBFDFE; }
fieldset.field-row legend { font-weight: 700; padding: 0 6px; font-size: .9rem; color: var(--muted); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; font-weight: 500; }

.diff del { color: var(--bad); }
.diff ins { color: var(--ok); text-decoration: none; font-weight: 600; }

.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- auth & parents ---------- */
.solo { min-height: 100vh; display: flex; flex-direction: column; }
.solo .pencil { height: 6px; }
.solo-main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 28px 18px 60px; }
.solo-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; margin: 10px 0 26px; }
.solo-brand img { width: 120px; height: 120px; object-fit: contain; }
.solo-brand h1 { font-size: 1.3rem; margin: 0; }
.solo-brand p { margin: 0; color: var(--muted); }
.code-input { font-size: 1.8rem !important; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.parent-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.parent-top .brand img { width: 40px; height: 40px; }
.child { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px; margin-bottom: 14px; }
.child h2 { margin: 0 0 2px; font-size: 1.15rem; }
.task { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.task:first-of-type { border-top: 0; }
.qty-row { display: grid; grid-template-columns: 1fr 120px; gap: 12px; align-items: center; }
.terms { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-size: .92rem; }
.receipt dl.facts { grid-template-columns: 1fr auto; }
footer.site { text-align: center; font-size: .8rem; color: var(--muted); padding: 20px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.filters select, .filters input[type=text] { width: auto; min-width: 180px; }
@media (max-width: 600px) { .filters > * { flex: 1 1 100%; } .filters select, .filters input { width: 100%; } }

.pay-inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.pay-inline input[type=text] { width: 96px; min-height: 32px; padding: 4px 8px; font-size: .9rem; }
.receipt-no { font-variant-numeric: tabular-nums; font-size: .82rem; color: var(--muted); white-space: nowrap; }

.copyright { margin: 6px auto 0; font-size: .78rem; color: var(--muted); max-width: none; }
.copyright a { color: inherit; }
footer.site-staff { margin-top: 48px; padding-top: 14px; border-top: 1px solid var(--line); text-align: center; }
.lang-toggle a { font-size: .85rem; font-weight: 600; text-decoration: none; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; }
.parent-nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.parent-nav a { white-space: nowrap; padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .92rem; }
.parent-nav a.active { background: color-mix(in srgb, var(--secondary) 16%, white); color: var(--primary); }
.solo-top-right { position: absolute; top: 14px; right: 16px; }
.thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.bubble { max-width: 85%; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.bubble.mine { align-self: flex-end; background: color-mix(in srgb, var(--secondary) 12%, white); border-color: color-mix(in srgb, var(--secondary) 30%, white); }
.bubble small { display: block; color: var(--muted); font-size: .78rem; margin-bottom: 4px; }
.bubble p { margin: 0; white-space: pre-wrap; }
.unread { font-weight: 700; }
.counter { font-size: .85rem; color: var(--muted); }
.radio-row ul { display: flex; gap: 18px; }
