/* ═════════════════════════════════════════════════════════════════════
   DESIGN SYSTEM — Clinic variant (mobile-first)
   Источник: макет «Центр на Гороховой — запись»
   Используется на всех страницах сайта
   ═════════════════════════════════════════════════════════════════════ */

:root{
  /* background / surfaces */
  --bg:         #F5F7FA;
  --surface:    #FFFFFF;
  --sunk:       #EEF2F7;
  --hover:      #E6EDF5;

  /* text */
  --text:       #0F1B2D;
  --text-2:     #3B4A60;
  --text-3:     #6B7A91;
  --text-on:    #FFFFFF;

  /* borders */
  --line:       #D6DEE9;
  --line-soft:  #E5EBF3;

  /* brand — professional medical blue */
  --brand:      #1E5AB4;
  --brand-600:  #174A99;
  --brand-100:  #DCE8F8;
  --brand-050:  #EEF4FC;

  /* status */
  --ok:         #1F8A54;
  --ok-bg:      #DDF0E4;
  --warn:       #B36B00;
  --warn-bg:    #FCE9CF;
  --bad:        #B42318;
  --bad-bg:     #FBE3E0;
  --info:       #1E5AB4;
  --info-bg:    #DCE8F8;

  /* slot states */
  --s-free-bg:       #FFFFFF;
  --s-free-hover:    var(--brand-100);
  --s-free-fg:       var(--brand);
  --s-booked-bg:     var(--warn-bg);
  --s-booked-fg:     var(--warn);
  --s-confirmed-bg:  var(--ok-bg);
  --s-confirmed-fg:  var(--ok);
  --s-completed-bg: #E4EEFB;
  --s-completed-fg: #174A99;
  --s-cancelled-bg: var(--bad-bg);
  --s-cancelled-fg: var(--bad);
  --s-mine-bg:       var(--brand);
  --s-mine-fg:       #FFFFFF;

  --ff: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --ff-mono: 'JetBrains Mono', ui-monospace, monospace;

  --maxw: 1320px;
  --pad: 16px;            /* mobile default */
  --row: 48px;
  --radius: 6px;
  --focus: 0 0 0 3px color-mix(in oklab, var(--brand) 30%, transparent);
}

@media (min-width: 640px){
  :root{ --pad: 20px; --row: 52px; }
}
@media (min-width: 900px){
  :root{ --pad: 28px; }
}

