/*
 * DUMA compact workspace
 *
 * A final visual layer for the operational UI. The existing HTML ids and
 * JavaScript behavior stay intact; this file owns the shell, density, rhythm,
 * and responsive composition.
 */

:root {
  --workspace-sidebar: 224px;
  --workspace-topbar: 64px;
  --workspace-gutter: 22px;
  --control-height: 38px;
  --touch-target: 44px;
  --radius-control: 8px;
  --radius-panel: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --bg: #edf2f4;
  --panel: #fbfcfc;
  --panel-soft: #f3f6f7;
  --line: #d8e1e5;
  --line-strong: #bac9d0;
  --text: #142229;
  --muted: #5f7078;
  --brand: #197993;
  --brand-dark: #0e6077;
  --brand-soft: #e3f2f6;
  --brand-ink: #f7fcfd;
  --brand-readable: #0d5c72;
  --green: #21845b;
  --amber: #ad7415;
  --red: #c64a4a;
  --success: var(--green);
  --warning: var(--amber);
  --danger: var(--red);
  --success-readable: #176544;
  --warning-readable: #76500d;
  --danger-readable: #a23535;
  --field: #ffffff;
  --field-border: var(--line-strong);
  --header: color-mix(in srgb, var(--panel) 97%, var(--bg));
  --font-ui:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  --font-accent: var(--font-ui);
  --font-data: var(--font-ui);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
  --focus-ring-strong:
    0 0 0 3px color-mix(in srgb, var(--brand) 28%, transparent);
  --shadow-menu: 0 4px 8px color-mix(in srgb, #25343a 16%, transparent);
  color-scheme: light;
}

:root[data-theme="dark"],
body[data-theme="dark"] {
  --bg: #0b1216;
  --panel: #121c22;
  --panel-soft: #18252c;
  --line: #283840;
  --line-strong: #3c515b;
  --text: #edf3f5;
  --muted: #96a9b2;
  --brand: #63bfd7;
  --brand-dark: #8bd4e6;
  --brand-soft: #17333d;
  --brand-ink: #071317;
  --brand-readable: #8bd4e6;
  --green: #55c48f;
  --amber: #dfaa4e;
  --red: #ed7777;
  --success: var(--green);
  --warning: var(--amber);
  --danger: var(--red);
  --success-readable: #8adbb4;
  --warning-readable: #edc77f;
  --danger-readable: #f2a0a0;
  --field: #101a20;
  --field-border: #3b4d56;
  --header: #10191f;
  --shadow-menu: 0 4px 8px rgb(0 0 0 / 32%);
  color-scheme: dark;
}

html {
  min-width: 0;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

.login-body {
  min-width: 0;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

:where(h1, h2, h3, p, dd, dt, strong, small, span, a) {
  overflow-wrap: anywhere;
}

:where(a[href^="tel:"], .audio-time, .monitor-call-phone strong) {
  overflow-wrap: normal;
  white-space: nowrap;
}

body[data-ui-state="empty"],
body[data-ui-state="loading"] {
  display: block;
}

::selection {
  background: color-mix(in srgb, var(--brand) 30%, transparent);
  color: var(--text);
}

:where(button, input, textarea, select) {
  font-family: inherit;
}

:where(button, a, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

:where(
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  .custom-select-button
) {
  min-height: var(--control-height);
  border-radius: var(--radius-control);
}

:where(
  button,
  input,
  textarea,
  select,
  .custom-select-button
):disabled,
:where(button, [role="button"])[aria-disabled="true"] {
  cursor: not-allowed;
  filter: none;
  opacity: 0.55;
  transform: none;
}

:where(button, [role="button"])[aria-busy="true"] {
  cursor: progress;
  pointer-events: none;
}

:where(input, textarea, select, .custom-select-button):disabled {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--muted);
}

/* App shell */

.app-header {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--z-header);
  display: block;
  width: var(--workspace-sidebar);
  min-height: 100dvh;
  padding: 0;
  overflow: visible;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--header);
  box-shadow: none;
}

.brand-lockup {
  display: flex;
  min-width: 0;
  height: 100%;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.brand {
  display: flex;
  width: 100%;
  min-height: 78px;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.brand img {
  width: 142px;
  max-width: 100%;
  max-height: 42px;
}

.app-tabs {
  display: flex;
  width: auto;
  min-width: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin: 14px 10px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.app-tabs a {
  position: relative;
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.005em;
  text-decoration: none;
  transition:
    background-color 150ms var(--ease-standard),
    border-color 150ms var(--ease-standard),
    color 150ms var(--ease-standard);
}

.app-nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.76;
}

.app-tabs a:hover .app-nav-icon,
.app-tabs a.active .app-nav-icon,
.app-tabs a[aria-current="page"] .app-nav-icon {
  opacity: 1;
}

.app-tabs a:hover {
  border-color: color-mix(in srgb, var(--brand) 18%, var(--line));
  background: color-mix(in srgb, var(--brand) 7%, var(--panel-soft));
  color: var(--text);
}

.app-tabs a.active,
.app-tabs a[aria-current="page"],
body[data-theme="dark"] .app-tabs a.active,
body[data-theme="dark"] .app-tabs a[aria-current="page"] {
  border-color: color-mix(in srgb, var(--brand) 32%, var(--line));
  background: var(--brand-soft);
  color: var(--brand-readable);
  font-weight: 750;
}

.app-tabs a.active::after,
.app-tabs a[aria-current="page"]::after {
  position: absolute;
  inset: 9px -11px 9px auto;
  width: 2px;
  border-radius: 2px;
  background: var(--brand);
  content: "";
}

.header-actions {
  position: fixed;
  inset: 0 0 auto var(--workspace-sidebar);
  z-index: var(--z-header);
  display: flex;
  min-width: 0;
  min-height: var(--workspace-topbar);
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding:
    max(10px, var(--safe-top))
    max(var(--workspace-gutter), var(--safe-right))
    10px
    var(--workspace-gutter);
  border-bottom: 1px solid var(--line);
  background: var(--header);
}

.phone-search {
  width: min(490px, 52vw);
  max-width: 490px;
  min-height: var(--control-height);
  margin: 0;
  border-color: var(--field-border);
  border-radius: var(--radius-control);
  background: var(--field);
  box-shadow: none;
}

.phone-search:focus-within {
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.phone-search input {
  height: calc(var(--control-height) - 2px);
  font-size: 13px;
  font-weight: 550;
}

.search-icon {
  width: 38px;
}

.search-icon svg {
  width: 17px;
}

.phone-search button,
.primary-button,
.secondary-button,
.secondary-action {
  min-height: var(--control-height);
  border-radius: var(--radius-control);
  padding-inline: 13px;
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

.phone-search button,
.primary-button {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
}

.secondary-button,
.secondary-action {
  border-color: var(--line-strong);
  background: var(--panel-soft);
  color: var(--text);
}

.phone-search button:hover,
.primary-button:hover {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
  color: var(--brand-ink);
  filter: none;
}

.secondary-button:hover,
.secondary-action:hover {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line-strong));
  background: color-mix(in srgb, var(--brand) 8%, var(--panel-soft));
  color: var(--brand-readable);
}

:where(.primary-button, .secondary-button, .secondary-action, .phone-search button):active {
  transform: translateY(1px);
}

.theme-toggle,
.profile-menu-trigger {
  width: var(--control-height);
  height: var(--control-height);
  min-height: var(--control-height);
  flex: 0 0 var(--control-height);
  border-color: var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--panel-soft);
  box-shadow: none;
}

.theme-toggle {
  width: 68px;
  flex-basis: 68px;
  border-radius: 999px;
}

.profile-menu {
  position: fixed;
  inset: auto auto max(12px, var(--safe-bottom)) 10px;
  width: calc(var(--workspace-sidebar) - 20px);
}

.profile-menu-trigger {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-basis: auto;
  justify-content: flex-start;
  gap: 9px;
  padding-inline: 12px;
}

.profile-menu-trigger::after {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  content: "Профіль";
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu-popover {
  inset: auto auto calc(100% + 8px) 0;
  width: 100%;
  border-color: var(--line-strong);
  border-radius: var(--radius-panel);
  background: var(--panel);
  box-shadow: var(--shadow-menu);
  transform-origin: bottom left;
}

.page-shell {
  width: auto;
  max-width: none;
  min-height: 100dvh;
  margin: 0 0 0 var(--workspace-sidebar);
  padding:
    calc(var(--workspace-topbar) + 18px)
    max(var(--workspace-gutter), var(--safe-right))
    max(44px, calc(28px + var(--safe-bottom)))
    max(var(--workspace-gutter), var(--safe-left));
}

.page-shell:has(.ai-settings-page:not(.hidden)) {
  width: auto;
  max-width: none;
}

body[data-ui-state="empty"] > #main-content {
  display: grid;
  min-height: 100dvh;
  align-content: center;
  justify-items: center;
  margin-left: var(--workspace-sidebar);
  padding:
    calc(var(--workspace-topbar) + 28px)
    var(--workspace-gutter)
    72px;
}

body[data-ui-state="empty"] .empty-state {
  width: min(100%, 680px);
}

.empty-state {
  min-height: 280px;
  border-color: var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel);
}

.empty-state .secondary-button {
  width: max-content;
  margin-top: 12px;
}

body[data-ui-state="loading"] > #main-content {
  min-height: 100dvh;
  margin-left: var(--workspace-sidebar);
  padding:
    calc(var(--workspace-topbar) + 18px)
    max(var(--workspace-gutter), var(--safe-right))
    max(44px, calc(28px + var(--safe-bottom)))
    max(var(--workspace-gutter), var(--safe-left));
}

