/* ============================================================
   Akfix OKK — okk-v1 design theme (overlay over design-system.css)
   Reskins the REAL app to the okk-v1 mockup look. Design only —
   no structural/feature changes. Load AFTER design-system.css.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ---- okk-v1 palette (source of truth) ---- */
  --okk-accent:        #D94452;
  --okk-accent-hover:  #C23D49;
  --okk-accent-soft:   #FCEDEF;
  --okk-accent-ring:   rgba(217, 68, 82, 0.32);
  --okk-on-accent:     #FFFFFF;

  --okk-bg:            #F4F1EC;
  --okk-surface:       #FFFFFF;
  --okk-surface-2:     #FAF8F5;
  --okk-surface-3:     #F1EEE8;
  --okk-hover:         #F5F2ED;
  --okk-nav-active:    #FCEDEF;

  --okk-text:          #1A1714;
  --okk-text-2:        #5E5953;
  --okk-text-3:        #948D84;

  --okk-border:        #E7E2DA;
  --okk-border-soft:   #EFEBE4;
  --okk-border-strong: #D8D2C8;

  --okk-good:          #1E9E5A;
  --okk-good-soft:     #E2F5EA;
  --okk-warn:          #C9821A;
  --okk-warn-soft:     #FBF0DC;
  --okk-bad:           #DB3B3B;
  --okk-bad-soft:      #FCE6E6;
  --okk-info:          #2F6FE0;
  --okk-info-soft:     #E5EDFC;

  --okk-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --okk-mono: 'JetBrains Mono', 'SF Mono', monospace;

  --okk-r-sm: 9px;
  --okk-r-md: 12px;
  --okk-r-lg: 16px;
  --okk-r-full: 999px;

  --okk-sh-1: 0 1px 2px rgba(38, 30, 22, 0.05);
  --okk-sh-2: 0 2px 6px rgba(38, 30, 22, 0.06), 0 1px 2px rgba(38, 30, 22, 0.04);
  --okk-sh-3: 0 10px 28px -10px rgba(38, 30, 22, 0.18), 0 2px 8px rgba(38, 30, 22, 0.05);

  /* ---- remap the app's existing semantic tokens onto the okk-v1 palette ---- */
  --color-primary:        var(--okk-accent);
  --color-primary-hover:  var(--okk-accent-hover);
  --color-primary-light:  var(--okk-accent-soft);

  --bg-app:        var(--okk-bg);
  --bg-card:       var(--okk-surface);
  --bg-sidebar:    var(--okk-surface-2);
  --bg-nav-active: var(--okk-nav-active);
  --bg-hover:      var(--okk-hover);
  --bg-input:      var(--okk-surface);

  --text-primary:   var(--okk-text);
  --text-secondary: var(--okk-text-2);
  --text-muted:     var(--okk-text-3);
  --text-link:      var(--okk-accent);

  --color-success:       var(--okk-good);
  --color-success-light: var(--okk-good-soft);
  --color-success-dark:  var(--okk-good);
  --color-error:         var(--okk-bad);
  --color-error-light:   var(--okk-bad-soft);
  --color-warning:       var(--okk-warn);
  --color-warning-light: var(--okk-warn-soft);
  --color-info:          var(--okk-info);
  --color-info-light:    var(--okk-info-soft);

  --border-default: var(--okk-border);
  --border-light:   var(--okk-border-soft);
  --border-focus:   var(--okk-accent);
  --border-card:    var(--okk-border);

  --shadow-sm:   var(--okk-sh-1);
  --shadow-card: var(--okk-sh-1);
  --shadow-md:   var(--okk-sh-2);
  --shadow-lg:   var(--okk-sh-3);
  --shadow-xl:   var(--okk-sh-3);

  --font-primary: var(--okk-font);
}

