/* Панель керування KAN Асистент. Фірмові кольори бота: синій, білий, світло-сірий. */
@font-face { font-family: "Inter"; src: url(fonts/Inter-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url(fonts/Inter-Medium.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url(fonts/Inter-SemiBold.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url(fonts/Inter-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --blue: #1F4BE0; --blue-hover: #1840C8; --blue-deep: #0026BB; --blue-ink: #0B1F7A;
  --blue-50: #F0F4FF; --blue-100: #E0E8FD; --blue-200: #C3D2FB;
  --bg: #F3F5F9; --surface: #FFFFFF; --subtle: #F8F9FC;
  --line: #E4E8F0; --line-strong: #CCD3E0;
  --ink: #0E1830; --ink-2: #3D4863; --muted: #6A7590;
  --ok: #0F7B55; --ok-bg: #E4F5EE; --warn: #A35A00; --warn-bg: #FFF3DF; --danger: #C8283C; --danger-bg: #FDECEE;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(14, 24, 48, .04), 0 1px 3px rgba(14, 24, 48, .06);
  --shadow-lg: 0 12px 32px rgba(14, 24, 48, .14), 0 2px 6px rgba(14, 24, 48, .08);
  --side: 264px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg);
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-hover); text-decoration: underline; text-underline-offset: 2px; }
h1 { font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 16px; line-height: 1.35; font-weight: 600; letter-spacing: -.01em; margin: 0 0 4px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--ink-2); }
p { margin: 0 0 12px; }
b, strong { font-weight: 600; }
small { font-size: 12.5px; }
.sprite { display: none; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.i.sm { width: 15px; height: 15px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; }
.num, td.num { font-variant-numeric: tabular-nums; text-align: right; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* --- каркас: бічне меню і зміст --- */
.app { display: flex; min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); display: flex; flex-direction: column; gap: 4px; padding: 20px 14px 14px;
  background: linear-gradient(180deg, #0B2DB8 0%, #0A2393 100%); color: #fff; z-index: 30; overflow-y: auto; }
.side .logo { display: flex; align-items: center; gap: 12px; color: #fff; padding: 0 8px 18px; text-decoration: none; }
.side .logo b { display: block; font-size: 15.5px; letter-spacing: -.01em; }
.side .logo small { display: block; color: rgba(255, 255, 255, .62); font-size: 12px; }
.side-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .5); padding: 14px 10px 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-sm); color: rgba(255, 255, 255, .82); font-weight: 500; }
.nav-item .i { opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.nav-item.on { background: #fff; color: var(--blue-deep); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.nav-item.on .i { opacity: 1; }

.switcher { position: relative; }
.switcher summary, .switcher.static { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); cursor: pointer; list-style: none; font-weight: 600; }
.switcher.static { cursor: default; }
.switcher summary::-webkit-details-marker { display: none; }
.switcher summary:hover { background: rgba(255, 255, 255, .16); }
.switcher .menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); color: var(--ink); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 5; max-height: 60vh; overflow-y: auto; }
.switcher .menu a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px; color: var(--ink); font-weight: 500; }
.switcher .menu a:hover { background: var(--subtle); text-decoration: none; }
.switcher .menu a.on { background: var(--blue-50); color: var(--blue-deep); }
.switcher .menu small { color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; }
.dot.active { background: #2BC48A; box-shadow: 0 0 0 3px rgba(43, 196, 138, .22); }
.dot.setup { background: #F5A524; box-shadow: 0 0 0 3px rgba(245, 165, 36, .22); }
.dot.archived { background: #9AA3B5; }

.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid rgba(255, 255, 255, .12); }
.me b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: rgba(255, 255, 255, .6); font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--blue-deep); font-weight: 700; flex: none; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: var(--radius-sm); border: 0; background: transparent; color: inherit; cursor: pointer; }
.me .icon-btn:hover { background: rgba(255, 255, 255, .12); }

.main { flex: 1; min-width: 0; margin-left: var(--side); }
.content { max-width: 1120px; margin: 0 auto; padding: 32px 40px 64px; }
.mobile-bar, .nav-toggle, .scrim { display: none; }