.loading-state {
  display: grid;
  width: 100%;
  max-width: none;
  gap: 12px;
}

.loading-state-copy {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 650;
}

.loading-skeleton {
  display: grid;
  min-height: 420px;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel);
}

.loading-skeleton > span,
.loading-skeleton-grid > span {
  display: block;
  border-radius: var(--radius-control);
  background: var(--panel-soft);
}

.loading-skeleton-heading {
  width: min(300px, 62%);
  height: 28px;
}

.loading-skeleton-line {
  width: min(520px, 86%);
  height: 14px;
}

.loading-skeleton-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 12px;
}

.loading-skeleton-grid > span {
  min-height: 320px;
  border: 1px solid var(--line);
}

/* Shared visual grammar */

.page-shell,
:where(
  .client-card,
  .content-grid,
  .client-main-stack,
  .client-side-stack,
  .my-work-page,
  .monitor-page,
  .call-stats-page,
  .analytics-page,
  .ai-settings-page,
  .admin-page,
  .call-detail-page,
  .call-detail-grid,
  .call-detail-primary
),
:where(
  .content-grid,
  .call-detail-grid,
  .call-stats-grid,
  .call-stats-bottom-grid,
  .my-work-rating-grid
) > * {
  min-width: 0;
}

.page-shell input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.login-page input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.custom-select-button {
  min-height: var(--control-height);
  border-radius: var(--radius-control);
}

.custom-select-button {
  font-size: 12px;
  font-weight: 650;
}

.custom-select-menu {
  max-width: min(520px, calc(100vw - 24px));
  animation: none;
}

.login-card {
  animation: none;
}

.custom-select-option {
  min-height: 36px;
  font-weight: 650;
  white-space: normal;
}

.section-label {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.section-heading {
  min-height: 34px;
  align-items: center;
  gap: 12px;
}

.section-heading h2,
.profile-block h2,
.call-stats-card-head h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 740;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.muted {
  color: var(--muted);
}

.status,
.monitor-call-type,
.monitor-alert-badge,
.admin-role-pill,
.ai-channel-chip,
.ai-count-pill {
  border-radius: 999px;
  font-weight: 700;
}

.no-data {
  border-color: var(--line);
  border-radius: var(--radius-control);
  background: var(--panel-soft);
}

.form-message[data-tone="success"],
[data-state="success"] {
  color: var(--success-readable);
}

.form-message[data-tone="error"],
.form-message[data-tone="danger"],
[data-state="error"] {
  color: var(--danger-readable);
}

/* Client workspace */

.client-card {
  gap: 14px;
}

.identity-row,
.upcoming-section,
.profile-grid,
.calls-section,
.tickets-section,
.notes-section,
.telegram-section,
.my-work-header,
.my-work-summary,
.my-work-rating-overview,
.my-work-panel,
.my-work-rating-section {
  border-color: var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel);
  box-shadow: none;
}

.identity-row {
  min-height: 76px;
  padding: 14px 16px;
}

.identity-row h1 {
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 760;
  letter-spacing: -0.03em;
}

.identity-meta {
  gap: 8px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.upcoming-section {
  padding: 14px 16px 16px;
}

.profile-grid {
  overflow: hidden;
}

.content-grid {
  grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.7fr);
  gap: 14px;
  align-items: start;
}

.client-main-stack,
.client-side-stack {
  gap: 14px;
}

.calls-section,
.tickets-section,
.notes-section,
.telegram-section {
  padding: 14px 16px 16px;
}

.ai-summary-card {
  border-color: var(--line);
  border-radius: var(--radius-control);
  background: var(--panel-soft);
  box-shadow: none;
}

.ticket-list,
.call-list,
.notes-list {
  margin-top: 10px;
}

.ticket-row,
.order-row,
.call-row,
.note-item {
  border-color: var(--line);
  background: transparent;
}

.call-row.is-restricted {
  cursor: default;
}

.call-row.is-restricted:hover,
.call-row.is-restricted:focus-visible {
  margin-inline: 0;
  padding-inline: 2px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.call-access-restriction {
  display: inline-flex;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--muted) 12%, var(--panel));
  color: var(--muted);
}

.call-access-restriction[hidden] {
  display: none;
}