/* ---- canvas ---- */
body {
  background: var(--okk-bg);
  color: var(--okk-text);
  font-family: var(--okk-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- cards ---- */
.card {
  background: var(--okk-surface);
  border: 1px solid var(--okk-border);
  border-radius: var(--okk-r-lg);
  box-shadow: var(--okk-sh-1);
}

/* KPI metric cards (dashboard top row) */
.metric-card-large {
  padding: 20px;
  border-radius: var(--okk-r-lg);
}
/* Макет: все KPI-карточки белые (акцент только в чип-иконке). */
.metric-card-large.card-highlighted {
  background: var(--okk-surface);
  border-color: var(--okk-border);
}

/* Big numeric values — okk-v1 light-weight tabular look */
.metric-value,
.metric-card-large .metric-value,
.metric-value-xl,
.metric-value-large,
.metric-number {
  font-weight: 300;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--okk-text);
}

/* ---- KPI cards (okk-v1 full-fidelity: chip + label + delta + number + sparkline) ---- */
.metric-card-large.kpi-card { display: flex; flex-direction: column; gap: 14px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-id { display: flex; align-items: center; gap: 9px; min-width: 0; }
.kpi-chip { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.kpi-chip svg { width: 16px; height: 16px; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--okk-text-2); white-space: nowrap; }
.kpi-delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 650; flex: none; }
.kpi-delta svg { width: 12px; height: 12px; }
.kpi-delta.up { color: var(--okk-good); }
.kpi-delta.down { color: var(--okk-bad); }
.kpi-delta.flat { color: var(--okk-text-3); }
.kpi-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.kpi-num { font-size: 38px; font-weight: 300; letter-spacing: -0.02em; line-height: 1; color: var(--okk-text); font-variant-numeric: tabular-nums; }
.kpi-num .unit { font-size: 18px; color: var(--okk-text-3); font-weight: 400; margin-left: 3px; }
.kpi-spark { margin-bottom: 2px; flex: none; }
.metric-card-large.kpi-card .metric-tooltip { display: inline-flex; }

/* Tabular-number helper */
.okk-tnum { font-variant-numeric: tabular-nums; }

/* ============================================================
   Component overrides — real app classes → okk-v1 look
   ============================================================ */

/* ---- Sidebar ---- */
.sidebar {
  background: var(--okk-surface-2);
  border-right: 1px solid var(--okk-border);
}
.sidebar-header {
  border-bottom: 1px solid var(--okk-border);
}
.sidebar-logo-icon {
  background: var(--okk-accent);
  color: var(--okk-on-accent);
  border-radius: 9px;
  font-weight: 800;
  box-shadow: var(--okk-sh-1);
}
.sidebar-section-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--okk-text-3);
}
.sidebar-item {
  border-radius: var(--okk-r-sm);
  color: var(--okk-text-2);
  font-size: 13.5px;
  font-weight: 550;
  transition: background .14s, color .14s;
  position: relative;
}
.sidebar-item:hover {
  background: var(--okk-hover);
  color: var(--okk-text);
}
.sidebar-item.active,
.sidebar-item.nav-link.active,
.nav-link.active {
  background: var(--okk-nav-active);
  color: var(--okk-accent);
  font-weight: 650;
}
.sidebar-item.active::before,
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--okk-accent);
}
.sidebar-item.active .nav-icon,
.nav-link.active .nav-icon { opacity: 1; color: var(--okk-accent); }

/* Дропдаун-тогглы (Сотрудники/Отделы) — обычные при раскрытии; акцент только у активной страницы (как в эталоне) */
.sidebar-dropdown-toggle:not(.active),
.sidebar-dropdown.open > .sidebar-dropdown-toggle:not(.active),
.sidebar-dropdown-toggle.open:not(.active) {
  background: transparent !important;
  color: var(--okk-text-2) !important;
  font-weight: 550 !important;
}
.sidebar-dropdown-toggle:not(.active):hover {
  background: var(--okk-hover) !important;
  color: var(--okk-text) !important;
}
.sidebar-dropdown-toggle:not(.active) .nav-icon {
  color: var(--okk-text-2) !important;
  opacity: .85;
}
.sidebar-dropdown-toggle:not(.active) .sidebar-dropdown-arrow { color: var(--okk-text-3) !important; }

