/* EKOS v1.0. Loaded after Compass styles; one shell for every role. */
:root {
  --ekos-header-bg: #26313A;
  --ekos-sidebar-bg: #2D3A42;
  --ekos-accent: #5A7D7D;
  --ekos-canvas-bg: #F4F6F7;
  --ekos-surface: #FFFFFF;
  --ekos-text: #20313B;
  --ekos-text-secondary: #52636C;
  --ekos-border: #DCE4E6;
  --ekos-hover: #EFF3F3;
  --ekos-focus-ring: #1D6E73;
  --ekos-positive-text: #246B51;
  --ekos-warning-text: #906100;
  --ekos-negative-text: #B13E38;
  --ekos-selected-check: #5A9F4C;
  --ekos-sidebar-width: 224px;
  --bg: var(--ekos-canvas-bg);
  --surface: var(--ekos-surface);
  --ink: var(--ekos-text);
  --muted: var(--ekos-text-secondary);
  --brand: var(--ekos-accent);
  --brand-soft: var(--ekos-hover);
  --border: var(--ekos-border);
  --danger: var(--ekos-negative-text);
  --ok: var(--ekos-positive-text);
  --topbar-height: 48px;
  --sg-bg: var(--ekos-canvas-bg);
  --sg-card: var(--ekos-surface);
  --sg-line: var(--ekos-border);
  --sg-text: var(--ekos-text);
  --sg-text-2: var(--ekos-text-secondary);
  --sg-acc: var(--ekos-accent);
  --sg-acc-text: var(--ekos-text);
  --sg-acc-soft: var(--ekos-hover);
  --sg-r-card: 12px;
  --sg-r-stat: 12px;
}
.ekos { font-size: 16px; line-height: 1.5; }
.ekos :focus-visible { outline: 3px solid var(--ekos-focus-ring); outline-offset: 3px; }
.ekos .topbar :focus-visible, .ekos-sidebar :focus-visible { outline-color: var(--ekos-surface); outline-offset: -3px; }
.ekos-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.ekos-skip { position: fixed; left: 8px; top: -80px; z-index: 100; padding: 8px; background: var(--ekos-surface); }
.ekos-skip:focus { top: 0; }
.ekos .topbar {
  height: calc(48px + env(safe-area-inset-top)); min-height: 48px;
  padding: env(safe-area-inset-top) 8px 0; gap: 0;
  background: var(--ekos-header-bg); box-shadow: none;
  display: flex; flex-direction: row; z-index: 30;
}
.ekos .topbar-brand { display: flex; align-items: center; gap: 8px; padding: 0 4px; height: 44px; background: transparent; border-radius: 8px; }
.ekos .topbar-brand strong { font-size: 16px; }
.ekos .topbar-mark { display: block; width: 28px; height: 28px; padding: 3px; border: 0; background: var(--ekos-accent); }
.ekos .topbar-actions { gap: 0; flex: 0 0 auto; margin-left: auto; }
.ekos .icon-btn { width: 44px; height: 44px; min-width: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; }
.ekos .icon-btn:hover { background: var(--ekos-accent); }
.ekos-popover { position: absolute; top: calc(48px + env(safe-area-inset-top)); width: 264px; max-width: calc(100vw - 16px); padding: 8px; background: var(--ekos-surface); color: var(--ekos-text); border: 1px solid var(--ekos-border); border-radius: 12px; box-shadow: 0 12px 32px #20313B26; }
#moduleMenu { left: 8px; }
#profileMenu { right: 8px; }
.ekos-popover strong { display: block; padding: 8px 12px; font-size: 14px; }
.ekos-popover button { width: 100%; min-height: 48px; background: transparent; color: var(--ekos-text); text-align: left; display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; font-weight: 500; }
.ekos-popover button:hover { background: var(--ekos-hover); }
#currentModule { justify-content: flex-start; gap: 12px; }
#currentModule > .ekos-module-check { color: var(--ekos-selected-check); font-size: 24px; margin-left: auto; }
#logoutBtn { border-top: 1px solid var(--ekos-border); border-radius: 0; color: var(--ekos-negative-text); }
.ekos-sidebar { position: fixed; top: calc(48px + env(safe-area-inset-top)); bottom: 0; left: 0; width: var(--ekos-sidebar-width); background: var(--ekos-sidebar-bg); color: var(--ekos-surface); z-index: 20; display: flex; flex-direction: column; overscroll-behavior: contain; }
.ekos-nav-backdrop { position: fixed; inset: 48px 0 0; z-index: 19; background: #20313B66; }
.ekos-sidebar-title { padding: 24px 16px 12px; font-size: 14px; white-space: nowrap; }
.ekos .tabs { display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 4px; padding: 8px; margin: 0; overflow-y: auto; min-width: 0; min-height: 0; max-height: none; max-width: none; width: 100%; position: static; background: transparent; box-shadow: none; border: 0; border-radius: 0; }
.ekos .tabs > button { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 12px; text-align: left; padding: 8px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ekos-surface); font-size: 16px; font-weight: 400; white-space: normal; }
.ekos .tabs > button svg { flex-shrink: 0; }
.ekos .tabs > button:hover { background: var(--ekos-header-bg); }
.ekos .tabs > button.active { background: var(--ekos-accent); font-weight: 600; }
.ekos .mode-switch { display: flex; flex: 0 0 auto; flex-direction: column; width: 100%; margin: 0 0 16px; border: 1px solid var(--ekos-accent); background: transparent; border-radius: 8px; }
.ekos .mode-switch .mode-option { flex: 0 0 auto; min-height: 44px; white-space: normal; font-size: 14px; color: var(--ekos-surface); background: transparent; }
.ekos .mode-switch .mode-option.is-active { background: var(--ekos-accent); color: var(--ekos-surface); }
.ekos .mode-option svg { display: none; }
.ekos-sidebar-footer { margin-top: auto; padding: 16px 8px; display: flex; gap: 8px; flex-wrap: wrap; font-size: 14px; }
#shellContext { width: 100%; overflow-wrap: anywhere; }
.ekos-sidebar-footer button { min-height: 44px; background: transparent; color: inherit; padding: 8px; font-size: 14px; }
#sidebarCollapse { width: 44px; font-size: 24px; }
#sidebarResize { position: absolute; top: 0; right: -4px; bottom: 0; width: 8px; cursor: col-resize; touch-action: none; }
#sidebarResize:hover, #sidebarResize:focus { background: var(--ekos-accent); }
.ekos-sidebar.is-collapsed .ekos-nav-label, .ekos-sidebar.is-collapsed .ekos-sidebar-title, .ekos-sidebar.is-collapsed #shellContext, .ekos-sidebar.is-collapsed #sidebarReset { display: none; }
.ekos-sidebar.is-collapsed .tabs > button { padding: 12px; }
.ekos-sidebar.is-collapsed .mode-option { padding: 12px; display: flex; justify-content: center; }
.ekos-sidebar.is-collapsed .mode-option span { display: none; }
.ekos-sidebar.is-collapsed .mode-option svg { display: block; }
.ekos main { max-width: none; width: auto; padding: 24px; margin: 0; min-width: 0; }
.ekos-signed-in main { margin-left: var(--ekos-sidebar-width); }
.ekos-page-context { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; color: var(--ekos-text-secondary); font-size: 14px; }
.ekos #navToggle { display: none; color: var(--ekos-text); }
.ekos #content { min-width: 0; overflow-wrap: anywhere; }
.ekos #content .sg-screen, .ekos #content .sg-desk, .ekos #content .sg-page { max-width: none; width: 100%; font-size: 16px; }
.ekos #content :is(.sg-screen, .sg-desk, .sg-page) { margin: 0; }
.ekos #content .sg-desk-title, .ekos #content h1 { font-size: 26px; font-weight: 650; line-height: 1.25; }
.ekos #content .sg-trainee-name { font-size: 26px; font-weight: 650; }
.ekos #content h3 { font-size: 18px; }
.ekos #content .sg-desk-sub, .ekos #content .sg-subtitle, .ekos #content .sg-trainee-meta, .ekos #content .sg-desk-foot, .ekos #content .sg-desk-hint { font-size: 14px; }
.ekos #content .card, .ekos #content .sg-panel, .ekos #content .sg-path-card, .ekos #content .sg-mentor-card { border-radius: 12px; padding: 24px; box-shadow: none; }
.ekos #content button, .ekos dialog button { min-height: 44px; }
.ekos #content input:not([type=checkbox]):not([type=radio]), .ekos #content select { min-height: 44px; max-width: 100%; font-size: 16px; }
.ekos #content textarea { max-width: 100%; font-size: 16px; }
.ekos #content label { font-size: 16px; }
.ekos #content .sg-btn, .ekos #content .sg-chip-filter, .ekos #content .sg-desk-back { font-size: 14px; }
.ekos #content .sg-table-wrap { max-width: 100%; overflow-x: auto; }
.ekos #content .sg-card-grid { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 24px; }
.ekos #content .sg-card-grid > * { min-width: 0; }
.ekos #content .sg-path-card { border-top: 3px solid var(--ekos-accent); }
.ekos #content .sg-header { background: var(--ekos-surface); border: 1px solid var(--ekos-border); padding: 0 0 24px; border-width: 0 0 1px; border-radius: 0; margin-bottom: 24px; }
.ekos #content .sg-header-name { font-size: 26px; font-weight: 650; color: var(--ekos-text); }
.ekos #content .sg-header-role { font-size: 14px; color: var(--ekos-text-secondary); opacity: 1; }
.ekos #content .sg-panel-title { font-size: 18px; }
.ekos #content :is(.sg-path-card-head span, .sg-mentor-info strong, .sg-mentor-info span, .sg-progress-row, .sg-block-count, .sg-block-reason, .sg-day-badge, .sg-state, .sg-list-card .sg-list-sub) { font-size: 14px; }
.ekos #content :is(.sg-path-label, .sg-path-meta, .sg-mentor-name, .sg-mentor-role, .sg-list-title, .sg-list-meta, .sg-step-label, .sg-step-meta, .sg-block-title, .sg-block-sub, .sg-alert-head, .sg-eyebrow, .sg-today-title, .sg-welcome, .sg-sub, .sg-chip, .sg-help-text) { font-size: 14px; }
.ekos #content form.card { max-width: none; margin: 24px 0; }
.ekos #content form.card > h3 { padding-bottom: 16px; border-bottom: 1px solid var(--ekos-border); }
.ekos #content .ql-toolbar { display: flex; flex-wrap: wrap; }
.ekos #content .ql-editor { min-height: 200px; font-size: 16px; line-height: 1.6; }
.ekos #content .row-actions { flex-wrap: wrap; }
.ekos dialog { max-width: min(960px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 24px; border: 1px solid var(--ekos-border); border-radius: 12px; }
.ekos dialog::backdrop { background: #20313B66; }
.ekos #shellDialog { width: 560px; }
.ekos #shellDialog h2 { padding-right: 24px; }
.ekos [hidden], .ekos .hidden { display: none !important; }
@media (max-width: 1023px) {
  .ekos main { padding: 16px; }
  .ekos #content .sg-card-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .ekos-signed-in main { margin-left: 0; }
  .ekos-sidebar { width: min(300px, calc(100vw - 32px)); box-shadow: 8px 0 24px #20313B26; display: none; }
  .ekos-sidebar:has(.nav-open) { display: flex; }
  .ekos .tabs { display: flex; }
  .ekos #navToggle:not(.hidden) { display: flex; }
  .ekos-page-context { margin-bottom: 16px; }
  #sidebarResize, .ekos-sidebar-footer button { display: none; }
  .ekos-sidebar.is-collapsed .ekos-nav-label, .ekos-sidebar.is-collapsed .ekos-sidebar-title, .ekos-sidebar.is-collapsed #shellContext { display: block; }
  .ekos-sidebar.is-collapsed .mode-option { font-size: 14px; padding: 8px; }
  .ekos-sidebar.is-collapsed .mode-option span { display: block; }
  .ekos-sidebar.is-collapsed .mode-option svg { display: none; }
  .ekos #content .card, .ekos #content .sg-panel, .ekos #content .sg-path-card, .ekos #content .sg-mentor-card { padding: 16px; }
  .ekos #content .sg-step-card { margin-left: 40px; min-width: 0; flex-wrap: wrap; }
  .ekos #content .sg-desk-head { gap: 12px; }
  .ekos #content .sg-desk-head > div { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .ekos *, .ekos *::before, .ekos *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* One workspace grid; account fields retain the same columns across every row. */
.ekos #content[data-ekos-screen="users"] > :is(form.card, section.card) { width: 100%; max-width: none; }
.ekos #content[data-ekos-screen="users"] .account-row:not(.roster-row-edit) { display: grid; grid-template-columns: minmax(140px,1.3fr) minmax(100px,1fr) minmax(90px,.8fr) minmax(110px,1fr) minmax(150px,1fr) 120px 96px; gap: 16px; padding: 16px; align-items: center; white-space: normal; overflow: visible; }
.ekos #content[data-ekos-screen="users"] .account-row > * { min-width: 0; }
.ekos #content[data-ekos-screen="users"] .account-row .account-name { max-width: none; min-width: 0; white-space: normal; overflow: visible; overflow-wrap: anywhere; }
.ekos #content[data-ekos-screen="users"] .account-row > .muted { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
.ekos #content .account-contacts { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; line-height: 1.5; }
.ekos #content .account-contacts a { display: inline-flex; align-items: center; min-height: 44px; }
.ekos #content .account-no-contacts { color: var(--ekos-text-secondary); }
.ekos #content .account-status { justify-self: start; white-space: normal; }
.ekos #content[data-ekos-screen="users"] .account-actions { display: flex; flex-wrap: nowrap; gap: 8px; margin-left: 0; justify-content: flex-end; }
.ekos #content .account-actions button { flex: 0 0 44px; width: 44px; }
.ekos #createUserForm .inline-form > .check-row { display: flex; align-items: center; align-self: end; flex: 0 0 auto; min-height: 44px; }
@media (max-width: 1399px) {
 .ekos #content[data-ekos-screen="users"] .account-row:not(.roster-row-edit) { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 96px; }
 .ekos #content .account-name { grid-column: 1 / 3; }
 .ekos #content .account-login { grid-column: 1; }
 .ekos #content .account-role { grid-column: 2; }
 .ekos #content .account-location { grid-column: 1; }
 .ekos #content .account-contacts { grid-column: 2; grid-row: 3 / 5; }
 .ekos #content .account-status { grid-column: 1; }
 .ekos #content .account-actions { grid-column: 3; grid-row: 1; }
}
@media (max-width: 767px) {
 .ekos #content[data-ekos-screen="users"] .account-row:not(.roster-row-edit) { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
 .ekos #content[data-ekos-screen="users"] .account-row:not(.roster-row-edit) > * { grid-column: 1 / -1; grid-row: auto; }
 .ekos #content[data-ekos-screen="users"] .account-row .account-role, .ekos #content[data-ekos-screen="users"] .account-row .account-status { grid-column: 1; }
 .ekos #content[data-ekos-screen="users"] .account-row .account-location, .ekos #content[data-ekos-screen="users"] .account-row .account-actions { grid-column: 2; }
 .ekos #content .account-row [data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--ekos-text-secondary); margin-bottom: 4px; }
 .ekos #content .account-actions { justify-content: flex-start; }
 .ekos #content .account-actions:empty { display: none; }
 .ekos #content .account-contacts { gap: 4px; }
}

/* Phone lists keep the employee, status and action together instead of crushing columns. */
@media (max-width: 767px) {
 .ekos #content :is(.sg-table-control, .sg-table-team) { display: block; }
 .ekos #content :is(.sg-table-control, .sg-table-team) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
 .ekos #content :is(.sg-table-control, .sg-table-team) tbody { display: block; }
 .ekos #content :is(.sg-table-control, .sg-table-team) tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 16px; border-bottom: 1px solid var(--ekos-border); }
 .ekos #content :is(.sg-table-control, .sg-table-team) tbody tr:last-child { border-bottom: 0; }
 .ekos #content :is(.sg-table-control, .sg-table-team) td { width: auto; padding: 0; border: 0; min-width: 0; }
 .ekos #content :is(.sg-table-control, .sg-table-team) td:first-child { grid-column: 1; }
 .ekos #content :is(.sg-table-control, .sg-table-team) td:last-child { grid-column: 2; grid-row: 1 / 4; align-self: center; }
 .ekos #content .sg-table-control td:nth-child(4)::before { content: 'Прогресс: '; color: var(--ekos-text-secondary); }
 .ekos #content .sg-table-control td:nth-child(4), .ekos #content .sg-table-control td:nth-child(5), .ekos #content .sg-table-team td:nth-child(4) { grid-column: 1; }
}

/* Shared page rhythm, including the legacy learning and employee screens. */
.ekos #content .section-title { margin: 0 0 24px; }
.ekos #content .sg-header { background: transparent; }
.ekos #content[data-ekos-screen="training-editor"] > :is(form.card, section.card) { width: 100%; margin: 0 0 24px; }
.ekos #content[data-ekos-screen="training-editor"] form.card { gap: 16px; }
.ekos #content[data-ekos-screen="training-editor"] :is(form.card, section.card) > :is(h3,p) { margin: 0; }
.ekos #content[data-ekos-screen="training-editor"] .inline-form { gap: 16px; }
.ekos #content .contacts { flex-wrap: wrap; min-width: 0; max-width: 100%; gap: 8px; }
.ekos #content .contact-chip { min-width: 44px; min-height: 44px; flex-shrink: 0; }
.ekos #content .contact-chip[aria-label="Telegram"] { width: auto; height: auto; padding: 8px; white-space: normal; overflow-wrap: anywhere; }
.ekos #content .contact-missing { color: var(--ekos-text-secondary); white-space: normal; }
.ekos #content .sg-mentor-card { flex-wrap: wrap; }
.ekos #content .sg-mentor-info { min-width: 0; }
.ekos #content .sg-tiles { gap: 12px; }
@media (min-width: 1100px) {
 .ekos #content .sg-tiles { grid-template-columns: repeat(5,minmax(0,1fr)); }
}
@media (max-width: 767px) {
 .ekos #content .sg-tiles { grid-template-columns: repeat(2,minmax(0,1fr)); }
 .ekos #content .sg-tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }
 .ekos #content[data-ekos-screen="training-editor"] > :is(form.card,section.card) { margin-bottom: 16px; }
 .ekos #content[data-ekos-screen="training-editor"] .inline-form { display: grid; grid-template-columns: minmax(0,1fr); }
 .ekos #content[data-ekos-screen="training-editor"] .inline-form button { width: 100%; }
 .ekos #content .sg-mentor-card .contact-missing { width: 100%; }
}

/* The route editor's input style must not turn a learner's title into a field. */
.ekos #content div.sg-step-title { border: 0; border-radius: 0; padding: 0; background: transparent; font-size: 16px; font-weight: 600; }
.ekos #content :is(.section-title h2, .sg-title) { font-size: 26px; font-weight: 650; line-height: 1.25; }
/* Source employee-card details use the same reading rhythm as route panels. */
.sg-incomplete ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.sg-incomplete li { display: grid; gap: 6px; min-width: 0; }
.sg-incomplete-meta { color: var(--sg-muted, #667780); font-size: 14px; overflow-wrap: anywhere; }
.sg-incomplete a { overflow-wrap: anywhere; }
.sg-desk-head { flex-wrap: wrap; }
#newRegulationPlacements { display: grid; gap: 12px; }
#newRegulationPlacements select { max-width: 100%; }
.humor-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.humor-actions button { min-height: 44px; }
/* Keep the format name readable when the editor toolbar wraps on phones. */
.ql-toolbar .ql-picker.ql-header { width: 140px; }
.ql-toolbar .ql-picker-label { white-space: nowrap; }
