@font-face {
  font-family: Montserrat;
  src: url('/assets/montserrat.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --navy: #1f2448;
  --navy-deep: #191e3c;
  --ink: #222747;
  --muted: #5e657c;
  --paper: #f3f5fa;
  --surface: #fff;
  --line: #dde3ef;
  --subtle: #f5f7fc;
  --cyan: #64c3d4;
  --cyan-hover: #79cddd;
  --cyan-soft: #e1f6f8;
  --green: #106345;
  --green-soft: #e7f7ed;
  --red: #a82042;
  --red-soft: #fbeaf0;
  --amber: #80530d;
  --amber-soft: #fff2da;
  --shadow: 0 12px 26px rgb(31 36 72 / .045);
  font-family: Montserrat, system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
[hidden] { display: none !important; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 19px; height: 19px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
h1, h2, p { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
a { color: inherit; }
:focus-visible { outline: 3px solid #1f83a1; outline-offset: 3px; }

.signin { min-height: 100svh; display: grid; place-items: center; padding: 28px; background: linear-gradient(133deg,#202649 0%, #212b54 63%, #273d68 100%); }
.signin-box { width: min(100%, 460px); background: var(--surface); padding: 42px; border: 1px solid #dce3ef; border-radius: 26px; box-shadow: 0 28px 86px rgb(9 13 35 / .28); }
.signin-box > img { display: block; height: auto; }
.signin-icon { display: grid; place-items: center; width: 49px; height: 49px; background: var(--cyan-soft); color: #246879; border-radius: 16px; margin: 31px 0 16px; }
.signin-box h1 { font-size: clamp(1.65rem, 6vw, 2.1rem); letter-spacing: -.065em; font-weight: 800; }
.signin-box > p { font-size: .88rem; color: var(--muted); line-height: 1.65; margin-top: 10px; }
.signin-box form { display: grid; gap: 10px; margin-top: 26px; }
.signin-box input { width: 100%; min-height: 48px; }
.signin-box .primary { margin-top: 5px; }

.portal { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100svh; }
.sidebar { height: 100svh; position: sticky; top: 0; display: flex; flex-direction: column; background: var(--navy); color: #fff; padding: 27px 16px 21px; }
.brand { padding: 4px 9px 27px; display: flex; align-items: center; gap: 10px; }
.brand img { display: block; width: 111px; height: auto; }
.brand span { font-size: .8rem; font-weight: 650; border-left: 1px solid #6c748d; padding-left: 10px; color: #dbdff1; }
.navigation { display: grid; gap: 4px; }
.navigation a { text-decoration: none; display: flex; align-items: center; gap: 11px; font-weight: 650; font-size: .82rem; color: #c7cee5; border-radius: 12px; padding: 12px 13px; min-height: 44px; }
.navigation a[aria-current] { background: #343e65; color: #e8fbff; }
.navigation a[aria-current] svg { color: var(--cyan); }
.navigation a:hover { background: #2b345d; }
.navigation a:focus-visible { outline-color: var(--cyan); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 15px 9px 0; border-top: 1px solid #394365; color: #c4cde9; font-size: .7rem; font-weight: 650; }
.sidebar-foot > span { width: 7px; height: 7px; border-radius: 100%; background: var(--cyan); }

.workspace { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 36px; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 65px; gap: 15px; }
.topbar-title { color: var(--muted); font-size: .77rem; font-weight: 600; }
.topbar-title strong { color: var(--ink); font-weight: 720; }
.topbar-title span { display: inline-block; padding: 0 7px; color: #7e88a1; }
.topbar-actions { display: flex; align-items: center; gap: 11px; }
.line-identity { display: flex; align-items: center; gap: 8px; background: var(--subtle); border: 1px solid var(--line); border-radius: 10px; min-height: 42px; padding: 5px 9px; }
.line-identity .icon { width: 14px; height: 14px; color: #376b7d; }
.line-identity span, .line-identity strong { display: block; }
.line-identity span { color: var(--muted); font-size: .6rem; font-weight: 650; }
.line-identity strong { color: var(--navy); font-size: .72rem; margin-top: 2px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.icon-button { display: inline-grid; place-items: center; min-width: 42px; min-height: 42px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); }
.icon-button:not(:disabled):hover { background: var(--subtle); color: var(--navy); }
.logout { background: var(--surface); border: 1px solid var(--line); min-height: 40px; min-width: 40px; }
.logout .icon { width: 17px; height: 17px; }

.main-content { margin: 0 auto; max-width: 1360px; padding: 34px 36px 45px; }
.main-heading { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 23px; }
.main-heading h1 { color: var(--navy); font-weight: 825; font-size: clamp(1.78rem, 4vw, 2.44rem); line-height: 1.13; letter-spacing: -.065em; }
.main-heading p { color: var(--muted); font-size: .84rem; margin-top: 7px; line-height: 1.5; }
.line-status { align-self: center; background: var(--subtle); color: var(--muted); border: 1px solid var(--line); border-radius: 100px; padding: 8px 11px; display: flex; align-items: center; gap: 7px; white-space: nowrap; font-size: .7rem; font-weight: 720; }
.line-status i { width: 7px; height: 7px; border-radius: 100%; background: currentColor; }
.line-status[data-state="ready"] { background: var(--green-soft); border-color: #c9e8d7; color: var(--green); }
.line-status[data-state="connecting"] { background: var(--amber-soft); border-color: #f7e1b9; color: var(--amber); }
.line-status[data-state="error"] { background: var(--red-soft); border-color: #f3ceda; color: var(--red); }

.work-grid { display: grid; grid-template-columns: minmax(310px, .92fr) minmax(285px, 1fr); align-items: start; gap: 22px; }
.right-column { display: grid; gap: 22px; min-width: 0; }
.card { scroll-margin-top: 18px; min-width: 0; background: var(--surface); border-radius: 19px; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 22px; }
.card-heading { display: flex; align-items: center; gap: 12px; }
.card-heading h2 { font-size: 1.11rem; letter-spacing: -.03em; font-weight: 780; }
.card-heading p { color: var(--muted); font-size: .73rem; margin-top: 4px; line-height: 1.5; }
.section-icon { background: var(--cyan-soft); display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #246879; flex: 0 0 auto; }
.section-icon .icon { width: 19px; height: 19px; }

.dial-area { max-width: 378px; margin: 18px auto 0; }
.number-field { display: flex; align-items: center; background: var(--subtle); border: 1px solid var(--line); border-radius: 13px; position: relative; }
.number-field input { width: 100%; min-width: 0; height: 63px; background: transparent; border: 0; border-radius: 12px; text-align: center; color: var(--navy); padding: 8px 43px; font-weight: 760; font-size: 1.75rem; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.number-field input::placeholder { color: #657088; font-size: .86rem; font-weight: 650; letter-spacing: 0; }
.number-field .backspace { position: absolute; right: 3px; }
.number-field .backspace:not(:disabled):hover { background: #e8edf7; }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 13px; }
.keypad button { display: grid; place-content: center; gap: 1px; width: 100%; min-height: 53px; padding: 5px; border: 1px solid var(--line); background: var(--subtle); border-radius: 11px; color: var(--navy); font-size: 1.26rem; line-height: 1; font-weight: 720; font-variant-numeric: tabular-nums; }
.keypad button:not(:disabled):hover { background: #e8f5f9; border-color: #b7dce4; }
.keypad button:not(:disabled):active { transform: translateY(1px); }
.keypad button small { color: var(--muted); font-size: .57rem; font-weight: 720; letter-spacing: .095em; }
.keypad button.special { padding: 10px 5px; }
.primary, .secondary, .danger { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; border-radius: 11px; min-height: 43px; font-weight: 760; font-size: .79rem; text-align: center; }
.primary { background: var(--cyan); color: var(--navy); border: 1px solid #59b7c8; }
.primary:not(:disabled):hover { background: var(--cyan-hover); }
.secondary { background: var(--surface); color: var(--navy); border: 1px solid var(--line); }
.secondary:not(:disabled):hover, .secondary[aria-pressed="true"] { background: #ebf7f9; border-color: #b7dce4; }
.secondary .icon, .primary .icon, .danger .icon { width: 15px; height: 15px; }
.danger { color: var(--red); background: var(--red-soft); border: 1px solid #f3cad6; }
.danger:not(:disabled):hover { background: #f8d8e2; }
.text-button { min-height: 40px; background: none; border: 0; color: #255e73; font-weight: 720; font-size: .73rem; text-underline-offset: 3px; }
.text-button:not(:disabled):hover { text-decoration: underline; }
.call-details { min-height: 92px; display: grid; align-content: center; justify-items: center; gap: 5px; text-align: center; border-radius: 13px; border: 1px solid #cbe5ed; color: var(--navy); background: linear-gradient(115deg,#edf8fb,#f2f6fd); padding: 12px 7px; }
.call-details p { color: #2f6174; font-size: .74rem; font-weight: 700; }
.call-details strong { font-size: 1.39rem; font-weight: 790; overflow-wrap: anywhere; }
.call-details time { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; font-size: .74rem; }
.dial-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 8px; margin-top: 14px; }
.dial-actions .text-button { grid-column: 1 / -1; }
.dial-actions:not(.with-echo) .primary, .receive-hint { grid-column: 1 / -1; }
.receive-hint { color: var(--muted); text-align: center; font-size: .67rem; line-height: 1.55; margin-top: 8px; }
.incoming-actions, .live-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.incoming-actions, .live-actions { margin-top: 14px; }
.live-actions { display: grid; gap: 8px; }
#enable-audio, #reconnect { display: block; margin: 4px auto 0; }
.notice { font-size: .73rem; color: var(--muted); line-height: 1.5; }
.notice.error { color: var(--red); }
.notice.success { color: var(--green); }
#phone-message { text-align: center; padding: 5px 0 0; }

.delivery-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 18px; }
.delivery-managed { margin: 17px 0 0; color: var(--muted); background: var(--subtle); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: .73rem; line-height: 1.55; }
.form-field { min-width: 0; display: grid; gap: 6px; }
.mode-field { grid-column: 1 / -1; }
label { color: #3c4564; font-size: .73rem; line-height: 1.3; font-weight: 720; }
.form-field input, .form-field select, .signin-box input { border: 1px solid var(--line); border-radius: 9px; min-height: 40px; padding: 0 9px; color: var(--navy); background: var(--subtle); font-size: .75rem; font-weight: 650; min-width: 0; }
.form-field select:disabled, .form-field input:disabled { opacity: .6; }
.integer-field { display: flex; align-items: center; position: relative; }
.integer-field input { width: 100%; padding-right: 62px; appearance: textfield; }
.integer-field input::-webkit-inner-spin-button, .integer-field input::-webkit-outer-spin-button { appearance: none; }
.integer-field > span { font-size: .64rem; right: 7px; color: var(--muted); position: absolute; pointer-events: none; }
.save-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 11px; }
.save-row .strong { min-height: 38px; background: var(--navy); color: var(--surface); border-color: var(--navy); }
.save-row .strong:not(:disabled):hover { background: #333e69; border-color: #333e69; }

.history-empty { display: flex; justify-content: center; align-items: center; gap: 8px; border: 1px dashed var(--line); background: var(--subtle); border-radius: 12px; padding: 22px 10px; margin-top: 16px; font-size: .74rem; line-height: 1.5; color: var(--muted); }
.history-empty .icon { width: 15px; height: 15px; }
.history-list { margin: 13px 0 0; padding: 0; list-style: none; max-height: 370px; overflow: auto; }
.history-list li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.history-list li:last-child { border-bottom: 0; }
.history-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: #2f6174; background: var(--cyan-soft); }
.history-icon .icon { width: 15px; height: 15px; }
.history-icon[data-result="missed"] { color: var(--red); background: var(--red-soft); }
.history-meta { min-width: 0; }
.history-meta strong { display: block; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-weight: 760; font-size: .78rem; }
.history-meta p { color: var(--muted); font-size: .65rem; margin-top: 4px; line-height: 1.32; }
.history-when { text-align: right; display: grid; gap: 3px; color: var(--muted); font-size: .62rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

@media (min-width: 1330px) {
  .topbar { padding-inline: 45px; }
  .main-content { padding-inline: 45px; }
  .work-grid, .right-column { gap: 26px; }
  .card { padding: 24px; }
}

@media (max-width: 1070px) {
  .portal { grid-template-columns: 172px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .brand { padding-inline: 3px; }
  .topbar, .main-content { padding-inline: 25px; }
  .work-grid, .right-column { gap: 15px; }
  .card { padding: 19px; }
}

@media (max-width: 870px) {
  .portal { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; padding: 10px 22px; flex-direction: row; align-items: center; gap: 14px; justify-content: space-between; flex-wrap: wrap; }
  .brand { padding: 0; }
  .navigation { display: flex; }
  .navigation a { padding-inline: 10px; font-size: .75rem; }
  .navigation .icon { width: 15px; height: 15px; }
  .sidebar-foot { padding: 0; margin: 0; border: 0; }
  .topbar { min-height: 56px; }
}

@media (max-width: 620px) {
  .sidebar { padding: 12px 14px 8px; gap: 8px 14px; }
  .brand img { width: 101px; }
  .sidebar-foot { font-size: .62rem; }
  .navigation { order: 3; width: 100%; justify-content: space-between; }
  .navigation a { min-height: 36px; font-size: .67rem; padding: 8px; gap: 5px; }
  .navigation .icon { width: 13px; height: 13px; }
  .topbar { padding: 9px 14px; }
  .topbar-title { display: none; }
  .topbar-actions { gap: 6px; flex: 1; justify-content: space-between; }
  .topbar-actions .logout { min-width: 36px; }
  .line-identity { gap: 5px; padding-inline: 7px; }
  .line-identity strong { font-size: .65rem; }
  .main-content { padding: 23px 14px 28px; }
  .main-heading { align-items: start; margin-bottom: 17px; gap: 8px; }
  .main-heading h1 { font-size: clamp(1.38rem, 6vw, 1.86rem); }
  .main-heading p { font-size: .71rem; }
  .line-status { align-self: start; margin-top: 1px; font-size: .6rem; padding: 6px 7px; gap: 5px; }
  .work-grid { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
  .number-field input { font-size: clamp(.94rem, 4vw, 1.4rem); padding-inline: 13px 40px; }
  #call-echo { white-space: nowrap; font-size: .7rem; gap: 5px; padding-inline: 6px; }
  .signin-box { padding: 27px; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  button, .navigation a { transition: background-color 120ms, color 120ms, border-color 120ms; }
}