/* Секция «Сотрудники»: тоггл отдела + сотрудник (как в эталоне okk-v1) */
.sidebar-department-toggle {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 36px; padding: 0 12px;
  background: none; border: none; border-radius: var(--okk-r-sm);
  color: var(--okk-text-2); font-size: 13px; font-weight: 550; cursor: pointer;
  transition: background .14s, color .14s;
}
.sidebar-department-toggle:hover { background: var(--okk-hover); color: var(--okk-text); }
.sidebar-department-toggle .flex-1 { text-align: left; text-transform: uppercase; letter-spacing: .02em; }
.sidebar-department-toggle .text-muted { font-size: 11.5px; color: var(--okk-text-3); font-weight: 600; }
.sidebar-department-arrow { color: var(--okk-text-3); transition: transform .2s var(--okk-ease); flex: none; }
.sidebar-department.open .sidebar-department-arrow { transform: rotate(90deg); }
.sidebar-department-content { padding: 2px 0 4px; }

.sidebar-employee {
  display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 12px 0 22px;
  border-radius: var(--okk-r-sm); color: var(--okk-text-2); font-size: 12.5px;
  text-decoration: none; cursor: pointer; transition: background .14s, color .14s;
}
.sidebar-employee:hover { background: var(--okk-hover); color: var(--okk-text); }
.sidebar-employee.active { background: var(--okk-nav-active); color: var(--okk-accent); font-weight: 600; }
.sidebar-employee-avatar {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; letter-spacing: .02em;
  color: var(--okk-text-2); background: var(--okk-surface-3);
}
/* Цветные аватарки (как в эталоне) — по позиции сотрудника в отделе */
.sidebar-employee:nth-of-type(6n+1) .sidebar-employee-avatar { background: var(--okk-good-soft); color: var(--okk-good); }
.sidebar-employee:nth-of-type(6n+2) .sidebar-employee-avatar { background: var(--okk-info-soft); color: var(--okk-info); }
.sidebar-employee:nth-of-type(6n+3) .sidebar-employee-avatar { background: var(--okk-accent-soft); color: var(--okk-accent); }
.sidebar-employee:nth-of-type(6n+4) .sidebar-employee-avatar { background: var(--okk-warn-soft); color: var(--okk-warn); }
.sidebar-employee:nth-of-type(6n+5) .sidebar-employee-avatar { background: #EFE9FC; color: #8B5CF6; }
.sidebar-employee:nth-of-type(6n)   .sidebar-employee-avatar { background: #DEF3F4; color: #0E9BA6; }
.sidebar-employee-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Header (okk-v1 layout) ---- */
.header {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 62px;
  padding: 0 22px;
  position: relative;
  z-index: var(--z-dropdown);
  background: color-mix(in srgb, var(--okk-bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--okk-border);
}
.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.header-period { display: inline-flex; }

/* Icon buttons in header */
.header .icon-btn {
  width: 38px; height: 38px; border-radius: var(--okk-r-sm);
  border: 1px solid transparent; background: transparent; color: var(--okk-text-2);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .14s, color .14s; padding: 0;
}
.header .icon-btn:hover { background: var(--okk-hover); color: var(--okk-text); }
.header-ping { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--okk-accent); border: 2px solid var(--okk-bg); }
.header-divider { width: 1px; height: 26px; background: var(--okk-border); margin: 0 2px; }

/* Search — okk-v1 pill */
.header-search .search-wrapper { position: relative; }
.header .search-input, .header .input.search-input {
  height: 38px; width: 240px; padding: 0 12px 0 34px;
  background: var(--okk-surface); border: 1px solid var(--okk-border);
  border-radius: var(--okk-r-sm); color: var(--okk-text); font-size: 13px;
}
.header .search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--okk-text-3); }

/* User block — okk-v1 */
.header-user { display: flex; align-items: center; gap: 8px; padding: 0 6px 0 4px; height: 38px; border-radius: var(--okk-r-sm); cursor: pointer; transition: background .14s; }
.header-user:hover { background: var(--okk-hover); }
.header-user-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  color: #fff; background: linear-gradient(135deg, var(--okk-accent), var(--okk-accent-hover));
}
.header-user-copy { text-align: left; line-height: 1.15; }
.header-user-name { font-size: 12.5px; font-weight: 650; color: var(--okk-text); white-space: nowrap; }
.header-user-role { font-size: 11px; color: var(--okk-text-3); white-space: nowrap; }
@media (max-width: 640px) { .header-user-copy { display: none; } .header .search-input { width: 150px; } }

