/* Услуги Трубчевск — мини-приложение MAX. Общая дизайн-система (2026-10-01).
   Идея: спокойный «ежедневник города». Один акцент — время: крупные табличные цифры
   в «билетиках» у клиента и лента дня у мастера. Всё остальное — тихие сгруппированные списки. */

:root {
    --bg: #F2F3F7;
    --surface: #FFFFFF;
    --surface-2: #F7F7FB;
    --ink: #1F2340;
    --ink-2: #555A78;
    --ink-3: #8C90AA;
    --line: #E4E5EE;
    --brand: #4F4FC8;
    --brand-ink: #FFFFFF;
    --brand-soft: #ECECFB;
    --free: #16875F;
    --free-soft: #E3F4EC;
    --busy: #C43D3D;
    --busy-soft: #FBE9E9;
    --warn: #9A6200;
    --warn-soft: #FFF3DC;
    --radius-l: 18px;
    --radius-m: 12px;
    --radius-s: 8px;
    --tabbar-h: 64px;
    --safe-b: env(safe-area-inset-bottom, 0px);
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #12142A;
        --surface: #1C1F38;
        --surface-2: #232744;
        --ink: #ECEDF7;
        --ink-2: #B3B6D0;
        --ink-3: #7F83A3;
        --line: #2E3254;
        --brand: #8D8DF4;
        --brand-ink: #12142A;
        --brand-soft: #2A2D55;
        --free: #4FCB98;
        --free-soft: #173A30;
        --busy: #F07878;
        --busy-soft: #3F2027;
        --warn: #F0B45A;
        --warn-soft: #3A2E17;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }
body {
    font-family: 'Golos Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    background: var(--bg);
    color: var(--ink);
    padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
}
body.no-tabbar { padding-bottom: calc(24px + var(--safe-b)); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- шапка ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    padding: 14px 16px 10px;
}
.topbar-row { display: flex; align-items: center; gap: 12px; max-width: 560px; margin: 0 auto; }
.topbar h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; flex: 1; min-width: 0; }
.topbar .sub { font-size: 13px; color: var(--ink-3); max-width: 560px; margin: 2px auto 0; }
.back { border: 0; background: var(--surface); width: 36px; height: 36px; border-radius: 50%; font-size: 18px; cursor: pointer; flex: none; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
          display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }

main { max-width: 560px; margin: 0 auto; padding: 4px 16px 0; }
.view { display: none; }
.view.active { display: block; }

/* ---------- заголовки групп ---------- */
.group-title { font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 22px 4px 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.group-title:first-child { margin-top: 8px; }
.group-title .link { font-weight: 500; font-size: 14px; color: var(--brand); background: none; border: 0; cursor: pointer; }

/* ---------- сгруппированный список ---------- */
.list { background: var(--surface); border-radius: var(--radius-l); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; min-height: 56px; position: relative; width: 100%;
       background: none; border: 0; text-align: left; cursor: default; }
button.row, a.row { cursor: pointer; color: var(--ink); }
button.row:active, a.row:active { background: var(--surface-2); }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--line); }
.row .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); display: grid; place-items: center; font-size: 17px; flex: none; }
.row .body { flex: 1; min-width: 0; }
.row .title { font-weight: 500; overflow-wrap: anywhere; }
.row .meta { font-size: 13px; color: var(--ink-3); margin-top: 1px; overflow-wrap: anywhere; }
.row .end { color: var(--ink-3); font-size: 14px; text-align: right; flex: none; }
.row .chev { color: var(--ink-3); font-size: 18px; flex: none; }
.row .price { font-weight: 600; color: var(--ink); white-space: nowrap; }

/* ---------- кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: var(--radius-m);
       padding: 13px 18px; font-weight: 600; font-size: 16px; cursor: pointer; background: var(--brand); color: var(--brand-ink); min-height: 48px; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn.plain { background: var(--surface); color: var(--ink); }
.btn.danger { background: var(--busy-soft); color: var(--busy); }
.btn.small { min-height: 36px; padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

/* ---------- чипы/фильтры ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-size: 14px; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* ---------- дни и «билетики» времени (главный акцент клиента) ---------- */
.days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day { flex: none; width: 62px; border: 0; background: var(--surface); border-radius: var(--radius-m); padding: 9px 0 8px; cursor: pointer; text-align: center; }
.day .wd { font-size: 12px; color: var(--ink-3); }
.day .dn { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.day .cnt { font-size: 11px; color: var(--free); }
.day.off { opacity: .45; cursor: not-allowed; }
.day.off .cnt { color: var(--ink-3); }
.day.on { background: var(--ink); color: var(--surface); }
.day.on .wd, .day.on .cnt { color: inherit; opacity: .75; }

.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.ticket { border: 0; background: var(--surface); border-radius: var(--radius-m); padding: 12px 0; font-size: 20px; font-weight: 700;
          font-variant-numeric: tabular-nums; letter-spacing: .5px; cursor: pointer; position: relative; }
.ticket::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 6px; height: 2px; border-radius: 2px; background: var(--free); opacity: .6; }
.ticket.on { background: var(--brand); color: var(--brand-ink); }
.ticket.on::after { background: var(--brand-ink); }
.ticket:disabled { color: var(--ink-3); text-decoration: line-through; opacity: .5; cursor: not-allowed; }
.ticket:disabled::after { display: none; }
.daypart { font-size: 13px; color: var(--ink-3); margin: 14px 2px 6px; }

