:root {
  --brand: #6B8779;       /* φόντο λογοτύπου */
  --brand-dark: #36594C;  /* κουμπιά και μικρό κείμενο σε ανοιχτό φόντο */
  --brand-darker: #2a473c;
  --brand-tint: #e6eee9;
  --ink: #1f2b26;
  --muted: #55665e;
  --bg: #f3f6f4;
  --surface: #ffffff;
  --line: #d3ddd8;
  --ok: #2d6a4f; --ok-bg: #dcefe3;
  --warn: #7a4e00; --warn-bg: #fbeccb;
  --bad: #9b2f25; --bad-bg: #f8dcd8;
  --radius: 12px;
  --tap: 44px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); font-size: 16px; line-height: 1.45; overflow-x: hidden; min-height: 100vh; min-height: 100dvh; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--brand-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #1d6fd6; outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Shell */
.shell { min-height: 100vh; min-height: 100dvh; display: block; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--brand); color: #f3f8f5; display: flex; align-items: center; gap: 12px;
  padding: calc(6px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 6px calc(12px + env(safe-area-inset-left)); min-height: 64px; }
.topbar .brand { flex: 1; min-width: 0; }
.sidebar { background: var(--brand); color: #f3f8f5; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand img { display: block; width: 56px; height: 56px; flex: none; }
.brand .bname { font-weight: 600; font-size: 1.05rem; line-height: 1.15; overflow-wrap: anywhere; }
.brand .bsub { font-size: .7rem; letter-spacing: .16em; opacity: .92; }
.sidebar .brand { flex-direction: column; align-items: flex-start; padding: 18px 16px 8px; }
.sidebar .brand img { width: 100%; max-width: 200px; height: auto; }
.menu-btn { background: transparent; color: inherit; border: 2px solid rgba(255,255,255,.7); border-radius: 10px; min-height: var(--tap); padding: 0 14px; cursor: pointer; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px 16px; }
.nav a, .nav button { display: flex; align-items: center; min-height: var(--tap); padding: 0 14px; border-radius: 10px; color: #f3f8f5; text-decoration: none; font-weight: 500; background: none; border: 0; text-align: left; cursor: pointer; width: 100%; }
.nav a[aria-current="page"] { background: rgba(255,255,255,.22); font-weight: 700; }
.nav a:active, .nav button:active { background: rgba(255,255,255,.3); }
.nav .sep { flex: 1; }
.sidebar-mobile { position: sticky; top: 64px; z-index: 19; background: var(--brand-dark); }
.main { padding: 14px calc(14px + env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left)); max-width: 1500px; margin: 0 auto; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.page-head h1 { min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); }
  .topbar, .sidebar-mobile { display: none; }
  .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
  .nav { display: flex; flex: 1; }
  .main { padding: 24px 28px 48px; width: 100%; }
}
@media (max-width: 899px) {
  .sidebar { display: none; }
  /* Μενού κινητού: πλαίσιο πάνω από το περιεχόμενο, κάτω από το header, με κύλιση αν χρειάζεται */
  .sidebar.show-mobile { display: block; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    top: calc(64px + env(safe-area-inset-top)); overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .sidebar .brand { display: none; }
  .nav { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }
  .nav a, .nav button { min-height: 52px; font-size: 1.05rem; }
}

/* Κουμπιά / φόρμες */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 16px; border-radius: 10px; border: 1.5px solid var(--brand-dark);
  background: var(--surface); color: var(--brand-dark); font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--brand-tint); }
