:root {
  --bg: #f4f2ee; --card: #ffffff; --ink: #1b1d1c; --muted: #6b706d; --line: #e2dfd8;
  --brand: #1f3a34; --brand-ink: #ffffff; --accent: #2f6f5e; --on-accent: #ffffff;
  --ok: #1d7a46; --ok-bg: #e3f4e9; --warn: #9a5b00; --warn-bg: #fdf0d9; --bad: #b4322b; --bad-bg: #fbe5e3;
  --neutral-bg: #ecebe7; --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121514; --card: #1c201e; --ink: #eef0ee; --muted: #9aa29e; --line: #2c322f;
    --brand: #183029; --accent: #6fc2a8; --on-accent: #0c1f19;
    --ok: #7fd6a2; --ok-bg: #173325; --warn: #f1c27a; --warn-bg: #3a2c12; --bad: #ff9a92; --bad-bg: #3d1c1a; --neutral-bg: #262b29;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); background: var(--brand); color: var(--brand-ink); }
.brand { font-weight: 700; letter-spacing: .2px; }
.top .link { background: none; border: 0; color: var(--brand-ink); opacity: .8; padding: 6px; }

main { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 12px; }
h2 { font-size: 17px; margin: 20px 0 8px; color: var(--muted); font-weight: 600; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs a { flex: 1; text-align: center; padding: 14px 6px; text-decoration: none; color: var(--muted); font-weight: 600; }
.tabs a.active { color: var(--accent); }
.tabs a.plus { color: var(--on-accent); background: var(--accent); margin: 8px; border-radius: 12px; padding: 8px 6px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.appt { display: grid; grid-template-columns: 64px 1fr; gap: 10px; text-decoration: none; color: inherit; }
.appt .time { font-size: 20px; font-weight: 700; }
.appt .dur { font-size: 13px; color: var(--muted); }
.appt .name { font-size: 20px; font-weight: 700; line-height: 1.2; }
.appt .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; color: var(--muted); font-size: 14px; }
.appt.dim { opacity: .55; }
.price { font-weight: 700; color: var(--ink); }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.pill.paid { background: var(--ok-bg); color: var(--ok); }
.pill.partial, .pill.no_price, .pill.no_price_paid { background: var(--warn-bg); color: var(--warn); }
.pill.unpaid { background: var(--bad-bg); color: var(--bad); }
.pill.neutral { background: var(--neutral-bg); color: var(--muted); }

.daynav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.daynav .title { flex: 1; text-align: center; }
.daynav .title b { display: block; font-size: 19px; }
.daynav .title span { color: var(--muted); font-size: 14px; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 20px; }
.summary { display: flex; gap: 10px; margin-bottom: 12px; }
.summary .card { flex: 1; margin: 0; padding: 10px 12px; }
.summary b { display: block; font-size: 18px; }
.summary span { color: var(--muted); font-size: 13px; }

.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer; transition: transform .06s ease, filter .1s; }
.btn:active { transform: scale(.97); filter: brightness(.95); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; }
.btn.busy { pointer-events: none; opacity: .7; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .btn { flex: 1; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }

.hero { padding: 16px; }
.hero .name { font-size: 26px; font-weight: 800; line-height: 1.15; }
.hero .when { color: var(--muted); margin-top: 4px; }
.hero .contacts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.money { border: 2px solid var(--accent); }
.money .top-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.money .big { font-size: 24px; font-weight: 800; }
.payrow { display: grid; grid-template-columns: 1fr 110px 44px; gap: 8px; margin-bottom: 8px; }
.payrow .iconbtn { height: 48px; }
.paytotal { display: flex; justify-content: space-between; margin: 8px 0 12px; font-weight: 600; }

.banner { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; background: var(--warn-bg); color: var(--warn); }
.banner .row { margin-top: 8px; }

.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.slot { min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-weight: 600; }
.slot.sel { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.empty { color: var(--muted); text-align: center; padding: 24px 8px; }

.list a.item { display: flex; justify-content: space-between; gap: 10px; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.list .item b { font-size: 17px; }
.list .item small { color: var(--muted); }
.pick { width: 100%; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin-bottom: 6px; }
.pick b { font-size: 17px; }
.pick small { color: var(--muted); display: block; }
.pick.sel { border: 2px solid var(--accent); }

.hist { padding: 10px 0; border-bottom: 1px solid var(--line); }
.hist:last-child { border-bottom: 0; }
.note { white-space: pre-wrap; }
.muted { color: var(--muted); }

#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .2s; z-index: 30; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--bad); color: #fff; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.sheet { background: var(--bg); width: 100%; max-width: 720px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet h1 { margin-top: 0; }

.login { max-width: 360px; margin: 12vh auto 0; }

body.compose .tabs { display: none; }
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.actionbar .btn { max-width: 688px; margin: 0 auto; display: flex; font-size: 17px; }
.stickyrow { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); background: var(--bg); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); margin-top: 14px; }

.seg { display: flex; background: var(--neutral-bg); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.seg a { flex: 1; text-align: center; padding: 10px 4px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; }
.seg a.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.weekday { padding: 10px 14px; }
.weekday.today { border: 2px solid var(--accent); }
.wdhead { display: flex; justify-content: space-between; text-decoration: none; color: inherit; padding: 4px 0; }
.wdhead span { color: var(--muted); font-size: 14px; }
.wrow { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.wrow .wt { font-weight: 700; }
.wrow .wn { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrow.dim { opacity: .5; }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mh { text-align: center; font-size: 13px; color: var(--muted); padding: 4px 0; }
.mc { aspect-ratio: 1; border-radius: 10px; background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: inherit; }
.mc.out { opacity: .35; }
.mc.today { border: 2px solid var(--accent); }
.mc .mn { font-weight: 600; }
.mc .mcount { background: var(--accent); color: var(--on-accent); border-radius: 999px; min-width: 22px; padding: 0 6px; font-size: 13px; font-weight: 700; text-align: center; }

.sendgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#toast { bottom: auto; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%) translateY(-20px); }
#toast.show { transform: translateX(-50%) translateY(0); }

.remind { border: 2px solid var(--warn); }
.remind.done { border-color: var(--ok); }
.remhead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.remrow { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.remrow .btn { min-height: 40px; padding: 6px 12px; }
.remrow .wt { font-weight: 700; }
.remrow .wn { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabs a { font-size: 15px; padding-left: 2px; padding-right: 2px; }
.tabs a.plus { flex: 1.1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 12px; font-size: 15px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.card.prev { border-style: dashed; }
.bar { display: grid; grid-template-columns: 96px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; }
.bar .track { height: 10px; background: var(--neutral-bg); border-radius: 6px; overflow: hidden; }
.bar .track div { height: 100%; background: var(--accent); border-radius: 6px; }

:root { --v: #d9731f; --v-bg: rgba(217,115,31,.16); --a: #9a5fc0; --a-bg: rgba(154,95,192,.16); --off: #8a8f8c; --off-bg: rgba(138,143,140,.14); }
.otag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.otag.o-v { background: var(--v-bg); color: var(--v); }
.otag.o-a { background: var(--a-bg); color: var(--a); }
.otag.o-off { background: var(--off-bg); color: var(--off); }
.mc.o-v { background: var(--v-bg); }
.mc.o-a { background: var(--a-bg); }
.mc.o-off { background: var(--off-bg); }
.weekday.o-v { border-left: 5px solid var(--v); }
.weekday.o-a { border-left: 5px solid var(--a); }
.weekday.o-off { border-left: 5px solid var(--off); }
.legend { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

.top .link { color: var(--brand-ink); text-decoration: none; font-size: 18px; }
.card.busy { background: var(--neutral-bg); color: var(--muted); border-style: dashed; }

.fab { position: fixed; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 24px; box-shadow: 0 4px 14px rgba(0,0,0,.3); z-index: 7; }
body.compose .fab { display: none; }
.ailog { max-height: 58vh; overflow: auto; padding: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.bubble { padding: 10px 12px; border-radius: 14px; max-width: 88%; white-space: pre-wrap; }
.bubble.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); }
.bubble.assistant { align-self: flex-start; background: var(--card); border: 1px solid var(--line); }
.bubble.pend { border: 2px solid var(--warn); }

.conflict { margin-top: 8px; padding: 6px 10px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); font-weight: 600; font-size: 14px; }
.chk { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.chk input { width: 22px; height: 22px; min-height: 0; }
#nLoc a { padding: 12px 4px; }
.top .link#gear { font-size: 15px; border: 1px solid rgba(255,255,255,.35); border-radius: 10px; padding: 6px 10px; margin-right: 6px; }

.top { gap: 10px; }
.top .brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top > div:last-child { white-space: nowrap; flex: 0 0 auto; }

.seg.small a { padding: 7px 4px; font-size: 14px; }
.dlist { margin-top: 4px; }
.drow { display: grid; grid-template-columns: 44px 30px 1fr; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); min-height: 58px; }
.drow.o-off { opacity: .75; }
.drow.today .dnum { background: var(--accent); color: var(--on-accent); border-radius: 12px; }
.dnum { text-align: center; text-decoration: none; color: inherit; padding: 4px 0; }
.dnum b { display: block; font-size: 20px; line-height: 1; }
.dnum small { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.drow.today .dnum small { color: #fff; }
.drow.o-v .dnum b { color: var(--v); }
.drow.o-a .dnum b { color: var(--a); }
.drow.today .dnum b { color: #fff; }
.dplus { text-decoration: none; color: var(--muted); font-size: 24px; text-align: center; }
.dchips { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip { position: relative; min-width: 58px; padding: 6px 8px; border-radius: 12px; text-decoration: none; text-align: center; line-height: 1.15; border: 2px solid; }
.tchip b { display: block; font-size: 15px; }
.tchip small { font-size: 12px; opacity: .8; }
.tchip i { position: absolute; top: -8px; right: -6px; font-style: normal; font-size: 13px; }
.tchip.m-v { border-color: var(--v); color: var(--v); }
.tchip.m-a { border-color: var(--a); color: var(--a); }
.tchip.m-v.s-done { background: var(--v); color: #fff; }
.tchip.m-a.s-done { background: var(--a); color: #fff; }
.tchip.s-noshow { border-style: dashed; opacity: .6; }
.tchip.t-train { border-color: #3d8bfd; color: #3d8bfd; }
.tchip.t-train.s-done { background: #3d8bfd; color: #fff; }

.bubble .say{display:block;margin-top:6px;background:none;border:0;padding:4px 0;color:var(--accent,#7fc4a8);font:inherit;font-size:.9em;cursor:pointer}
#aiMic.rec{background:#c0392b;color:#fff;border-color:#c0392b;animation:pulse 1s infinite}
@keyframes pulse{50%{opacity:.6}}

.seg.wrap { flex-wrap: wrap; gap: 2px; }
.seg.wrap a { flex: 1 0 30%; padding: 8px 4px; font-size: 14px; }
.nbadge { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: #c0392b; color: #fff; font-size: 11px; font-weight: 700; vertical-align: 2px; }

.tabs a.blink { animation: tabblink 1.2s ease-in-out infinite; color: var(--warn); }
@keyframes tabblink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.tchip.unconf { background: var(--warn-bg); border-style: dashed; color: var(--warn) !important; border-color: var(--warn) !important; animation: tabblink 1.6s ease-in-out infinite; }
.tchip.unconf i { background: var(--warn); color: #000; border-radius: 999px; padding: 0 4px; }

.btn.blink { animation: tabblink 1.2s ease-in-out infinite; border-color: var(--warn); color: var(--warn); }

.tl { border: 1px solid var(--line, #8883); border-radius: 12px; overflow: hidden; }
.tl-row { display: flex; align-items: center; min-height: 40px; border-top: 1px solid #8882; font-size: 14px; }
.tl-row:first-child { border-top: 0; }
.tl-h { width: 46px; flex: none; text-align: right; padding-right: 8px; color: var(--muted); font-size: 12px; }
.tl-c { flex: 1; padding: 0 8px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tl-free { cursor: pointer; }
.tl-out { background: #8881; cursor: pointer; }
.tl-appt { background: color-mix(in srgb, var(--v, #f08a24) 28%, transparent); cursor: pointer; }
.tl-block { background: #8884; color: var(--muted); }
.tl-g { background: #8882; color: var(--muted); }
.tl-sel { background: #4a90e255; }
.tl-open { border: 1px solid #8886; background: transparent; color: inherit; border-radius: 8px; padding: 4px 8px; }
.tl-bar { margin: 6px 0; }

.tl-free, .tl-row[data-t] { touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.tl-float { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 30; max-width: 560px; margin: 0 auto; box-shadow: 0 6px 24px #0008; }
.tl-row { user-select: none; -webkit-user-select: none; }

.hl { outline: 4px solid #ffb300 !important; outline-offset: 3px; border-radius: 12px; box-shadow: 0 0 0 8px rgba(255,179,0,.35), 0 0 24px rgba(255,179,0,.8); animation: tabblink 0.9s ease-in-out infinite; position: relative; z-index: 5; }

.fab.fab-off { display: none !important; }
#rMic.rec { background: #c0392b; color: #fff; border-color: #c0392b; animation: pulse 1s infinite; }

details.acc { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin: 10px 0; padding: 0 14px; }
details.acc > summary { cursor: pointer; font-weight: 700; font-size: 17px; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: '▾'; opacity: .6; transition: transform .15s; }
details.acc[open] > summary::after { transform: rotate(180deg); }
details.acc[open] { padding-bottom: 12px; }

/* цвета мастеров: Василий — оранжевый, Анна — фиолетовый */
.card.appt.mV, .wrow.mV, details.acc.mV, .card.mV { border-left: 5px solid var(--v); }
.card.appt.mA, .wrow.mA, details.acc.mA, .card.mA { border-left: 5px solid var(--a); }
.card.appt.mA { background: linear-gradient(90deg, var(--a-bg), transparent 40%), var(--card); }
.card.appt.mV { background: linear-gradient(90deg, var(--v-bg), transparent 40%), var(--card); }
.wrow.mV { padding-left: 8px; } .wrow.mA { padding-left: 8px; }

@media (max-width: 560px) { .cl-tools { width: 100%; display: grid !important; grid-template-columns: 1fr 1fr; } .cl-tools .btn { min-height: 40px; font-size: 15px; padding: 0 8px; margin: 0; } }

.list .item.mV { border-left: 5px solid var(--v); padding-left: 10px; background: linear-gradient(90deg, var(--v-bg), transparent 45%); }
.list .item.mA { border-left: 5px solid var(--a); padding-left: 10px; background: linear-gradient(90deg, var(--a-bg), transparent 45%); }

.pill.blink { animation: tabblink 1.2s ease-in-out infinite; }