/* Sidebar collapse */
#app.sidebar-collapsed .sidebar { width: 72px; min-width: 72px; }
#app.sidebar-collapsed .sidebar-item span,
#app.sidebar-collapsed .sidebar-section-title,
#app.sidebar-collapsed .sidebar-dropdown-arrow,
#app.sidebar-collapsed .sidebar-dropdown-content,
#app.sidebar-collapsed .sidebar-header > a > div:last-child,
#app.sidebar-collapsed #sidebar-user-footer .flex-1,
#app.sidebar-collapsed #sidebar-user-footer button { display: none !important; }
#app.sidebar-collapsed .sidebar-item { justify-content: center; padding-left: 0; padding-right: 0; }
#app.sidebar-collapsed .sidebar-item.active::before, #app.sidebar-collapsed .nav-link.active::before { left: 0; }

/* ---- Dark theme tokens (okk-v1) ---- */
[data-theme="dark"] {
  --okk-accent:#F26C78; --okk-accent-hover:#FF8089; --okk-accent-soft:#3A2226; --okk-accent-ring:rgba(242,108,120,.34); --okk-on-accent:#1A0F11;
  --okk-bg:#14120F; --okk-surface:#1E1B17; --okk-surface-2:#1A1713; --okk-surface-3:#26221C; --okk-hover:#272320; --okk-nav-active:#2E2023;
  --okk-text:#F3EFE9; --okk-text-2:#B3ABA0; --okk-text-3:#7E7669;
  --okk-border:#312C25; --okk-border-soft:#29251F; --okk-border-strong:#423B31;
  --okk-good:#46C97D; --okk-good-soft:#18301F; --okk-warn:#E0A33C; --okk-warn-soft:#322610; --okk-bad:#F26060; --okk-bad-soft:#361A1A; --okk-info:#6C9BF0; --okk-info-soft:#16223A;
  --okk-sh-1:0 1px 2px rgba(0,0,0,.4); --okk-sh-2:0 2px 8px rgba(0,0,0,.45); --okk-sh-3:0 12px 30px -10px rgba(0,0,0,.6),0 2px 8px rgba(0,0,0,.4);
}
.search-input,
.input.search-input {
  background: var(--okk-surface);
  border: 1px solid var(--okk-border);
  border-radius: var(--okk-r-sm);
  color: var(--okk-text);
}
.search-input::placeholder { color: var(--okk-text-3); }
.search-input:focus,
.input.search-input:focus {
  outline: none;
  border-color: var(--okk-accent);
  box-shadow: 0 0 0 3px var(--okk-accent-ring);
}

/* ---- Period selector (segmented) ---- */
.period-tabs-group {
  display: inline-flex;
  padding: 3px;
  background: var(--okk-surface-3);
  border-radius: var(--okk-r-sm);
  gap: 2px;
  border: none;
}
.period-tab {
  border: none;
  background: transparent;
  height: 30px;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 550;
  color: var(--okk-text-2);
  border-radius: var(--okk-r-sm);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.period-tab:hover { color: var(--okk-text); }
.period-tab.active {
  background: var(--okk-surface);
  color: var(--okk-text);
  box-shadow: var(--okk-sh-1);
}

/* ---- Buttons ---- */
.btn {
  border-radius: var(--okk-r-sm);
  font-weight: 550;
  transition: background .16s, border-color .16s, color .16s, box-shadow .16s;
}
.btn-primary {
  background: var(--okk-accent);
  color: var(--okk-on-accent);
  border-color: var(--okk-accent);
  box-shadow: var(--okk-sh-1);
}
.btn-primary:hover { background: var(--okk-accent-hover); border-color: var(--okk-accent-hover); }
.btn-secondary {
  background: var(--okk-surface);
  color: var(--okk-text);
  border: 1px solid var(--okk-border-strong);
}
.btn-secondary:hover { background: var(--okk-hover); }
.btn-ghost { background: transparent; color: var(--okk-text-2); border-color: transparent; }
.btn-ghost:hover { background: var(--okk-hover); color: var(--okk-text); }

/* ---- Badges / pills ---- */
.badge {
  border-radius: var(--okk-r-full);
  font-weight: 600;
}

/* ---- Tables ---- */
table thead th, .table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--okk-text-3);
}
table tbody td, .table td {
  border-top: 1px solid var(--okk-border-soft);
}
table tbody tr:hover, .table tbody tr:hover { background: var(--okk-hover); }

