/* Антарам — кабинет. Сначала телефон, с 900px — компьютер (боковое меню). */
:root {
  --bg: #f5f2ed; --surface: #fff; --surface-2: #efebe4; --line: #e2ddd4;
  --text: #24201b; --muted: #6f675c; --accent: #8a5a2b; --accent-text: #fff; --accent-soft: #f1e6d8;
  --busy: #c0566f; --busy-bg: #f6dde3; --free: #2f7d57; --free-bg: #dcefe4;
  --partial: #b07a1c; --partial-bg: #f6e8c8; --today: #8a5a2b;
  --ok-bg: #dcefe4; --ok: #1f5f40; --err-bg: #f8dcdc; --err: #8d2424; --warn-bg: #fbedc9; --warn: #6d4c06;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 10px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181614; --surface: #221f1c; --surface-2: #2b2723; --line: #38332d;
    --text: #efe9e1; --muted: #a59b8e; --accent: #d39a5e; --accent-text: #1b1612; --accent-soft: #3a2d20;
    --busy: #f08ca3; --busy-bg: #4a2630; --free: #79c99d; --free-bg: #1f3a2b;
    --partial: #e7b55a; --partial-bg: #45361a; --today: #d39a5e;
    --ok-bg: #1f3a2b; --ok: #9be0b8; --err-bg: #4a2222; --err: #ffb3b3; --warn-bg: #45361a; --warn: #f3d28c;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 18px; margin: 20px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Каркас: шапка, меню-список (на телефоне выезжает, на компьютере слева и сворачивается) */
.topbar { position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 8px; padding: 0 16px 0 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: .3px; color: var(--text); text-decoration: none; padding-left: 4px; }
.venue-switch { flex: 1; min-width: 0; }
.venue-switch select { width: 100%; max-width: 320px; }
.venue-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; text-decoration: none; flex: none; }
.iconbtn { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--text); display: grid; place-items: center; cursor: pointer; flex: none; }
.iconbtn svg { width: 24px; height: 24px; }
.iconbtn:hover { background: var(--surface-2); }
main { padding: 16px 16px 40px; max-width: 1080px; min-width: 0; }

