/* ============================================================
   Kase — φύλλο ύφους
   Παλέτα: μελάνι / ψυχρό χαρτί / πράσινο πίστωσης / κόκκινο χρέωσης
   ============================================================ */

:root {
  --ink:        #131b26;
  --ink-2:      #35455a;
  --ink-3:      #6b7c92;
  --line:       #d6dde5;
  --line-soft:  #e6ebf0;
  --paper:      #eef1f5;
  --surface:    #ffffff;

  --in:         #0e7a6b;   /* έσοδα  */
  --in-soft:    #d7f0eb;
  --out:        #b23b31;   /* έξοδα  */
  --out-soft:   #f8dedb;
  --warn:       #b4740c;

  --r:      10px;
  --r-sm:   7px;
  --shadow: 0 1px 2px rgba(19,27,38,.06), 0 1px 12px rgba(19,27,38,.05);

  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

a { color: inherit; }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 14px; }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--ink);
  color: #fff;
  position: sticky; top: 0; z-index: 40;
}
.topbar-in { display: flex; align-items: center; gap: 18px; height: 54px; }
.brand {
  font-weight: 700; letter-spacing: .02em; text-decoration: none;
  display: flex; align-items: center; gap: 9px; font-size: 17px;
}
.brand-mark {
  width: 9px; height: 18px; border-radius: 2px;
  background: linear-gradient(180deg, var(--in) 0 50%, var(--out) 50% 100%);
}
.nav-desktop { display: none; margin-left: auto; gap: 4px; }
.nav-desktop a {
  text-decoration: none; padding: 7px 12px; border-radius: var(--r-sm);
  color: #b9c6d6; font-size: 14px; font-weight: 500;
}
.nav-desktop a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-desktop a.on { background: rgba(255,255,255,.14); color: #fff; }
.signout {
  margin-left: auto; font-size: 13px; color: #93a4b8;
  text-decoration: none; padding: 6px 10px; border-radius: var(--r-sm);
}
.nav-desktop ~ .signout { margin-left: 0; }
.signout:hover { color: #fff; background: rgba(255,255,255,.08); }

/* ---------- Bottom nav (κινητό) ---------- */
.nav-mobile {
  position: fixed; inset: auto 0 0 0; z-index: 45;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-mobile a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 1px 8px; text-decoration: none;
  color: var(--ink-3); font-size: 10px; font-weight: 500;
  letter-spacing: -.01em; white-space: nowrap;
}
.nav-mobile svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-mobile a.on { color: var(--ink); }

/* ---------- Δομικά ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  margin: 14px 0;
}
.card-pad { padding: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line-soft);
}
.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-2); }

.eyebrow { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }

/* ---------- Επιλογέας μήνα ---------- */
.monthbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 16px 0 0;
}
.monthbar .m-name { font-size: 19px; font-weight: 600; }
.monthbar a {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); text-decoration: none; color: var(--ink-2);
  font-size: 17px; line-height: 1;
}
.monthbar a:hover { border-color: var(--ink-3); }
.monthbar a[aria-disabled] { opacity: .35; pointer-events: none; }

/* ---------- ΖΥΓΑΡΙΑ: το χαρακτηριστικό στοιχείο ---------- */
.scale { padding: 20px 16px 18px; position: relative; }
.scale-net { text-align: center; margin-bottom: 18px; }
.scale-net .n { font-family: var(--mono); font-size: 34px; font-weight: 600; letter-spacing: -.02em; display: block; line-height: 1.1; }
.scale-net.pos .n { color: var(--in); }
.scale-net.neg .n { color: var(--out); }

.scale-rows { position: relative; display: grid; gap: 12px; }
.scale-rows::before {
  content: ""; position: absolute; left: 50%; top: -4px; bottom: -4px;
  width: 1px; background: var(--line); transform: translateX(-.5px);
}
.srow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.shalf { display: grid; gap: 5px; }
.strack { height: 24px; border-radius: 5px; background: var(--line-soft); overflow: hidden; display: flex; }
.sfill { height: 100%; min-width: 3px; transition: width .45s cubic-bezier(.2,.7,.3,1); }

