:root {
  color-scheme: light;
  --ink: #142944;
  --muted: #536781;
  --brand: #3454a1;
  --brand-dark: #243f82;
  --surface: #fff;
  --line: #dce6f2;
  --canvas: #f4f7fc;
  --quiet: #f1f5fc;
  --radius: 18px;
  --columns: minmax(155px, 1.1fr) minmax(155px, 1.24fr) minmax(118px, .7fr) minmax(78px, .5fr) 105px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(160deg, #eff5fe, var(--canvas) 330px);
  font-size: 15px;
  line-height: 1.46;
}

h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid #4b7dd4;
  outline-offset: 2px;
}

.shell { width: min(calc(100% - 48px), 1120px); margin-inline: auto; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar__inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; }
.brand__mark, .email-mark { display: inline-grid; place-items: center; flex: 0 0 auto; color: white; background: var(--brand); font-weight: 750; }
.brand__mark { width: 36px; height: 36px; border-radius: 10px; font-size: 14px; letter-spacing: -.045em; }
.email-mark { width: 21px; height: 21px; border-radius: 7px; background: linear-gradient(145deg, #4269b7, #294985); font-size: 14px; }

.workspace { padding-block: 30px 48px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
h1 { font-size: clamp(29px, 5vw, 41px); line-height: 1.12; letter-spacing: -.045em; }
.page-head p { margin-top: 5px; }
.demo-note { margin-bottom: 16px; font-size: 13px; color: #4f627b; }
.demo-note strong { color: #3b5070; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--brand-dark);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.button--primary { background: var(--brand); color: white; box-shadow: 0 4px 12px rgb(52 84 161 / 20%); }
.button--primary:hover { background: var(--brand-dark); }
.button--quiet { background: var(--quiet); border-color: #dce6f6; }
.button--outline { background: white; border-color: #d3dff1; }
.button--quiet:hover, .button--outline:hover, .button--text:hover { background: #e7effb; border-color: #c7d6ed; }
.plus { font-size: 19px; line-height: 1; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 19px; }
.metric {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 62px;
  padding: 10px 14px;
  text-align: start;
  color: var(--ink);
  background: #fafdff;
  border: 1px solid #d5e2f4;
  border-radius: 14px;
}
.metric:hover { background: #eff5ff; }
.metric[aria-pressed="true"] { background: #e8effe; border-color: #7695cf; box-shadow: inset 0 0 0 1px #7695cf; }
.metric strong { color: var(--brand-dark); font-size: 25px; font-variant-numeric: tabular-nums; line-height: 1; }
.metric__label { font-size: 14px; font-weight: 700; }
.metric__badge { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #e8efff; color: #244c9a; font-weight: 800; }
[data-quick-status="booked"] .metric__badge { background: #ddf5ed; color: #135d4e; }
[data-quick-status="closed"] .metric__badge { background: #edf1f6; color: #475973; }

.panel {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 37px rgb(36 63 115 / 7%);
}
.panel__head { padding: 16px 19px 15px; }
.panel__title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
h2 { font-size: 20px; line-height: 1.25; letter-spacing: -.018em; }
.count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.filters { display: grid; grid-template-columns: minmax(180px, 1fr) auto minmax(164px, 205px) auto; gap: 8px; align-items: center; }
.branch-filter, .date-filter { display: flex; align-items: center; gap: 7px; min-width: 0; }
.branch-filter__label, .date-filter > span { color: var(--muted); font-size: 13px; font-weight: 650; }
.branch-filter .button { min-width: 44px; min-height: 44px; padding-inline: 8px; }
.branch-filter .button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: white; }
.date-filter input { min-height: 44px; font-size: 14px; cursor: pointer; }
.search { position: relative; }
.search__icon { position: absolute; top: 13px; left: 13px; width: 13px; height: 13px; border: 1.8px solid #5c7190; border-radius: 50%; pointer-events: none; }
.search__icon::after { position: absolute; content: ""; width: 6px; height: 2px; bottom: -3px; right: -4px; border-radius: 1px; background: #5c7190; transform: rotate(45deg); }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  min-width: 0;
  padding: 8px 10px;
  color: var(--ink);
  background: white;
  border: 1px solid #ccd9ea;
  border-radius: 9px;
}
.filters input, .filters select { background: #fbfdff; }
.search input { padding-inline-start: 34px; }
input::placeholder, textarea::placeholder { color: #61748b; opacity: 1; }

.column-head, .request { display: grid; grid-template-columns: var(--columns); align-items: center; column-gap: 13px; }
.column-head { padding: 8px 19px; color: #445975; background: #f0f5fc; border-top: 1px solid var(--line); font-weight: 700; font-size: 12px; }
.request { padding: 12px 19px; border-top: 1px solid #e4ecf6; }
.request:hover { background: #f8fbff; }
.request__person, .request__details { display: grid; min-width: 0; gap: 2px; overflow-wrap: anywhere; }
.request__number { font-size: 12px; color: var(--brand-dark); font-weight: 750; font-variant-numeric: tabular-nums; }
.request h3 { font-size: 15px; line-height: 1.3; }
.request__details strong { font-weight: 700; }
.request__person .muted, .request__details .muted, .request__time { font-size: 13px; }
.request__time { font-variant-numeric: tabular-nums; }
.request__call {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 44px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
  text-underline-offset: 3px;
}
.request__call:focus-visible { outline: 3px solid #4b7dd4; outline-offset: 2px; border-radius: 5px; }
.edit-call { margin-bottom: 8px; }
.request__open { justify-self: end; }
.request__open span { font-size: 14px; }
.status { justify-self: start; width: fit-content; border-radius: 100px; padding: 4px 9px; font-weight: 750; font-size: 12px; line-height: 1.3; white-space: nowrap; }
.status[data-status="new"] { color: #244c9a; background: #e8efff; }
.status[data-status="booked"] { color: #135d4e; background: #ddf5ed; }
.status[data-status="closed"] { color: #475973; background: #edf1f6; }
.empty { padding: 30px 16px; text-align: center; border-top: 1px solid var(--line); }
.empty p { margin-top: 4px; }

.dialog {
  width: min(630px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 19px;
  box-shadow: 0 22px 64px rgb(19 36 68 / 23%);
  overflow: hidden;
}
.dialog[open] { display: flex; flex-direction: column; }
.dialog::backdrop { background: rgb(22 39 68 / 49%); }
.dialog form { display: flex; flex-direction: column; min-height: 0; }
.dialog__head, .dialog__foot { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fbfdff; }
.dialog__head { padding: 15px 17px; border-bottom: 1px solid var(--line); }
.dialog__head p { margin-top: 4px; font-size: 13px; }
.dialog__body { padding: 16px 17px; overflow-y: auto; overscroll-behavior: contain; }
.dialog__foot { padding: 10px 17px; border-top: 1px solid var(--line); }
.dialog__foot .button--primary { min-width: 125px; margin-left: auto; }
.icon-close { flex: 0 0 auto; width: 42px; height: 42px; background: var(--quiet); color: var(--ink); border: 1px solid #d6e3f4; border-radius: 11px; font-size: 24px; line-height: 1; }
.icon-close:hover { background: #e7effc; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid label { display: grid; align-content: start; gap: 5px; font-size: 13px; font-weight: 700; }
.form-grid input, .form-grid select, .form-grid textarea { font-size: 15px; font-weight: 400; }
.form-status { min-width: 0; margin: 0; padding: 0; border: 0; }
.form-status legend { margin-bottom: 5px; padding: 0; font-size: 13px; font-weight: 700; }
.form-status__choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.form-status__choices label { position: relative; cursor: pointer; }
.form-status__choices input { position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0; opacity: 0; }
.form-status__choices span { display: grid; place-items: center; min-height: 44px; padding: 7px 4px; border: 1px solid #ccd9ea; border-radius: 9px; background: #fbfdff; text-align: center; }
.form-status__choices input:checked + span { border-color: var(--brand); background: #e8effe; color: var(--brand-dark); }
.form-status__choices input:focus-visible + span { outline: 3px solid #4b7dd4; outline-offset: 2px; }
.form-wide { grid-column: 1 / -1; }
textarea { resize: vertical; }
.history { margin-top: 13px; padding: 9px 11px; background: var(--quiet); border-radius: 9px; font-size: 13px; }
.history summary { min-height: 24px; cursor: pointer; font-weight: 700; }
.history ol { margin: 8px 0 0; padding-left: 19px; color: var(--muted); }
.history li + li { margin-top: 5px; }

.dialog--email { width: min(475px, calc(100% - 32px)); }
.email-demo { background: #edf3fc; }
.email-message { display: flex; align-items: start; gap: 9px; }
.email-mark--large { width: 34px; height: 34px; border-radius: 11px; font-size: 19px; }
.email-message__body { flex: 1; min-width: 0; padding: 11px 13px; background: white; border: 1px solid #dae5f5; border-radius: 3px 13px 13px; }
.email-message__body dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.email-message__body dt { color: var(--brand-dark); font-weight: 750; }
.email-message__body dd { margin: 0; }
.email-message__body p { margin-block: 9px 10px; overflow-wrap: anywhere; white-space: pre-line; }
.email-message__button { width: 100%; }
.email-note { margin-top: 12px; font-size: 13px; }

.toast { position: fixed; z-index: 2; right: 18px; bottom: 18px; max-width: min(420px, calc(100vw - 36px)); padding: 9px 13px; color: white; background: #233a65; border-radius: 11px; box-shadow: 0 8px 23px rgb(19 36 68 / 18%); font-size: 14px; }

a.button { text-decoration: none; }
a:focus-visible { outline: 3px solid #4b7dd4; outline-offset: 2px; }
.button:disabled { cursor: default; opacity: .64; }
.test-workspace { max-width: 650px; }
.test-form { padding: 17px; }
.topbar__actions { display: flex; align-items: center; gap: 7px; }
.login-workspace { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-panel { width: min(100%, 410px); padding: clamp(22px, 5vw, 38px); }
.login-panel h1 { margin: 18px 0; }
.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; gap: 5px; font-weight: 700; }
.login-form label > input:not([type="checkbox"]) { width: 100%; min-height: 46px; font-size: 16px; font-weight: 400; }
.login-form .login-remember { display: flex; align-items: center; gap: 9px; min-height: 44px; font-size: 14px; font-weight: 500; cursor: pointer; }
.login-remember input { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; accent-color: var(--brand); }
.login-error { padding: 9px 11px; background: #fff2f2; color: #8d2532; border-radius: 8px; }
.test-form__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.form-response { margin-top: 12px; padding: 10px 12px; border-radius: 9px; background: #edf4fd; }
.form-response[data-state="error"] { color: #8a3541; background: #fce9ec; }
.form-response .button { margin-top: 7px; }
.demo-banner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 15px; }
.demo-banner .demo-note { margin-bottom: 0; }
.demo-banner a { color: var(--brand-dark); font-size: 13px; font-weight: 750; text-underline-offset: 3px; }
.form-warning { margin-bottom: 13px; }
#edit-delivery { margin-top: 2px; font-weight: 700; }

@media (max-width: 780px) {
  .shell { width: calc(100% - 28px); }
  .topbar__inner { min-height: 56px; }
  .workspace { padding-block: 19px 32px; }
  .page-head { gap: 8px; margin-bottom: 11px; }
  .page-head p { font-size: 13px; }
  .demo-note { margin-bottom: 12px; }
  .metrics { gap: 7px; margin-bottom: 12px; }
  .metric { min-height: 53px; gap: 5px; padding: 8px; }
  .metric__label { font-size: 12px; }
  .metric strong { font-size: 20px; }
  .metric__badge { width: 22px; height: 22px; font-size: 12px; }
  .panel__head { padding: 11px; }
  .panel__title { margin-bottom: 8px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .search { grid-column: 1 / -1; }
  .date-filter input { font-size: 16px; }
  #clear-filters { grid-column: 1 / -1; justify-self: end; }
  .column-head { display: none; }
  .requests { display: grid; gap: 7px; padding: 0 9px 9px; }
  .request {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "person status" "details details" "time open";
    gap: 5px 10px;
    padding: 8px 10px;
    background: #fbfdff;
    border: 1px solid #dce7f5;
    border-radius: 12px;
  }
  .request__person { grid-area: person; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; column-gap: 6px; }
  .request__call { grid-column: 1 / -1; }
  .request__details { grid-area: details; gap: 1px; font-size: 14px; }
  .request__time { grid-area: time; }
  .request .status { grid-area: status; align-self: start; justify-self: end; }
  .request__open { grid-area: open; padding-inline: 11px; }
  .search input, .form-grid input, .form-grid select, .form-grid textarea { font-size: 16px; }
  .search__icon { top: 14px; }
  .button, input, select, .icon-close { min-height: 44px; }
}

@media (max-width: 480px) {
  .brand { gap: 6px; font-size: 14px; }
  .brand__mark { width: 31px; height: 31px; border-radius: 8px; font-size: 12px; }
  .email-trigger { gap: 6px; padding-inline: 9px; font-size: 13px; }
  #registry-logout .button { padding-inline: 8px; font-size: 13px; }
  .page-head { flex-wrap: wrap; align-items: flex-end; }
  .page-head .button { font-size: 13px; padding-inline: 9px; }
  .metric { grid-template-columns: minmax(0, 1fr) auto; }
  .metric__label { grid-row: 2; grid-column: 1 / -1; }
  .branch-filter__label, .date-filter > span { display: none; }
  .dialog:not(.dialog--email) { inset: auto 0 0; width: 100%; max-height: calc(100dvh - 12px); border-radius: 16px 16px 0 0; }
  .dialog:not(.dialog--email) .dialog__foot { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .dialog__head, .dialog__body, .dialog__foot { padding-inline: 13px; }
  .form-grid { gap: 10px; }
  .form-grid label:nth-child(3) { grid-column: 1 / -1; }
  .form-grid label:nth-child(6) { grid-column: 1 / -1; }
  .toast { bottom: max(12px, env(safe-area-inset-bottom)); right: 12px; }
}

@media (max-width: 359px) {
  .topbar__actions:has(#registry-logout:not([hidden])) .email-trigger__label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}