.call-access-restriction svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.telegram-chat,
.viber-chat {
  border-color: var(--line);
  border-radius: var(--radius-control);
  background: var(--panel-soft);
}

/* My work */

.my-work-page {
  gap: 14px;
}

.my-work-header {
  padding: 15px 16px;
}

.my-work-header h1 {
  font-size: 22px;
  font-weight: 760;
}

.my-work-tabs {
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
}

.my-work-tabs button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
}

.my-work-tabs button.active {
  border-color: color-mix(in srgb, var(--brand) 30%, var(--line));
  background: var(--brand-soft);
  color: var(--brand-readable);
}

.my-work-summary > div,
.my-work-rating-overview > div {
  min-height: 76px;
}

.my-work-summary strong,
.my-work-rating-overview strong {
  font-size: 20px;
}

.my-work-panel,
.my-work-rating-section {
  padding: 14px 16px 16px;
}

.my-work-call-toolbar {
  margin-top: 10px;
  padding-bottom: 10px;
}

/* Calls table */

.monitor-page {
  display: grid;
  gap: 0;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel);
  box-shadow: none;
}

.monitor-page > .monitor-hero,
.monitor-page > .monitor-panel {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.monitor-page > .monitor-hero {
  grid-template-columns: minmax(0, 1fr) minmax(430px, 0.62fr);
  min-height: 72px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-panel) var(--radius-panel) 0 0;
}

.monitor-hero h1 {
  font-family: var(--font-ui);
  font-size: 21px;
  font-weight: 760;
  letter-spacing: -0.025em;
}

.monitor-status-grid {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.monitor-status-grid div {
  min-height: 44px;
  padding: 5px 11px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
}

.monitor-status-grid div:first-child {
  border-left: 0;
}

.monitor-status-grid span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.monitor-status-grid strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 720;
}

.monitor-page > .monitor-panel {
  padding: 13px 16px 14px;
  border-radius: 0 0 var(--radius-panel) var(--radius-panel);
}

.monitor-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin: 10px 0 12px;
  padding: 0;
}

.monitor-toolbar-primary {
  display: grid;
  grid-template-columns:
    minmax(250px, 1fr)
    minmax(360px, 0.9fr)
    minmax(190px, 0.5fr);
  gap: 8px;
  align-items: stretch;
}

.monitor-toolbar-secondary {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(150px, 210px))
    minmax(110px, 140px)
    auto;
  gap: 8px;
  align-items: stretch;
  justify-content: end;
}

.monitor-toolbar-primary > #monitor-query {
  grid-column: auto;
  width: 100%;
  min-height: var(--control-height);
}

.monitor-date-filter,
.monitor-operator-filter,
.monitor-page-size,
.monitor-filter-select {
  min-width: 0;
  min-height: var(--control-height);
  border-color: var(--field-border);
  border-radius: var(--radius-control);
  background: var(--field);
}

.monitor-date-filter {
  grid-column: auto;
}

.monitor-operator-filter {
  grid-column: auto;
}

.monitor-filter-select {
  padding-inline: 8px;
}

.monitor-toolbar .custom-select-button,
.monitor-operator-trigger,
.monitor-toolbar .monitor-date-field input {
  min-height: calc(var(--control-height) - 2px);
  font-size: 11px;
}

.monitor-toolbar-secondary > .primary-button {
  min-width: 96px;
  align-self: stretch;
}

.monitor-filter-message {
  grid-column: 1 / -1;
}

.monitor-table-head,
.monitor-call-link {
  grid-template-columns:
    minmax(220px, 1.28fr)
    minmax(126px, 0.62fr)
    minmax(172px, 0.82fr)
    minmax(84px, 0.34fr)
    minmax(66px, 0.3fr)
    18px;
  gap: 10px;
}

.monitor-table-head {
  display: grid;
  align-items: center;
  min-width: 820px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius-control) var(--radius-control) 0 0;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.monitor-list {
  gap: 0;
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border-color: var(--line);
  border-radius: 0 0 var(--radius-control) var(--radius-control);
  background: var(--panel);
}

.monitor-call-row {
  min-width: 820px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.monitor-call-link {
  grid-template-areas: "identity time operator duration score arrow";
  min-height: 58px;
  padding: 7px 12px;
  color: var(--text);
}

.monitor-call-link > .monitor-call-identity {
  grid-area: identity;
}

.monitor-call-link > .monitor-call-time {
  grid-area: time;
}

.monitor-call-link > .monitor-call-operator {
  grid-area: operator;
}

.monitor-call-link > .monitor-call-duration {
  grid-area: duration;
}

.monitor-call-link > .monitor-call-score-cell {
  grid-area: score;
}

.monitor-call-link > .monitor-call-arrow {
  grid-area: arrow;
}

.monitor-call-link:hover,
.monitor-call-link:focus-visible {
  background: color-mix(in srgb, var(--brand) 6%, var(--panel-soft));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 38%, var(--line));
  transform: none;
}

.monitor-call-link.is-problem {
  background: color-mix(in srgb, var(--warning) 7%, var(--panel));
}

.monitor-call-phone .call-direction-icon {
  width: 28px;
  height: 28px;
}

.monitor-call-phone strong {
  font-family: var(--font-data);
  font-size: 13px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}

.monitor-call-type,
.monitor-alert-badge {
  min-height: 18px;
  margin-top: 3px;
  padding: 2px 6px;
  font-size: 9px;
}

.monitor-call-fact {
  gap: 2px;
}

.monitor-call-fact span {
  display: none;
}

.monitor-call-fact strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 620;
}

.monitor-call-score {
  min-width: 46px;
  min-height: 23px;
  font-size: 12px;
}

.monitor-call-arrow {
  width: 17px;
  height: 17px;
}

.monitor-pagination {
  margin-top: 12px;
  padding-top: 11px;
}

.monitor-page-button {
  min-width: 34px;
  min-height: 34px;
  border-radius: var(--radius-control);
}

.my-work-table-head {
  margin-top: 2px;
}

.my-work-call-list {
  margin-top: 0;
}

/* Statistics and analytics */

.call-stats-page {
  gap: 12px;
}

.call-stats-page .monitor-hero,
.call-stats-page .monitor-panel,
.call-stats-card,
.manager-performance {
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel);
  box-shadow: none;
}

.call-stats-page .monitor-hero {
  min-height: 70px;
  padding: 13px 16px;
}

.call-stats-page .monitor-panel {
  padding: 14px 16px 16px;
}

.call-stats-summary,
.monitor-analytics-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-color: var(--line);
  border-radius: var(--radius-control);
}

.call-stats-summary > div,
.monitor-analytics-summary > div {
  min-height: 72px;
  padding: 10px 12px;
  border-color: var(--line);
}

.call-stats-summary span,
.call-stats-summary small,
.monitor-analytics-summary span,
.monitor-analytics-summary small {
  font-size: 10px;
  font-weight: 600;
  text-transform: none;
}

.call-stats-summary strong,
.monitor-analytics-summary strong {
  font-size: 20px;
  font-weight: 760;
}