/* Έξοδα: αριστερό μισό, ετικέτα και μπάρα μαζί, γεμίζει προς τα αριστερά */
.srow-out .shalf { grid-column: 1; text-align: right; }
.srow-out .strack { justify-content: flex-end; }
.srow-out .sfill  { background: var(--out); border-radius: 5px 0 0 5px; }
/* Έσοδα: δεξί μισό, γεμίζει προς τα δεξιά */
.srow-in .shalf { grid-column: 2; text-align: left; }
.srow-in .strack { justify-content: flex-start; }
.srow-in .sfill  { background: var(--in); border-radius: 0 5px 5px 0; }

.slabel { display: flex; align-items: baseline; gap: 8px; }
.srow-out .slabel { justify-content: flex-end; }
.slabel .k { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.slabel .v { font-family: var(--mono); font-size: 15px; font-weight: 600; }

/* ---------- Budgets ---------- */
.bud { padding: 4px 16px 16px; display: grid; gap: 13px; }
.bud-row .bud-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 5px; }
.bud-name { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.bud-num { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.bud-track { height: 7px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.bud-fill { height: 100%; border-radius: 4px; background: var(--in); transition: width .4s ease; }
.bud-fill.w { background: var(--warn); }
.bud-fill.o { background: var(--out); }

/* ---------- Φόρμες ---------- */
.field { margin-bottom: 13px; }
.field > label, .lbl {
  display: block; font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px;
}
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=search], select, textarea {
  width: 100%; font-family: var(--sans); font-size: 16px;
  padding: 11px 12px; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  appearance: none;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--ink-2); outline-offset: 2px;
}
input[type=number] { font-family: var(--mono); }

select {
  padding-right: 38px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7c92' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 17px;
}
input[type=date] { min-height: 46px; }
.amount-in { font-family: var(--mono) !important; font-size: 26px !important; font-weight: 600; padding: 12px 14px !important; text-align: right; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.row3 { display: grid; grid-template-columns: 1fr; gap: 11px; }

/* Διακόπτης Έξοδο / Έσοδο */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; background: var(--line-soft); padding: 3px; border-radius: var(--r-sm); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  text-align: center; padding: 9px 6px; border-radius: 5px; cursor: pointer;
  font-weight: 600; font-size: 14px; color: var(--ink-3);
}
.seg input:checked + label { background: var(--surface); box-shadow: var(--shadow); }
.seg input[value=expense]:checked + label { color: var(--out); }
.seg input[value=income]:checked  + label { color: var(--in); }

/* Κουμπιά */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  padding: 12px 18px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: var(--ink); color: #fff; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #22303f; }
.btn-full { width: 100%; }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--paper); }
.btn-sm { padding: 7px 11px; font-size: 13px; }
.btn-danger { background: var(--surface); color: var(--out); border-color: var(--out-soft); }
.btn-danger:hover { background: var(--out-soft); }

/* ---------- Λίστα κινήσεων ---------- */
.tx { list-style: none; margin: 0; padding: 0; }
.tx li { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line-soft); }
.tx li:last-child { border-bottom: 0; }
.tx-main { min-width: 0; flex: 1; }
.tx-desc { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-meta { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap; }
.tx-amt { font-family: var(--mono); font-weight: 600; font-size: 15px; white-space: nowrap; }
.tx-amt.in  { color: var(--in); }
.tx-amt.out { color: var(--out); }
.tx-act { display: flex; gap: 5px; flex: none; }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm);
  color: var(--ink-3); cursor: pointer; text-decoration: none; font-size: 13px;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn.d:hover { color: var(--out); border-color: var(--out); }
.rec-tag { font-size: 10px; letter-spacing: .05em; text-transform: uppercase; background: var(--line-soft); padding: 1px 5px; border-radius: 3px; color: var(--ink-3); font-weight: 600; }

/* ---------- Πίνακες μικρών οθονών ---------- */
.stack { display: grid; gap: 0; }
.stack > * { border-bottom: 1px solid var(--line-soft); }
.stack > *:last-child { border-bottom: 0; }