/* ---- Page title ---- */
#main-content h1,
.page-title,
.page-header h1 {
  font-weight: 300;
  letter-spacing: -0.015em;
  color: var(--okk-text);
}

/* ---- Inputs (generic) ---- */
.input, input.input, select.input {
  border-radius: var(--okk-r-sm);
  border: 1px solid var(--okk-border-strong);
}
.input:focus { border-color: var(--okk-accent); box-shadow: 0 0 0 3px var(--okk-accent-ring); outline: none; }

/* ---- Widget header (card head) — okk-v1 ---- */
.widget-header { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; }
.widget-icon {
  width: 34px; height: 34px; border-radius: var(--okk-r-sm);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: var(--okk-surface-3); color: var(--okk-text-2);
}
.widget-icon svg { width: 18px; height: 18px; }
.widget-icon-primary { background: var(--okk-accent-soft); color: var(--okk-accent); }
.widget-icon-success { background: var(--okk-good-soft); color: var(--okk-good); }
.widget-icon-warning { background: var(--okk-warn-soft); color: var(--okk-warn); }
.widget-icon-info    { background: var(--okk-info-soft); color: var(--okk-info); }
.widget-icon-danger  { background: var(--okk-bad-soft);  color: var(--okk-bad); }
.widget-title { font-size: 15px; font-weight: 600; color: var(--okk-text); letter-spacing: -0.01em; }
.widget-subtitle { font-size: 12.5px; color: var(--okk-text-3); }

/* ---- Index / stat tiles (Статистика звонков, Сводный индекс) ---- */
.idx-widget.card { padding: var(--okk-card-pad, 20px); }
.idx-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 6px; border-radius: var(--okk-r-md); background: transparent;
}

/* «Статистика звонков»: контейнер — прозрачная секция, плитки — карточки как KPI */
#dashboard-call-stats .idx-widget.card,
#dept-call-stats .idx-widget.card,
#employee-call-stats .idx-widget.card {
  background: transparent; border: none; box-shadow: none; padding: 0;
}
#dashboard-call-stats .idx-widget.card .widget-header,
#dept-call-stats .idx-widget.card .widget-header,
#employee-call-stats .idx-widget.card .widget-header { padding: 0 2px; }
.idx-grid-call-stats { gap: var(--okk-gap, 16px) !important; }
.idx-grid-call-stats .idx-card {
  background: var(--okk-surface);
  border: 1px solid var(--okk-border);
  border-radius: var(--okk-r-lg);
  box-shadow: var(--okk-sh-1);
  padding: 18px 14px;
}

