/* «Наш ремонт» — Sage & Cream. Світла й темна теми, бічна панель (ПК) / нижня навігація (телефон). */
:root {
  --bg: #F6F2E9; --surface: #FFFDF8; --surface2: #F0EBDD; --ink: #2B3228; --ink2: #5C6558; --ink3: #8A9285;
  --line: #E4DDCC; --sage: #5C7A60; --sage-d: #435B47; --sage-l: #DCE6D8; --clay: #B7835C; --clay-l: #F1E1D3;
  --warn: #B07A1E; --warn-l: #F6EBCF; --bad: #A5483F; --bad-l: #F4DCD8; --ok: #4E7C55; --ok-l: #DDEBDD;
  --shadow: 0 1px 2px rgba(43,50,40,.06), 0 6px 20px rgba(43,50,40,.06);
  --r: 16px; --r-s: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #151915; --surface: #1D231D; --surface2: #252C25; --ink: #E9E7DC; --ink2: #B2B8AA; --ink3: #7F877B;
  --line: #2F372F; --sage: #8FB093; --sage-d: #A9C6AC; --sage-l: #2A382B; --clay: #D0A07C; --clay-l: #3A2F26;
  --warn: #DDB35A; --warn-l: #3A3220; --bad: #E08A80; --bad-l: #3D2522; --ok: #8FC197; --ok-l: #233226;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3); color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #151915; --surface: #1D231D; --surface2: #252C25; --ink: #E9E7DC; --ink2: #B2B8AA; --ink3: #7F877B;
    --line: #2F372F; --sage: #8FB093; --sage-d: #A9C6AC; --sage-l: #2A382B; --clay: #D0A07C; --clay-l: #3A2F26;
    --warn: #DDB35A; --warn-l: #3A3220; --bad: #E08A80; --bad-l: #3D2522; --ok: #8FC197; --ok-l: #233226;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; line-height: 1.2; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
a { color: var(--sage-d); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--ink3); }
.muted { color: var(--ink3); } .small { font-size: .85rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* Каркас */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 22px 14px; border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-family: var(--serif); font-size: 1.25rem; font-weight: 600; }
.brand svg { width: 34px; height: 34px; flex: none; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--ink2); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface2); }
.nav a.on { background: var(--sage-l); color: var(--sage-d); }
.nav svg { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side .grow { flex: 1; }
.main { min-width: 0; padding: 26px clamp(16px, 3vw, 40px) 60px; max-width: 1180px; width: 100%; }
.top { flex-wrap: wrap; display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.top .title { flex: 1 1 200px; min-width: 0; }
.top .btn { flex: none; }
.top .sub { color: var(--ink3); font-size: .9rem; margin-top: 2px; }
.searchbox { position: relative; flex: 0 1 340px; }
.searchbox input { width: 100%; padding: 10px 14px 10px 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.searchbox input[type=search] { padding-left: 38px; }
.searchbox svg { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; stroke: var(--ink3); fill: none; stroke-width: 1.8; }
.bottom { display: none; }

/* Картки */
.stack > *, .grid > * { min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card h2 + * { margin-top: 12px; }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); } .auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.stack > * + * { margin-top: 14px; } .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .between { justify-content: space-between; }
.stat .label { color: var(--ink3); font-size: .85rem; } .stat .val { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; margin-top: 4px; }
.stat .hint { color: var(--ink3); font-size: .8rem; margin-top: 2px; }
.stat.hero { background: linear-gradient(160deg, var(--sage) 0%, var(--sage-d) 100%); color: #F6F2E9; border: none; }
.stat.hero .label, .stat.hero .hint { color: rgba(246,242,233,.78); }
:root[data-theme="dark"] .stat.hero { background: linear-gradient(160deg, #3C5A40, #2C4430); color: #E9E7DC; }

/* Кнопки та поля */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); padding: 9px 16px; border-radius: 999px; cursor: pointer; font-weight: 500; text-decoration: none; color: var(--ink); min-height: 40px; }
.btn:hover { background: var(--surface2); }
.btn.primary { background: var(--sage); color: #fff; border-color: var(--sage); }
:root[data-theme="dark"] .btn.primary { color: #0F150F; }
.btn.primary:hover { background: var(--sage-d); }
.btn.danger { color: var(--bad); } .btn.ghost { border-color: transparent; background: transparent; } .btn.sm { padding: 5px 12px; min-height: 32px; font-size: .9rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; }
label.f { display: block; } label.f > span { display: block; font-size: .82rem; color: var(--ink2); margin-bottom: 4px; font-weight: 500; }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=password], input[type=url], input[type=search], select, textarea, input:not([type]) { width: 100%; padding: 10px 12px; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--surface); min-height: 42px; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--sage); outline-offset: 1px; }
.form { display: grid; gap: 12px; } .form.two { grid-template-columns: 1fr 1fr; } .form .full { grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; } .check input { width: 20px; height: 20px; accent-color: var(--sage); }

/* Чіпи, бейджі */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; background: var(--surface2); color: var(--ink2); white-space: nowrap; }
.chip.ok { background: var(--ok-l); color: var(--ok); } .chip.warn { background: var(--warn-l); color: var(--warn); } .chip.bad { background: var(--bad-l); color: var(--bad); } .chip.sage { background: var(--sage-l); color: var(--sage-d); } .chip.clay { background: var(--clay-l); color: var(--clay); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.tabs button { border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--sage); color: #fff; border-color: var(--sage); }
:root[data-theme="dark"] .tabs button.on { color: #0F150F; }
.progress { height: 8px; border-radius: 99px; background: var(--surface2); overflow: hidden; } .progress > i { display: block; height: 100%; background: var(--sage); border-radius: 99px; }

/* Списки замість таблиць */
.list > .item { display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); } .list > .item:last-child { border-bottom: none; }
.list .item .grow { flex: 1; min-width: 0; } .list .item .t { font-weight: 500; overflow-wrap: anywhere; } .list .item .s { color: var(--ink3); font-size: .85rem; }
.item.click { cursor: pointer; } .item.click:hover { background: var(--surface2); border-radius: 10px; }
.sum { font-family: var(--serif); font-weight: 600; white-space: nowrap; }
.empty { text-align: center; padding: 36px 16px; color: var(--ink3); } .empty b { display: block; color: var(--ink2); font-family: var(--serif); font-size: 1.1rem; margin-bottom: 6px; }
.alert { padding: 12px 14px; border-radius: var(--r-s); background: var(--warn-l); color: var(--warn); } .alert.bad { background: var(--bad-l); color: var(--bad); } .alert.ok { background: var(--ok-l); color: var(--ok); }
.devnote { padding: 10px 14px; border-radius: var(--r-s); background: var(--clay-l); color: var(--clay); font-size: .9rem; }

/* Канбан, календар */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(148px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--surface2); border-radius: var(--r); padding: 10px; min-height: 120px; } .col h3 { padding: 4px 6px 10px; display: flex; justify-content: space-between; }
.col.over { outline: 2px dashed var(--sage); }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; } .tcard .t { font-weight: 500; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; } .cal .d { min-height: 86px; border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px; background: var(--surface); font-size: .8rem; overflow: hidden; } .cal .d.off { opacity: .45; } .cal .d.today { border-color: var(--sage); } .cal .hd { text-align: center; color: var(--ink3); font-size: .8rem; }
.cal .ev { background: var(--sage-l); color: var(--sage-d); border-radius: 6px; padding: 1px 6px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; } .cal .ev.done { text-decoration: line-through; opacity: .6; }

