:root {
  --bg: #111315;
  --panel: #1b1e22;
  --panel-strong: #23272c;
  --text: #f5f5f5;
  --muted: #a5abb2;
  --line: #353a41;
  --brand: #c8a15a;
  --brand-dark: #e2bd73;
  --accent: #c8a15a;
  --danger: #d64545;
  --ok: #2eaf5d;
  --warning: #f0a500;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

:root[data-theme="light"] {
  --bg: #f1f3f5;
  --panel: #ffffff;
  --panel-strong: #f6f7f8;
  --text: #1d2329;
  --muted: #6b737c;
  --line: #d7dce1;
  --brand: #b88632;
  --brand-dark: #91651d;
  --accent: #b88632;
  --danger: #c43b3b;
  --ok: #23854a;
  --warning: #b87900;
  --shadow: 0 18px 50px rgba(39, 48, 58, 0.14);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 480px);
  align-items: center;
  gap: 48px;
  padding: 48px clamp(28px, 8vw, 140px);
  isolation: isolate;
  overflow: hidden;
  background: #050a0e;
}

.login-screen::before { content: ""; position: absolute; z-index: -2; inset: 0; background: url('/assets/horus-back.png') center / cover no-repeat; }
.login-screen::after { content: ""; position: absolute; z-index: -1; inset: 0; background: radial-gradient(circle at 7% 77%, rgba(255, 220, 142, 0.3) 0%, rgba(255, 194, 92, 0.12) 5%, transparent 18%), linear-gradient(90deg, rgba(5, 10, 14, 0.08), rgba(5, 10, 14, 0.76)); pointer-events: none; }
.login-screen > * { position: relative; z-index: 1; }

.login-brand { position: relative; display: flex; justify-content: center; align-items: center; overflow: visible; transform: translate(9%, -7%); }
.login-brand img { position: relative; z-index: 1; }
.login-brand img { width: min(620px, 94%); max-height: 340px; object-fit: contain; mix-blend-mode: screen; }
.login-panel { width: 100%; max-width: 420px; padding: 38px; border: 1px solid rgba(226, 189, 115, 0.35); border-radius: 8px; background: rgba(13, 17, 20, 0.84); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36); backdrop-filter: blur(10px); }
.login-eyebrow { margin-bottom: 12px; color: var(--brand-dark); font-size: 12px; font-weight: 700; letter-spacing: 3px; }
.login-panel h1 { margin: 0; font-size: 30px; }
.login-subtitle { margin: 10px 0 28px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.login-subtitle .acronym-letter { color: rgba(226, 189, 115, 0.72); font-weight: 800; }
.login-form { display: grid; gap: 18px; }
.login-form label { display: grid; gap: 8px; }
.login-form label span { color: var(--muted); font-size: 13px; }
.login-form input { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 6px; background: rgba(27, 30, 34, 0.9); color: var(--text); padding: 0 13px; outline: none; }
.login-form input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(200, 161, 90, 0.14); }
.login-button { width: 100%; min-height: 46px; margin-top: 6px; }
.login-status { min-height: 18px; color: var(--muted); font-size: 13px; }
.login-status.error { color: var(--danger); }

