/* Barberly design system — black / white / neutral grey */
:root {
  --black: #111111;
  --black-2: #1a1a1a;
  --black-3: #222222;
  --black-4: #2c2c2c;
  --white: #ffffff;
  --bg: #f5f5f5;
  --line: #e5e5e5;
  --muted: #777777;
  --ok: #16834a;
  --ok-dark: #3ec27a;
  --err: #c73535;
  --err-dark: #ef6b6b;
  --warn: #b7791f;
  --warn-dark: #e3b04b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--black); background: var(--white); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0; }
.i { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 26px; height: 26px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .22em; font-size: 15px; text-decoration: none; text-transform: uppercase; }
.logo .i { width: 26px; height: 26px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; transition: background .15s, color .15s, border-color .15s, opacity .15s; white-space: nowrap; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-dark { background: var(--black); color: var(--white); }
.btn-dark:hover:not(:disabled) { background: #000; }
.btn-light { background: var(--white); color: var(--black); }
.btn-light:hover:not(:disabled) { background: #ececec; }
.btn-outline { background: transparent; border-color: var(--line); color: var(--black); }
.btn-outline:hover:not(:disabled) { border-color: var(--black); }
.btn-ghost-dark { background: transparent; border-color: rgba(255,255,255,.35); color: var(--white); }
.btn-ghost-dark:hover:not(:disabled) { border-color: var(--white); background: rgba(255,255,255,.06); }
.btn-danger { background: transparent; border-color: #f0caca; color: var(--err); }
.btn-danger:hover:not(:disabled) { background: #fdf2f2; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-sq { border-radius: var(--radius-sm); }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.icon-btn:hover { border-color: var(--black); }
.btn .spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .label { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err-text { font-size: 12px; color: var(--err); }
.input, .select, .textarea { width: 100%; min-height: 46px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white); outline: none; transition: border-color .15s; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--black); }
.input.invalid, .select.invalid { border-color: var(--err); }
.textarea { min-height: 84px; resize: vertical; }
.input-group { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--white); }
.input-group:focus-within { border-color: var(--black); }
.input-group .input { border: 0; border-radius: 0; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; background: var(--bg); color: var(--muted); font-size: 13px; white-space: nowrap; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.check { display: inline-flex; gap: 10px; align-items: center; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--black); }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: #d4d4d4; border-radius: 99px; transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + span { background: var(--black); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--black); outline-offset: 2px; }

/* ---------- cards / misc ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge-ok { color: var(--ok); background: #e9f6ee; }
.badge-err { color: var(--err); background: #fbeaea; }
.badge-warn { color: var(--warn); background: #fdf3e2; }
.badge-muted { color: #555; background: #efefef; }
.badge-dark { color: #fff; background: var(--black); }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); font-size: 14px; }
.alert-err { border-color: #f0caca; background: #fdf3f3; color: #8f2424; }
.alert-ok { border-color: #c6e7d3; background: #f0faf4; color: #11633a; }
.alert-warn { border-color: #f1dfb9; background: #fffaf0; color: #7a520f; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .i { width: 36px; height: 36px; margin: 0 auto 12px; color: #bbb; display: block; }
.empty h4 { color: var(--black); margin-bottom: 6px; font-size: 16px; }
.skeleton { background: linear-gradient(90deg, #eee 0, #f6f6f6 50%, #eee 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; min-height: 16px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- toast & modal ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 420px; }
.toast { background: var(--black); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.25); animation: tin .2s ease-out; pointer-events: auto; display: flex; gap: 10px; align-items: center; }
.toast.err { background: var(--err); }
.toast.ok .i { color: #6fe0a2; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 900; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--white); color: var(--black); border-radius: 16px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: inherit; z-index: 1; }
.modal-head h3 { font-size: 18px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@media (max-width: 560px) {
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; }
}

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #fafafa; }

/* ---------- tabs / segmented ---------- */
.seg { display: inline-flex; padding: 4px; border-radius: 10px; background: var(--bg); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--white); color: var(--black); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.avatar { width: 40px; height: 40px; border-radius: 50%; background: #e9e9e9; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #555; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