.call-stats-grid,
.call-stats-bottom-grid {
  gap: 12px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.call-stats-card {
  padding: 13px 14px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
}

.call-stats-grid > .call-stats-card,
.call-stats-bottom-grid > .call-stats-card {
  border: 1px solid var(--line);
}

.call-stats-card-head {
  min-height: 32px;
  margin-bottom: 10px;
}

.call-stats-card-head h2 {
  font-size: 15px;
}

.call-stats-chart-wrap,
.call-stats-card:not(.call-stats-card-wide) .call-stats-chart-wrap {
  height: 220px;
  min-height: 220px;
}

.call-stats-card-wide .call-stats-chart-wrap {
  height: 250px;
}

.call-stats-table-card {
  padding: 0;
}

.call-stats-table-card .call-stats-card-head {
  padding: 13px 14px;
}

.call-stats-table-wrap {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius-panel) var(--radius-panel);
}

.call-stats-table th,
.call-stats-table td {
  height: 40px;
  padding: 7px 9px;
  font-size: 11px;
}

.call-stats-list {
  border-color: var(--line);
}

.call-stats-list-row {
  min-height: 42px;
  padding: 7px 9px;
}

.call-stats-heatmap,
.call-stats-heatmap-cell,
body[data-theme="dark"] .call-stats-heatmap-cell,
body[data-theme="dark"] .call-stats-heatmap-cell:hover,
body[data-theme="dark"] .call-stats-heatmap-cell:focus-visible {
  box-shadow: none;
}

.analytics-page {
  gap: 0;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel);
}

.analytics-page > .monitor-hero,
.analytics-page > .monitor-panel {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.analytics-page > .monitor-hero {
  min-height: 70px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.analytics-page > .monitor-panel {
  padding: 14px 16px 16px;
}

.manager-performance {
  margin: 14px 0 0;
  padding: 14px;
}

.manager-rating-summary,
.manager-rating-table,
.manager-rating-insights,
.call-type-chart {
  border-color: var(--line);
}

.manager-rating-matrix th,
.manager-rating-matrix td,
.manager-rating-trend-matrix th,
.manager-rating-trend-matrix td {
  font-size: 11px;
}

/* Call detail */

.call-detail-page {
  gap: 12px;
}

.detail-back-link {
  min-height: 34px;
  margin: 0;
  padding: 5px 3px;
  color: var(--muted);
  font-size: 12px;
}

.detail-back-link:hover {
  color: var(--brand-readable);
}

.call-detail-hero {
  min-height: 76px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel) var(--radius-panel) 0 0;
  background: var(--panel);
  box-shadow: none;
}

.call-detail-hero h1 {
  font-family: var(--font-ui);
  font-size: 23px;
  font-weight: 770;
  letter-spacing: -0.03em;
}

.call-detail-facts {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius-panel) var(--radius-panel);
  background: var(--panel);
  box-shadow: none;
}

.call-detail-facts > div,
.call-detail-facts > div:nth-child(2) {
  min-height: 54px;
  padding: 8px 11px;
  border-color: var(--line);
}

.call-detail-facts span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.call-detail-facts strong {
  font-size: 12px;
  font-weight: 700;
}

.call-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(410px, 0.88fr);
  gap: 12px;
  align-items: start;
}

.call-detail-primary {
  display: grid;
  min-width: 0;
  gap: 12px;
}

.detail-panel {
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel);
  box-shadow: none;
}

.call-quality-panel {
  border: 1px solid var(--line);
}

.call-transcript-panel {
  position: sticky;
  top: calc(var(--workspace-topbar) + 14px);
  display: flex;
  min-width: 0;
  max-height: calc(100dvh - var(--workspace-topbar) - 28px);
  flex-direction: column;
  overflow: hidden;
}

.detail-transcript-block {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  margin: 0;
  padding: 0;
  border: 0;
}

.detail-summary,
.quality-summary {
  margin: 9px 0 11px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.detail-analysis-list {
  border-color: var(--line);
  border-radius: var(--radius-control);
}

.detail-analysis-group > header {
  padding: 8px 10px;
}

.detail-analysis-item {
  min-height: 44px;
  padding: 8px 10px;
}

.detail-analysis-item > span {
  font-size: 10px;
}

.detail-analysis-item > strong {
  font-size: 12px;
  line-height: 1.45;
}

.quality-context {
  border-color: var(--line);
  background: var(--line);
}

.quality-context-item {
  min-height: 46px;
  padding: 8px 10px;
}

.quality-score {
  min-width: 62px;
  min-height: 38px;
  border-radius: var(--radius-control);
  background: color-mix(in srgb, var(--quality-tone) 8%, var(--panel-soft));
  box-shadow: none;
  font-size: 21px;
}

.quality-criteria {
  gap: 10px;
}

.quality-metric-group {
  gap: var(--space-3);
  padding: var(--space-3);
  border: 0;
  border-radius: 0;
  background: transparent;
}

.quality-group-list {
  gap: var(--space-2);
  overflow: visible;
  border: 0;
  border-radius: 0;
}

.quality-metric-group .quality-group-list > .quality-item,
.quality-metric-group .quality-group-list > .quality-metric-item {
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel-soft);
}

.quality-metric-group .quality-group-list > .quality-metric-item {
  border-color: color-mix(in srgb, var(--metric-color) 38%, var(--line));
  background: color-mix(in srgb, var(--metric-color) 9%, var(--panel-soft));
}

.quality-metric-group .quality-group-list > .quality-metric-item.has-manual-score {
  border-color: color-mix(in srgb, var(--accent) 44%, var(--line));
  background: color-mix(in srgb, var(--accent) 6%, var(--panel-soft));
}

.quality-metric-group .quality-group-list > :last-child {
  border-bottom: 1px solid var(--line);
}

.quality-metric-group .quality-group-list > .quality-metric-item:last-child {
  border-bottom-color: color-mix(in srgb, var(--metric-color) 38%, var(--line));
}

.quality-metric-title strong {
  font-size: 12px;
}

.quality-item p,
.quality-metric-item p {
  font-size: 12px;
  line-height: 1.45;
}

.detail-audio {
  margin-top: 9px;
}

.audio-player {
  border-color: color-mix(in srgb, var(--brand) 36%, var(--line));
  border-radius: var(--radius-control);
  background: var(--panel-soft);
  box-shadow: none;
}

.audio-visual {
  min-height: 82px;
}

.audio-play-button {
  width: 40px;
  height: 40px;
  border-color: var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: none;
}

.audio-controls {
  min-height: 38px;
  padding: 5px 8px;
}

.audio-download {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  border-color: color-mix(in srgb, var(--brand) 32%, var(--line));
  background: color-mix(in srgb, var(--brand) 9%, var(--panel));
  color: var(--brand);
}

.audio-download svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.1;
}

.audio-download:hover,
.audio-download:focus-visible {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
}