/* ---------- лента дня мастера (главный акцент мастера) ---------- */
.timeline { position: relative; padding-left: 64px; }
.timeline::before { content: ""; position: absolute; left: 52px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-item { position: relative; margin-bottom: 10px; }
.tl-time { position: absolute; left: -64px; width: 50px; text-align: right; top: 12px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }
.tl-time small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); }
.tl-card { background: var(--surface); border-radius: var(--radius-m); padding: 12px 14px; border-left: 4px solid var(--brand); }
.tl-card .who { font-weight: 600; }
.tl-card .what { font-size: 14px; color: var(--ink-2); }
.tl-card .acts { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.tl-item.free .tl-card { background: var(--free-soft); border-left-color: var(--free); color: var(--free); font-weight: 600; font-size: 14px; padding: 9px 14px; }
.tl-item.past .tl-card { opacity: .55; }
.tl-item.now .tl-time { color: var(--brand); }
.tl-item.break .tl-card { background: var(--surface-2); border-left-color: var(--ink-3); color: var(--ink-3); font-size: 14px; padding: 9px 14px; }

/* ---------- метки ---------- */
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; vertical-align: 1px; }
.tag.free { background: var(--free-soft); color: var(--free); }
.tag.busy { background: var(--busy-soft); color: var(--busy); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.stars { color: #E8A317; letter-spacing: 1px; }

/* ---------- формы ---------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--ink-2); margin: 0 4px 6px; }
.input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-m); padding: 13px 14px; font-size: 16px; min-height: 48px; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.input { resize: vertical; min-height: 96px; }
.form-row { display: flex; gap: 10px; }
.form-row > * { flex: 1; min-width: 0; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch input { width: 46px; height: 28px; appearance: none; -webkit-appearance: none; background: var(--line); border-radius: 999px; position: relative; cursor: pointer; flex: none; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--free); }
.switch input:checked::after { transform: translateX(18px); }

/* ---------- сводка сверху ---------- */
.summary { display: flex; gap: 8px; margin: 6px 0 4px; }
.summary .cell { flex: 1; background: var(--surface); border-radius: var(--radius-m); padding: 10px 12px; }
.summary .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary .l { font-size: 12px; color: var(--ink-3); }

/* ---------- пустые состояния, подсказки ---------- */
.empty { text-align: center; padding: 34px 20px; color: var(--ink-2); background: var(--surface); border-radius: var(--radius-l); }
.empty .big { font-size: 36px; margin-bottom: 6px; }
.empty p { margin-bottom: 14px; }
.note { background: var(--brand-soft); color: var(--ink); border-radius: var(--radius-m); padding: 12px 14px; font-size: 14px; margin: 10px 0; }
.note b { color: var(--brand); }
.note.warn { background: var(--warn-soft); }
.note.bad { background: var(--busy-soft); }
.skeleton { height: 56px; border-radius: var(--radius-m); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sk 1.2s infinite linear; margin-bottom: 8px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- нижняя панель вкладок ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
          padding-bottom: var(--safe-b); }
.tabbar-in { display: flex; max-width: 560px; margin: 0 auto; height: var(--tabbar-h); }
.tab { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
       font-size: 11px; color: var(--ink-3); cursor: pointer; position: relative; }
.tab .ti { font-size: 21px; line-height: 1; filter: grayscale(1); opacity: .7; }
.tab.on { color: var(--brand); font-weight: 600; }
.tab.on .ti { filter: none; opacity: 1; }
.tab .badge { position: absolute; top: 8px; left: 50%; margin-left: 8px; background: var(--busy); color: #fff; font-size: 10px; font-weight: 700;
              min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 4px; }

/* ---------- нижний лист (модалка) ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(15, 17, 35, .45); z-index: 50; display: none; }
.sheet-bg.on { display: block; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; background: var(--bg); border-radius: 22px 22px 0 0;
         max-height: 92vh; overflow-y: auto; padding: 10px 16px calc(20px + var(--safe-b)); transform: translateY(105%); transition: transform .22s ease-out; }
.sheet.on { transform: none; }
.sheet-in { max-width: 560px; margin: 0 auto; }
.sheet .grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { font-size: 20px; font-weight: 700; margin-bottom: 12px; }

/* ---------- всплывающее сообщение ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); transform: translateX(-50%) translateY(20px); opacity: 0;
         background: var(--ink); color: var(--surface); padding: 11px 16px; border-radius: 12px; font-size: 14px; z-index: 60; max-width: calc(100% - 32px);
         transition: opacity .2s, transform .2s; pointer-events: none; text-align: center; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--busy); color: #fff; }

/* ---------- мелочи ---------- */
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.hidden { display: none !important; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }
