:root {
  --bg: #0b0b0b;
  --card: #161615;
  --card-2: #1e1e1c;
  --line: #2c2b27;
  --yellow: #ffc61a;
  --yellow-dim: #b98d0c;
  --white: #f6f3ea;
  --muted: #a09c90;
  --red: #ff6257;
  --green: #7bd88f;
  --blue: #7cc4ff;
  --radius: 16px;
  --hand: "Caveat", "Segoe Script", "Bradley Hand", cursive;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--white); font: 15px/1.45 var(--sans); }
body { min-height: 100vh; padding-bottom: calc(84px + env(safe-area-inset-bottom)); overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--yellow); text-decoration: none; }
h1, h2, h3, p { margin: 0; }

/* ---------- шапка ---------- */
#top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: rgba(11,11,11,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
#top img { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--yellow); }
.wordmark { font-weight: 900; font-style: italic; letter-spacing: .02em; font-size: 15px; white-space: nowrap; }
.wordmark b { color: var(--yellow); font-weight: 900; }
.wordmark i { color: var(--muted); font-style: normal; font-weight: 400; margin: 0 5px; }
.role-tag { margin-left: auto; font-size: 12px; font-weight: 700; color: #111; background: var(--yellow);
  padding: 3px 10px; border-radius: 99px; }
.role-tag.client { background: transparent; color: var(--muted); border: 1px solid var(--line); }

#app { padding: 16px; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