.app-shell.is-hidden { display: none; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

.is-hidden { display: none !important; }

@media (max-width: 760px) {
  .login-screen { grid-template-columns: 1fr; gap: 18px; padding: 28px 20px; overflow-y: auto; }
  .login-brand { transform: none; }
  .login-brand img { width: min(420px, 84vw); max-height: 210px; }
  .login-panel { max-width: none; padding: 28px 22px; }
  .login-subtitle { font-size: 13px; white-space: normal; }
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #0d0f11;
  color: var(--text);
  padding: 24px 18px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  margin: -24px -18px 26px;
  padding: 8px 12px;
  background: #0d0f11;
  border-bottom: 1px solid rgba(200, 161, 90, 0.32);
}

.brand-logo { display: block; width: 228px; height: 72px; object-fit: contain; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #111315;
  border: 1px solid rgba(200, 161, 90, 0.42);
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-name {
  font-family: Orbitron, "Arial Narrow", "Segoe UI", sans-serif;
  letter-spacing: 2px;
  font-size: 24px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 2px;
  color: #8f969e;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.sidebar-user { position: fixed; left: 18px; bottom: 24px; width: 228px; z-index: 10; }
.user-button { display: grid; grid-template-columns: 28px 1fr 18px; align-items: center; width: 100%; min-height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); text-align: left; cursor: pointer; }
.user-button:hover, .user-button[aria-expanded="true"] { border-color: rgba(200, 161, 90, 0.55); background: rgba(200, 161, 90, 0.12); }
.user-icon { color: var(--brand-dark); font-size: 22px; line-height: 1; }
.user-button-name { font-size: 14px; font-weight: 600; }
.user-chevron { color: var(--muted); font-size: 16px; text-align: right; }
.user-menu { position: absolute; right: 0; bottom: calc(100% + 8px); left: 0; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-strong); box-shadow: var(--shadow); }
.user-menu-item { width: 100%; border: 0; border-radius: 6px; background: transparent; color: var(--text); padding: 10px 12px; text-align: left; cursor: pointer; }
.user-menu-item:hover { background: rgba(214, 69, 69, 0.14); color: #ffaaa5; }
.change-password-form { display: grid; gap: 8px; padding: 10px 6px 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.change-password-form label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.change-password-form input { width: 100%; min-width: 0; }
.change-password-actions { display: flex; gap: 6px; }
.change-password-actions button { flex: 1; padding: 8px 10px; }
.theme-switch-row { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 8px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.theme-switch-row::before { content: "Тема"; margin-right: auto; color: var(--muted); font-size: 13px; }
.theme-icon { color: var(--muted); font-size: 17px; line-height: 1; }
.theme-icon.active { color: var(--brand); }
.theme-switch { position: relative; width: 42px; height: 22px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: #111315; cursor: pointer; }
.theme-switch span { display: block; width: 16px; height: 16px; border-radius: 50%; background: #d5d9de; transition: transform 160ms ease, background 160ms ease; }
.theme-switch.active { background: #e4c47e; }
.theme-switch.active span { background: #fff8e7; transform: translateX(18px); }

.nav-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c8cdd2;
  text-align: left;
  cursor: pointer;
  padding: 0 12px;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(200, 161, 90, 0.12);
  color: #ffffff;
  box-shadow: inset 2px 0 0 var(--brand);
}

.nav-icon {
  font-size: 18px;
}

.main {
  min-width: 0;
  padding: 28px;
}

:root[data-theme="light"] .sidebar { background: #e6e9ec; color: var(--text); }
:root[data-theme="light"] .brand-mark { background: #f4f5f6; }
:root[data-theme="light"] .nav-item { color: #4e5761; }
:root[data-theme="light"] .nav-item:hover, :root[data-theme="light"] .nav-item.active { color: #252b31; }
:root[data-theme="light"] .login-screen { background: #050a0e; }
:root[data-theme="light"] .login-panel { background: rgba(13, 17, 20, 0.84); color: #f5f5f5; }
:root[data-theme="light"] .login-panel h1 { color: #f5f5f5; }
:root[data-theme="light"] .login-form input { background: rgba(27, 30, 34, 0.9); color: #f5f5f5; border-color: #353a41; color-scheme: dark; }
:root[data-theme="light"] .login-form input::placeholder { color: #a5abb2; }
:root[data-theme="light"] .primary-button { background: #d2a449; color: #241b0d; border-color: #c18e2d; box-shadow: 0 3px 10px rgba(180, 126, 30, 0.18); }
:root[data-theme="light"] .primary-button:hover { background: #b98525; color: #ffffff; border-color: #a87218; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: Orbitron, "Arial Narrow", "Segoe UI", sans-serif;
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
}

.status-pill,
.inline-status,
.panel-title span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--muted);
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.status-pill.ok,
.inline-status.ok {
  border-color: rgba(35, 122, 71, 0.28);
  color: var(--ok);
}

.status-pill.error,
.inline-status.error {
  border-color: rgba(157, 49, 40, 0.28);
  color: var(--danger);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.location-filter-bar { display: flex; align-items: flex-start; gap: 22px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-group { display: flex; align-items: flex-start; gap: 9px; flex-wrap: wrap; }
.filter-group-label { color: var(--muted); font-size: 12px; line-height: 36px; white-space: nowrap; }
.department-switcher { display: flex; flex-wrap: wrap; gap: 8px; }
.location-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.location-chip {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}

.location-chip:hover,
.location-chip.active {
  border-color: rgba(200, 161, 90, 0.5);
  background: rgba(200, 161, 90, 0.12);
  color: var(--brand-dark);
}

.department-chip { max-width: 260px; }

.users-layout { display: grid; grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr); gap: 16px; }
.users-layout > .form-panel { min-width: 0; }
.users-layout .action-bar { margin-top: 18px; }
.users-list { display: grid; gap: 10px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-strong); }
.user-row strong, .user-row small { display: block; }
.user-row small { margin-top: 4px; color: var(--muted); }
.user-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.user-row-main { min-width: 180px; flex: 1; }
.user-edit-panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); max-width: 700px; }
.access-grid { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 18px; padding: 12px 0; }
.access-grid strong { display: block; margin-bottom: 8px; font-size: 13px; }
.access-option { display: flex; gap: 7px; align-items: flex-start; margin: 7px 0; color: var(--muted); font-size: 13px; }
.access-option input[type="checkbox"] { width: 16px; height: 16px; min-height: 16px; flex: 0 0 16px; margin: 0; padding: 0; accent-color: var(--brand); }
.access-note { margin: 14px 0; color: var(--muted); font-size: 13px; }
.user-password-input { width: 150px; min-height: 36px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); padding: 0 9px; }
.danger-icon { color: var(--danger); }

#dashboardView > .kpi-grid,
#dashboardView > .section-header,
#dashboardView > .table-wrap { display: none; }

.pulse-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.pulse-head h2 { margin: 0 0 5px; font-size: 22px; }
.pulse-head p { margin: 0; color: var(--muted); font-size: 14px; }
.pulse-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 14px; margin-bottom: 14px; }
.pulse-grid-bottom { grid-template-columns: 1fr; }
.pulse-grid-bottom > .pulse-panel:nth-child(2) { display: none; }
.pulse-panel { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 18px; }
.pulse-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.pulse-panel-head h3 { margin: 0 0 4px; font-size: 16px; }
.pulse-panel-head span { color: var(--muted); font-size: 13px; }
.pulse-panel-head > strong { color: var(--ok); font-size: 13px; white-space: nowrap; }
.terminal-health-list { display: grid; gap: 8px; }
.terminal-health-item { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 11px; min-height: 54px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-strong); }
.terminal-health-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px rgba(165, 171, 178, .12); }
.terminal-health-dot.online { background: var(--ok); box-shadow: 0 0 0 3px rgba(46, 175, 93, .14); }
.terminal-health-dot.offline { background: var(--danger); box-shadow: 0 0 0 3px rgba(214, 69, 69, .14); }
.terminal-health-name { display: block; font-weight: 700; }
.terminal-health-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.terminal-health-state { color: var(--muted); font-size: 12px; white-space: nowrap; }
.terminal-health-state.online { color: var(--ok); }
.terminal-health-state.offline { color: var(--danger); }
.pulse-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pulse-stat { display: grid; gap: 5px; min-height: 86px; align-content: center; padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-strong); }
.pulse-stat strong { font-size: 28px; line-height: 1; }
.pulse-stat span { color: var(--muted); font-size: 12px; }
.pulse-stat.warning strong { color: var(--warning); }
.pulse-list { display: grid; gap: 8px; max-height: 260px; overflow: auto; }
@media (min-width: 901px) {
  .pulse-grid-bottom .pulse-panel { height: calc(100vh - 500px); min-height: 0; box-sizing: border-box; display: flex; flex-direction: column; }
.pulse-grid-bottom .pulse-list { flex: 1; min-height: 0; max-height: none; overflow-y: auto; align-content: start; }
}
.pulse-list-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pulse-list-item:last-child { border-bottom: 0; }
.pulse-list-item strong { display: block; font-size: 14px; }
.pulse-list-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.pulse-list-item time { color: var(--text); font-size: 13px; white-space: nowrap; }
.pulse-attention-item { display: grid; grid-template-columns: minmax(180px, 1.3fr) minmax(120px, 1fr) minmax(140px, 1fr) minmax(90px, .7fr); align-items: center; gap: 14px; }
.pulse-attention-item .pulse-status { color: var(--warning); font-weight: 600; }
.pulse-attention-item .pulse-time { display: grid; gap: 3px; color: var(--muted); font-size: 12px; }
.pulse-attention-item .pulse-time strong { color: var(--text); font-size: 13px; font-weight: 600; }
.pulse-empty { color: var(--muted); font-size: 13px; padding: 12px 0; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.metric,
.form-panel,
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
  min-height: 102px;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.metric strong {
  display: block;
  font-size: 24px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.section-header,
.panel-title,
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-header {
  margin: 4px 0 12px;
}

.toolbar-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-inline input {
  min-width: 170px;
}

.toolbar-inline input[type="search"] {
  min-width: 260px;
}

.toolbar-inline select {
  min-width: 160px;
}

#addEmployeeButton,
#exportMonthlyButton {
  white-space: nowrap;
}

#addEmployeeButton {
  min-width: 190px;
}

#exportMonthlyButton {
  min-width: 145px;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 230px);
  scrollbar-gutter: stable;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.monthly-wrap {
  max-height: calc(100vh - 170px);
}

.monthly-table {
  min-width: 1280px;
}

.monthly-table th,
.monthly-table td {
  white-space: nowrap;
}

.monthly-table .day-col,
.monthly-table .day-cell {
  min-width: 44px;
  max-width: 54px;
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
}
.monthly-table .day-col { height: 54px; vertical-align: middle; }
.monthly-table .day-col .day-weekday { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 600; line-height: 1; text-transform: uppercase; }
.monthly-table .day-col strong { display: block; font-size: 14px; line-height: 1; }
.monthly-table .day-col.weekend,
.monthly-table thead th.day-col.weekend { background: var(--panel-strong); }
.monthly-table .day-col.weekend .day-weekday { color: var(--brand); }

.monthly-table .day-cell {
  font-weight: 700;
}

.monthly-table .day-cell.ok {
  color: var(--ok);
  background: rgba(35, 122, 71, 0.08);
}

.monthly-table .day-cell.warning {
  color: var(--warning);
  background: rgba(240, 165, 0, 0.14);
}

.monthly-table .day-cell.single {
  color: var(--danger);
  background: rgba(157, 49, 40, 0.08);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Keep column names visible while a long report is being inspected. */
table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--panel-strong);
  box-shadow: 0 1px 0 var(--line);
}

td {
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

.settings-form {
  display: grid;
  gap: 16px;
  max-width: 1040px;
}

.is-hidden {
  display: none;
}

.employee-editor {
  max-width: none;
  margin-bottom: 16px;
}

.employee-row { cursor: pointer; }
.employee-row:hover td { background: var(--panel-strong); }
.employee-card { width: 100%; box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr) 340px; column-gap: 24px; margin: 0 0 18px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.employee-card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.employee-card-head { grid-column: 1 / -1; }
.employee-card-actions { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 14px; }
.employee-card-head h2 { margin: 0; }
.employee-card-title { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.employee-portrait { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.employee-portrait span { color: var(--muted); font-size: 20px; line-height: 1; }
.employee-portrait.green span { color: #56c982; }
.employee-portrait.yellow span { color: #e5b84d; }
.employee-portrait.red span { color: #e45b5b; }
.employee-link { padding: 0; border: 0; background: transparent; color: var(--brand); cursor: pointer; font: inherit; font-weight: 600; text-align: left; }
.employee-link:hover { text-decoration: underline; }
.employee-card-head > div { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-kicker { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0; }
.employee-card-grid { display: grid; grid-column: 1; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; margin-top: 18px; align-items: start; }
.employee-card-actions { grid-column: 1 / -1; margin-top: 2px; }
.employee-photo-box { display: grid; justify-items: start; gap: 10px; align-content: start; }
.photo-actions { display: flex; gap: 8px; align-items: center; }
.employee-photo { width: 180px; height: 220px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-strong); }
.photo-placeholder { width: 180px; height: 220px; box-sizing: border-box; display: grid; place-content: center; justify-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-strong); color: var(--muted); }
.photo-placeholder.is-hidden { display: none; }
.photo-placeholder span { font-size: 54px; line-height: 1; opacity: .65; }
.photo-placeholder strong { font-size: 13px; font-weight: 600; }
.employee-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-content: start; max-width: 620px; }
.employee-facts div { display: grid; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.employee-facts span { color: var(--muted); font-size: 12px; }
.employee-facts strong { overflow-wrap: anywhere; }
.inline-edit-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.inline-edit-fields label, .inline-terminal-editor { display: grid; gap: 5px; }
.inline-edit-fields label > span, .inline-terminal-editor > span { color: var(--muted); font-size: 12px; }
.inline-edit-fields input, .inline-edit-fields select { min-height: 38px; width: 100%; box-sizing: border-box; }
.inline-terminal-editor, .inline-edit-actions { grid-column: 1 / -1; }
.inline-terminal-list { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-terminal-option { display: inline-flex !important; grid-template-columns: none !important; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-strong); }
.inline-terminal-option span { color: var(--text) !important; font-size: 13px !important; }
.inline-edit-actions { display: flex; gap: 8px; margin-top: 4px; }
.employee-card-events { grid-column: 2; grid-row: 2 / span 2; min-width: 0; margin-top: 18px; border-left: 1px solid var(--line); padding: 0 0 0 20px; }
.employee-card-events h3 { margin: 0 0 10px; }
.employee-card-footer { grid-column: 1 / -1; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.mini-event-list { display: grid; gap: 8px; }
.mini-event-list { max-height: 250px; overflow-y: auto; padding-right: 8px; }
.mini-event-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.mini-event-list span { color: var(--muted); text-align: right; }
.text-button { border: 0; background: transparent; color: var(--danger, #c75050); cursor: pointer; padding: 0; }
.danger-action { font-weight: 600; }

@media (max-width: 900px) {
  .pulse-grid, .pulse-grid-bottom { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .pulse-head { align-items: stretch; flex-direction: column; }
  .pulse-head .secondary-button { align-self: flex-start; }
  .pulse-stat-grid { grid-template-columns: 1fr; }
  .pulse-attention-item { grid-template-columns: 1fr 1fr; gap: 8px; }
  .pulse-grid-bottom .pulse-panel { min-height: 0; }
  .pulse-grid-bottom .pulse-list { min-height: 0; }
}

@media (max-width: 900px) {
  .employee-card { display: block; }
  .employee-card-grid, .employee-facts { grid-template-columns: 1fr; }
  .employee-photo { width: 140px; height: 170px; }
  .mini-event-list > div { display: grid; gap: 3px; }
  .mini-event-list span { text-align: left; }
  .employee-card-events { margin-top: 22px; border-left: 0; border-top: 1px solid var(--line); padding: 16px 0 0; }
  .inline-edit-fields { grid-template-columns: 1fr; }
}

.assignment-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.assignment-list,
.structure-list {
  display: grid;
  gap: 8px;
}

.assignment-list {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.assignment-option,
.structure-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 10px 12px;
}

.assignment-option {
  justify-content: flex-start;
  min-width: 0;
  align-items: flex-start;
  overflow: hidden;
}

.assignment-option input {
  width: 16px !important;
  min-height: 16px !important;
  height: 16px;
  flex: 0 0 auto;
}

.assignment-option > span {
  min-width: 0;
  overflow: hidden;
}

.assignment-option strong,
.assignment-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-empty {
  color: var(--muted);
  padding: 12px 0;
  font-size: 13px;
}

.generated-number-box {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 0 8px 0 12px;
}

.generated-number-box strong {
  flex: 1;
  min-width: 0;
  color: var(--brand);
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}

.generated-number-box .icon-button {
  flex: 0 0 30px;
}

.structure-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.legacy-structure-header,
.legacy-structure-layout {
  display: none !important;
}

.legacy-structure {
  display: none;
}

.structure-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.structure-heading h2 {
  margin: 0;
  font-size: 26px;
}

.structure-heading p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.eyebrow {
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  margin-bottom: 7px;
}

.structure-tree-shell {
  max-width: 900px;
  border-top: 1px solid var(--line);
  padding: 14px 0 30px;
}

.tree-node {
  position: relative;
}

.tree-children {
  margin-left: 20px;
  padding-left: 23px;
  border-left: 1px solid rgba(200, 161, 90, 0.25);
}

.tree-node-row,
.tree-leaf {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px;
  border-radius: 8px;
}

.tree-node-row:hover,
.tree-leaf:hover {
  background: rgba(255, 255, 255, 0.035);
}

.tree-group-row {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  color: var(--muted);
}

.tree-group-row strong {
  flex: 1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.tree-node-row > div,
.tree-leaf > div {
  min-width: 0;
  flex: 1;
}

.tree-node-row strong,
.tree-leaf strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.tree-node-row small,
.tree-leaf small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.tree-symbol {
  flex: 0 0 22px;
  width: 22px;
  color: var(--brand);
  text-align: center;
  font-size: 13px;
}

.company-symbol {
  font-size: 19px;
}

.terminal-symbol {
  color: var(--success);
}

.tree-toggle,
.tree-add,
.tree-delete,
.icon-button {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tree-delete {
  border-color: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.tree-delete:hover {
  color: var(--error);
  border-color: rgba(214, 69, 69, 0.5);
  background: rgba(214, 69, 69, 0.08);
}

.tree-toggle {
  border-color: transparent;
  font-size: 17px;
}

.tree-add:hover,
.icon-button:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: rgba(200, 161, 90, 0.08);
}

.tree-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 10px 8px 10px 34px;
}

.tree-node.collapsed > .tree-children {
  display: none;
}

.tree-node.collapsed > .tree-node-row .tree-toggle {
  transform: rotate(-90deg);
}

.structure-editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 8, 9, 0.72);
}

.structure-editor-backdrop.is-hidden {
  display: none;
}

.structure-editor {
  width: min(430px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.editor-top,
.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.structure-editor h3 {
  margin: 0;
  font-size: 20px;
}

.structure-editor #structureEditorFields {
  display: grid;
  gap: 14px;
  margin: 24px 0;
}

.editor-actions {
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.inline-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.inline-form .primary-button {
  justify-self: start;
}

#settingsView > form#settingsForm {
  display: none;
}

.settings-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.settings-tab {
  min-height: 42px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0 4px;
  margin-right: 14px;
  cursor: pointer;
}

.settings-tab.active {
  border-bottom-color: var(--brand);
  color: var(--brand-dark);
  font-weight: 700;
}

.settings-subview {
  display: none;
}

.settings-subview.active {
  display: block;
}

.section-note {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.terminal-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.5fr);
  gap: 16px;
  align-items: start;
}

.terminal-list-panel,
.terminal-editor {
  max-width: none;
}

.terminal-list {
  display: grid;
  gap: 8px;
}

.terminal-list-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.terminal-list-item:hover,
.terminal-list-item.active {
  border-color: rgba(200, 161, 90, 0.55);
  background: rgba(200, 161, 90, 0.1);
}

.terminal-list-item span,
.terminal-list-item small {
  color: var(--muted);
  font-size: 12px;
}

.editor-actions {
  margin-top: 18px;
}

.form-panel {
  padding: 18px;
}

.panel-title {
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid.compact {
  margin-top: 14px;
}

label span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 7px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15181b;
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}

:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea {
  background: #ffffff;
  color: #1d2329;
  color-scheme: light;
}

:root[data-theme="light"] input::placeholder { color: #9299a1; }

input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(200, 161, 90, 0.16);
}

.list-summary {
  color: var(--muted);
  font-size: 13px;
  margin: -4px 0 12px;
}

.switch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--panel-strong);
}

.switch-label input {
  width: 18px;
  height: 18px;
  min-height: 18px;
}

.switch-label span {
  margin: 0;
  color: var(--text);
}

#telegramForm .telegram-enabled {
  width: fit-content;
  margin-top: 16px;
}

#telegramForm .telegram-note {
  margin-top: 14px;
}

.inline-status {
  display: inline-flex;
  margin-top: 14px;
  border-radius: 8px;
  white-space: normal;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  border: 1px solid transparent;
}

.primary-button {
  background: var(--brand);
  color: #111315;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button {
  background: var(--panel-strong);
  color: var(--text);
  border-color: var(--line);
}

.secondary-button:hover {
  border-color: var(--brand);
}

.empty-row {
  color: var(--muted);
}

.admin-logs-panel {
  min-width: 0;
}

.admin-logs-table-wrap {
  max-height: min(68vh, 760px);
  overflow: auto;
}

.admin-logs-table-wrap table {
  min-width: 1240px;
}

.admin-log-message {
  min-width: 380px;
  max-width: 640px;
  white-space: normal;
}

.admin-log-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.admin-log-success { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.admin-log-running { color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent); }
.admin-log-error { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.admin-log-busy { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    padding: 16px;
  }

  .sidebar-user { position: relative; left: auto; bottom: auto; width: auto; margin-top: 16px; }

  .brand {
    margin-bottom: 16px;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 4px;
    min-height: 58px;
    padding: 6px;
    text-align: center;
  }

  .main {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .kpi-grid,
  .form-grid,
  .terminal-layout {
    grid-template-columns: 1fr;
  }

  .section-header,
  .panel-title,
  .action-bar,
  .toolbar-inline {
    align-items: stretch;
    flex-direction: column;
  }
}
