/* =====================================================================
   FORPAS Control Center — design tokens & layout (mobile first)
   Σκούρο sidebar αριστερά, λευκή εφαρμογή, κάρτες με λεπτό περίγραμμα,
   AI Βοηθός δεξιά (σταθερό πάνελ σε μεγάλες οθόνες, συρτάρι αλλού).
   ===================================================================== */

:root {
  color-scheme: light;

  /* Surfaces */
  --page: #F7F8FA;
  --card: #FFFFFF;
  --line: #E8EBF0;
  --line-2: #F0F2F5;
  --hover: #F5F7FA;

  /* Sidebar */
  --nav-bg: #1D2432;
  --nav-bg-2: #2A3344;
  --nav-text: #C7CEDB;
  --nav-muted: #7F8AA0;
  --nav-line: #2C3546;

  /* Text */
  --text: #1E2433;
  --muted: #6B7385;
  --faint: #9AA2B2;

  /* Brand */
  --brand: #E1252F;
  --brand-dark: #C3141E;
  --brand-soft: #FDECEC;
  --on-brand: #FFFFFF;

  /* Tones */
  --blue: #2F7FEA;   --blue-soft: #E8F1FD;
  --red: #E5383F;    --red-soft: #FDECEC;
  --amber: #EE9F12;  --amber-soft: #FEF4E1;
  --green: #22A35A;  --green-soft: #E5F6EC;
  --purple: #7B5BDB; --purple-soft: #F0EBFC;
  --gray: #6B7385;   --gray-soft: #F0F2F5;

  --dark-btn: #161B26;
  --on-dark: #FFFFFF;

  --font: "Manrope", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;

  --r-card: 14px;
  --r-md: 10px;
  --r-sm: 8px;
  --shadow-card: 0 1px 2px rgba(20, 28, 48, .04);
  --shadow-float: 0 18px 40px -16px rgba(20, 28, 48, .35);
  --focus: 0 0 0 3px rgba(47, 127, 234, .30);

  --sidebar-w: 264px;
  --ai-w: 384px;
  --topbar-h: 64px;
  --tabbar-h: 68px;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

body {
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 60;
  background: var(--card);
}

body.no-scroll { overflow: hidden; }

h1, h2, p { margin: 0; }
h2 { text-wrap: balance; }
ul, ol { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
button, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ico {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.ico--sm { width: 16px; height: 16px; }
.ico--xs { width: 13px; height: 13px; }

/* ---------- Logo ---------- */

.logo { display: grid; gap: 4px; }
.logo__word {
  font-size: 2.1rem;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -.04em;
  line-height: .95;
  color: var(--brand);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .15);
}
.logo__tec { color: var(--brand); }
.logo__sub {
  justify-self: start;
  padding: 2px 6px;
  border-radius: 3px;
  background: #E9ECF2;
  color: #2A3344;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .01em;
}
.logo--compact .logo__word { font-size: 1.45rem; text-shadow: none; }
.logo--compact .logo__tec { color: var(--text); }

/* ---------- Common atoms ---------- */

.circle {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%; flex: none;
}
.circle .ico { width: 18px; height: 18px; }
.circle--sm { width: 32px; height: 32px; }
.circle--sm .ico { width: 16px; height: 16px; }
.circle--lg { width: 48px; height: 48px; }
.circle--lg .ico { width: 24px; height: 24px; }
.circle--xl { width: 52px; height: 52px; }
.circle--xl .ico { width: 24px; height: 24px; }
.circle--sq { border-radius: var(--r-md); }
.circle--blue { background: var(--blue-soft); color: var(--blue); }
.circle--red { background: var(--red-soft); color: var(--red); }
.circle--amber { background: var(--amber-soft); color: var(--amber); }
.circle--green { background: var(--green-soft); color: var(--green); }
.circle--purple { background: var(--purple-soft); color: var(--purple); }

.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn--round { border: 1.5px solid var(--line); color: var(--text); }
.icon-btn--sm { width: 32px; height: 32px; }
.icon-btn--dark { color: var(--nav-text); }
.icon-btn--dark:hover { background: var(--nav-bg-2); color: var(--on-dark); }

.badge {
  position: absolute; top: 3px; right: 2px;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center;
  border-radius: 999px; background: var(--brand); color: var(--on-brand);
  font-size: 10px; font-weight: 800;
  box-shadow: 0 0 0 2px var(--card);
}

.avatar {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  font-size: 12px; font-weight: 800; letter-spacing: .02em;
}
.avatar--brand { background: var(--brand); color: var(--on-brand); }
.avatar--green { background: var(--green-soft); color: var(--green); }
.avatar--blue { background: var(--blue-soft); color: var(--blue); }
.avatar--amber { background: var(--amber-soft); color: var(--amber); }
.avatar--red { background: var(--red-soft); color: var(--red); }

.tag {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px 9px; border-radius: 6px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.tag--red { background: var(--red-soft); color: var(--red); }
.tag--amber { background: var(--amber-soft); color: #C27C00; }
.tag--blue { background: var(--blue-soft); color: var(--blue); }
.tag--green { background: var(--green-soft); color: var(--green); }
.tag--gray { background: var(--gray-soft); color: var(--gray); }

.count {
  display: inline-grid; place-items: center;
  min-width: 24px; height: 22px; padding: 0 7px;
  border-radius: 999px; font-size: 12px; font-weight: 800;
  background: var(--gray-soft); color: var(--muted);
}
.count--red { background: var(--brand); color: var(--on-brand); }
.count--soft { background: var(--blue-soft); color: var(--blue); }

.link { font-size: 13px; font-weight: 600; color: var(--blue); }
.link:hover { text-decoration: underline; }

.pill-btn {
  display: inline-flex; align-items: center;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  font-size: 12.5px; font-weight: 700; color: var(--text);
  min-height: 32px; white-space: nowrap;
}
.pill-btn:hover { border-color: var(--brand); color: var(--brand); }

.meter { height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.meter__fill { display: block; height: 100%; width: var(--pct, 0%); border-radius: inherit; background: var(--blue); }
.meter__fill--green { background: var(--green); }
.meter__fill--blue { background: var(--blue); }
.meter__fill--amber { background: var(--amber); }
.meter__fill--red { background: var(--red); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.legend__dot--blue { background: var(--blue); }
.legend__dot--red { background: var(--red); }
.legend__dot--amber { background: var(--amber); }
.legend__dot--green { background: var(--green); }

.empty { color: var(--muted); font-size: 13px; }

.callout {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--r-md);
  background: var(--amber-soft); font-size: 12.5px; color: var(--text);
}
.callout .ico { color: #C27C00; margin-top: 1px; }

/* ---------- Shell ---------- */

.shell { min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

/* Sidebar (off-canvas σε κινητό) */
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
  width: min(var(--sidebar-w), 86vw);
  display: flex; flex-direction: column; gap: 22px;
  padding-top: calc(18px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  padding-left: max(14px, env(safe-area-inset-left, 0px));
  padding-right: 14px;
  background: var(--nav-bg);
  color: var(--nav-text);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .25s ease;
}
body.nav-open .sidebar { transform: none; }
.sidebar__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding-left: 4px; }
.nav-backdrop {
  position: fixed; inset: 0; z-index: 45;
  background: rgba(12, 16, 26, .45);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

.sidenav { display: grid; gap: 2px; }
.sidenav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-md);
  font-size: 13.5px; font-weight: 600; color: var(--nav-text);
}
.sidenav__item .ico { color: var(--nav-muted); }
.sidenav__item:hover { background: var(--nav-bg-2); color: var(--on-dark); }
.sidenav__item.is-active { background: var(--nav-bg-2); color: var(--on-dark); box-shadow: inset 0 0 0 1px #3A4458; }
.sidenav__item.is-active .ico { color: var(--on-dark); }
.sidenav__label { flex: 1; min-width: 0; }
.sidenav__badge {
  min-width: 22px; height: 20px; padding: 0 6px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--brand); color: var(--on-brand); font-size: 11px; font-weight: 800;
}
.sidenav__more { color: var(--nav-muted); }

.sidebar__foot { margin-top: auto; display: grid; gap: 14px; padding-top: 14px; border-top: 1px solid var(--nav-line); }
.office-status { display: grid; gap: 6px; padding-left: 6px; font-size: 12px; }
.office-status__label { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--nav-muted); font-weight: 700; }
.office-status__on { display: inline-flex; align-items: center; gap: 8px; color: var(--on-dark); font-weight: 600; }
.office-status__on::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(34, 163, 90, .25); }
.new-task {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-radius: var(--r-md);
  border: 1px solid #3A4458; background: var(--nav-bg-2);
  color: var(--on-dark); font-weight: 700;
}
.new-task:hover { background: #343E52; }

/* Topbar */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  display: flex; align-items: center; gap: 8px;
  min-height: var(--topbar-h);
  padding-block: 10px;
  padding-left: max(10px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.topbar__title { display: none; }
.logo--compact { margin-right: auto; }
.search {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%; color: var(--muted);
}
.search span { display: none; }
.topbar__actions { display: flex; align-items: center; gap: 2px; }
.hide-sm, .hide-md { display: none; }
.user { display: inline-flex; align-items: center; gap: 10px; padding: 4px; border-radius: 999px; margin-left: 4px; }
.user__text, .user__chev { display: none; }

/* Content */
.content {
  flex: 1;
  container-type: inline-size;
  display: grid; gap: 16px; align-content: start;
  padding-top: 16px;
  padding-bottom: 20px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.scope { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-md); background: var(--card); border: 1px solid var(--line); }
.scope__btn { padding: 7px 12px; border-radius: var(--r-sm); font-size: 13px; font-weight: 700; color: var(--muted); min-height: 34px; }
.scope__btn.is-active { background: var(--text); color: var(--card); }
.filter-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 12px; border-radius: var(--r-md);
  background: var(--card); border: 1px solid var(--line);
  font-size: 13px; font-weight: 700; min-height: 40px;
}
.filter-toggle[aria-expanded="true"] { border-color: var(--text); }
.filter-toggle__count { min-width: 18px; height: 18px; display: grid; place-items: center; border-radius: 999px; background: var(--brand); color: var(--on-brand); font-size: 11px; }
.ai-btn {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r-md);
  background: var(--dark-btn); color: var(--on-dark);
  font-size: 13px; font-weight: 700; min-height: 40px;
}
.ai-btn .ico { color: #FFB4B7; }
body.ai-open .ai-btn { background: var(--brand); }
body.ai-open .ai-btn .ico { color: var(--on-brand); }

.filters {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
  padding: 14px; border-radius: var(--r-card);
  background: var(--card); border: 1px solid var(--line);
}
.filter { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); min-width: 0; }
.filter select {
  width: 100%; height: 38px; padding: 0 10px;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--card);
  font-size: 13px; font-weight: 600; color: var(--text);
}
.filter-reset { align-self: end; height: 38px; border-radius: var(--r-sm); font-size: 13px; font-weight: 700; color: var(--blue); }

/* ---------- KPIs ---------- */

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi {
  display: grid; gap: 10px; align-content: start;
  padding: 14px; border-radius: var(--r-card);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-card);
  min-width: 0;
}
.kpi .circle--lg { width: 40px; height: 40px; }
.kpi__body { display: grid; gap: 3px; min-width: 0; }
.kpi__label { font-size: 12.5px; font-weight: 700; color: var(--text); }
.kpi__row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.kpi__value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi__delta { font-size: 12px; font-weight: 700; }
.kpi__delta.is-good { color: var(--green); }
.kpi__delta.is-bad { color: var(--red); }
.kpi__note { font-size: 11.5px; color: var(--muted); }

/* ---------- Cards ---------- */

.board { display: grid; gap: 16px; }
.card {
  display: grid; gap: 14px; align-content: start;
  padding: 16px; border-radius: var(--r-card);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-card);
  min-width: 0;
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card__title { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.card__title small { font-size: 12px; font-weight: 600; color: var(--muted); }
.card__title--icon { display: inline-flex; align-items: center; gap: 10px; }
.card__hint { font-size: 12px; font-weight: 600; color: var(--muted); }
.select-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: var(--r-sm); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
}

/* Mobile priority order */
.card--brief { order: 1; }
.card--myday { order: 2; }
.card--due { order: 3; }
.card--urgent { order: 4; }
.card--notif { order: 5; }
.card--inbox { order: 6; }
.card--qa { order: 7; }
.card--recv { order: 8; }
.card--unbilled { order: 9; }
.card--recurring { order: 10; }
.card--cash { order: 11; }
.card--perf { order: 12; }
.card--cal { order: 13; }
.card--income { order: 14; }
.card--donut { order: 15; }
.card--recent { order: 16; }

/* Brief */
.brief { display: grid; gap: 8px; }
.brief__item {
  display: grid; gap: 8px;
  padding: 12px 12px 12px 14px; border-radius: var(--r-md);
  background: var(--page); border-left: 3px solid var(--blue);
}
.brief__item--crit { border-left-color: var(--red); }
.brief__item--warn { border-left-color: var(--amber); }
.brief__text { font-size: 13px; font-weight: 600; }
.brief__item .pill-btn { justify-self: start; }

/* Area chart */
.area-chart { width: 100%; overflow-x: auto; }
.area-chart__svg { display: block; width: 100%; min-width: 420px; height: auto; }
.chart-grid { stroke: var(--line-2); stroke-width: 1; }
.chart-tick { fill: var(--muted); font-family: var(--font); font-size: 11.5px; }
.chart-tick.is-future { fill: var(--faint); }
.area-stop--blue { stop-color: var(--blue); }
.area-stop--red { stop-color: var(--red); }
.area-line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.area-line--blue { stroke: var(--blue); }
.area-line--red { stroke: var(--red); }
.area-dot { stroke: var(--card); stroke-width: 1.5; }
.area-dot--blue { fill: var(--blue); }
.area-dot--red { fill: var(--red); }

/* Donut */
.donut { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 18px; }
.donut__fig { position: relative; width: 150px; max-width: 100%; aspect-ratio: 1; }
.donut__svg { display: block; width: 100%; height: 100%; }
.donut__seg { fill: none; }
.donut__seg--green { stroke: var(--green); }
.donut__seg--blue { stroke: var(--blue); }
.donut__seg--amber { stroke: var(--amber); }
.donut__seg--red { stroke: var(--red); }
.donut__center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut__center strong { font-size: 22px; font-weight: 800; line-height: 1; }
.donut__center span { font-size: 11.5px; color: var(--muted); }
.donut__legend { display: grid; gap: 12px; }
.donut__legend li { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.donut__pct { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Notifications */
.notif { display: grid; gap: 4px; }
.notif__item {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 8px; margin-inline: -8px; border-radius: var(--r-md); cursor: pointer;
}
.notif__item:hover { background: var(--hover); }
.notif__label { font-size: 13px; font-weight: 600; }

/* Deadlines */
.due { display: grid; }
.due__item {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line-2); cursor: pointer;
}
.due__item:first-child { border-top: 0; padding-top: 0; }
.due__date {
  display: grid; justify-items: center; align-content: center;
  height: 48px; border-radius: var(--r-md); border: 1px solid var(--line); line-height: 1;
}
.due__date strong { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.due__date small { font-size: 10px; font-weight: 700; color: var(--muted); margin-top: 3px; letter-spacing: .04em; }
.due__date.is-overdue { border-color: #F6C3C5; background: var(--red-soft); color: var(--red); }
.due__date.is-overdue small { color: var(--red); }
.due__body { display: grid; gap: 1px; min-width: 0; }
.due__title { font-size: 13.5px; font-weight: 700; }
.due__sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.due__note { font-size: 11.5px; font-weight: 600; color: #C27C00; }

/* Receivables */
.recv { display: grid; }
.recv__item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "body amount" "body days";
  gap: 2px 12px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line-2); cursor: pointer;
}
.recv__item:first-child { border-top: 0; padding-top: 0; }
.recv__body { grid-area: body; display: grid; gap: 1px; min-width: 0; }
.recv__client { font-size: 13.5px; font-weight: 700; }
.recv__ref { font-size: 12px; color: var(--muted); }
.recv__limit { font-size: 11.5px; font-weight: 700; color: var(--red); }
.recv__amount { grid-area: amount; justify-self: end; font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.recv__days { grid-area: days; justify-self: end; font-size: 12px; font-weight: 700; color: #C27C00; }
.recv__days.is-late { color: var(--red); }

/* Performance */
.perf { display: grid; gap: 14px; }
.perf__item {
  display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; grid-template-areas: "av body pct" "av meter meter";
  gap: 6px 12px; align-items: center;
}
.perf__item .avatar { grid-area: av; }
.perf__body { grid-area: body; display: grid; min-width: 0; }
.perf__name { font-size: 13.5px; font-weight: 700; }
.perf__sub { font-size: 12px; color: var(--muted); }
.perf__item .meter { grid-area: meter; }
.perf__pct { grid-area: pct; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.perf__pct--green { color: var(--green); }
.perf__pct--blue { color: var(--blue); }
.perf__pct--amber { color: #C27C00; }
.perf__pct--red { color: var(--red); }

/* Calendar */
.cal { display: grid; gap: 12px; }
.cal__head { display: flex; align-items: center; justify-content: space-between; }
.cal__month { font-size: 14px; font-weight: 800; }
.cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px 2px; text-align: center; }
.cal__wd { font-size: 11px; font-weight: 800; color: var(--muted); padding-bottom: 4px; }
.cal__day { display: grid; justify-items: center; gap: 2px; padding: 3px 0; border-radius: var(--r-sm); }
.cal__day:not(:disabled):hover .cal__num { background: var(--hover); }
.cal__num {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.cal__day.is-out .cal__num { color: var(--faint); }
.cal__day.has-obligation .cal__num { box-shadow: inset 0 0 0 1.5px var(--red); color: var(--red); font-weight: 800; }
.cal__day.is-today .cal__num { background: var(--blue); color: var(--on-brand); box-shadow: none; font-weight: 800; }
.cal__dots { display: flex; gap: 3px; height: 5px; }
.cal__dot { width: 5px; height: 5px; border-radius: 50%; }
.cal__dot--blue { background: var(--blue); }
.cal__dot--green { background: var(--green); }
.legend--cal { justify-content: center; }
.legend__dot--round { border-radius: 50%; }

/* Recent tasks */
.recent { display: grid; }
.recent__item {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; grid-template-areas: "ic body tag" "ic meta meta";
  gap: 4px 12px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line-2); cursor: pointer;
}
.recent__item:first-child { border-top: 0; padding-top: 0; }
.recent__item .circle { grid-area: ic; }
.recent__body { grid-area: body; display: grid; min-width: 0; }
.recent__title { font-size: 13.5px; font-weight: 700; }
.recent__sub { font-size: 12px; color: var(--muted); }
.recent__item .tag { grid-area: tag; justify-self: end; }
.recent__owner { grid-area: meta; font-size: 12px; color: var(--muted); }
.recent__date { display: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Quick actions */
.qa { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.qa__btn {
  display: grid; justify-items: center; align-content: start; gap: 8px;
  padding: 12px 4px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--card);
  text-align: center; min-height: 104px;
}
.qa__btn:hover { border-color: #CDD3DD; background: var(--hover); }
.qa__btn .circle--xl { width: 44px; height: 44px; }
.qa__label { font-size: 12px; font-weight: 700; line-height: 1.25; }

/* My day */
.checklist { display: grid; }
.check {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 9px 0; border-top: 1px solid var(--line-2);
}
.check:first-child { border-top: 0; padding-top: 0; }
.check__box {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px;
  border: 1.5px solid #CBD1DB; color: transparent;
}
.check__box .ico { width: 15px; height: 15px; stroke-width: 2.6; }
.check.is-done .check__box { background: var(--green); border-color: var(--green); color: var(--on-brand); }
.check__body { display: grid; min-width: 0; }
.check__title { font-size: 13.5px; font-weight: 700; }
.check.is-done .check__title { color: var(--faint); text-decoration: line-through; }
.check__sub { font-size: 12px; color: var(--muted); }
.check__est { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }

/* Generic rows */
.rows { display: grid; }
.row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line-2); cursor: pointer;
}
.row:first-child { border-top: 0; padding-top: 0; }
.row--static { grid-template-columns: minmax(0, 1fr) auto; cursor: default; }
.row__bar { width: 4px; height: 34px; border-radius: 4px; }
.row__bar--red { background: var(--red); }
.row__bar--amber { background: var(--amber); }
.row__body { display: grid; gap: 1px; min-width: 0; }
.row__title { font-size: 13.5px; font-weight: 700; }
.row__what { font-weight: 500; color: var(--muted); }
.row__sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.row__ago { font-size: 12px; color: var(--faint); white-space: nowrap; }
.row__right { display: flex; align-items: center; gap: 10px; }
.row__amount { font-weight: 800; font-variant-numeric: tabular-nums; }

/* Recurring */
.recurring { display: grid; gap: 16px; }
.rc { display: grid; gap: 8px; }
.rc__top { display: flex; justify-content: space-between; gap: 12px; }
.rc__title { font-size: 13.5px; font-weight: 700; }
.rc__ratio { font-size: 13px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.rc__foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 32px; }
.rc__missing { font-size: 12px; font-weight: 700; color: #C27C00; }
.rc__ok { font-size: 12px; font-weight: 700; color: var(--green); }

/* Cash drawers */
.drawers { display: grid; gap: 8px; }
.drawer-box { display: grid; gap: 6px; padding: 12px; border-radius: var(--r-md); background: var(--page); }
.drawer-box--central { background: transparent; border: 1px dashed var(--line); }
.drawer-box__head { display: flex; justify-content: space-between; gap: 12px; }
.drawer-box__name { font-size: 13.5px; font-weight: 700; }
.drawer-box__total { font-variant-numeric: tabular-nums; }
.drawer-box__meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); }

/* Footer */
.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding-top: 14px;
  padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-top: 1px solid var(--line);
  background: var(--card);
  font-size: 12px; color: var(--muted);
}
.footer a:hover { color: var(--text); }
.demo { margin-left: 6px; padding: 3px 8px; border-radius: 6px; background: var(--green-soft); color: var(--green); font-weight: 800; }

/* ---------- AI panel ---------- */

.ai {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 55;
  width: min(var(--ai-w), 100%);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-float);
  transform: translateX(105%);
  transition: transform .25s ease;
}
body.ai-open .ai { transform: none; }
.ai-backdrop {
  position: fixed; inset: 0; z-index: 54;
  background: rgba(12, 16, 26, .35);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
body.ai-open .ai-backdrop { opacity: 1; pointer-events: auto; }

.ai__head {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.ai__title { font-size: 15px; font-weight: 800; }
.ai__sub { font-size: 12px; color: var(--muted); }

.ai__thread {
  overflow-y: auto; display: grid; align-content: start; gap: 12px;
  padding: 16px; padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--page);
}
.msg { display: flex; }
.msg--user { justify-content: flex-end; }
.msg__bubble { max-width: 92%; padding: 12px 14px; border-radius: 14px; font-size: 13.5px; }
.msg--user .msg__bubble { background: var(--text); color: var(--card); border-bottom-right-radius: 4px; }
.msg--ai .msg__bubble { display: grid; gap: 10px; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg__text { font-weight: 500; }
.msg__list { display: grid; gap: 6px; }
.msg__item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px;
  padding: 8px 10px; border-radius: var(--r-sm); background: var(--page);
  border-left: 3px solid var(--blue); font-size: 12.5px;
}
.msg__item--crit { border-left-color: var(--red); }
.msg__item--warn { border-left-color: var(--amber); }
.msg__item--ok { border-left-color: var(--green); }
.msg__value { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.msg__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.msg__bubble--typing { display: flex !important; gap: 5px; padding: 14px; }
.typing-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: blink 1s infinite; }
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.ai__foot {
  display: grid; gap: 10px;
  padding: 12px 16px 14px; padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-top: 1px solid var(--line);
}
.ai__chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ai__chips::-webkit-scrollbar { display: none; }
.ai-chip {
  flex: none; padding: 6px 11px; border-radius: 999px;
  background: var(--page); border: 1px solid var(--line);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.ai-chip:hover { border-color: var(--brand); color: var(--brand); }
.ai__form {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px;
  padding: 6px 6px 6px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card);
}
.ai__form:focus-within { border-color: var(--text); }
.ai__form textarea {
  width: 100%; min-height: 36px; max-height: 140px; padding: 8px 0;
  border: 0; outline: none; resize: none; background: transparent;
  font-size: 14px; line-height: 1.4;
}
.ai__send { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: var(--on-brand); }
.ai__send:hover { background: var(--brand-dark); }
.ai__privacy { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }

/* ---------- Tab bar (κινητό) ---------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  min-height: var(--tabbar-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: max(6px, env(safe-area-inset-left, 0px));
  padding-right: max(6px, env(safe-area-inset-right, 0px));
  background: var(--card); border-top: 1px solid var(--line);
}
.tabbar__item { display: grid; justify-items: center; gap: 3px; padding-block: 9px; font-size: 11px; font-weight: 700; color: var(--faint); }
.tabbar__item.is-active { color: var(--brand); }
.tabbar__item .ico { width: 22px; height: 22px; }
.tabbar__fab {
  justify-self: center; display: grid; place-items: center;
  width: 54px; height: 54px; margin-top: -24px; border-radius: 50%;
  background: var(--brand); color: var(--on-brand);
  box-shadow: 0 10px 22px -10px rgba(225, 37, 47, .7), 0 0 0 5px var(--card);
}
.tabbar__fab .ico { width: 26px; height: 26px; stroke-width: 2.3; }

/* ---------- Sheet ---------- */

.sheet { position: fixed; inset: 0; z-index: 70; display: grid; align-items: end; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(12, 16, 26, .45); }
.sheet__panel {
  position: relative; display: grid; gap: 14px;
  padding-top: 10px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--card); border-radius: 20px 20px 0 0;
  animation: sheet-in .22s ease-out;
}
.sheet__grip { justify-self: center; width: 40px; height: 5px; border-radius: 999px; background: var(--line); }
.sheet__head { display: flex; justify-content: space-between; align-items: center; }
.sheet__head h2 { font-size: 17px; font-weight: 800; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom, 0px));
  z-index: 80; width: max-content; max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: var(--r-md);
  background: var(--dark-btn); color: var(--on-dark);
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-float);
}