/* ---------- типографика ---------- */
.title { font-size: 22px; font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .01em; line-height: 1.1; }
.title b { color: var(--yellow); }
.hand { font-family: var(--hand); font-size: 26px; line-height: 1.05; font-weight: 700; }
.underline { display: inline-block; padding-bottom: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 8' preserveAspectRatio='none'%3E%3Cpath d='M2 5.5C40 2 90 2.5 198 4' stroke='%23ffc61a' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") bottom/100% 8px no-repeat; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.section { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--yellow); margin-top: 6px; }

/* ---------- герой ---------- */
.hero { text-align: center; padding: 8px 0 2px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.hero img { width: min(62vw, 250px); height: auto; aspect-ratio: 1; border-radius: 50%;
  box-shadow: 0 0 0 1px #000, 0 0 60px rgba(255,198,26,.18); }
.hero p { max-width: 34ch; color: var(--muted); }

/* ---------- кнопки ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px;
  padding: 12px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card);
  font-weight: 700; cursor: pointer; text-align: center; color: var(--white); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--yellow); border-color: var(--yellow); color: #111; font-weight: 800;
  box-shadow: 0 4px 0 var(--yellow-dim); }
.btn.primary:active { box-shadow: 0 1px 0 var(--yellow-dim); transform: translateY(3px); }
.btn.outline { border-color: var(--yellow); color: var(--yellow); background: transparent; }
.btn.danger { border-color: #4a2623; color: var(--red); background: transparent; }
.btn.sm { min-height: 40px; padding: 8px 12px; font-size: 14px; width: auto; border-radius: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.center { align-items: center; }
.grow0 { flex: 0 0 auto !important; }
.ic { display: inline-flex; width: 20px; height: 20px; flex: 0 0 20px; }
.ic svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- карточки ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 10px; }
.card.tap { cursor: pointer; }
.card.tap:active { background: var(--card-2); }
.card.accent { border-color: var(--yellow); }
.card-head { display: flex; align-items: center; gap: 8px; }
.card-head .num { font-weight: 800; }
.card-head .pill { margin-left: auto; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.meta { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.meta .ic { width: 17px; height: 17px; flex-basis: 17px; margin-top: 2px; color: var(--yellow); }
.meta b { color: var(--white); font-weight: 600; }

.pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap;
  border: 1px solid var(--line); color: var(--muted); }
.pill.new { color: var(--yellow); border-color: var(--yellow-dim); }
.pill.accepted, .pill.in_progress { color: var(--blue); border-color: #2c4a63; }
.pill.waiting { color: #ffb070; border-color: #63432c; }
.pill.done { color: var(--green); border-color: #2c5a37; }
.pill.cancelled { color: var(--red); border-color: #4a2623; }
.cat { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--yellow); font-size: 14px; }
.cat .ic { width: 16px; height: 16px; flex-basis: 16px; }

.bar { height: 8px; border-radius: 99px; background: #262521; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--yellow); transition: width .3s; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-row .bar { flex: 1; }
.bar-row span { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }

/* ---------- формы ---------- */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, textarea, select { width: 100%; background: #0f0f0e; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px; color: var(--white); font-size: 16px; outline: none; min-height: 48px; }
textarea { resize: vertical; min-height: 96px; }
input:focus, textarea:focus, select:focus { border-color: var(--yellow); }
input::placeholder, textarea::placeholder { color: #6b685f; }
input[type=date] { color-scheme: dark; }
input[type=range] { padding: 0; border: 0; min-height: 32px; accent-color: var(--yellow); background: transparent; }
.cats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cats button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; font-size: 13px; font-weight: 700;
  cursor: pointer; color: var(--white); }
.cats button .ic { width: 26px; height: 26px; flex-basis: 26px; color: var(--yellow); }
.cats button.on { background: var(--yellow); border-color: var(--yellow); color: #111; }
.cats button.on .ic { color: #111; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { padding: 8px 14px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card);
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--white); }
.chip.on { background: var(--yellow); border-color: var(--yellow); color: #111; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--white); cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; flex: 0 0 22px; accent-color: var(--yellow); padding: 0; }

/* ---------- списки мастера ---------- */
.item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item input[type=checkbox] { width: 22px; height: 22px; min-height: 0; flex: 0 0 22px; accent-color: var(--yellow); padding: 0; margin-top: 1px; }
.item .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item.done .txt { color: var(--muted); text-decoration: line-through; }
.item .qty { color: var(--yellow); font-weight: 700; white-space: nowrap; }
.item .del { background: none; border: 0; color: #6b685f; padding: 2px; cursor: pointer; }
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; min-width: 0; }
.add-row .q { flex: 0 0 84px; }
.add-row .btn { flex: 0 0 48px; width: 48px; padding: 0; }

/* ---------- плитки статистики ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 10px; cursor: pointer; }
.tile b { display: block; font-size: 26px; font-weight: 900; line-height: 1; }
.tile span { font-size: 12px; color: var(--muted); }
.tile.hot b { color: var(--yellow); }

.person { display: flex; align-items: center; gap: 12px; }
.avatar { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; background: var(--yellow); color: #111;
  display: grid; place-items: center; font-weight: 900; font-size: 17px; }
.person .who { flex: 1; min-width: 0; }
.person .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.empty .hand { color: var(--white); }
.loader { text-align: center; padding: 60px 0; color: var(--muted); }
.event { display: flex; gap: 10px; font-size: 13px; padding: 7px 0; border-top: 1px solid var(--line); }
.event:first-child { border-top: 0; }
.event time { color: var(--muted); white-space: nowrap; flex: 0 0 auto; }

/* ---------- нижнее меню ---------- */
#nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: center;
  background: rgba(11,11,11,.96); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
#nav:empty { display: none; }
#nav button { flex: 1; max-width: 160px; background: none; border: 0; padding: 6px 2px; display: flex; flex-direction: column;
  align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer; position: relative; }
#nav button .ic { width: 23px; height: 23px; flex-basis: 23px; }
#nav button.on { color: var(--yellow); }
#nav button .badge { position: absolute; top: 0; left: calc(50% + 6px); background: var(--yellow); color: #111;
  font-size: 10px; font-weight: 800; border-radius: 99px; padding: 1px 6px; }

#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--white); color: #111; padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 10; max-width: 88vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--red); color: #fff; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row3 { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 8px; align-items: end; }
.row3 input { padding-left: 10px; padding-right: 10px; }

.btn.sm { white-space: nowrap; }
.row.wrap > * { flex: 1 1 auto; min-width: auto; }
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* ---------- календарь ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.cal-nav { width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card-2); color: var(--white);
  display: grid; place-items: center; cursor: pointer; padding: 0; }
.cal-nav[disabled] { opacity: .3; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-week { margin-bottom: 4px; }
.cal-week span { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-week span:nth-child(n+6) { color: var(--yellow-dim); }
.day { position: relative; aspect-ratio: 1; border-radius: 12px; border: 1.5px solid transparent; background: transparent; color: var(--white);
  font-weight: 600; font-size: 15px; cursor: pointer; padding: 0; font-variant-numeric: tabular-nums; }
.day[disabled] { color: #4a4841; cursor: default; }
.day.today { border-color: var(--yellow); color: var(--yellow); }
.day.mid { background: rgba(255,198,26,.16); border-radius: 6px; }
.day.sel { background: var(--yellow); border-color: var(--yellow); color: #111; font-weight: 800; }
.dots { position: absolute; left: 0; right: 0; bottom: 5px; display: flex; justify-content: center; gap: 3px; }
.dots b, .legend b { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
b.fresh { background: var(--white); }
b.busy { background: var(--yellow); }
.day.sel b.busy { background: #111; }
.day.sel b.fresh { background: #111; opacity: .45; }
.legend { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .chip { margin-left: auto; padding: 6px 12px; font-size: 13px; }

/* ---------- цена и фото ---------- */
.price { font-weight: 800; color: var(--yellow); font-variant-numeric: tabular-nums; }
.price.big { font-size: 24px; display: flex; flex-direction: column; line-height: 1.2; }
.photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.photos:empty { display: none; }
.ph { position: relative; aspect-ratio: 1; }
.thumb { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; background: #262521; cursor: pointer; display: block; }
.thumb.broken { opacity: .3; }
.ph-del { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--white);
  color: #111; display: grid; place-items: center; padding: 4px; cursor: pointer; }
.ph-del .ic { width: 14px; height: 14px; flex-basis: 14px; }
.viewer { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.94); display: grid; place-items: center; padding: 12px; }
.viewer img { max-width: 100%; max-height: 100%; border-radius: 8px; }
#nav button { font-size: 10.500px; }
.price-row { display: flex; gap: 8px; align-items: stretch; }
.price-row input { flex: 1; min-width: 0; }
.price-row .btn { flex: 0 0 auto; width: auto; min-height: 48px; }
