:root {
  /* SVOYA Studio — black & white */
  --bg: #f7f7f7;
  --card: #ffffff;
  --text: #0a0a0a;
  --muted: #7c7c7c;
  --border: #e4e4e4;
  --accent: #000000;
  --accent-hover: #2b2b2b;
  --accent-soft: #efefef;
  --ok: #000000;
  --ok-soft: #e6e6e6;
  --warn: #6b6b6b;
  --warn-soft: #f1f1f1;
  --danger: #c62828;
  --danger-soft: #fdecec;
  --info: #0a0a0a;
  --info-soft: #ffffff;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0, 0, 0, .05);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 24px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.right { margin-left: auto; }
.stack > * + * { margin-top: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 9px 16px; border-radius: 10px; font: inherit; font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #f0f0f0; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f0c4c4; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #ededed; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.lg { padding: 13px 20px; font-size: 16px; }

/* forms */
label.f { display: block; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text);
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
input[type=color] { padding: 2px; height: 40px; }
textarea { min-height: 70px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f7f7f7; }
td.num, th.num { text-align: right; white-space: nowrap; }

/* badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.booked { background: #ffe3c2; color: #6b3a00; }
.badge.done { background: #e6e6e6; color: #333; }
.badge.noshow { background: #fbd0d0; color: #7d1010; }
.badge.cancelled { background: #eee; color: #777; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #0a0a0a; color: #fff; padding: 11px 18px; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 1000; max-width: calc(100vw - 32px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
#toast.show { opacity: 1; }
#toast.err { background: var(--danger); }

/* modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 500;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); padding: 22px;
}
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.modal-head h2 { margin: 0; flex: 1; }
.modal-foot { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
@media (max-width: 560px) { .modal-bg { padding: 0; } .modal { border-radius: 0; min-height: 100%; } }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* staff photo instead of initials */
.avatar.photo { background-size: cover; background-position: center; background-color: #eee; }


/* explanation under a settings field */
.hint { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 4px; font-weight: 400; }


/* photos of work in a client card */
.wphotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.wphotos figure { margin: 0; }
.wphotos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; background: #eee; }
.wphotos figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nowrap { white-space: nowrap; }


/* «Підтвердив» / «Клієнт прийшов» */
.badge.confirmed { background: #cdeed6; color: #0f5126; }
.badge.arrived { background: #d3e2ff; color: #123a85; }
/* appointment card: state switch and payment choice */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1 1 120px; }
.seg button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.paylines { width: 100%; }
.paylines td { padding: 4px 0; }
.paylines td.num { text-align: right; }
.paylines tr.total td { border-top: 1px solid var(--border); font-weight: 700; padding-top: 8px; }


/* state buttons in a visit card take the state's colour when chosen */
.seg button[data-vs=booked].on { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.seg button[data-vs=confirmed].on { background: #1e9e4a; border-color: #1e9e4a; color: #fff; }
.seg button[data-vs=arrived].on { background: #2563eb; border-color: #2563eb; color: #fff; }
.seg button[data-vs=noshow].on { background: #d32f2f; border-color: #d32f2f; color: #fff; }