/* Плитки «Статистики» как KPI-карточки (чип + число + спарклайн) — шире, 3 в ряд */
.idx-grid-call-stats { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
@media (max-width: 900px) { .idx-grid-call-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
@media (max-width: 560px) { .idx-grid-call-stats { grid-template-columns: 1fr !important; } }
.idx-stat-card { text-align: left; }
.idx-stat-card .kpi-top { align-items: center; }
.idx-stat-card .kpi-id { align-items: center; }
.idx-stat-card .kpi-chip { align-self: center; }
.idx-stat-card .kpi-label { flex: 1; min-width: 0; }
.idx-stat-label { white-space: normal; overflow: visible; text-overflow: clip; font-size: 10px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--okk-text-3); line-height: 1.25; }
.idx-stat-label .idx-label-stack { display: flex; flex-wrap: wrap; column-gap: .35em; row-gap: 1px; }
.idx-stat-label .idx-label-stack-secondary { color: var(--okk-text-3); font-weight: 600; margin-left: 0; }
.idx-stat-label-single { display: inline-block; white-space: nowrap; }
/* числа выравниваются по низу карточки — ряд ровный, не кривой */
.metric-card-large.idx-stat-card { justify-content: space-between; min-height: 126px; }
.idx-stat-card .kpi-id { align-items: center; }
/* одинаковый размер числа во всех плитках */
.idx-stat-num { font-size: 38px; font-weight: 300; letter-spacing: -0.02em; line-height: 1; }
.idx-stat-ratio { display: inline-flex; flex-direction: row; align-items: baseline; gap: 5px; font-size: 38px; }
.idx-stat-ratio .idx-ratio-sec { font-size: 20px; font-weight: 400; color: var(--okk-text-3); }
.idx-stat-text { font-size: 22px; font-weight: 600; color: var(--okk-text-3); }
.idx-stat-card .kpi-spark { align-self: flex-end; }
.idx-counter-value {
  font-size: 30px; font-weight: 300; line-height: 1;
  letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
}
.idx-label-with-tooltip, .idx-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--okk-text-3);
  display: inline-flex; align-items: center; gap: 4px; text-align: center;
}
/* «Сводный индекс» — сетка auto-fit как в макете (не трогаем idx-grid-3/4) */
.idx-grid:not(.idx-grid-3):not(.idx-grid-4) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 12px;
  align-items: end;
}
/* «Требуют разбора» — строки как в макете */
.okk-alert-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--okk-r-full); font-size: 12px; font-weight: 700; color: var(--okk-bad); background: var(--okk-bad-soft); }
.okk-alert-row { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--okk-r-sm); cursor: pointer; transition: background .12s; }
.okk-alert-row:hover { background: var(--okk-hover); }
.okk-alert-score { width: 36px; height: 36px; border-radius: 9px; background: var(--okk-bad-soft); color: var(--okk-bad); display: flex; align-items: center; justify-content: center; flex: none; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.okk-alert-body { flex: 1; min-width: 0; }
.okk-alert-topic { font-size: 13px; font-weight: 600; color: var(--okk-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.okk-alert-meta { font-size: 11.5px; color: var(--okk-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.okk-alert-chev { color: var(--okk-text-3); flex: none; }
.okk-alert-empty { padding: 22px; text-align: center; color: var(--okk-text-3); font-size: 13.5px; }
.okk-alert-hint { padding: 8px 12px 2px; color: var(--okk-text-3); font-size: 11.5px; text-align: right; }
.okk-alert-pagination { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px; padding: 12px 12px 2px; border-top: 1px solid var(--okk-border); }
.okk-alert-pagination.is-loading { opacity: .6; pointer-events: none; }
.okk-alert-pages { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; }
.okk-alert-page-status { color: var(--okk-text-3); font-size: 11.5px; white-space: nowrap; }
.okk-alert-pagination .btn[disabled] { opacity: .45; cursor: not-allowed; }

@media (max-width: 640px) {
  .okk-alert-pagination { grid-template-columns: 1fr 1fr; }
  .okk-alert-pages { grid-column: 1 / -1; grid-row: 1; flex-wrap: wrap; }
  .okk-alert-page-status { grid-column: 1 / -1; grid-row: 2; text-align: center; }
  .okk-alert-pagination > .btn:first-child { grid-column: 1; grid-row: 3; }
  .okk-alert-pagination > .btn:last-child { grid-column: 2; grid-row: 3; }
}

/* Settings use the available desktop width instead of squeezing long operational labels. */
.general-container { max-width: none; }
.settings-section {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(320px, 1.2fr);
  justify-content: initial;
  gap: 32px;
}
.settings-section .section-content,
.settings-section .settings-textarea-wrapper { min-width: 0; width: 100%; }

/* ---- Calls journal — okk-v1 ---- */
.calls-page {
  max-width: 1480px;
  margin: 0 auto;
}
.calls-page > #calls-breadcrumbs nav,
#settings-breadcrumbs nav { margin-bottom: 0; }
.calls-page-head { align-items: flex-end; }
.calls-page-head .page-title { font-size: 27px; font-weight: 300; }
.calls-page-head .page-sub { margin-top: 3px; }
.calls-primary-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
}
.calls-filter-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: var(--okk-text-3);
}
.calls-primary-filter-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.calls-filter-select {
  width: auto;
  min-width: 176px;
  height: 42px;
  padding: 0 38px 0 13px;
  border-color: var(--okk-border-strong);
  border-radius: var(--okk-r-sm);
  background-color: var(--okk-surface);
}
.calls-period-filter {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--okk-r-sm);
  background: var(--okk-surface-3);
  color: var(--okk-text-3);
  font-size: 12.5px;
  white-space: nowrap;
}
.calls-period-filter strong {
  color: var(--okk-text-2);
  font-weight: 600;
}
.calls-table-card { overflow: visible; }
.calls-table-toolbar {
  padding: 16px 18px !important;
  border-color: var(--okk-border) !important;
}
.calls-table-toolbar .widget-icon {
  background: var(--okk-accent-soft);
  color: var(--okk-accent);
}
.calls-table-actions .input {
  height: 36px;
  border-color: var(--okk-border-strong);
  border-radius: var(--okk-r-sm);
  background: var(--okk-surface);
  font-size: 12.5px;
  line-height: 1.2;
}
.calls-table-actions select.input { padding-top: 0; padding-bottom: 0; }
.calls-table-actions input.input { padding-top: 0; padding-bottom: 0; }
.calls-table-card > .border-b:nth-child(2) {
  background: var(--okk-surface-2) !important;
  border-color: var(--okk-border-soft) !important;
}
.calls-table-scroll { border-radius: 0; }
.calls-table-card .table { min-width: 1120px; }
.calls-table-card .table thead { background: var(--okk-surface); }
.calls-table-card .table th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--okk-border-soft);
  color: var(--okk-text-3);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.calls-table-card .table td {
  padding: 12px 14px !important;
  border-color: var(--okk-border-soft);
  vertical-align: middle;
}
.calls-table-card .call-row:hover { background: var(--okk-hover) !important; }
.calls-score-cell {
  display: inline-grid;
  grid-template-columns: 28px 58px;
  align-items: center;
  gap: 8px;
  min-width: 94px;
  font-variant-numeric: tabular-nums;
}
.calls-score-value { font-size: 13.5px; font-weight: 700; }
.calls-score-track {
  display: block;
  width: 58px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--okk-surface-3);
}
.calls-score-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
}
/* ---- Settings — okk-v1 ---- */
.settings-page {
  max-width: 1480px;
  padding: 24px;
  margin: 0 auto;
}
.settings-header { margin-bottom: 18px; }
.settings-title {
  margin-bottom: 3px;
  color: var(--okk-text);
  font-size: 27px;
  font-weight: 300;
  letter-spacing: -.015em;
}
.settings-subtitle { color: var(--okk-text-3); font-size: 13.5px; }
.settings-tabs {
  display: flex;
  width: 100%;
  gap: 2px;
  padding: 0;
  margin-bottom: 20px;
  overflow-x: auto;
  border-bottom: 1px solid var(--okk-border);
  border-radius: 0;
  background: transparent;
  scrollbar-width: thin;
}
.settings-tab {
  position: relative;
  flex: 0 0 auto;
  height: 44px;
  padding: 0 14px;
  border-radius: 0;
  color: var(--okk-text-2);
  font-size: 13.5px;
  font-weight: 550;
}
.settings-tab:hover { color: var(--okk-text); background: transparent; }
.settings-tab.active {
  color: var(--okk-accent);
  background: transparent;
  box-shadow: none;
}
.settings-tab.active::after {
  content: '';
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 2px;
  border-radius: 2px;
  background: var(--okk-accent);
}
.settings-tab svg { width: 17px; height: 17px; }
.settings-tab.active svg { color: var(--okk-accent); }
.settings-content {
  min-height: 500px;
  overflow: visible;
  border: 1px solid var(--okk-border);
  border-radius: var(--okk-r-lg);
  background: var(--okk-surface);
  box-shadow: var(--okk-sh-1);
}
.general-container { max-width: none; padding: 20px; }
.general-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 0;
}
.general-header-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: var(--okk-r-sm);
  background: var(--okk-accent-soft);
  color: var(--okk-accent);
}
.general-header-icon svg { width: 18px; height: 18px; }
.general-header h2 { font-size: 16px; font-weight: 650; }
.general-header p { margin-top: 2px; color: var(--okk-text-3); font-size: 12.5px; }
.settings-sections { gap: 0; }
.settings-section {
  display: grid;
  grid-template-columns: minmax(260px, .95fr) minmax(320px, 1.05fr);
  align-items: start;
  gap: 32px;
  padding: 20px 0;
  border-top: 1px solid var(--okk-border-soft);
  border-radius: 0;
  background: transparent;
}
.settings-section .section-header h3 { color: var(--okk-text); font-size: 14px; font-weight: 600; }
.settings-section .section-header p {
  max-width: 500px;
  margin-top: 3px;
  color: var(--okk-text-3);
  font-size: 12.5px;
  line-height: 1.45;
}
.settings-section .section-content { justify-self: stretch; }
.settings-section .settings-input,
.settings-section .settings-select,
.settings-section .settings-month-input,
.settings-section .settings-textarea {
  border-color: var(--okk-border-strong);
  border-radius: var(--okk-r-sm);
  background: var(--okk-surface);
}
.settings-section .settings-input:focus,
.settings-section .settings-select:focus,
.settings-section .settings-month-input:focus,
.settings-section .settings-textarea:focus {
  border-color: var(--okk-accent);
  box-shadow: 0 0 0 3px var(--okk-accent-ring);
}
.settings-section-actions {
  display: flex;
  grid-template-columns: none;
  justify-content: flex-end;
  padding-top: 18px;
  border-top: 1px solid var(--okk-border-soft);
}