.transcript-list {
  min-height: 320px;
  max-height: none;
  flex: 1;
  align-content: start;
  margin-top: var(--space-2);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
  scrollbar-color: var(--line-strong) transparent;
}

.transcript-item {
  --transcript-role-color: var(--muted);
  --transcript-role-surface: var(--panel);
  grid-template-columns: 32px minmax(0, 1fr);
  column-gap: var(--space-2);
  row-gap: var(--space-1);
  align-items: start;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-block-end: 1px solid var(--line);
  border-radius: 0;
  background: var(--transcript-role-surface);
  box-shadow: none;
}

.transcript-item header {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
}

.transcript-item header strong {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-1);
  color: var(--transcript-role-color);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.055em;
  overflow-wrap: anywhere;
}

.transcript-item header strong::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}

.transcript-item header span {
  margin-inline-start: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  white-space: nowrap;
}

.transcript-item p {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.transcript-play {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: grid;
  align-self: start;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border-color: color-mix(in srgb, var(--transcript-role-color) 54%, var(--line));
  border-radius: 50%;
  background: color-mix(in srgb, var(--transcript-role-color) 10%, var(--panel));
  color: var(--transcript-role-color);
  font-size: 0;
  line-height: 1;
  box-shadow: none;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.transcript-play-icon {
  display: block;
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.transcript-play:hover:not(:disabled) {
  border-color: var(--transcript-role-color);
  background: color-mix(in srgb, var(--transcript-role-color) 20%, var(--panel));
  color: var(--transcript-role-color);
}

.transcript-play:focus-visible {
  border-color: var(--transcript-role-color);
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  background: color-mix(in srgb, var(--transcript-role-color) 20%, var(--panel));
  color: var(--transcript-role-color);
  box-shadow: none;
}

.transcript-play:disabled {
  opacity: 0.46;
}

.transcript-client {
  --transcript-role-color: var(--audio-client);
  --transcript-role-surface: color-mix(in srgb, var(--audio-client) 14%, var(--panel));
}

.transcript-operator {
  --transcript-role-color: var(--brand);
  --transcript-role-surface: color-mix(in srgb, var(--brand) 13%, var(--panel));
}

.transcript-extra {
  --transcript-role-color: var(--transcript-speaker-color);
  --transcript-role-surface: color-mix(
    in srgb,
    var(--transcript-speaker-color) 13%,
    var(--panel)
  );
}

.transcript-unknown {
  --transcript-role-color: var(--muted);
  --transcript-role-surface: color-mix(in srgb, var(--line-strong) 10%, var(--panel));
}

@media (max-width: 640px), (pointer: coarse) {
  .transcript-item {
    grid-template-columns: var(--touch-target) minmax(0, 1fr);
  }

  .transcript-play {
    width: var(--touch-target);
    height: var(--touch-target);
  }
}

@media (max-width: 640px) {
  .transcript-item {
    padding-block: var(--space-3);
  }

  .transcript-item header strong,
  .transcript-item header span {
    font-size: 12px;
  }

  .transcript-item p {
    font-size: 14px;
    line-height: 1.5;
  }
}

.detail-tickets-panel,
.call-detail-page > .detail-panel {
  border-radius: var(--radius-panel);
}

/* Admin and AI settings */

.admin-page,
.ai-settings-page {
  gap: 14px;
}

.admin-hero,
.admin-panel,
.ai-soldly-hero,
.ai-soldly-list-panel,
.ai-soldly-detail {
  border-color: var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel);
  box-shadow: none;
}

.admin-hero,
.ai-soldly-hero {
  padding: 14px 16px;
}

.admin-tabs,
.ai-soldly-tabs {
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
}

.admin-tabs button,
.ai-soldly-tabs button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
}

.admin-tabs button.active,
.ai-soldly-tabs button.active {
  border-color: color-mix(in srgb, var(--brand) 30%, var(--line));
  background: var(--brand-soft);
  color: var(--brand-readable);
}

.admin-tabs button.active::after,
.ai-soldly-tabs button.active::after {
  display: none;
}

.admin-user-card,
.admin-number-card,
.admin-feedback-card,
.admin-telegram-card,
.ai-type-card,
.ai-metric-card {
  border-color: var(--line);
  background: transparent;
  box-shadow: none;
}

.ai-gradient-button,
.ai-hero-settings {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: none;
}

.ai-gradient-button:hover,
.ai-hero-settings:hover {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
  box-shadow: none;
  transform: none;
}

.account-dialog,
.ai-soldly-dialog {
  border-color: var(--line-strong);
  border-radius: var(--radius-panel);
}

/* Flat operational surfaces and interaction layers */

:is(
  .empty-state,
  .trip-hero,
  .telegram-thread,
  .telegram-chat,
  .viber-chat,
  .ai-summary-card,
  .modal-ticket-card,
  .monitor-ai,
  .call-stats-heatmap,
  .detail-analysis-group,
  .detail-analysis-item,
  .quality-context-item,
  .quality-metric-group,
  .quality-metric-item,
  .audio-player,
  .audio-visual,
  .transcript-extra
) {
  background-image: none;
  box-shadow: none;
}

.trip-hero,
.telegram-thread,
.modal-ticket-card,
.detail-analysis-group,
.quality-metric-group,
.audio-visual {
  background-color: var(--panel-soft);
}

.trip-departure {
  background: color-mix(in srgb, var(--brand) 7%, var(--panel-soft));
}

.trip-route-line {
  background: var(--line-strong);
}

.ticket-schedule span,
.ticket-icon-button {
  background-image: none;
  box-shadow: none;
}

.quality-context-item span {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.call-stats-card-head .section-label {
  display: none;
}

.call-stats-focus span,
.call-stats-focus em {
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

:is(
  .account-dialog,
  .tickets-modal,
  .telegram-photo-modal,
  .ai-soldly-dialog
)::backdrop {
  background: rgb(7 17 22 / 58%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

:is(
  .account-dialog form,
  .ai-soldly-dialog form,
  .tickets-modal-panel,
  .telegram-photo-modal-panel
) {
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-panel);
  background: var(--panel);
  box-shadow: var(--shadow-menu);
}

/* The metric editor is intentionally a long, data-dense form. Keep its
 * header and actions stable while the form body is the only page-level
 * scrolling surface. Short dialogs remain content-sized. */
.ai-soldly-dialog.ai-metric-dialog {
  width: min(960px, calc(100% - 24px));
  height: min(88dvh, 840px);
  max-height: min(88dvh, 840px);
  overflow: hidden;
}

.ai-soldly-dialog.ai-metric-dialog form {
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: hidden;
}

.ai-soldly-dialog.ai-metric-dialog .ai-dialog-body {
  display: block;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  /* Keep the final option's criteria field clear of the persistent actions. */
  padding-block-end: calc(var(--space-4) + var(--control-height));
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.ai-soldly-dialog.ai-metric-dialog .ai-dialog-body > * + * {
  margin-top: var(--space-2);
}

:is(
  .account-dialog-head,
  .tickets-modal-head,
  .telegram-photo-modal-head,
  .ai-soldly-dialog-head
) {
  background: var(--panel);
}

.booking-action-confirm-layer {
  background: rgb(7 17 22 / 22%);
  animation: none;
}

.booking-action-confirm-popover,
body[data-theme="dark"] .booking-action-confirm-popover {
  border-color: var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--panel);
  box-shadow: var(--shadow-menu);
}

.booking-action-confirm-popover.is-success {
  --confirm-accent: var(--success);
  --confirm-accent-2: var(--success);
}

.booking-action-confirm-popover.is-warning {
  --confirm-accent: var(--warning);
  --confirm-accent-2: var(--warning);
}

.booking-action-confirm-popover.is-danger {
  --confirm-accent: var(--danger);
  --confirm-accent-2: var(--danger);
}

.booking-action-confirm-mark {
  background: var(--confirm-accent);
  box-shadow: none;
}

.booking-action-confirm-button {
  min-height: var(--control-height);
  border-radius: var(--radius-control);
  font-weight: 720;
}

.booking-action-confirm-button:hover {
  transform: none;
}

.booking-action-confirm-button.is-confirm {
  border-color: var(--confirm-accent);
  background: var(--confirm-accent);
  color: var(--brand-ink);
  box-shadow: none;
}

.custom-select-menu,
.monitor-operator-popover,
.booking-calendar-popover,
.call-stats-heatmap-tooltip {
  z-index: var(--z-popover);
  border-color: var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--panel);
  box-shadow: var(--shadow-menu);
}

.call-stats-heatmap-tooltip {
  z-index: var(--z-tooltip);
  animation: none;
}

.custom-select-option,
.monitor-operator-option {
  border-radius: var(--radius-control);
}

:is(
  .modal-close,
  .note-action-button,
  .monitor-date-reset,
  .monitor-operator-head button,
  .audio-speed,
  .audio-download
) {
  min-width: 34px;
  min-height: 34px;
  border-radius: var(--radius-control);
}

.admin-icon-button {
  width: var(--control-height);
  height: var(--control-height);
  min-width: var(--control-height);
  min-height: var(--control-height);
  border-radius: var(--radius-control);
}

.motion-enter,
.motion-item,
.telegram-thread.motion-item {
  animation: none;
  will-change: auto;
}

.telegram-thread,
.form-message,
.manager-rating-company-track > span,
.call-type-overview > span,
.call-type-track > span {
  animation: none;
}

/* Responsive shell and dense data */

@media (max-width: 1280px) {
  .monitor-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .monitor-toolbar-primary {
    grid-template-columns:
      minmax(230px, 1fr)
      minmax(340px, 0.92fr)
      minmax(180px, 0.5fr);
  }

  .monitor-toolbar-secondary {
    grid-template-columns:
      repeat(2, minmax(140px, 190px))
      minmax(104px, 128px)
      auto;
  }

  .call-detail-grid {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
  }

  .content-grid {
    grid-template-columns: minmax(0, 1fr) minmax(330px, 0.68fr);
  }
}

@media (max-width: 1100px) {
  :root {
    --workspace-sidebar: 204px;
    --workspace-gutter: 18px;
  }

  .brand {
    padding-inline: 18px;
  }

  .app-tabs {
    margin-inline: 8px;
  }

  .monitor-toolbar-primary {
    grid-template-columns: minmax(360px, 1fr) minmax(190px, 0.55fr);
  }

  .monitor-toolbar-primary > #monitor-query {
    grid-column: 1 / -1;
  }

  .monitor-page > .monitor-hero,
  .monitor-page > .monitor-panel,
  .monitor-toolbar-primary,
  .monitor-toolbar-secondary {
    min-width: 0;
  }

  .monitor-table-head,
  .monitor-call-link {
    grid-template-columns:
      minmax(180px, 1.25fr)
      minmax(110px, 0.65fr)
      minmax(130px, 0.9fr)
      minmax(74px, 0.4fr)
      minmax(60px, 0.3fr)
      18px;
    gap: 8px;
  }

  .monitor-table-head,
  .monitor-call-row {
    min-width: 0;
  }

  .call-detail-grid,
  .content-grid,
  .my-work-rating-grid {
    grid-template-columns: 1fr;
  }

  .call-transcript-panel {
    position: static;
    max-height: none;
  }

  .transcript-list {
    max-height: 560px;
  }

  .monitor-page > .monitor-hero {
    grid-template-columns: 1fr;
  }

  .monitor-status-grid {
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }
}

@media (max-width: 900px) {
  :root {
    --workspace-sidebar: 0px;
    --workspace-topbar: auto;
    --workspace-gutter: 14px;
  }

  .app-header {
    position: sticky;
    inset: 0 auto auto;
    display: grid;
    width: 100%;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand-lockup {
    height: auto;
  }

  .brand {
    width: auto;
    min-height: 58px;
    padding: 10px 14px;
    border-bottom: 0;
  }

  .brand img {
    width: 122px;
    max-height: 36px;
  }

  .app-tabs {
    flex-direction: row;
    gap: 3px;
    margin: 0;
    padding: 0 10px 9px;
    overflow-x: auto;
  }

  .app-tabs a {
    min-height: 36px;
    flex: 0 0 auto;
    gap: 7px;
    padding-inline: 11px;
    font-size: 12px;
  }

  .app-nav-icon {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }

  .app-tabs a.active::after,
  .app-tabs a[aria-current="page"]::after {
    display: none;
  }

  .header-actions {
    position: static;
    min-height: 54px;
    padding: 8px 10px;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .theme-toggle {
    position: relative;
    inset: auto;
    margin-left: 0;
  }

  .profile-menu {
    position: relative;
    inset: auto;
    width: auto;
  }

  .profile-menu-trigger {
    display: grid;
    width: var(--control-height);
    flex-basis: var(--control-height);
    justify-content: initial;
    padding: 0;
  }

  .profile-menu-trigger::after {
    display: none;
  }

  .profile-menu-popover {
    inset: calc(100% + 8px) 0 auto auto;
    width: min(270px, calc(100vw - 20px));
    transform-origin: top right;
  }

  .phone-search {
    width: auto;
    max-width: none;
  }

  .monitor-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .monitor-toolbar-primary {
    grid-template-columns: minmax(320px, 1fr) minmax(180px, 0.55fr);
  }

  .monitor-toolbar-secondary {
    grid-template-columns:
      repeat(2, minmax(130px, 1fr))
      minmax(104px, 0.7fr)
      auto;
  }

  .monitor-date-filter,
  .monitor-operator-filter {
    grid-column: auto;
  }

  .monitor-filter-select,
  .monitor-page-size,
  .monitor-toolbar .primary-button {
    grid-column: auto;
    width: 100%;
  }

  .page-shell,
  body[data-ui-state="empty"] > #main-content,
  body[data-ui-state="loading"] > #main-content {
    min-height: auto;
    margin-left: 0;
    padding: 14px var(--workspace-gutter) 38px;
  }

  .loading-skeleton-grid {
    grid-template-columns: 1fr;
  }

  .loading-skeleton-grid > span {
    min-height: 180px;
  }

  .call-stats-summary,
  .monitor-analytics-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .call-stats-grid,
  .call-stats-bottom-grid {
    grid-template-columns: 1fr;
  }

  .call-stats-card-wide {
    grid-column: 1;
  }
}

@media (max-width: 640px) {
  :root {
    --control-height: var(--touch-target);
    --workspace-gutter: 10px;
  }

  .header-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .phone-search {
    min-width: 0;
    grid-column: 1;
  }

  .theme-toggle {
    grid-column: 2;
    justify-self: auto;
  }

  .profile-menu {
    grid-column: 3;
  }

  .phone-search button {
    padding-inline: 10px;
  }

  .monitor-page,
  .analytics-page,
  .call-detail-hero,
  .call-detail-facts,
  .detail-panel,
  .call-stats-card,
  .my-work-header,
  .my-work-panel,
  .identity-row,
  .upcoming-section,
  .profile-grid,
  .calls-section,
  .tickets-section,
  .notes-section,
  .telegram-section {
    border-radius: var(--radius-panel);
  }

  .monitor-page > .monitor-hero,
  .monitor-page > .monitor-panel,
  .analytics-page > .monitor-hero,
  .analytics-page > .monitor-panel {
    padding-inline: 11px;
  }

  .monitor-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .monitor-toolbar-primary,
  .monitor-toolbar-secondary {
    display: grid;
    grid-column: 1;
    gap: 7px;
  }

  .monitor-toolbar-primary {
    grid-template-columns: 1fr;
  }

  .monitor-toolbar-secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .monitor-toolbar-primary > #monitor-query,
  .monitor-date-filter,
  .monitor-operator-filter,
  .monitor-filter-message {
    grid-column: 1;
    width: 100%;
  }

  .monitor-filter-select,
  .monitor-page-size {
    grid-column: auto;
    width: 100%;
  }

  .monitor-toolbar .primary-button {
    grid-column: auto;
    width: auto;
    min-width: 112px;
    justify-self: end;
  }

  .monitor-operator-trigger {
    min-height: var(--control-height);
  }

  .monitor-table-head {
    display: none;
  }

  .monitor-list {
    border-radius: var(--radius-control);
  }

  .monitor-call-row {
    min-width: 0;
  }

  .monitor-call-link {
    min-width: 0;
    grid-template-areas:
      "identity score arrow"
      "time duration duration"
      "operator operator operator";
    grid-template-columns: minmax(0, 1fr) auto 18px;
    gap: 6px 10px;
    min-height: 112px;
    padding: 10px;
  }

  .monitor-call-fact {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: baseline;
    gap: 6px;
  }

  .monitor-call-fact span {
    display: inline;
  }

  .monitor-call-operator {
    padding-top: 4px;
    border-top: 1px solid var(--line);
  }

  .call-detail-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .call-detail-facts > div:nth-child(2) {
    border-right: 0;
  }

  .call-detail-facts > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .call-quality-heading-actions {
    align-items: flex-end;
    flex-direction: column;
  }

  .call-detail-badges {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .quality-context {
    grid-template-columns: 1fr;
  }

  .my-work-summary,
  .my-work-rating-overview,
  .call-stats-summary,
  .monitor-analytics-summary {
    grid-template-columns: 1fr;
  }

  .call-stats-focus-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    overflow: visible;
  }

  .call-stats-focus-chip {
    min-width: 0;
  }

  .manager-rating-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    overflow: visible;
  }

  .manager-rating-summary span {
    min-width: 0;
    flex: none;
  }

  .ai-list-head {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .ai-list-title {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
  }

  .ai-list-head > .ai-gradient-button {
    width: 100%;
    justify-self: stretch;
  }

  .ai-type-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    min-height: 0;
    padding: 8px;
  }

  .ai-type-card-main {
    width: 100%;
  }

  .ai-type-card-actions {
    width: 100%;
    justify-content: flex-end;
    padding-top: 5px;
    border-top: 1px solid var(--line);
  }

  #client-phone,
  .detail-back-link,
  .analytics-period-filter[data-custom="false"] .custom-select-button {
    min-height: var(--touch-target);
  }

  #client-phone {
    display: inline-flex;
    align-items: center;
  }

  .my-work-summary > div + div,
  .my-work-rating-overview > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  body {
    font-size: 14px;
  }

  :where(
    .phone-search input,
    .primary-button,
    .secondary-button,
    .secondary-action,
    .custom-select-button,
    .monitor-operator-trigger
  ) {
    font-size: 13px;
  }

  :where(
    .section-label,
    .monitor-status-grid span,
    .monitor-table-head,
    .call-detail-facts span,
    .detail-analysis-item > span
  ) {
    font-size: 11px;
  }

  :is(
    .modal-close,
    .note-action-button,
    .monitor-date-reset,
    .monitor-operator-head button,
    .audio-speed,
    .audio-download,
    .transcript-play,
    .monitor-page-button,
    .admin-icon-button,
    .ai-icon-button-soft,
    .ai-gradient-button,
    .ai-white-button,
    .ai-quiet-button,
    .ai-type-open,
    .ai-metric-open,
    .ai-soldly-switch,
    .app-tabs a,
    .my-work-tabs button,
    .admin-tabs button,
    .ai-soldly-tabs button,
    .messaging-tab,
    .login-brand
  ) {
    min-width: var(--touch-target);
    min-height: var(--touch-target);
  }
}

@media (pointer: coarse) {
  :where(
    button,
    [role="button"],
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    select,
    .custom-select-button,
    .primary-button,
    .secondary-button,
    .secondary-action,
    .theme-toggle,
    .profile-menu-trigger,
    .app-tabs a,
    .admin-tabs button,
    .ai-soldly-tabs button
  ) {
    min-height: var(--touch-target);
  }

  :where(
    .theme-toggle,
    .profile-menu-trigger,
    .modal-close,
    .note-action-button,
    .monitor-date-reset,
    .monitor-operator-head button,
    .audio-speed,
    .audio-download
  ) {
    min-width: var(--touch-target);
  }
}

@media (max-width: 480px) {
  .header-actions {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .phone-search {
    grid-column: 1 / -1;
  }

  .theme-toggle {
    grid-column: 1;
    justify-self: start;
  }

  .profile-menu {
    grid-column: 2;
  }

  .loading-skeleton {
    min-height: 360px;
    padding: 12px;
  }

  .monitor-toolbar-secondary {
    grid-template-columns: 1fr;
  }

  .monitor-status-grid {
    grid-template-columns: 1fr;
  }

  .monitor-status-grid div,
  .monitor-status-grid div:first-child {
    display: grid;
    grid-template-columns: minmax(112px, 0.8fr) minmax(0, 1fr);
    min-height: 36px;
    align-items: baseline;
    gap: 8px;
    padding: 7px 0;
    border: 0;
    border-top: 1px solid var(--line);
  }

  .monitor-status-grid span,
  .monitor-status-grid strong {
    overflow-wrap: normal;
  }

  .monitor-toolbar .primary-button {
    width: 100%;
    justify-self: stretch;
  }

  .booking-action-confirm-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .header-actions {
    background: var(--header);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: #a5b3ba;
    --line-strong: #6c7f88;
  }

  :root[data-theme="dark"],
  body[data-theme="dark"] {
    --line: #647984;
    --line-strong: #8fa2aa;
  }

  :where(button, a, input, textarea, select, [tabindex]):focus-visible {
    outline-width: 3px;
  }
}

@media (forced-colors: active) {
  :where(button, a, input, textarea, select, [tabindex]):focus-visible {
    outline: 2px solid Highlight;
  }

  :where(
    .status,
    .monitor-call-type,
    .monitor-alert-badge,
    .admin-role-pill,
    .ai-channel-chip,
    .ai-count-pill
  ) {
    border: 1px solid currentColor;
  }

  .booking-action-confirm-mark {
    border: 2px solid currentColor;
    background: CanvasText;
  }
}

/* Manual metric score correction */

.quality-manual-score-marker {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 46%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: color-mix(in srgb, var(--accent) 84%, var(--ink));
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.quality-metric-item.has-manual-score {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.quality-manual-score-comparison {
  color: color-mix(in srgb, var(--accent) 72%, var(--muted));
  font-variant-numeric: tabular-nums;
}

.metric-score-picker {
  display: grid;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: var(--radius-control);
  background: color-mix(in srgb, var(--accent) 5%, var(--panel-soft));
  padding: 10px;
}

.metric-score-picker-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.metric-score-picker-heading > span {
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
}

.metric-score-picker-heading small {
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  text-align: right;
}

.metric-score-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 7px;
}

.metric-score-option {
  display: grid;
  grid-template-areas:
    "label score"
    "status status";
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 66px;
  align-items: center;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--score-option-color) 25%, var(--line));
  border-radius: calc(var(--radius-control) - 2px);
  background: color-mix(in srgb, var(--score-option-color) 5%, var(--panel));
  color: var(--text);
  padding: 8px 9px;
  text-align: left;
  transition:
    border-color var(--motion-base) var(--ease-standard),
    background var(--motion-base) var(--ease-standard),
    transform var(--motion-press) var(--ease-emphasized-out);
}

.metric-score-option:hover,
.metric-score-option:focus-visible {
  border-color: color-mix(in srgb, var(--score-option-color) 62%, var(--line));
  background: color-mix(in srgb, var(--score-option-color) 13%, var(--panel));
  outline: 0;
}

.metric-score-option.selected {
  border-color: color-mix(in srgb, var(--score-option-color) 88%, var(--line));
  background: color-mix(in srgb, var(--score-option-color) 25%, var(--panel));
}

.metric-score-option:hover,
.metric-score-option:focus-visible {
  transform: translateY(-1px);
}

.metric-score-option:focus-visible {
  box-shadow: var(--focus-ring);
}

.metric-score-option strong {
  grid-area: label;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 11px;
  font-weight: 730;
  line-height: 1.25;
}

.metric-score-option-score {
  grid-area: score;
  flex: 0 0 auto;
  border-radius: 999px;
  background: color-mix(in srgb, var(--score-option-color) 18%, var(--panel));
  color: color-mix(in srgb, var(--score-option-color) 86%, var(--ink));
  padding: 3px 6px;
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.metric-score-option-status {
  grid-area: status;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-self: start;
  min-height: 14px;
  color: color-mix(in srgb, var(--score-option-color) 88%, var(--ink));
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  visibility: hidden;
}

.metric-score-option.selected .metric-score-option-status {
  visibility: visible;
}

.metric-score-option-status .ai-svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.8;
}

.metric-score-option.selected .metric-score-option-score {
  background: color-mix(in srgb, var(--score-option-color) 31%, var(--panel));
  color: color-mix(in srgb, var(--score-option-color) 94%, var(--ink));
}

/* AI feedback: keep the correction auditable without turning the queue into cards. */

.admin-feedback-correction {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 6px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.admin-feedback-correction-label,
.admin-feedback-correction-status {
  color: var(--muted);
  font-weight: 700;
}

.admin-feedback-correction > strong {
  min-width: 0;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.admin-feedback-correction-arrow {
  color: var(--brand-readable);
  font-size: 14px;
  font-weight: 800;
}

.admin-feedback-correction-status {
  color: var(--brand-readable);
}

.admin-feedback-context {
  grid-column: 1 / -1;
  min-width: 0;
  border-top: 1px solid var(--line);
  margin-top: 2px;
  padding-top: 8px;
}

.admin-feedback-context summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  list-style-position: inside;
}

.admin-feedback-context summary small {
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-feedback-context summary:focus-visible {
  border-radius: 4px;
  box-shadow: var(--focus-ring);
  outline: 0;
}

.admin-feedback-context-body {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.admin-feedback-context-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-feedback-context-entry {
  display: grid;
  gap: 4px;
  border-top: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  padding-top: 7px;
}

.admin-feedback-context-entry:first-child {
  border-top: 0;
  padding-top: 0;
}

.admin-feedback-context-entry.is-active strong {
  color: var(--brand-readable);
}

.admin-feedback-context-entry-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.admin-feedback-context-entry-head strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}

.admin-feedback-context-entry-head span,
.admin-feedback-context-ai,
.admin-feedback-context-reset {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.4;
}

.admin-feedback-context-entry-head span {
  flex: 0 1 auto;
  text-align: right;
}

.admin-feedback-context-transition,
.admin-feedback-context-comment,
.admin-feedback-context-ai,
.admin-feedback-context-reset {
  margin: 0;
  overflow-wrap: anywhere;
}

.admin-feedback-context-transition {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 6px;
  color: var(--text);
  font-size: 11px;
  line-height: 1.4;
}

.admin-feedback-context-transition b {
  color: var(--text);
  font-weight: 800;
}

.admin-feedback-context-comment {
  color: var(--text);
  font-size: 11px;
  line-height: 1.45;
}

.admin-feedback-context-reset {
  color: var(--warning);
}

.monitor-call-score[data-manual-score="true"]::after {
  content: "◆";
  margin-left: 3px;
  color: var(--accent);
  font-size: 8px;
  vertical-align: middle;
}

@media (max-width: 520px) {
  .metric-score-picker-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .metric-score-picker-heading small {
    text-align: left;
  }

  .quality-metric-actions {
    gap: 4px;
  }

  .admin-feedback-context summary,
  .admin-feedback-context-entry-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .admin-feedback-context summary small,
  .admin-feedback-context-entry-head span {
    text-align: left;
    white-space: normal;
  }
}

@media (forced-colors: active) {
  .metric-score-option,
  .quality-manual-score-marker {
    border: 1px solid currentColor;
  }
}