/* --- заголовок сторінки --- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .sub { color: var(--muted); margin: 6px 0 0; max-width: 720px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; margin-bottom: 10px; }
.crumb:hover { color: var(--blue); text-decoration: none; }

/* --- картки --- */
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 24px; margin-bottom: 20px; color: inherit; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-head p, .card-head .hint { color: var(--muted); margin: 2px 0 0; font-size: 13.5px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 20px 24px 0; }
.card.accent { border-color: var(--blue-200); background: linear-gradient(180deg, var(--blue-50), #fff 70%); box-shadow: 0 0 0 3px rgba(31, 75, 224, .06), var(--shadow); }
.card-foot { border-top: 1px solid var(--line); margin: 20px -24px -22px; padding: 14px 24px; background: var(--subtle); border-radius: 0 0 var(--radius) var(--radius);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-bottom: 24px; }
.grid .card { margin: 0; }
a.card.project { transition: border-color .15s, box-shadow .15s, transform .15s; display: flex; flex-direction: column; gap: 14px; }
a.card.project:hover { border-color: var(--blue-200); box-shadow: var(--shadow-lg); transform: translateY(-1px); text-decoration: none; }
.project-top { display: flex; align-items: center; gap: 12px; }
.project-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); font-weight: 700; font-size: 16px; flex: none; }
.project-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: auto; }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.progress.full span { background: #1FA971; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.two img { max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); display: block; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.gap { margin-top: 20px; }

/* --- стани, мітки --- */
.flash { display: flex; gap: 10px; align-items: flex-start; background: var(--ok-bg); color: #0B5E41; border: 1px solid #BFE6D5; border-radius: 10px; padding: 12px 16px; margin-bottom: 20px; font-weight: 500; }
.flash .i { margin-top: 1px; }
.error { display: flex; gap: 10px; background: var(--danger-bg); color: #8E1626; border: 1px solid #F5C3CA; border-radius: 10px; padding: 12px 16px; margin-bottom: 20px; }
.changes { background: var(--blue-50); border: 1px solid var(--blue-200); border-left: 3px solid var(--blue); border-radius: var(--radius-sm); padding: 14px 16px; margin: 0 0 16px; white-space: pre-line; color: var(--ink-2); }
.note { background: var(--subtle); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; color: var(--ink-2); font-size: 13.5px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--subtle); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.active { background: var(--ok-bg); color: var(--ok); border-color: #C3E8D8; }
.badge.setup { background: var(--warn-bg); color: var(--warn); border-color: #F7DDB0; }
.badge.archived { background: #EEF0F4; color: var(--muted); }
.badge.active::before, .badge.setup::before, .badge.archived::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 12px; border-radius: 99px; background: var(--subtle); border: 1px solid var(--line); font-size: 13px; }
.chip b { font-variant-numeric: tabular-nums; }

/* --- готовність --- */
.checks { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-2); }
.checks li { display: flex; align-items: center; gap: 6px; }
.checks li::before { content: ""; width: 16px; height: 16px; border-radius: 50%; flex: none; background: var(--line) center / 10px no-repeat; }
.checks .ok::before { background-color: var(--ok-bg); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230F7B55' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E"); }
.checks .no::before { background-color: var(--danger-bg); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23C8283C' stroke-width='3.5' stroke-linecap='round'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E"); }
.checks .warn::before { background-color: var(--warn-bg); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A35A00' stroke-width='3.5' stroke-linecap='round'%3E%3Cpath d='M12 6v7M12 18h.01'/%3E%3C/svg%3E"); }
.checks.wide { display: block; }
.checks.wide li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 4px 10px; padding: 14px 24px; border-top: 1px solid var(--line); font-size: 14px; }
.checks.wide li::before { width: 24px; height: 24px; background-size: 13px; }
.checks.wide li > div b { color: var(--ink); }
.checks.wide li > div span { display: block; color: var(--muted); font-size: 13px; }
.checks.wide li a.go { color: var(--muted); display: inline-flex; padding: 6px; border-radius: 6px; }
.checks.wide li a.go:hover { background: var(--subtle); color: var(--blue); }
.checks.wide li:hover { background: #FBFCFE; }

/* --- форми --- */
.stack { display: grid; gap: 16px; max-width: 560px; }
.stack button { justify-self: start; }
label { display: grid; gap: 6px; font-weight: 500; font-size: 13.5px; color: var(--ink); }
label small { color: var(--muted); font-weight: 400; }
input, select, textarea { font: inherit; color: var(--ink); height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; width: 100%;
  transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover { border-color: #B3BCCD; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 75, 224, .16); }
input:disabled, select:disabled { background: var(--subtle); color: var(--muted); }
input::placeholder { color: #9AA3B5; }
select { width: auto; padding-right: 34px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236A7590' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 10px center / 16px no-repeat; }
input[type=file] { height: auto; padding: 8px; background: var(--subtle); border-style: dashed; cursor: pointer; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-right: 12px; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); cursor: pointer; }
input[type=file]:hover::file-selector-button { border-color: var(--blue); color: var(--blue); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); margin: 0; }
input[type=month] { width: auto; }
input[type=color] { width: 44px; height: 36px; padding: 3px; cursor: pointer; }
input.pc { width: 84px; text-align: right; font-variant-numeric: tabular-nums; height: 36px; padding: 0 10px; }
.field-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field-row > label { flex: 1 1 180px; }

/* --- кнопки --- */
button, a.button { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s; text-decoration: none; }
button:hover, a.button:hover { border-color: #AEB8CB; background: var(--subtle); color: var(--ink); text-decoration: none; }
button.primary, a.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 1px 2px rgba(31, 75, 224, .3); }
button.primary:hover, a.button.primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); color: #fff; }
button.danger { color: var(--danger); }
button.danger:hover { background: var(--danger-bg); border-color: #F1B5BE; color: var(--danger); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--subtle); }
button.small, a.button.small { height: 32px; padding: 0 12px; font-size: 13px; }
button.link { height: auto; border: 0; background: none; padding: 0; color: var(--blue); font-weight: 500; }
button:disabled, button:disabled:hover { opacity: .45; cursor: not-allowed; background: #fff; border-color: var(--line-strong); color: var(--ink); }
button.primary:disabled { background: var(--blue); color: #fff; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions form, form.inline { display: inline-flex; margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font-weight: 600; background: #fff; }
.tile .i { width: 36px; height: 36px; padding: 8px; border-radius: 9px; background: var(--blue-50); color: var(--blue); }
.tile small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; }
.tile:hover { border-color: var(--blue-200); background: var(--blue-50); color: var(--ink); text-decoration: none; }

/* --- таблиці --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .02em; background: var(--subtle); }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #FBFCFE; }
.card.flush table th:first-child, .card.flush table td:first-child { padding-left: 24px; }
.card.flush table th:last-child, .card.flush table td:last-child { padding-right: 24px; }
.card table.plain th { background: none; }
td.actions { justify-content: flex-end; }
td .actions { justify-content: flex-end; }
.who-cell { display: flex; align-items: center; gap: 10px; }
.who-cell .avatar { width: 30px; height: 30px; font-size: 12.5px; background: var(--blue-50); color: var(--blue); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .i { width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: var(--subtle); color: var(--muted); margin-bottom: 8px; }
.empty p { margin: 0; }

/* --- умови і ставки --- */
.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tables > div { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--subtle); }
.tables table td, .tables table th { padding: 4px 6px; border: 0; background: none; }
.tables tbody tr:hover td { background: none; }
.rates-table { table-layout: fixed; width: auto; }
.rates-table td, .rates-table th { padding: 6px 4px; width: 84px; min-width: 84px; }
.rates-table thead th { background: none; text-align: center; white-space: normal; line-height: 1.25; vertical-align: bottom; }
.rates-table thead tr:first-child th:first-child { width: 96px; text-align: left; }
.rates-table input.pc { width: 100%; }
.add-row-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 0; }
.checkboxes { display: flex; flex-wrap: wrap; gap: 8px; }
.checkboxes label { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 99px; cursor: pointer; background: #fff; }
.checkboxes label:has(input:checked) { border-color: var(--blue); background: var(--blue-50); color: var(--blue-deep); }
label.inline { display: inline-flex; align-items: center; gap: 10px; }
.scroll { overflow-x: auto; }
.step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--blue-50); color: var(--blue); font-size: 12px; font-weight: 700; margin-right: 8px; }

/* --- стиль PDF --- */
.colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.colors label { display: flex; align-items: center; gap: 12px; font-weight: 500; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.logo-preview { background: #6b6470; padding: 16px 20px; border-radius: 10px; display: inline-block; margin-bottom: 14px; }
.logo-preview img { height: 44px; display: block; }
.section-title { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 24px 0 12px; }
.section-title:first-child { margin-top: 0; }

/* --- копіювання посилання --- */
.copy { display: flex; gap: 8px; }
.copy input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }

/* --- вхід --- */
.auth { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, #3D66F0 0%, transparent 60%), linear-gradient(160deg, #1F4BE0 0%, #0026BB 55%, #071C86 100%); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(4, 18, 90, .35); padding: 36px 32px 30px; text-align: center; }
.auth-card .mark { width: 64px; height: 64px; margin: 0 auto 18px; display: block; }
.auth-card h1 { font-size: 22px; margin-bottom: 8px; }
.auth-card p { color: var(--ink-2); }
.auth-card .muted { color: var(--muted); font-size: 13px; }
.auth-card button { width: 100%; height: 46px; font-size: 15px; margin: 8px 0 14px; }
.auth-card .cmd { display: inline-block; font-family: ui-monospace, "SF Mono", Menlo, monospace; background: var(--blue-50); color: var(--blue-deep); padding: 1px 8px; border-radius: 6px; font-weight: 600; }
.auth-brand { color: rgba(255, 255, 255, .75); text-align: center; margin-top: 18px; font-size: 13px; }

/* --- телефон і планшет --- */
@media (max-width: 960px) {
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .side { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .nav-toggle:checked ~ .side { transform: none; }
  .nav-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(8, 16, 40, .45); z-index: 20; }
  .main { margin-left: 0; }
  .mobile-bar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 10; height: 56px; padding: 0 8px;
    background: linear-gradient(90deg, #0B2DB8, #0A2393); color: #fff; }
  .mobile-bar .logo { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 15px; }
  .mobile-bar .logo:hover { text-decoration: none; }
  .content { padding: 20px 16px 48px; }
  h1 { font-size: 21px; }
  .card { padding: 18px 16px; }
  .card.flush .card-head { padding: 18px 16px 0; }
  .card-foot { margin: 16px -16px -18px; padding: 12px 16px; }
  .checks.wide li { padding: 12px 16px; }
  .two { grid-template-columns: 1fr; }
  .card.flush table th:first-child, .card.flush table td:first-child { padding-left: 16px; }
  .card.flush table th:last-child, .card.flush table td:last-child { padding-right: 16px; }
}
@media (max-width: 640px) {
  table.stackable, table.stackable thead, table.stackable tbody, table.stackable tr, table.stackable td { display: block; }
  table.stackable thead { display: none; }
  table.stackable tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.stackable tr:last-child { border-bottom: 0; }
  table.stackable td { border: 0; padding: 3px 0 !important; }
  table.stackable td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
  table.stackable td.actions, table.stackable td .actions { justify-content: flex-start; }
  table.stackable tbody tr:hover td { background: none; }
  .copy { flex-direction: column; }
  .page-head { align-items: flex-start; }
}

/* ширина смужки готовності */
.progress span.w0 { width: 0%; }
.progress span.w5 { width: 5%; }
.progress span.w10 { width: 10%; }
.progress span.w15 { width: 15%; }
.progress span.w20 { width: 20%; }
.progress span.w25 { width: 25%; }
.progress span.w30 { width: 30%; }
.progress span.w35 { width: 35%; }
.progress span.w40 { width: 40%; }
.progress span.w45 { width: 45%; }
.progress span.w50 { width: 50%; }
.progress span.w55 { width: 55%; }
.progress span.w60 { width: 60%; }
.progress span.w65 { width: 65%; }
.progress span.w70 { width: 70%; }
.progress span.w75 { width: 75%; }
.progress span.w80 { width: 80%; }
.progress span.w85 { width: 85%; }
.progress span.w90 { width: 90%; }
.progress span.w95 { width: 95%; }
.progress span.w100 { width: 100%; }
.gap-b { margin-bottom: 20px; }
.page-head .actions h1 { margin-right: 4px; }
.card-foot form.actions b { margin-right: 4px; }

/* --- уточнення --- */
.copy input { font-family: inherit; }
.copy input[readonly] { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; background: var(--subtle); }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form > input:not([type=hidden]) { flex: 1; }
.field-row { align-items: flex-start; }
.field-row > button { margin-top: 26px; }
th.right { text-align: right; }
.card.flush .card-foot { margin: 0; border-radius: 0; }
td .actions { flex-wrap: nowrap; }
.who-cell b { white-space: nowrap; }
form:has(option[value=ready]:checked) input[type=month] { visibility: hidden; }
@media (min-width: 861px) { .side { box-shadow: none; } }
@media (max-width: 860px) {
  .side { box-shadow: none; }
  .nav-toggle:checked ~ .side { box-shadow: var(--shadow-lg); }
}
@media (max-width: 640px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile { flex-direction: column; align-items: flex-start; gap: 8px; }
  table.stackable td[data-label] { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  table.stackable td[data-label]::before { display: inline; font-size: 12.5px; text-align: left; }
  table.stackable td .actions { flex-wrap: wrap; margin-top: 6px; }
  .field-row > button { margin-top: 0; }
  form:has(option[value=ready]:checked) input[type=month] { display: none; }
  .inline-form { flex-wrap: wrap; }
  .inline-form > * { flex: 1 1 100%; }
}
td select { height: 34px; font-size: 13px; padding-left: 10px; }
.card.flush table th, .card.flush table td { padding-left: 10px; padding-right: 10px; }
.card.flush table th:first-child, .card.flush table td:first-child { padding-left: 24px; }
.card.flush table th:last-child, .card.flush table td:last-child { padding-right: 24px; }
@media (max-width: 860px) { .card.flush table th:first-child, .card.flush table td:first-child { padding-left: 16px; } .card.flush table th:last-child, .card.flush table td:last-child { padding-right: 16px; } }

/* --- свій вибір файлу і місяця --- */
.file { position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 12px 6px 6px; border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm); background: var(--subtle); cursor: pointer; font-weight: 400; flex: 1; min-width: 0; }
.file:hover { border-color: var(--blue); background: var(--blue-50); }
.file input[type=file] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; padding: 0; border: 0; }
.file-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: #fff; font-weight: 600; white-space: nowrap; color: var(--ink); }
.file:hover .file-btn { border-color: var(--blue); color: var(--blue); }
.file-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.file-name.chosen { color: var(--ink); font-weight: 500; }
.file.disabled { opacity: .5; pointer-events: none; }
.month-pick { display: inline-flex; gap: 6px; }
.month-pick select { min-width: 0; }
.month-pick select:first-child { width: 132px; }
.month-pick select:last-child { width: 92px; }
tr:has(option[value=ready]:checked) .month-pick { visibility: hidden; }
.badge.building { background: var(--blue-50); color: var(--blue); border-color: var(--blue-200); }
.badge.building::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: #F7DDB0; }
.icon-danger { color: var(--muted); width: 32px; height: 32px; padding: 0; border-color: transparent; background: transparent; }
.icon-danger:hover { color: var(--danger); background: var(--danger-bg); border-color: transparent; }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
@media (max-width: 640px) {
  tr:has(option[value=ready]:checked) .month-pick { display: none; }
  .cell-actions { justify-content: flex-start; }
}
.add-row:has(option[value=ready]:checked) .until-wrap,
.add-row:has(select[name=building] option[value=""]:not(:checked)) .until-wrap { display: none; }
.until-wrap { display: inline-flex; align-items: center; gap: 8px; }

/* --- опис змін, завантаження, версії --- */
ul.changes { list-style: none; white-space: normal; padding: 12px 16px; }
ul.changes li { padding: 3px 0 3px 16px; position: relative; color: var(--ink); }
ul.changes li::before { content: ""; position: absolute; left: 2px; top: 11px; width: 5px; height: 5px; border-radius: 50%; background: var(--blue); }
ul.changes li.head { padding-left: 0; font-weight: 700; margin-top: 8px; }
ul.changes li.head:first-child { margin-top: 0; }
ul.changes li.head::before { display: none; }
h3 { font-size: 14px; margin: 0 0 8px; }
.small { font-size: 13px; }
.center { text-align: center; }
.dl { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.dl .i { flex: none; }
.upload-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.upload-row .file { flex: 1 1 280px; }
.field { display: grid; gap: 6px; margin-bottom: 4px; }
.field small { color: var(--muted); font-size: 13px; }
.field-label { font-weight: 500; font-size: 13.5px; }
.field-label small { font-weight: 400; }
.versions { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; font-size: 13px; }
.versions > span { display: inline-flex; align-items: center; gap: 8px; }

/* --- паркінги в умовах --- */
.parks { display: grid; gap: 10px; }
.park { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.park[open] { border-color: var(--blue-200); }
.park > summary { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.park > summary::-webkit-details-marker { display: none; }
.park > summary .avatar { background: var(--blue-50); color: var(--blue); width: 32px; height: 32px; }
.park > summary .chev { margin-left: auto; color: var(--muted); }
.park > summary:hover { background: var(--subtle); border-radius: 10px; }
.park > :not(summary) { margin-left: 14px; margin-right: 14px; }
.park > :last-child { margin-bottom: 14px; }
.park-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.park-grid label { flex: 0 1 240px; }
.park-grid input.num { width: 160px; text-align: right; }

/* --- ставки --- */
.rates-view { table-layout: fixed; width: 100%; min-width: 560px; }
.rates-view col.label { width: 170px; }
.rates-view th, .rates-view td { padding: 12px 16px; }
.rates-view thead th.center, .rates-view td.center { text-align: center; }
.rates-view tbody th { text-align: left; font-weight: 600; white-space: nowrap; background: var(--subtle); color: var(--ink); }
.rates-view td b { display: block; font-size: 15px; }
.rates-view td small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.edit-table > summary { cursor: pointer; font-weight: 600; color: var(--blue); margin-bottom: 10px; }

/* --- калькулятори --- */
.calc-form { display: grid; gap: 16px; max-width: 640px; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--subtle); border: 1px solid var(--line); border-radius: 10px; justify-self: start; }
.segmented label { display: inline-flex; position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { padding: 8px 14px; border-radius: 7px; font-weight: 600; color: var(--ink-2); }
.segmented input:checked + span { background: #fff; color: var(--blue-deep); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--blue); }
.segmented label.off { cursor: not-allowed; }
.segmented label.off span { color: #9AA3B5; }
.segmented small { font-weight: 500; font-size: 11px; padding: 1px 6px; border-radius: 99px; background: var(--line); color: var(--muted); margin-left: 4px; }
.calc-target { display: none; gap: 6px; }
.calc-target label { justify-self: start; }
.calc-target select { min-width: 220px; }
.calc-form:has(input[value=apartments]:checked) .calc-target[data-kind=apartments],
.calc-form:has(input[value=parking]:checked) .calc-target[data-kind=parking] { display: grid; }

/* --- статистика --- */
.period select { min-width: 180px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.kpi span { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi b { display: block; font-size: 28px; line-height: 1.2; margin-top: 6px; font-variant-numeric: tabular-nums; color: var(--ink); }
svg.chart { width: 100%; min-width: 560px; height: auto; display: block; }
svg.chart .gridline { stroke: var(--line); stroke-width: 1; }
svg.chart .gridline.zero { stroke: var(--line-strong); }
svg.chart .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.chart .bar path { fill: var(--blue); }
svg.chart .bar .hit { fill: transparent; }
svg.chart .bar:hover .hit { fill: var(--blue-50); }
svg.chart .bar:hover path { fill: var(--blue-deep); }
tr.idle td { color: var(--muted); }
tr.on td { background: var(--blue-50); }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, 1fr); } .kpi b { font-size: 24px; } }
.role-name { display: block; }
.role-extra { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ok); font-weight: 600; }
.period-card { padding: 14px 16px; }
.period-row { display: flex; gap: 12px 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.chips-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-nav a { padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--subtle); color: var(--ink-2); font-weight: 600; font-size: 13px; }
.chips-nav a:hover { border-color: var(--blue-200); color: var(--blue-deep); text-decoration: none; }
.chips-nav a.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.period-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.period-form label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--muted); }
.period-form input.day { width: 118px; height: 36px; font-variant-numeric: tabular-nums; }
.period-form button { height: 36px; }
.danger-text { color: var(--danger); }
.kpis.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .kpis.three { grid-template-columns: repeat(2, 1fr); } }

/* --- телефон: таблиці редагування як компактні картки, форми в одну колонку --- */
@media (max-width: 640px) {
  table.cards tr { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; align-items: center; padding: 14px 16px; }
  table.cards td { padding: 0 !important; }
  table.cards td:first-child { grid-column: 1; grid-row: 1; }
  table.cards td.cell-act { grid-column: 2; grid-row: 1; }
  table.cards td[data-label] { grid-column: 1 / -1; display: flex !important; align-items: center; justify-content: space-between; gap: 12px; }
  table.cards td[data-label]::before { display: inline; margin: 0; font-size: 13px; font-weight: 500; white-space: nowrap; }
  table.cards td[data-label] select[name=status] { width: 168px; }
  table.cards td[data-label] .month-pick select:first-child { width: 128px; }
  table.cards td[data-label] .month-pick select:last-child { width: 88px; }
  table.cards tr:has(option[value=ready]:checked) td.until { display: none !important; }
  table.cards td.cell-act .cell-actions { justify-content: flex-end; }
  table.cards td .muted { text-align: right; }
  table.cards .who-cell { gap: 10px; }

  .add-row { display: grid !important; grid-template-columns: 1fr 1fr; gap: 10px; }
  .add-row > b { grid-column: 1 / -1; }
  .add-row > input, .add-row > select { width: 100% !important; }
  .add-row .until-wrap { grid-column: 1 / -1; display: flex; justify-content: space-between; }
  .add-row > button { grid-column: 1 / -1; }

  .field-row.save-row { display: grid; gap: 12px; }
  .field-row.save-row button { justify-self: start; }

  .page-head { margin-bottom: 16px; }
  .page-head .sub { font-size: 14px; }
  .card-head p { font-size: 13px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; font-size: 14px; }
  .upload-row > button, .stack > button, .calc-form .actions button { width: 100%; }
  .file { flex-wrap: wrap; }
  .file-name { flex: 1 1 100%; padding-left: 4px; }
  .period-row { display: grid; }
  .period-form { display: grid; grid-template-columns: 1fr 1fr; }
  .period-form label.inline { display: grid; gap: 4px; }
  .period-form input.day { width: 100%; }
  .period-form button { grid-column: 1 / -1; }
  .segmented { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .segmented span { display: block; text-align: center; }
  .park > summary .muted { flex-basis: 100%; padding-left: 44px; font-size: 13px; }
  .card-foot.actions button, .card-foot > button { flex: 1 1 auto; }
  .tables { grid-template-columns: 1fr; }
  ul.changes { padding: 10px 12px; font-size: 13.5px; }
  .rates-view th, .rates-view td { padding: 10px 8px; }
  .rates-view { min-width: 480px; }
  .rates-view col.label { width: 96px; }
  .rates-view tbody th { white-space: normal; }
  .kpi { padding: 12px 14px; }
  .kpi b { font-size: 22px; }
}
.cols > * { min-width: 0; }
@media (max-width: 640px) {
  table.stackable td[data-label] { display: flex !important; justify-content: space-between; gap: 12px; text-align: right; }
  table.stackable td[data-label]::before { display: inline; text-align: left; font-size: 12.5px; }
}
.role-cell { display: grid; gap: 2px; justify-items: start; }
@media (max-width: 640px) { .role-cell { justify-items: end; } }
@media (max-width: 640px) {
  svg.chart { min-width: 0; }
  svg.chart .axis { font-size: 22px; }
}

/* таблиці знижок стоять рівно: заголовки в одному рядку сітки, таблиці починаються на одній висоті */
.tables { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); grid-auto-rows: auto; align-items: stretch; }
.tables > div { display: grid; grid-template-rows: subgrid; grid-row: span 2; align-content: start; gap: 8px; }
.tables > div > h3 { margin: 0; align-self: end; }
.tables table { width: 100%; table-layout: fixed; }
.tables table th { white-space: nowrap; padding-right: 6px; }
.tables table td input.pc { width: 100%; max-width: 110px; }
.tables > div > table { align-self: start; }
.tables table td { height: 44px; padding-top: 3px; padding-bottom: 3px; }

/* --- розсилка --- */
textarea { height: auto; min-height: 150px; padding: 10px 12px; line-height: 1.45; resize: vertical; }
.fmt-bar { display: flex; gap: 6px; margin: 6px 0; }
.fmt-bar button { min-width: 40px; }
.tg-msg { white-space: pre-line; max-width: 520px; padding: 10px 14px; border-radius: 14px 14px 14px 4px; background: #EEF3FE; border: 1px solid var(--blue-200); line-height: 1.45; overflow-wrap: anywhere; }
.tg-msg a { color: var(--blue); }