/* Модальні вікна */
.scrim { position: fixed; inset: 0; background: rgba(20,25,20,.45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 20px; width: min(640px, 100%); max-height: 92vh; overflow-y: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(860px, 100%); } .modal header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.toasts { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; width: min(420px, 92vw); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); } .toast.bad { background: var(--bad); color: #fff; }
.shopmode .item { padding: 16px 4px; font-size: 1.05rem; } .shopmode input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--sage); }
.chart text { fill: var(--ink2); font-size: 11px; font-family: var(--sans); } .chart .grid line { stroke: var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85rem; color: var(--ink2); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.plan { position: relative; display: inline-block; max-width: 100%; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface2); } .plan img { display: block; max-width: 100%; height: auto; }
.pin { position: absolute; transform: translate(-50%, -100%); width: 26px; height: 26px; border-radius: 50% 50% 50% 0; rotate: -45deg; background: var(--clay); border: 2px solid #fff; cursor: pointer; } .pin.k-electric { background: #C9A227; } .pin.k-water { background: #4A83B5; } .pin.k-photo { background: var(--sage); }
.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; } .gal figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; } .gal img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; } .gal figcaption { padding: 6px 8px; font-size: .8rem; color: var(--ink2); }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; } .auth .card { width: min(420px, 100%); }
.help h3 { margin-top: 22px; } .help p, .help li { color: var(--ink2); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; } .side { display: none; }
  .main { padding: 18px 14px 110px; }
  .g3, .g4 { grid-template-columns: repeat(2, 1fr); } .g2 { grid-template-columns: 1fr; }
  .bottom { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom a, .bottom button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .72rem; color: var(--ink3); text-decoration: none; background: none; border: none; padding: 6px 2px; cursor: pointer; }
  .bottom a.on { color: var(--sage-d); } .bottom svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .top { flex-wrap: wrap; } .mat-q { display: none; } .searchbox { flex: 1 1 100%; order: 3; }
  .form.two { grid-template-columns: 1fr; } .scrim { align-items: end; padding: 0; } .modal { border-radius: 20px 20px 0 0; max-height: 94vh; width: 100%; }
  .kanban { grid-auto-columns: 82%; } .cal .d { min-height: 62px; } .toasts { bottom: 90px; }
}
@media (max-width: 420px) { .g3, .g4 { grid-template-columns: 1fr; } h1 { font-size: 1.5rem; } }
@media print { .side, .bottom, .top .btn, .searchbox { display: none !important; } .shell { display: block; } body { background: #fff; color: #000; } }