/* ─────────── RESET / BASE ─────────── */
*{ box-sizing: border-box; }
html, body{ margin: 0; padding: 0; }
body{
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a{ color: var(--brand); text-decoration: none; }
a:hover{ color: var(--brand-600); }
img{ max-width: 100%; display: block; }

/* ─────────── CHROME / HEADER ─────────── */
.chrome{
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.chrome-inner{
  max-width: var(--maxw); margin: 0 auto;
  padding: 0 var(--pad);
  height: 56px;
  display: flex; align-items: center; gap: 12px;
}
@media (min-width: 900px){
  .chrome-inner{ gap: 28px; }
}
.brand{
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15px; color: var(--text);
  letter-spacing: -0.01em;
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover{ color: var(--text); }
.brand .mark{
  width: 26px; height: 26px;
  background: var(--brand);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
  font-family: var(--ff-mono);
}
.brand .brand-text{ display: none; }
@media (min-width: 640px){ .brand .brand-text{ display: inline; } }

.navlinks{ display: none; gap: 4px; margin-left: 12px; }
@media (min-width: 900px){ .navlinks{ display: flex; } }
.navlinks a{
  color: var(--text-2);
  font-size: 14px; padding: 8px 14px; border-radius: 6px;
  font-weight: 500;
}
.navlinks a:hover{ background: var(--sunk); color: var(--text); }
.navlinks a.current{ color: var(--brand); background: var(--brand-050); }

.chrome-right{ margin-left: auto; display: flex; gap: 6px; align-items: center; }
@media (min-width: 640px){ .chrome-right{ gap: 10px; } }

.chrome-user{
  display: none; align-items: center; gap: 10px;
  color: var(--text-2); font-size: 13px;
}
@media (min-width: 900px){ .chrome-user{ display: flex; } }
.chrome-user .who{ font-weight: 500; color: var(--text); }

/* Mobile burger for navlinks */
.burger{
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 0; background: transparent; cursor: pointer;
  color: var(--text-2);
  border-radius: var(--radius);
  padding: 0;
}
.burger:hover{ background: var(--sunk); color: var(--text); }
@media (min-width: 900px){ .burger{ display: none; } }
.burger svg{ width: 20px; height: 20px; }

.mobile-menu{
  display: none;
  position: fixed; top: 56px; left: 0; right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 12px var(--pad);
  z-index: 49;
  flex-direction: column; gap: 2px;
  box-shadow: 0 8px 20px rgba(15,27,45,0.08);
}
.mobile-menu.on{ display: flex; }
.mobile-menu a{
  padding: 10px 14px; border-radius: var(--radius);
  color: var(--text); font-weight: 500;
}
.mobile-menu a:hover, .mobile-menu a.current{
  background: var(--brand-050); color: var(--brand);
}
@media (min-width: 900px){ .mobile-menu{ display: none !important; } }

/* ─────────── STAGE / LAYOUT ─────────── */
.stage{ max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad); }
.stage-pad{ padding: 24px var(--pad); max-width: var(--maxw); margin: 0 auto; }
@media (min-width: 640px){ .stage-pad{ padding: 28px var(--pad); } }

/* ─────────── TYPOGRAPHY ─────────── */
.eyebrow{
  font-family: var(--ff-mono);
  font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3);
  font-weight: 500;
}
h1.h1, .h1{ font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 10px 0 8px; line-height: 1.15; }
h2.h2, .h2{ font-size: 20px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 6px; }
h3.h3, .h3{ font-size: 17px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; }
@media (min-width: 640px){
  h1.h1, .h1{ font-size: 32px; }
  h2.h2, .h2{ font-size: 24px; }
  h3.h3, .h3{ font-size: 18px; }
}
.lead{ font-size: 15px; color: var(--text-2); line-height: 1.55; margin: 0; }
@media (min-width: 640px){ .lead{ font-size: 16px; } }
.muted{ color: var(--text-3); }

/* ─────────── HR ─────────── */
.hr{ border: 0; height: 1px; background: var(--line); margin: 16px 0; }
.hr-soft{ border: 0; height: 1px; background: var(--line-soft); margin: 16px 0; }

/* ═════════════ GRID: columns / column (Bulma-style API) ═════════════ */
.columns{
  display: flex;
  flex-wrap: wrap;
  margin: -8px;
}
.columns.is-gapless{ margin: 0; }
.columns.is-gapless > .column{ padding: 0; }
.columns.is-multiline{ flex-wrap: wrap; }
.columns.is-vcentered{ align-items: center; }
.columns:not(.is-mobile){ flex-direction: column; }
@media (min-width: 640px){
  .columns:not(.is-mobile){ flex-direction: row; }
}

.column{
  padding: 8px;
  flex: 1 1 0;
  min-width: 0;
}

@media (min-width: 640px){
  .column.is-half          { flex: 0 0 50%; max-width: 50%; }
  .column.is-one-third     { flex: 0 0 33.3333%; max-width: 33.3333%; }
  .column.is-two-thirds    { flex: 0 0 66.6666%; max-width: 66.6666%; }
  .column.is-one-quarter   { flex: 0 0 25%; max-width: 25%; }
  .column.is-three-quarters{ flex: 0 0 75%; max-width: 75%; }
  .column.is-one-fifth     { flex: 0 0 20%; max-width: 20%; }
  .column.is-two-fifths    { flex: 0 0 40%; max-width: 40%; }
  .column.is-three-fifths  { flex: 0 0 60%; max-width: 60%; }
  .column.is-four-fifths   { flex: 0 0 80%; max-width: 80%; }
  .column.is-narrow        { flex: 0 0 auto; }
  .column.is-full          { flex: 0 0 100%; max-width: 100%; }
  .column.is-1  { flex: 0 0 8.333%;  max-width: 8.333%; }
  .column.is-2  { flex: 0 0 16.666%; max-width: 16.666%; }
  .column.is-3  { flex: 0 0 25%;     max-width: 25%; }
  .column.is-4  { flex: 0 0 33.333%; max-width: 33.333%; }
  .column.is-5  { flex: 0 0 41.666%; max-width: 41.666%; }
  .column.is-6  { flex: 0 0 50%;     max-width: 50%; }
  .column.is-7  { flex: 0 0 58.333%; max-width: 58.333%; }
  .column.is-8  { flex: 0 0 66.666%; max-width: 66.666%; }
  .column.is-9  { flex: 0 0 75%;     max-width: 75%; }
  .column.is-10 { flex: 0 0 83.333%; max-width: 83.333%; }
  .column.is-11 { flex: 0 0 91.666%; max-width: 91.666%; }
  .column.is-12 { flex: 0 0 100%;    max-width: 100%; }
}

/* ═════════════ TABS ═════════════ */
.tabs{
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tabs ul{
  list-style: none; padding: 0; margin: 0;
  display: flex; gap: 2px;
  min-width: max-content;
}
.tabs li{ display: flex; }
.tabs li a{
  padding: 10px 16px;
  color: var(--text-2);
  font-weight: 500; font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 80ms, border-color 80ms;
}
.tabs li a:hover{ color: var(--text); }
.tabs li.is-active a{
  color: var(--brand);
  border-bottom-color: var(--brand);
}
.tabs.is-boxed li a{
  border: 1px solid transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 0;
}
.tabs.is-boxed li.is-active a{
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

/* ═════════════ BUTTONS ═════════════ */
.btn{
  font-family: inherit;
  font-size: 14px; font-weight: 500;
  padding: 8px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 80ms, border-color 80ms, color 80ms;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  line-height: 1.2;
  min-height: 36px;
}
.btn:hover{ background: var(--sunk); color: var(--text); }
.btn:focus-visible{ outline: 0; box-shadow: var(--focus); }
.btn:disabled, .btn.is-disabled{ opacity: .55; cursor: not-allowed; }

.btn-primary{ background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover{ background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

.btn-ghost{ background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover{ background: var(--sunk); color: var(--text); }

.btn-danger{ background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-danger:hover{ background: #8F1C14; border-color: #8F1C14; color: #fff; }

.btn-success{ background: var(--ok); color: #fff; border-color: var(--ok); }
.btn-success:hover{ background: #176B42; border-color: #176B42; color: #fff; }

.btn-warn{ background: var(--warn); color: #fff; border-color: var(--warn); }
.btn-warn:hover{ background: #8E5600; border-color: #8E5600; color: #fff; }

.btn-sm{ padding: 6px 12px; font-size: 13px; min-height: 30px; }
.btn-lg{ padding: 11px 20px; font-size: 15px; min-height: 42px; }
.btn-icon{ padding: 8px; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; }
.btn-block{ width: 100%; justify-content: center; }

/* Button group (aka Bulma .buttons.has-addons) */
.btn-group{ display: inline-flex; }
.btn-group .btn{ border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child{
  border-top-left-radius: var(--radius);
  border-bottom-left-radius: var(--radius);
  margin-left: 0;
}
.btn-group .btn:last-child{
  border-top-right-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}
.btn-group .btn:hover, .btn-group .btn:focus-visible{ z-index: 1; position: relative; }

/* ═════════════ CARD ═════════════ */
.card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.card.card-pad-0{ padding: 0; }
.card-hover{
  transition: border-color 100ms, box-shadow 100ms;
  cursor: pointer;
}
.card-hover:hover{
  border-color: var(--brand);
  box-shadow: 0 2px 6px color-mix(in oklab, var(--brand) 12%, transparent);
}
.card-head{ padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.card-head h3, .card-head .h3{ margin: 0; }
.card-body{ padding: 20px; }
.card-foot{ padding: 14px 20px; border-top: 1px solid var(--line-soft); background: var(--sunk); }
@media (min-width: 640px){ .card{ padding: 22px; } }

/* ═════════════ FORMS ═════════════ */
.field{ margin-bottom: 14px; }
.field > label,
.form-label,
label.label{
  display: block;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  margin-bottom: 6px;
}
.field > label .opt,
.form-label .opt{ color: var(--text-3); font-weight: 400; margin-left: 4px; }

.input, .textarea,
input.input, textarea.textarea{
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  border-radius: var(--radius);
  transition: border-color 80ms, box-shadow 80ms;
  min-height: 38px;
}
.input:focus, .textarea:focus,
input.input:focus, textarea.textarea:focus{
  border-color: var(--brand);
  box-shadow: var(--focus);
}
.textarea, textarea.textarea{ min-height: 72px; resize: vertical; line-height: 1.5; }
.field-row{ display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px){ .field-row{ grid-template-columns: 1fr 1fr; } }

/* Select */
.select{
  position: relative; display: inline-block; width: 100%;
}
.select select,
.fselect,
select.fselect{
  width: 100%;
  font-family: inherit; font-size: 14px; font-weight: 500;
  color: var(--text);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 9px 32px 9px 12px;
  border-radius: var(--radius);
  appearance: none; -webkit-appearance: none;
  cursor: pointer;
  min-height: 38px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
                    linear-gradient(-45deg, transparent 50%, var(--text-3) 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 12px) 50%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}
.select select:hover, .fselect:hover{ border-color: var(--brand); }
.select select:focus-visible, .fselect:focus-visible{
  outline: 0; box-shadow: var(--focus); border-color: var(--brand);
}

/* has-addons — Bulma-compatible */
.field.has-addons{
  display: flex;
  margin-bottom: 14px;
}
.field.has-addons .control{ flex: 0 0 auto; display: flex; }
.field.has-addons .control.is-expanded{ flex: 1 1 auto; }
.field.has-addons .control .input,
.field.has-addons .control .btn,
.field.has-addons .control .fselect,
.field.has-addons > .input,
.field.has-addons > .btn,
.field.has-addons > .fselect{
  border-radius: 0;
  margin-left: -1px;
  width: 100%;
}
.field.has-addons > .control:first-child > .input,
.field.has-addons > .control:first-child > .btn,
.field.has-addons > .control:first-child > .fselect,
.field.has-addons > .input:first-child,
.field.has-addons > .btn:first-child,
.field.has-addons > .fselect:first-child{
  border-top-left-radius: var(--radius);
  border-bottom-left-radius: var(--radius);
  margin-left: 0;
}
.field.has-addons > .control:last-child > .input,
.field.has-addons > .control:last-child > .btn,
.field.has-addons > .control:last-child > .fselect,
.field.has-addons > .input:last-child,
.field.has-addons > .btn:last-child,
.field.has-addons > .fselect:last-child{
  border-top-right-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}
.field.has-addons .input:focus,
.field.has-addons .btn:focus-visible{ z-index: 2; position: relative; }

/* checkbox row */
.check{
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; color: var(--text-2);
  margin: 14px 0; cursor: pointer; line-height: 1.4;
}
.check input{ margin-top: 2px; accent-color: var(--brand); }

/* error text */
.field-error, .help.is-danger{
  color: var(--bad); font-size: 12.5px; margin-top: 4px;
}
.input.is-invalid, .textarea.is-invalid, .fselect.is-invalid{ border-color: var(--bad); }

/* ═════════════ ALERTS / NOTIFICATIONS ═════════════ */
.alert, .notification{
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14px;
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 14px;
}
.alert .close, .notification .close, .notification .delete{
  margin-left: auto; cursor: pointer; background: transparent; border: 0;
  color: inherit; opacity: .6; font-size: 18px; line-height: 1; padding: 0 4px;
  width: auto; height: auto;
}
.alert .close:hover, .notification .close:hover, .notification .delete:hover{ opacity: 1; }
.alert-success, .notification.is-success{ background: var(--ok-bg); border-color: color-mix(in oklab, var(--ok) 30%, transparent); color: var(--ok); }
.alert-danger,
.alert-error,
.notification.is-danger{ background: var(--bad-bg); border-color: color-mix(in oklab, var(--bad) 30%, transparent); color: var(--bad); }
.alert-warning, .notification.is-warning{ background: var(--warn-bg); border-color: color-mix(in oklab, var(--warn) 30%, transparent); color: var(--warn); }
.alert-info, .notification.is-info{ background: var(--info-bg); border-color: color-mix(in oklab, var(--info) 25%, transparent); color: var(--info); }

/* ═════════════ TAGS / BADGES ═════════════ */
.tag{
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; font-size: 12px; font-weight: 500;
  border-radius: 4px;
  background: var(--sunk); color: var(--text-2);
  border: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
}
.tag-ok, .tag.is-success{ background: var(--ok-bg); color: var(--ok); border-color: color-mix(in oklab, var(--ok) 25%, transparent); }
.tag-warn, .tag.is-warning{ background: var(--warn-bg); color: var(--warn); border-color: color-mix(in oklab, var(--warn) 25%, transparent); }
.tag-bad, .tag.is-danger{ background: var(--bad-bg); color: var(--bad); border-color: color-mix(in oklab, var(--bad) 25%, transparent); }
.tag-info, .tag.is-info{ background: var(--info-bg); color: var(--info); border-color: color-mix(in oklab, var(--info) 25%, transparent); }
.tag-brand{ background: var(--brand); color: #fff; border-color: var(--brand); }

.tags{ display: flex; flex-wrap: wrap; gap: 6px; }

/* ═════════════ TABLES ═════════════ */
.table-wrap{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}
.table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.table th, .table td{
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.table th{
  background: var(--sunk);
  color: var(--text-3);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table tbody tr:hover{ background: var(--sunk); }
.table tbody tr:last-child td{ border-bottom: 0; }

/* ═════════════ CRUMBS ═════════════ */
.crumbs{
  font-size: 12.5px; color: var(--text-3); margin-bottom: 8px;
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.crumbs a{ color: var(--text-2); }
.crumbs a:hover{ color: var(--brand); }

/* ═════════════ AVATAR ═════════════ */
.avatar{
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-100);
  color: var(--brand);
  font-weight: 600; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar-lg{ width: 40px; height: 40px; font-size: 14px; }
.avatar-solid{ background: var(--brand); color: #fff; }

/* ═════════════ SCRIM ═════════════ */
.scrim{
  position: fixed; inset: 0;
  background: rgba(15, 27, 45, 0.32);
  z-index: 99; opacity: 0; pointer-events: none;
  transition: opacity 180ms ease;
}
.scrim.on{ opacity: 1; pointer-events: auto; }

/* ═════════════ DRAWER ═════════════
   mobile: bottom-sheet (выезжает снизу, с ручкой)
   desktop ≥640px: справа, как в макете
   ═════════════════════════════════ */
.drawer{
  position: fixed;
  background: var(--surface);
  z-index: 100;
  overflow-y: auto;
  display: flex; flex-direction: column;
  transition: transform 240ms cubic-bezier(.3,.8,.3,1);
  /* mobile defaults */
  left: 0; right: 0; bottom: 0; top: auto;
  max-height: 92vh;
  border-top: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  transform: translateY(100%);
  box-shadow: 0 -8px 24px rgba(15,27,45,0.12);
}
.drawer.on{ transform: translateY(0); }

/* grab handle — only on mobile */
.drawer::before{
  content: '';
  position: sticky; top: 0;
  display: block;
  width: 44px; height: 4px;
  margin: 8px auto 2px;
  background: var(--line);
  border-radius: 2px;
  flex-shrink: 0;
}

@media (min-width: 640px){
  .drawer{
    top: 0; right: 0; bottom: 0; left: auto;
    width: 460px; max-width: 94vw;
    max-height: none;
    border-top: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    transform: translateX(100%);
    box-shadow: -8px 0 24px rgba(15,27,45,0.08);
  }
  .drawer.on{ transform: translateX(0); }
  .drawer::before{ display: none; }
}

.drawer-head{
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
@media (min-width: 640px){ .drawer-head{ padding: 16px 24px; } }
.drawer-head .title{ font-weight: 600; font-size: 15px; }
.drawer-head .close{
  border: 0; background: transparent; cursor: pointer;
  font-size: 22px; color: var(--text-3);
  width: 30px; height: 30px; line-height: 1;
  border-radius: 4px; padding: 0;
}
.drawer-head .close:hover{ background: var(--sunk); color: var(--text); }
.drawer-body{ padding: 20px; flex: 1; }
@media (min-width: 640px){ .drawer-body{ padding: 24px; } }
.drawer-foot{
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: flex; gap: 10px; align-items: center;
  position: sticky; bottom: 0;
  flex-wrap: wrap;
}
@media (min-width: 640px){ .drawer-foot{ padding: 14px 24px; } }
.drawer-foot .spacer{ flex: 1; }

/* ═════════════ MODAL ═════════════
   На мобиле как bottom-sheet, на десктопе центрировано
   ═════════════════════════════════ */
.modal{
  position: fixed; inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
}
@media (min-width: 640px){
  .modal{ align-items: center; padding: 20px; }
}
.modal.on, .modal.is-active{ display: flex; }
.modal-card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  max-width: 540px; width: 100%;
  max-height: 92vh;
  display: flex; flex-direction: column;
  box-shadow: 0 -12px 40px rgba(15,27,45,0.22);
  overflow: hidden;
  z-index: 101;
  position: relative;
}
@media (min-width: 640px){
  .modal-card{
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(15,27,45,0.22);
  }
}
.modal-background{
  position: absolute; inset: 0;
  background: rgba(15, 27, 45, 0.32);
  z-index: 100;
}
.modal-head, .modal-card-head{
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
@media (min-width: 640px){
  .modal-head, .modal-card-head{ padding: 16px 24px; }
}
.modal-head .title, .modal-card-title{ font-weight: 600; font-size: 15px; margin: 0; }
.modal-head .close, .modal-card-head .close, .modal-card-head .delete{
  border: 0; background: transparent; cursor: pointer;
  font-size: 22px; color: var(--text-3);
  width: 30px; height: 30px; line-height: 1; border-radius: 4px; padding: 0;
}
.modal-head .close:hover, .modal-card-head .close:hover,
.modal-card-head .delete:hover{ background: var(--sunk); color: var(--text); }
.modal-body, .modal-card-body{ padding: 18px 20px; overflow-y: auto; flex: 1; }
@media (min-width: 640px){
  .modal-body, .modal-card-body{ padding: 20px 24px; }
}
.modal-foot, .modal-card-foot{
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  display: flex; gap: 10px; flex-wrap: wrap;
  background: var(--surface);
}
@media (min-width: 640px){
  .modal-foot, .modal-card-foot{ padding: 14px 24px; }
}
.modal-foot .spacer, .modal-card-foot .spacer{ flex: 1; }

/* ═════════════ FOOTER ═════════════ */
footer.page-foot{
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding: 24px var(--pad);
  display: flex; justify-content: space-between; gap: 24px;
  max-width: var(--maxw); margin-left: auto; margin-right: auto;
  color: var(--text-3); font-size: 13px;
  flex-wrap: wrap;
  flex-direction: column;
}
@media (min-width: 640px){
  footer.page-foot{ flex-direction: row; gap: 40px; align-items: center; }
}
footer.page-foot .cols{ display: flex; gap: 20px; flex-wrap: wrap; }
@media (min-width: 640px){ footer.page-foot .cols{ gap: 32px; } }
footer.page-foot a{ color: var(--text-2); }
footer.page-foot a:hover{ color: var(--brand); }

/* ═════════════ UTILITY ═════════════ */
.flex{ display: flex; }
.flex-col{ display: flex; flex-direction: column; }
.items-center{ align-items: center; }
.items-start{ align-items: flex-start; }
.items-end{ align-items: flex-end; }
.justify-between{ justify-content: space-between; }
.justify-end{ justify-content: flex-end; }
.gap-2{ gap: 8px; } .gap-3{ gap: 12px; } .gap-4{ gap: 16px; }

.mt-0{ margin-top: 0; } .mt-2{ margin-top: 8px; } .mt-3{ margin-top: 12px; } .mt-4{ margin-top: 16px; } .mt-5{ margin-top: 24px; } .mt-6{ margin-top: 32px; }
.mb-0{ margin-bottom: 0; } .mb-2{ margin-bottom: 8px; } .mb-3{ margin-bottom: 12px; } .mb-4{ margin-bottom: 16px; } .mb-5{ margin-bottom: 24px; }
.ml-auto{ margin-left: auto; }

.text-right{ text-align: right; }
.text-center{ text-align: center; }
.text-left{ text-align: left; }

.wrap{ flex-wrap: wrap; }
.spacer{ flex: 1; }
.hidden{ display: none !important; }

.tnum{ font-variant-numeric: tabular-nums; }
.mono{ font-family: var(--ff-mono); }

/* visibility helpers */
.hide-sm{ display: none !important; }
@media (min-width: 640px){ .hide-sm{ display: initial !important; } }

.show-sm-only{ }
@media (min-width: 640px){ .show-sm-only{ display: none !important; } }

.hide-md{ display: initial; }
@media (min-width: 900px){ .hide-md{ display: none !important; } }

.show-md{ display: none !important; }
@media (min-width: 900px){ .show-md{ display: initial !important; } }

/* prevent body scroll when overlay is open */
body.no-scroll{ overflow: hidden; }