/* =====================================================================
   Container queries: διάταξη πίνακα ανάλογα με το διαθέσιμο πλάτος
   (λειτουργεί σωστά και όταν το πάνελ AI είναι ανοιχτό)
   ===================================================================== */

@container (min-width: 560px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; padding: 16px; }
  .kpi .circle--lg { width: 48px; height: 48px; }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board > .card { order: 0; }
  .card--brief, .card--income, .card--qa, .card--recent { grid-column: 1 / -1; }
  .qa { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .card { padding: 18px; }
}

@container (min-width: 900px) {
  .filters { grid-template-columns: repeat(5, minmax(0, 1fr)) auto; }
  .board { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .board > :where(.card) { grid-column: span 6; }
  .card--brief, .card--qa { grid-column: span 12; }
  .card--income { grid-column: span 7; }
  .card--donut { grid-column: span 5; }
  .card--cal { grid-column: span 5; }
  .card--recent { grid-column: span 7; }
  .qa { grid-template-columns: repeat(8, minmax(0, 1fr)); }

  .recent__item {
    grid-template-columns: 36px minmax(0, 1fr) auto auto auto;
    grid-template-areas: "ic body tag meta date";
    gap: 12px;
  }
  .recent__date { display: block; grid-area: date; }
}

@container (min-width: 1180px) {
  .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpi { grid-template-columns: auto minmax(0, 1fr); padding: 16px 14px; gap: 12px; }
  .kpi .circle--lg { width: 44px; height: 44px; }
  .kpi__value { font-size: 21px; }

  .board > :where(.card) { grid-column: span 4; }
  .card--brief { grid-column: span 12; }
  .card--income { grid-column: span 5; }
  .card--donut { grid-column: span 4; }
  .card--notif { grid-column: span 3; }
  .card--due, .card--recv, .card--perf, .card--cal { grid-column: span 3; }
  .card--recent { grid-column: span 6; }
  .card--qa { grid-column: span 6; }
  .qa { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .donut { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .donut__legend { width: 100%; }
}

@container (min-width: 1380px) {
  .donut { grid-template-columns: auto minmax(0, 1fr); justify-items: stretch; }
  .qa { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .card--recent, .card--qa { grid-column: span 6; }
}

/* =====================================================================
   Media queries: κέλυφος (sidebar, topbar, AI)
   ===================================================================== */

@media (min-width: 640px) {
  .hide-sm { display: inline-grid; }
  .search { width: auto; flex: 1; max-width: 420px; justify-content: flex-start; display: inline-flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: var(--r-md); border: 1px solid var(--line); color: var(--faint); height: 42px; margin-inline: 8px; }
  .search span { display: inline; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .logo--compact { margin-right: 0; }
  .topbar__actions { margin-left: auto; }
}

@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; height: 100vh; width: auto; z-index: 1;
    transform: none; transition: none;
  }
  .sidebar__close, .nav-backdrop { display: none; }
  body.nav-collapsed .shell { grid-template-columns: 0 minmax(0, 1fr); }
  body.nav-collapsed .sidebar { visibility: hidden; padding: 0; overflow: hidden; }

  .logo--compact { display: none; }
  .topbar { padding-inline: 20px 24px; gap: 12px; }
  .topbar__title { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; white-space: nowrap; }
  .search { margin-inline: 12px; }
  .hide-md { display: inline-grid; }
  .topbar__actions { gap: 6px; }
  .user { padding: 4px 8px 4px 4px; }
  .user__text { display: grid; text-align: left; line-height: 1.2; }
  .user__text strong { font-size: 13px; }
  .user__text small { font-size: 11.5px; color: var(--muted); }
  .user__chev { display: block; color: var(--muted); }

  .content { padding: 20px 24px 32px; gap: 18px; }
  .footer { padding: 16px 24px; }
  .tabbar { display: none; }

  .sheet { align-items: center; justify-items: center; }
  .sheet__panel { width: min(620px, calc(100% - 48px)); border-radius: 20px; padding: 20px; }
  .sheet__grip { display: none; }
  .qa--sheet { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .toast { bottom: 32px; }
}

/* Μεγάλες οθόνες: το AI γίνεται σταθερή στήλη δεξιά */
@media (min-width: 1680px) {
  body.ai-open .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--ai-w); }
  body.ai-open.nav-collapsed .shell { grid-template-columns: 0 minmax(0, 1fr) var(--ai-w); }
  .ai { position: sticky; top: 0; height: 100vh; width: auto; box-shadow: none; transform: none; transition: none; z-index: 1; }
  body:not(.ai-open) .ai { display: none; }
  .ai-backdrop { display: none; }
  body.ai-open .card--brief { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