.btn.primary { background: var(--brand-dark); color: #fff; }
.btn.primary:hover { background: var(--brand-darker); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.btn.sm { min-height: 40px; padding: 0 12px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 4px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > label, .field > legend { font-weight: 600; font-size: .92rem; padding: 0; }
.req { color: var(--bad); }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: var(--tap); padding: 8px 12px; border: 1.5px solid #9fb0a8; border-radius: 10px; background: #fff; font-size: 16px; }
input[type=date], input[type=time] { min-width: 0; }
.radios { display: flex; flex-wrap: wrap; gap: 8px; }
.radio, .check { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; }
.check { border: 0; padding: 0; background: none; }
.radio input, .check input { width: 20px; height: 20px; }
.error { background: var(--bad-bg); color: var(--bad); border: 1px solid #e3aaa3; padding: 10px 12px; border-radius: 10px; font-weight: 500; }
.info { background: var(--brand-tint); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; }
.notice-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #ecd090; padding: 10px 12px; border-radius: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* Κάρτες / λίστες */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.card h2 { margin-bottom: 10px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.tile .v { font-size: 1.5rem; font-weight: 700; color: var(--brand-dark); }
.tile .l { font-size: .85rem; color: var(--muted); }
.tile.warn .v { color: var(--bad); }
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.list > li { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; min-width: 0; }
.list > li:first-child { border-top: 0; }
.list .main-col { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge.gray { background: #e8ece9; color: #36443d; } .badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.brand { background: var(--brand-dark); color: #fff; }
.state { padding: 28px 14px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.state.error { color: var(--bad); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand-dark); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
.seg { display: inline-flex; border: 1.5px solid var(--brand-dark); border-radius: 10px; overflow: hidden; }
.seg button { min-height: 42px; padding: 0 14px; border: 0; background: #fff; color: var(--brand-dark); font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--brand-dark); color: #fff; }
.seg button + button { border-left: 1.5px solid var(--brand-dark); }

/* Ημερολόγιο */
.cal-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.cal-bar .title { font-weight: 700; flex: 1 1 160px; min-width: 0; }
.daychips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; -webkit-overflow-scrolling: touch; }
.daychips button { flex: none; min-width: 52px; min-height: var(--tap); border: 1.5px solid var(--line); background: #fff; border-radius: 10px; font-weight: 600; cursor: pointer; padding: 0 8px; }
.daychips button.today { border-color: var(--brand-dark); color: var(--brand-dark); }
.week { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.day { min-width: 0; scroll-margin-top: 140px; }
.day h3 { font-size: .95rem; padding: 6px 2px; color: var(--brand-dark); }
.day.today h3 { text-decoration: underline; text-underline-offset: 4px; }
.day .slots { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.scard { display: flex; flex-direction: column; gap: 2px; text-align: left; background: var(--surface); border: 1.5px solid var(--line); border-left: 6px solid var(--brand); border-radius: 10px; padding: 9px 11px; cursor: pointer; min-height: var(--tap); min-width: 0; width: 100%; }
.scard.individual { border-left-color: #8a6d1f; }
.scard.full { background: #f4f1ea; }
.scard.past { opacity: .72; }
.scard.cancelled { text-decoration: line-through; opacity: .55; }
.scard .t { font-weight: 700; } .scard .k { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.scard .who { font-weight: 600; overflow-wrap: anywhere; } .scard .seats { font-size: .85rem; } .scard .wl, .scard .mv { font-size: .78rem; color: var(--warn); font-weight: 600; }
.nosessions { color: var(--muted); font-size: .9rem; padding: 6px 2px; }
@media (min-width: 1200px) {
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: start; }
  .day .slots { grid-template-columns: minmax(0, 1fr); }
  .daychips { display: none; }
}

/* Dialog */
dialog.dlg { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); box-shadow: 0 20px 60px rgba(0,0,0,.35); background: var(--surface); color: var(--ink); }
dialog.dlg.wide { width: min(780px, calc(100vw - 20px)); }
dialog.dlg::backdrop { background: rgba(20, 35, 29, .55); }
.dlg-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; border-radius: 16px 16px 0 0; }
.dlg-body { padding: 14px; display: flex; flex-direction: column; gap: 14px; overflow-wrap: anywhere; }
.section { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }

/* Toasts / offline */
#toasts { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; max-width: 520px; padding: 12px 16px; border-radius: 12px; background: var(--brand-darker); color: #fff; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.bad { background: var(--bad); }
#offline { position: sticky; top: 0; z-index: 60; background: var(--warn-bg); color: var(--warn); font-weight: 600; text-align: center; padding: 8px 12px; border-bottom: 1px solid #ecd090; }
.preview-banner { background: #2b2b2b; color: #ffe08a; padding: 10px 14px; font-weight: 600; border-radius: 10px; }

/* Σύνδεση */
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px 14px; background: var(--brand); }
.login .logo { display: flex; flex-direction: column; align-items: center; color: #f3f8f5; text-align: center; gap: 4px; }
.login .logo img { width: min(220px, 60vw); height: auto; display: block; }
.login .logo .bname { font-size: 1.9rem; font-weight: 600; } .login .logo .bsub { letter-spacing: .2em; font-size: .8rem; }
.login .panel { width: min(440px, 100%); background: var(--surface); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.login .tabs { width: 100%; }
.login .tabs button { flex: 1; }
.copybox { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; word-break: break-all; background: #f1f4f2; padding: 8px 10px; border-radius: 8px; user-select: all; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