/* ---------- Λοιπά ---------- */
.flash { padding: 11px 14px; border-radius: var(--r-sm); margin: 14px 0; font-size: 14px; font-weight: 500; }
.flash-ok  { background: var(--in-soft);  color: #0a5a4e; }
.flash-err { background: var(--out-soft); color: #8c2c24; }

.empty { padding: 34px 20px; text-align: center; color: var(--ink-3); }
.empty p { margin: 0 0 14px; }

.muted { color: var(--ink-3); }
.mono  { font-family: var(--mono); }
.right { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Login ---------- */
.login-wrap { max-width: 380px; margin: 12vh auto; padding: 0 18px; }
.login-mark { display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 22px; font-size: 22px; font-weight: 700; }
.login-mark .brand-mark { width: 11px; height: 24px; }

/* ---------- Desktop ---------- */
@media (min-width: 720px) {
  body { padding-bottom: 30px; }
  .nav-mobile { display: none; }
  .nav-desktop { display: flex; }
  .row3 { grid-template-columns: 1fr 1fr 1fr; }
  .scale-net .n { font-size: 40px; }
  .wrap { padding: 0 20px; }
}

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

/* ============================================================
   Ανάλυση και στόχοι
   ============================================================ */

/* Επιλογέας περιόδου */
.segbar { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; margin: 16px 0 0; }
.segbar a { flex: 1; text-align: center; padding: 8px 4px; border-radius: 5px; text-decoration: none; font-size: 13.5px; font-weight: 600; color: var(--ink-3); }
.segbar a.on { background: var(--ink); color: #fff; }

/* KPI πλέγμα */
.kpis { display: grid; grid-template-columns: 1fr 1fr; }
.kpis .kpi { padding: 14px 16px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.kpis .kpi:nth-child(2n) { border-right: 0; }
.kpis .kpi:nth-last-child(-n+2) { border-bottom: 0; }
.kpi .k { display: block; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.kpi .v { display: block; font-family: var(--mono); font-size: 20px; font-weight: 600; margin: 3px 0 1px; letter-spacing: -.02em; }
.kpi .v.in  { color: var(--in); }
.kpi .v.out { color: var(--out); }
.kpi .s { font-size: 11.5px; color: var(--ink-3); }

.note { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.note strong { color: var(--ink); }

/* Γραφήματα */
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 10px 4px 4px; }
svg.cx { display: block; width: 100%; min-width: 540px; height: auto; }
.cx-grid  { stroke: var(--line-soft); stroke-width: 1; }
.cx-base  { stroke: var(--line); stroke-width: 1; }
.cx-zero  { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.cx-ax    { font-family: var(--mono); font-size: 12px; fill: var(--ink-3); }
.cx-in    { fill: var(--in); }
.cx-out   { fill: var(--out); }
.cx-line  { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cx-area  { fill: rgba(19,27,38,.07); stroke: none; }
.cx-dot   { fill: var(--surface); stroke: var(--ink); stroke-width: 1.6; }
.cx-goal  { stroke: var(--warn); stroke-width: 1.5; stroke-dasharray: 5 4; }
.cx-goal-t { fill: var(--warn); font-size: 11px; }

.legend { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; font-weight: 600; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-left: 6px; }
.legend i:first-child { margin-left: 0; }
.lg-in  { background: var(--in); }
.lg-out { background: var(--out); }

/* Μεταβολή vs προηγούμενη περίοδο */
.chg { font-size: 11px; font-weight: 700; padding: 1px 4px; border-radius: 3px; margin-left: 4px; }
.chg.up   { color: var(--out); background: var(--out-soft); }
.chg.down { color: var(--in);  background: var(--in-soft); }
.chg.new  { color: var(--ink-3); background: var(--line-soft); }

/* Στόχοι */
.goal-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 10px; }
.goal-big { display: block; font-family: var(--mono); font-size: 25px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.goal-big.in  { color: var(--in); }
.goal-big.out { color: var(--out); }
.goal-sub { display: block; font-family: var(--mono); font-size: 15px; color: var(--ink-3); font-weight: 500; }

.hint { font-size: 12.5px; color: var(--ink-3); margin: 8px 0 0; }

.hist { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 16px; }
.hist-c { text-align: center; }
.hist-b { display: block; height: 6px; border-radius: 3px; background: var(--line); }
.hist-b.ok   { background: var(--in); }
.hist-b.miss { background: var(--warn); }
.hist-b.neg  { background: var(--out); }
.hist-l { font-size: 10.5px; color: var(--ink-3); font-weight: 600; }

.dep { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.dep summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 6px; }
.dep summary::before { content: "＋"; font-size: 15px; color: var(--ink-3); }
.dep[open] summary::before { content: "−"; }
.dep-form { padding-top: 12px; }

@media (min-width: 720px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .kpis .kpi { border-bottom: 0; }
  .kpis .kpi:nth-child(2n) { border-right: 1px solid var(--line-soft); }
  .kpis .kpi:last-child { border-right: 0; }
  svg.cx { min-width: 0; }
}