.nav { position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: 280px; max-width: 85vw; display: flex; flex-direction: column; gap: 2px; padding: calc(14px + env(safe-area-inset-top)) 10px calc(14px + env(safe-area-inset-bottom)); background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; transform: translateX(-102%); transition: transform .22s ease; }
body.nav-open .nav { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.18); }
.nav-backdrop { display: none; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.35); }
body.nav-open .nav-backdrop { display: block; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 15px; white-space: nowrap; }
.nav a svg { width: 22px; height: 22px; flex: none; color: var(--muted); }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.on svg { color: var(--accent); }
.nav hr { border: 0; border-top: 1px solid var(--line); margin: 6px 8px; }
.nav .spacer { flex: 1; }
.nav-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 8px 12px; font-size: 17px; }
.nav .collapse { display: none; }
@media (min-width: 900px) {
  .burger { display: none; }
  .topbar { padding-left: 20px; }
  .layout { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .nav { position: sticky; top: 60px; z-index: 5; height: calc(100vh - 60px); width: 236px; max-width: none; transform: none; transition: width .18s ease; padding-top: 14px; }
  .nav-backdrop, .nav-head { display: none !important; }
  .nav .collapse { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
  .nav .collapse:hover { background: var(--surface-2); }
  .nav .collapse svg { width: 20px; height: 20px; flex: none; transition: transform .18s; }
  .nav-mini .nav { width: 66px; }
  .nav-mini .nav a span, .nav-mini .nav .collapse span { display: none; }
  .nav-mini .nav .collapse svg { transform: rotate(180deg); }
  main { padding: 24px 32px 48px; }
}

/* Элементы */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 16px; margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { color: var(--err); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--text); font-size: 16px; margin: 4px 0; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.grid2 { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.error { background: var(--err-bg); color: var(--err); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.yes { background: var(--free-bg); color: var(--free); }
.badge.no { background: var(--busy-bg); color: var(--busy); }
.badge.pending { background: var(--partial-bg); color: var(--partial); }
.badge.confirmed { background: var(--free-bg); color: var(--free); }
.badge.cancelled { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; }
.segmented a { padding: 7px 14px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; }
.segmented a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented.radios label { margin: 0; color: inherit; font-size: inherit; }
.segmented.radios input { position: absolute; opacity: 0; pointer-events: none; }
.segmented.radios span { display: block; padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; }
.segmented.radios input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented.radios input:focus-visible + span { outline: 2px solid var(--accent); }
.nowrap { white-space: nowrap; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 0; color: var(--text); text-decoration: none; }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item .sub { font-size: 14px; color: var(--muted); }
.datebox { flex: none; width: 52px; text-align: center; border-radius: 10px; background: var(--surface-2); padding: 4px 0; }
.datebox b { display: block; font-size: 20px; line-height: 1.1; }
.datebox span { font-size: 12px; color: var(--muted); }
dl.props { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.fab { position: fixed; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 11; width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-size: 30px; text-decoration: none; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
@media (min-width: 900px) { .fab { display: none; } }
.only-desktop { display: none; }
@media (min-width: 900px) { .only-desktop { display: inline-flex; } }

/* Календарь */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-head h2 { margin: 0; flex: 1; text-align: center; font-size: 18px; text-transform: capitalize; }
.cal-nav { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; text-decoration: none; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: 20px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal .wd { text-align: center; font-size: 12px; color: var(--muted); padding: 2px 0 4px; text-transform: uppercase; letter-spacing: .3px; }
.cal .wd.we { color: var(--busy); }
.day { position: relative; height: 56px; min-width: 0; border-radius: 10px; padding: 6px 6px 5px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; font: inherit; color: var(--text); text-decoration: none; cursor: pointer; overflow: hidden; background: var(--surface-2); }
.day .n { font-weight: 600; font-size: 15px; line-height: 1; }
.day .l { width: 100%; font-size: 10px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day.free { background: var(--free-bg); color: var(--free); }
.day.busy { background: var(--busy-bg); color: var(--busy); }
.day.partial { background: var(--partial-bg); color: var(--partial); }
.day.past { opacity: .5; }
.day.today { box-shadow: inset 0 0 0 2px var(--today); }
.day.sel { box-shadow: inset 0 0 0 3px var(--text); }
.day .dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--partial); }
.day:hover { filter: brightness(.97); }
@media (min-width: 700px) { .cal { gap: 6px; } .day { height: 72px; padding: 8px 9px 7px; } .day .n { font-size: 16px; } .day .l { font-size: 12px; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 5px; }
.cal-wrap { display: grid; gap: 16px; }
@media (min-width: 1100px) { .cal-wrap:has(#day-panel:not(:empty)) { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
#day-panel:empty { display: none; }
.hall-row { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.hall-row:first-of-type { border-top: 0; }
.htmx-request.loading-dim { opacity: .6; transition: opacity .2s; }

/* История */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.timeline li:first-child { border-top: 0; }
.timeline .who { font-weight: 600; }
.chg { color: var(--muted); }

/* Вход */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(90% 60% at 0% 0%, #fbe3d3 0%, rgba(251,227,211,0) 70%),
              radial-gradient(80% 60% at 100% 100%, #e4eee3 0%, rgba(228,238,227,0) 70%),
              linear-gradient(180deg, #fdf8f3 0%, #f6eee6 100%); }
.auth .card { width: 100%; max-width: 380px; padding: 28px 24px; border: 0; border-radius: 22px; box-shadow: 0 12px 40px rgba(122, 82, 52, .12), 0 1px 3px rgba(122, 82, 52, .08); }
.auth h1 { text-align: center; margin-bottom: 4px; }
.auth .logo { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center; font-size: 26px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #e3a57e 0%, #c27a5a 100%); box-shadow: 0 6px 16px rgba(194, 122, 90, .35); }
.auth .tagline { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.auth .btn.primary { border: 0; background: linear-gradient(135deg, #c27a5a 0%, #a8603f 100%); color: #fff; }
.auth input:focus { outline-color: #c27a5a; }
@media (prefers-color-scheme: dark) {
  .auth { background: radial-gradient(90% 60% at 0% 0%, #3a2a22 0%, rgba(58,42,34,0) 70%),
                      radial-gradient(80% 60% at 100% 100%, #23302a 0%, rgba(35,48,42,0) 70%), #181614; }
  .auth .card { box-shadow: 0 12px 40px rgba(0,0,0,.4); }
}
.temp { font: 600 26px/1.2 ui-monospace, Menlo, monospace; letter-spacing: 2px; background: var(--surface-2); border-radius: 12px; padding: 14px; text-align: center; user-select: all; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
table.tbl th, table.tbl td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
table.tbl th { color: var(--muted); font-weight: 500; font-size: 13px; border-top: 0; }
@media (max-width: 420px) { .grid2.stack-narrow { grid-template-columns: 1fr; } }

/* Лиды (этап 3) */
.badge.st { color: #fff; }
.st-gray { background: #8a8178; } .st-blue { background: #3b6fb6; } .st-violet { background: #7a55b3; }
.st-amber { background: #b07a1c; } .st-teal { background: #2a8a86; } .st-green { background: #2f7d57; } .st-red { background: #b2475e; }
@media (prefers-color-scheme: dark) { .badge.st { color: #16130f; }
  .st-gray { background: #b3a99c; } .st-blue { background: #8db4ea; } .st-violet { background: #c0a3ec; }
  .st-amber { background: #e7b55a; } .st-teal { background: #76cfca; } .st-green { background: #79c99d; } .st-red { background: #f08ca3; } }
.warn-text { color: var(--warn); }
.lead-grid { display: grid; gap: 0 16px; }
@media (min-width: 1000px) { .lead-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; } }
.lead-grid .card b { font-size: 15px; }
.phone-link { font-size: 18px; font-weight: 600; text-decoration: none; display: inline-block; padding: 4px 0; }
.grid3 { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .grid3 { grid-template-columns: 2fr 1fr 1fr; } }
.feed .ev { font-size: 14px; }
.feed .note { white-space: pre-line; margin-top: 4px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--text); }
.feed .thumb { display: block; max-width: 220px; max-height: 220px; margin-top: 6px; border-radius: 10px; border: 1px solid var(--line); object-fit: cover; }
details > summary { cursor: pointer; color: var(--accent); list-style-position: inside; }
details.card > summary { color: var(--text); }
input[type=month] { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
input[type=file] { width: 100%; font: inherit; padding: 8px 0; }
.date-kind .segmented { margin-bottom: 2px; }
.tabs-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabs-scroll .segmented { white-space: nowrap; }
.setting-line { padding: 8px 0; border-top: 1px solid var(--line); }
.setting-line:first-child { border-top: 0; }
.iconbtn[disabled] { opacity: .3; cursor: default; }
/* Календарь спроса */
.day.plain { background: var(--surface-2); }
.demand-n { position: absolute; right: 6px; bottom: 6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.approx { display: block; margin-bottom: 10px; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--text); text-decoration: none; font-size: 14px; }

[hidden] { display: none !important; }  /* атрибут hidden сильнее display у .grid2 и т. п. */

/* Цвет статуса — кружками; выбранный обведён */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 0 6px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; position: relative; box-shadow: 0 0 0 2px var(--surface); }
.swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch:has(input:checked) { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; }
