/* ფერები: ღია ცისფერი (დღე) და მუქი ლურჯი (ღამე). */
:root {
  --bg: #EEF6FD; --surface: #FFFFFF; --surface-2: #F4F9FE; --line: #D5E6F5;
  --text: #12314F; --muted: #5A7593; --primary: #2E8FD8; --primary-strong: #1A6DB0; --primary-soft: #DDEEFC;
  --accent: #5EC2F0; --ok: #23915F; --warn: #C27A12; --bad: #C8423A; --on-primary: #FFFFFF;
  --h0: #E4F0FB; --h1: #B9DBF5; --h2: #80BEEC; --h3: #4099DC; --h4: #1A6DB0;
  --shadow: 0 1px 2px rgba(18, 49, 79, .06), 0 4px 16px rgba(18, 49, 79, .06);
  --radius: 14px;
  --font: "Noto Sans Georgian", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0B1726; --surface: #12233A; --surface-2: #172B45; --line: #23405F;
  --text: #E1EEFB; --muted: #91AAC5; --primary: #5BB1F2; --primary-strong: #8DCBF7; --primary-soft: #1B3656;
  --accent: #5EC2F0; --ok: #4CC08A; --warn: #E6A84A; --bad: #EF7A72; --on-primary: #08182A;
  --h0: #152B44; --h1: #1D4A75; --h2: #2A6AA3; --h3: #3E8FD2; --h4: #73BBF2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.55; -webkit-text-size-adjust: 100%; }
a { color: var(--primary-strong); }
:root[data-theme="dark"] a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.08rem; font-weight: 650; }
h3 { font-size: .98rem; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-family: "Inter", var(--font); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- განლაგება ---- */
.app { min-height: 100vh; }
.side { display: none; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topright { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.main { padding: 16px 16px 120px; max-width: 1180px; margin: 0 auto; outline: none; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.02rem; }
.brand img { border-radius: 9px; display: block; }

.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottom a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 9px; font-size: .68rem; color: var(--muted); text-decoration: none; min-width: 0; }
.bottom a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bottom a.on { color: var(--primary); font-weight: 600; }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 252px 1fr; grid-template-rows: auto 1fr; grid-template-areas: "side top" "side main"; }
  .side { grid-area: side; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
  .top { grid-area: top; }
  .main { grid-area: main; padding: 22px 28px 60px; width: 100%; }
  .bottom, .mobile-only { display: none !important; }
}
.sidenav { display: flex; flex-direction: column; gap: 2px; }
.sidenav .label { margin: 14px 10px 4px; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.sidenav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text); text-decoration: none; }
.sidenav a:hover { background: var(--surface-2); }
.sidenav a.on { background: var(--primary-soft); color: var(--primary-strong); font-weight: 600; }
:root[data-theme="dark"] .sidenav a.on { color: var(--primary-strong); }
.sidenav .dot { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.sidenav .dot svg { width: 16px; height: 16px; }
.sidenav .pct { margin-left: auto; font-size: .78rem; color: var(--muted); }
.sidefoot { margin-top: auto; font-size: .82rem; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }

/* ---- ელემენტები ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card > h2 { margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.card > h2 .right { margin-left: auto; font-size: .85rem; font-weight: 500; }
.grid { display: grid; gap: 14px; }
.grid > *, .stack > * { min-width: 0; }
.cols-2 { grid-template-columns: 1fr; }
@media (min-width: 1180px) { .cols-2 { grid-template-columns: 1.15fr .85fr; align-items: start; } }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-decoration: none; color: var(--text); font-weight: 500; }
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: .86rem; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--primary-strong); }
:root[data-theme="dark"] .btn.ghost { color: var(--primary); }
.iconbtn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; color: var(--text); }
.iconbtn:hover { border-color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: .85rem; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], select, textarea { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.bar { height: 8px; background: var(--h0); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.bar.ok > i { background: var(--ok); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: .78rem; background: var(--primary-soft); color: var(--primary-strong); font-weight: 600; white-space: nowrap; }
:root[data-theme="dark"] .pill { color: var(--primary-strong); }
.pill.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.banner { padding: 10px 14px; border-radius: 12px; background: var(--primary-soft); color: var(--text); font-size: .9rem; border: 1px solid var(--line); }

/* ---- მთავარი გვერდი ---- */
.hello { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 18px; margin-bottom: 14px; }
.hello .stats { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; min-width: 104px; }
.stat b { display: block; font-size: 1.2rem; font-family: "Inter", var(--font); }
.stat span { font-size: .76rem; color: var(--muted); }

.today { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.today li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.today .mi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; }
.today .meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; font-size: .84rem; color: var(--muted); margin-bottom: 4px; }
.today .meta span { white-space: nowrap; }
@media (max-width: 520px) {
  .today li { grid-template-columns: 34px minmax(0, 1fr); }
  .today li > div:last-child { grid-column: 2; display: flex; justify-content: flex-end; }
  .hello .stats { width: 100%; }
  .stat { flex: 1; min-width: 0; }
  .top .brand span { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
  .tchip .tname { display: none; }
}
.today .meta b { color: var(--text); font-weight: 600; }
.today li.done { opacity: .75; }

.mods { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.mod .foot { flex-wrap: wrap; gap: 2px 10px; }
.mod { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.mod:hover { transform: translateY(-1px); border-color: var(--primary); }
.mod .head { display: flex; align-items: center; gap: 10px; }
.mod .mi { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.mod .head small { display: block; color: var(--muted); font-size: .78rem; }
.mod .foot { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }

.week { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .86rem; }
.week th, .week td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.week th { color: var(--muted); font-weight: 600; font-size: .78rem; }
.week td.num { white-space: nowrap; text-align: right; }
.week tr.now td { background: var(--primary-soft); }
.week tr.now td:first-child { border-radius: 8px 0 0 8px; }
.week tr.now td:last-child { border-radius: 0 8px 8px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: .78rem; white-space: nowrap; }
.chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chip.ok { border-color: var(--ok); }
.tablewrap { overflow-x: auto; }

.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat i { width: 13px; height: 13px; border-radius: 3px; background: var(--h0); display: block; }
.heat i.l1 { background: var(--h1); } .heat i.l2 { background: var(--h2); } .heat i.l3 { background: var(--h3); } .heat i.l4 { background: var(--h4); }
.heat i.future { background: transparent; }
.legend { display: flex; align-items: center; gap: 3px; font-size: .74rem; color: var(--muted); margin-top: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

.pvsa { display: flex; flex-direction: column; gap: 9px; }
.pvsa .r { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; gap: 8px; align-items: center; font-size: .85rem; }
.pvsa .r span:last-child { white-space: nowrap; }
.pvsa .r span:last-child { text-align: right; color: var(--muted); }

/* ---- მოდულის გვერდი ---- */
.hero { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.hero .mi { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; color: #fff; flex: none; }
.hero .mi svg { width: 28px; height: 28px; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.steps li { padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); font-size: .82rem; background: var(--surface-2); }
.steps li.cur { border-color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.links a { display: flex; align-items: center; gap: 8px; }
.sessions { list-style: none; margin: 0; padding: 0; font-size: .86rem; }
.sessions li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.sessions li span:first-child { flex: 1; }

/* ---- გეგმის რედაქტორი ---- */
.dayed { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.dayed h3 { display: flex; justify-content: space-between; margin-bottom: 8px; }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) 76px 40px; gap: 6px; margin-bottom: 6px; }
.days { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }

/* ---- ჩანიშვნები ---- */
.fab { position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 40; width: 52px; height: 52px; border-radius: 50%; border: none; background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 18px rgba(26, 109, 176, .35); cursor: pointer; display: grid; place-items: center; }
.fab .cnt { position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; border-radius: 99px; background: var(--surface); color: var(--primary-strong); font-size: .72rem; font-weight: 700; display: grid; place-items: center; border: 1px solid var(--line); padding: 0 4px; }
@media (min-width: 900px) { .fab { bottom: 24px; right: 24px; } }
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer-bg { position: absolute; inset: 0; background: rgba(8, 24, 42, .35); }
.drawer-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(440px, 100%); background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); padding-top: max(14px, env(safe-area-inset-top)); }
.drawer-body { padding: 14px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.note { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
.note p { margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note .nm { display: flex; align-items: center; gap: 8px; font-size: .76rem; color: var(--muted); flex-wrap: wrap; }
.note .nm .num { white-space: nowrap; }
.note .nm .btn { margin-left: auto; }

/* ---- ტაიმერი ---- */
.tchip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border-radius: 99px; background: var(--primary); color: var(--on-primary); font-size: .86rem; font-weight: 600; }
.tchip button { width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(255, 255, 255, .22); color: inherit; display: grid; place-items: center; cursor: pointer; }

/* ---- შესვლა ---- */
.login { max-width: 380px; margin: 8vh auto 0; }
.login .card { display: flex; flex-direction: column; gap: 12px; }
.err { color: var(--bad); font-size: .88rem; min-height: 1.2em; }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 10px; font-size: .88rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 80; max-width: calc(100% - 32px); }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.empty { text-align: center; padding: 18px; color: var(--muted); }

/* ---- ეტაპი 1: Dashboard, კალენდარი, პარამეტრები ---- */
.card.compact { padding: 14px; }
.card.compact > h2 { font-size: 1rem; margin-bottom: 8px; }
.card > h2 svg { width: 18px; height: 18px; color: var(--primary); flex: none; }
.card h3.sub { margin: 14px 0 8px; font-size: .86rem; color: var(--muted); font-weight: 600; }
.emptystate { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: .88rem; }
.emptystate p { margin: 0 0 8px; }
.kv { display: flex; justify-content: space-between; gap: 10px; margin: 4px 0; font-size: .9rem; }
.kv span { color: var(--muted); }
.reason { font-size: .78rem; color: var(--warn); margin-top: 4px; }
.blrow { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.blrow p { margin: 0; }
.banner.bad { border-color: var(--bad); color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--surface)); }
.ach { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ach li { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; font-size: .86rem; color: var(--muted); opacity: .75; }
.ach li svg { width: 18px; height: 18px; }
.ach li.on { color: var(--text); opacity: 1; }
.ach li.on svg { color: var(--warn); }
.ach small { font-size: .76rem; }
.calnav { margin-bottom: 10px; }
.calnav h2 { min-width: 150px; text-align: center; }
.iconbtn:disabled { opacity: .4; cursor: default; }
.iconbtn.sm { width: 32px; height: 32px; }
.week.cal td:nth-child(3), .week.cal td:nth-child(4), .week.cal th:nth-child(3), .week.cal th:nth-child(4) { text-align: right; white-space: nowrap; }
.week tfoot td { border-bottom: none; padding-top: 10px; }
.mod .pill { align-self: flex-start; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .88em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }
.field + .field { margin-top: 10px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