.idx-gauge-values { font-variant-numeric: tabular-nums; font-size: 14px; }
.idx-gauge-fact { font-weight: 700; }
.idx-gauge-plan { color: var(--okk-text-3); font-weight: 500; }
.idx-donut + .idx-label-with-tooltip { margin-top: 2px; }

/* ---- Settings: narrow screens ---- */
@media (max-width: 640px) {
  .calls-primary-filters {
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

  .calls-filter-icon { display: none; }

  .calls-primary-filter-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .calls-filter-select,
  .calls-period-filter {
    width: 100%;
    min-width: 0;
  }

  .calls-period-filter {
    justify-content: space-between;
    margin-left: 0;
  }

  .calls-table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .calls-table-toolbar > .widget-header {
    flex-direction: row !important;
    align-items: center !important;
    padding: 0 !important;
  }

  .calls-table-actions,
  .calls-table-filters,
  .calls-table-manual-tag,
  .calls-bulk-actions {
    width: 100%;
    min-width: 0;
    align-items: stretch;
    justify-content: flex-start;
  }

  .calls-table-actions,
  .calls-table-filters,
  .calls-bulk-actions {
    flex-direction: column;
  }

  .calls-table-manual-tag > *,
  .calls-table-filters > *,
  .calls-bulk-actions > *,
  #filter-manual-tag,
  #filter-scenario,
  #calls-bulk-action,
  #calls-bulk-tag-value {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100%;
  }

  .calls-table-scroll {
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .settings-page {
    padding: 18px 14px;
    max-width: 100%;
  }

  .settings-header {
    margin-bottom: 18px;
  }

  .settings-tabs {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .settings-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .settings-content {
    overflow: hidden;
  }

  .employees-container {
    padding: 18px;
  }

  .employees-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .employees-header .btn {
    width: 100%;
    justify-content: center;
  }

  .employees-departments {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .employees-dept-section,
  .employee-card,
  .employee-info {
    min-width: 0;
  }

  .employee-actions {
    opacity: 1;
  }

  .general-container {
    padding: 18px;
  }

  .settings-section {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 14px;
    padding: 16px;
  }

  .section-header,
  .section-content,
  .settings-textarea-wrapper {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .section-header p {
    max-width: none;
  }

  .settings-select,
  .settings-month-input,
  .settings-textarea {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .settings-textarea-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .checkbox-setting > div {
    min-width: 0;
  }

  #openrouter-balance-widget,
  #openrouter-balance-widget > div {
    max-width: 100%;
  }

  #openrouter-balance-widget > div {
    flex-wrap: wrap;
  }

  .settings-section-actions {
    align-items: stretch;
  }

  .settings-section-actions .btn {
    width: 100%;
  }
}
