:root {
  color-scheme: light;
  --bg: oklch(0.98 0.008 145);
  --surface: oklch(1 0 0);
  --surface-soft: oklch(0.962 0.01 150);
  --surface-strong: oklch(0.94 0.012 150);
  --text: oklch(0.245 0.02 158);
  --muted: oklch(0.52 0.016 158);
  --subtle: oklch(0.66 0.014 158);
  --line: oklch(0.912 0.01 150);
  --line-strong: oklch(0.86 0.012 150);
  --accent: oklch(0.47 0.1 158);
  --accent-strong: oklch(0.4 0.09 158);
  --accent-soft: oklch(0.945 0.032 158);
  --accent-fg: oklch(0.99 0.01 158);
  --blue: oklch(0.54 0.14 255);
  --blue-soft: oklch(0.95 0.025 255);
  --amber: oklch(0.62 0.14 68);
  --amber-soft: oklch(0.955 0.045 78);
  --red: oklch(0.545 0.15 28);
  --red-soft: oklch(0.95 0.035 28);
  --red-fg: oklch(0.99 0.01 28);
  --green: oklch(0.52 0.11 158);
  --green-soft: oklch(0.94 0.035 158);
  --radius-card: 20px;
  --radius-field: 13px;
  --shadow-sm: 0 1px 2px oklch(0.245 0.02 158 / 5%), 0 10px 28px -16px oklch(0.245 0.02 158 / 22%);
  --shadow-md: 0 1px 2px oklch(0.245 0.02 158 / 6%), 0 22px 55px -25px oklch(0.245 0.02 158 / 32%);
  font-family: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(0.188 0.014 158);
  --surface: oklch(0.232 0.016 158);
  --surface-soft: oklch(0.272 0.018 158);
  --surface-strong: oklch(0.31 0.019 158);
  --text: oklch(0.962 0.008 150);
  --muted: oklch(0.735 0.014 155);
  --subtle: oklch(0.61 0.014 155);
  --line: oklch(0.32 0.018 158);
  --line-strong: oklch(0.38 0.02 158);
  --accent: oklch(0.76 0.13 160);
  --accent-strong: oklch(0.84 0.11 160);
  --accent-soft: oklch(0.305 0.045 160);
  --accent-fg: oklch(0.18 0.03 160);
  --blue: oklch(0.74 0.12 255);
  --blue-soft: oklch(0.3 0.04 255);
  --amber: oklch(0.8 0.13 75);
  --amber-soft: oklch(0.32 0.05 75);
  --red: oklch(0.7 0.14 28);
  --red-soft: oklch(0.31 0.055 28);
  --red-fg: oklch(0.18 0.04 28);
  --green: oklch(0.78 0.13 160);
  --green-soft: oklch(0.3 0.05 160);
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 30%), 0 12px 30px -18px oklch(0 0 0 / 60%);
  --shadow-md: 0 1px 2px oklch(0 0 0 / 38%), 0 24px 58px -24px oklch(0 0 0 / 72%);
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

.auth-body { display: grid; grid-template-rows: auto 1fr; }
.admin-body { padding: 0 0 56px; }

.auth-shellbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1160px, 100%);
  min-height: 58px;
  margin: 0 auto;
  padding: 8px 32px;
  border-bottom: 1px solid var(--line);
}
.site-brand, .admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-fg);
}
.brand-mark svg { width: 16px; height: 16px; stroke-width: 2.2; }
.theme-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--subtle);
}
.theme-toggle:hover { background: var(--surface-soft); color: var(--accent); box-shadow: none; }
.theme-icon { width: 18px; height: 18px; stroke-width: 1.8; }
.theme-icon--sun { display: none; }
[data-theme="dark"] .theme-icon--moon { display: none; }
[data-theme="dark"] .theme-icon--sun { display: block; }

.auth-main {
  align-self: center;
  width: min(430px, calc(100% - 32px));
  margin: 48px auto;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.auth-main--wide {
  display: block;
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.eyebrow, .page-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: 30px; line-height: 1.12; font-weight: 800; letter-spacing: -.03em; }
h2 { letter-spacing: -.02em; }
p { line-height: 1.55; }
a { color: var(--accent); }
.auth-main:not(.auth-main--wide) > p:not(.eyebrow, .auth-note, [role="alert"]) { margin: 10px 0 26px; color: var(--muted); font-size: 14px; }
.auth-main form > p { margin: 0 0 17px; }

label { color: var(--text); font-size: 13px; font-weight: 600; }
input, select {
  width: 100%;
  height: 46px;
  margin-top: 7px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-field);
  outline: none;
  background: var(--surface);
  color: inherit;
  font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:focus, select:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 14%, transparent);
}
input::placeholder { color: var(--subtle); }
select { appearance: auto; }
button {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: var(--radius-field);
  background: var(--accent);
  color: var(--accent-fg);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}
button:hover { filter: brightness(.97); }
button:active { transform: translateY(1px); }
[role="alert"] { margin: 0 0 18px; padding: 11px 12px; border-radius: 11px; background: var(--red-soft); color: var(--red); font-size: 13px; }
.auth-note { margin: 20px 0 0; color: var(--muted); text-align: center; font-size: 13px; }
.auth-note a { font-weight: 600; text-underline-offset: 3px; }

/* Общая оболочка админки */
.admin-shellbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 58px;
  padding: 8px 0;
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  backdrop-filter: blur(14px);
}
.admin-shellbar::before {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw);
  z-index: -1;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--bg) 85%, transparent);
}
.admin-brand {
  width: fit-content;
  line-height: 1.15;
}
.admin-brand small { display: block; margin-top: 2px; color: var(--subtle); font-size: 9px; font-weight: 500; letter-spacing: .01em; }
.admin-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}
.admin-nav a {
  padding: 7px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s ease, background .15s ease, box-shadow .15s ease;
}
.admin-nav a:hover { background: var(--surface-soft); color: var(--text); }
.admin-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.admin-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.admin-actions a {
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.admin-actions a:hover { background: var(--surface-soft); color: var(--text); }
.admin-actions .admin-logout { color: var(--red); }

.admin-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 42px 0 26px;
}
.admin-header h1 { font-size: clamp(32px, 4vw, 46px); }
.admin-header p:not(.page-kicker) { max-width: 670px; margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.header-counter, .section-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-field);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.live-status {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 240px;
  padding: 12px 15px;
  border: 1px solid color-mix(in oklab, var(--green) 25%, var(--line));
  border-radius: var(--radius-field);
  background: var(--green-soft);
}
.live-status > i { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px color-mix(in oklab, var(--green) 14%, transparent); }
.live-status span { color: var(--green); font-size: 12px; font-weight: 700; }
.live-status small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 500; }

/* Метрики */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.metric-card {
  min-width: 0;
  min-height: 136px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}
.metric-card::after { content: ""; position: absolute; inset: auto 0 0; height: 3px; background: var(--metric-color); opacity: .7; }
.metric-card__top, .metric-card__value { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; z-index: 1; }
.metric-card__top > span { color: var(--muted); font-size: 12px; font-weight: 750; }
.metric-card__top i {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--metric-soft);
  color: var(--metric-color);
  font-style: normal;
  font-weight: 900;
}
.metric-card__top i::after { content: var(--metric-symbol); }
.metric-card__value { align-items: flex-end; justify-content: flex-start; margin-top: 21px; }
.metric-card__value strong { color: var(--text); font-size: 36px; line-height: .9; letter-spacing: -.05em; }
.metric-card__value small { max-width: 112px; padding-bottom: 1px; color: var(--subtle); font-size: 10px; line-height: 1.35; }
.metric-card--pending { --metric-color: var(--amber); --metric-soft: var(--amber-soft); --metric-symbol: "…"; }
.metric-card--online { --metric-color: var(--green); --metric-soft: var(--green-soft); --metric-symbol: "●"; }
.metric-card--active { --metric-color: var(--blue); --metric-soft: var(--blue-soft); --metric-symbol: "✓"; }
.metric-card--logins { --metric-color: var(--accent); --metric-soft: var(--accent-soft); --metric-symbol: "↗"; }

.secondary-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.mini-metric { display: flex; flex-direction: column-reverse; gap: 7px; min-width: 0; padding: 15px 18px; border-right: 1px solid var(--line); }
.mini-metric:last-child { border-right: 0; }
.mini-metric span { overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.mini-metric strong { font-size: 20px; letter-spacing: -.03em; }

/* Секции обзора */
.dashboard-layout { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.dashboard-section {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.dashboard-section--chart { grid-column: span 8; overflow: hidden; }
.dashboard-section--offices { grid-column: span 4; }
.dashboard-section--queue, .dashboard-section--activity { grid-column: span 6; }
.dashboard-section--audit { grid-column: span 8; }
.dashboard-section--system { grid-column: span 4; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; color: var(--text); font-size: 16px; line-height: 1.25; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.section-total { color: var(--text); font-size: 25px; font-weight: 800; letter-spacing: -.04em; }
.section-link { color: var(--accent); font-size: 11px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.section-link span { display: inline-block; margin-left: 3px; transition: transform .15s ease; }
.section-link:hover span { transform: translateX(3px); }

.chart {
  display: flex;
  align-items: flex-end;
  height: 242px;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  padding: 12px 3px 0;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 47px, var(--line) 48px);
}
.chart-column { display: grid; grid-template-rows: 22px 1fr 20px; align-items: end; flex: 1 1 0; min-width: 0; width: auto; height: 100%; text-align: center; }
.chart-column > span, .chart-column > small { color: var(--subtle); font-size: 9px; font-weight: 650; }
.chart-column > small { min-width: 0; overflow: visible; white-space: nowrap; }
.chart-column:last-child > small { transform: translateX(-5px); }
.chart-bar { display: block; min-height: 3px; border-radius: 5px 5px 2px 2px; background: var(--accent); }
.chart-column--today .chart-bar { background: var(--blue); }
.chart-column--today > small { color: var(--blue); font-weight: 800; }
.chart-bar--0 { height: 3px; opacity: .22; }
.chart-bar--1 { height: 10%; }
.chart-bar--2 { height: 20%; }
.chart-bar--3 { height: 30%; }
.chart-bar--4 { height: 40%; }
.chart-bar--5 { height: 50%; }
.chart-bar--6 { height: 60%; }
.chart-bar--7 { height: 70%; }
.chart-bar--8 { height: 80%; }
.chart-bar--9 { height: 90%; }
.chart-bar--10 { height: 100%; }

.office-grid { display: grid; gap: 25px; padding: 9px 2px 4px; }
.office-row > div { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; font-size: 12px; }
.office-row > div > strong { font-weight: 750; }
.office-row > div > span { font-size: 14px; font-weight: 800; }
.office-row > div > span small { margin-left: 5px; color: var(--subtle); font-size: 9px; font-weight: 650; }
.office-row progress { display: block; width: 100%; height: 7px; border: 0; border-radius: 999px; overflow: hidden; background: var(--surface-strong); }
.office-row progress::-webkit-progress-bar { border-radius: 999px; background: var(--surface-strong); }
.office-row progress::-webkit-progress-value { border-radius: 999px; background: var(--accent); }
.office-row progress::-moz-progress-bar { border-radius: 999px; background: var(--accent); }

.dashboard-list { margin: 0; padding: 0; list-style: none; }
.dashboard-list li { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 57px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.dashboard-list li:last-child { border-bottom: 0; }
.dashboard-list strong { font-size: 12px; }
.dashboard-list small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.dashboard-list time { white-space: nowrap; }
.user-summary { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.user-avatar--muted { background: var(--surface-strong); color: var(--muted); }
.activity-time { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.activity-time > i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in oklab, var(--green) 12%, transparent); }
.compact-actions { display: flex; gap: 6px; }
.compact-actions button { width: auto; height: 30px; padding: 0 10px; border-radius: 8px; font-size: 10px; }
.empty-state { color: var(--muted); }

.system-grid { display: grid; gap: 9px; }
.system-grid article { display: flex; align-items: center; gap: 12px; min-height: 66px; padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--radius-field); background: var(--surface-soft); }
.system-grid strong, .system-grid small { display: block; }
.system-grid strong { font-size: 11px; }
.system-grid small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.health { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; }
.health--ok { background: var(--green); box-shadow: 0 0 0 5px color-mix(in oklab, var(--green) 12%, transparent); }
.health--warning { background: var(--amber); box-shadow: 0 0 0 5px color-mix(in oklab, var(--amber) 12%, transparent); }
.health--error { background: var(--red); box-shadow: 0 0 0 5px color-mix(in oklab, var(--red) 12%, transparent); }
.analytics-note { margin: 18px 3px 0; color: var(--subtle); font-size: 10px; text-align: right; }

/* Таблицы и управляющие элементы */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.dashboard-section .table-wrap { border: 0; border-radius: 0; box-shadow: none; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 16px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--surface-soft); }
th { color: var(--subtle); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
td small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.audit-action { display: inline-flex; padding: 5px 8px; border-radius: 7px; background: var(--surface-strong); color: var(--muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.status { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; background: var(--surface-strong); font-size: 10px; font-weight: 700; white-space: nowrap; }
.status--pending { background: var(--amber-soft); color: var(--amber); }
.status--active { background: var(--green-soft); color: var(--green); }
.status--rejected, .status--blocked { background: var(--red-soft); color: var(--red); }
.actions { min-width: 230px; }
.actions__inner { display: flex; flex-wrap: wrap; gap: 7px; }
.users-table td time { white-space: nowrap; }
.users-table th:last-child,
.users-table td.actions {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: -12px 0 18px -18px color-mix(in oklab, var(--text) 35%, transparent);
}
.users-table th:last-child { z-index: 3; }
.users-table tbody tr:hover td.actions { background: var(--surface-soft); }
.users-table--compact-actions .actions { min-width: 126px; }
.users-table--compact-actions .actions .inline-form { flex: 0 0 auto; }
.inline-form { margin: 0; }
.inline-form button { width: auto; height: 32px; padding: 0 11px; border-radius: 8px; font-size: 10px; }
.nickname-form { display: flex; align-items: center; gap: 6px; min-width: 245px; margin: 0; }
.nickname-form input { width: 150px; height: 32px; margin: 0; padding: 0 9px; border-radius: 8px; font-size: 11px; }
.nickname-form button { width: auto; height: 32px; padding: 0 10px; border-radius: 8px; font-size: 10px; }
.employee-profile-form {
  display: grid;
  grid-template-columns: 140px 160px auto;
  align-items: end;
  gap: 7px;
  min-width: 410px;
  margin: 0;
}
.employee-profile-form label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}
.employee-profile-form input {
  height: 32px;
  margin: 0;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 11px;
}
.employee-profile-form button {
  width: auto;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 10px;
}
.button--danger { background: var(--red); color: var(--red-fg); }
.button--secondary { background: var(--surface-strong); color: var(--text); }
.button--secondary:hover { background: var(--line-strong); }
.danger-actions { display: grid; gap: 16px; margin-top: 24px; text-align: center; }
.danger-actions form { margin: 0; }
.presence-hint { margin: -10px 4px 15px; color: var(--muted); font-size: 10px; }
.presence { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.presence i { width: 7px; height: 7px; border-radius: 50%; background: var(--subtle); }
.presence--online { color: var(--green); font-weight: 750; }
.presence--online i { background: var(--green); box-shadow: 0 0 0 3px color-mix(in oklab, var(--green) 12%, transparent); }

/* Компактный список и карточка сотрудника */
.user-list { display: grid; gap: 12px; }
.user-list-card {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(240px, 1.2fr) 172px 160px;
  align-items: center;
  gap: 22px;
  min-width: 0;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.user-list-card__identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-list-card__identity > div { min-width: 0; }
.user-list-card__identity strong,
.user-list-card__identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-list-card__identity strong { font-size: 14px; }
.user-list-card__identity small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.user-list-card__summary { min-width: 0; }
.user-list-card__summary span,
.user-list-card__summary strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-list-card__summary span { color: var(--subtle); font-size: 9px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.user-list-card__summary strong { margin-top: 5px; font-size: 12px; font-weight: 600; }
.user-list-card__summary strong i { margin: 0 7px; color: var(--subtle); font-style: normal; font-weight: 400; }
.user-list-card__state { display: grid; justify-items: start; gap: 8px; width: 172px; }
.user-card-open {
  width: auto;
  min-width: 0;
  max-width: 100%;
  min-height: 38px;
  height: auto;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-align: center;
}

.user-dialog {
  width: min(780px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: var(--radius-card);
  outline: none;
  background: transparent;
  color: var(--text);
}
.user-dialog::backdrop { background: color-mix(in oklab, var(--text) 28%, transparent); backdrop-filter: blur(3px); }
.user-dialog__panel {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.user-dialog__header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
}
.user-dialog__header h2 { margin: 0; font-size: 18px; }
.user-dialog__header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.user-dialog__close { flex: 0 0 auto; width: 34px; height: 34px; padding: 0; background: transparent; color: var(--muted); font-size: 23px; font-weight: 400; line-height: 1; }
.user-dialog__close:hover { background: var(--surface-soft); color: var(--text); }
.user-dialog__body { padding: 20px; }
.user-dialog__section { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); }
.user-dialog__section + .user-dialog__section { margin-top: 14px; }
.user-dialog__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.user-dialog__heading h3, .user-dialog__danger h3 { margin: 0; font-size: 15px; }
.user-dialog__heading p, .user-dialog__danger p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.user-card-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0; }
.user-card-form label span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.user-card-form input { margin: 0; }
.user-card-form__wide { grid-column: 1 / -1; }
.user-card-form__save { grid-column: 1 / -1; width: fit-content; min-width: 180px; padding: 0 18px; justify-self: end; }
.user-activity-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-field); }
.user-activity-grid > div { min-width: 0; padding: 13px; border-right: 1px solid var(--line); background: var(--surface-soft); }
.user-activity-grid > div:last-child { border-right: 0; }
.user-activity-grid span, .user-activity-grid strong { display: block; }
.user-activity-grid span { color: var(--subtle); font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.user-activity-grid strong { margin-top: 6px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.user-dialog__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.user-dialog__actions .inline-form { flex: 0 0 auto; }
.user-dialog__actions button { height: 36px; padding: 0 13px; font-size: 11px; }
.user-dialog__empty { margin: 0; color: var(--muted); font-size: 11px; }
.user-dialog__danger { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 14px; padding: 18px 20px; border: 1px solid color-mix(in oklab, var(--red) 24%, var(--line)); border-radius: var(--radius-card); background: var(--red-soft); }
.user-dialog__danger .inline-form { flex: 0 0 auto; }
.user-dialog__danger button { width: auto; height: 36px; padding: 0 13px; font-size: 11px; }

/* Обратная связь */
.feedback-list { display: grid; gap: 12px; }
.feedback-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.feedback-card--new { border-left-color: var(--accent); }
.feedback-card--reviewed { border-left-color: var(--amber); }
.feedback-card--resolved { opacity: .76; }
.feedback-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 17px 19px 14px;
  border-bottom: 1px solid var(--line);
}
.feedback-category {
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.feedback-card h2 { margin: 5px 0 0; font-size: 16px; }
.feedback-card header p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.feedback-state { display: grid; justify-items: end; gap: 7px; white-space: nowrap; }
.feedback-state time { color: var(--muted); font-size: 9px; }
.status--new { background: var(--accent-soft); color: var(--accent-strong); }
.status--reviewed { background: var(--amber-soft); color: var(--amber); }
.status--resolved { background: var(--surface-strong); color: var(--muted); }
.feedback-message {
  padding: 18px 19px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.feedback-card > footer { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 19px 17px; }
.feedback-empty {
  padding: 54px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-card);
  color: var(--muted);
  text-align: center;
}
.feedback-empty strong { color: var(--text); font-size: 16px; }
.feedback-empty p { margin: 6px 0 0; font-size: 12px; }

@media (max-width: 1080px) {
  .admin-shellbar { grid-template-columns: 1fr auto; }
  .admin-nav { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; justify-content: flex-start; order: 3; overflow-x: auto; padding: 3px 0 7px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .secondary-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mini-metric:nth-child(3) { border-right: 0; }
  .mini-metric:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .dashboard-section--chart, .dashboard-section--audit { grid-column: span 7; }
  .dashboard-section--offices, .dashboard-section--system { grid-column: span 5; }
  .user-list-card { grid-template-columns: minmax(190px, 1fr) minmax(200px, 1.2fr) minmax(142px, 160px); gap: 16px; }
  .user-list-card__state { display: flex; align-items: center; grid-column: 1 / 3; grid-row: 2; width: auto; }
  .user-card-open { grid-column: 3; grid-row: 1 / 3; width: 100%; }
}

@media (max-width: 760px) {
  .auth-shellbar { padding: 8px 16px; }
  .admin-body { padding: 0 0 32px; }
  .auth-main--wide { width: min(100% - 24px, 1160px); }
  .admin-shellbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 0; }
  .admin-brand { flex: 1 1 auto; }
  .admin-actions { margin-left: auto; }
  .admin-actions > a:first-child { display: none; }
  .admin-nav { order: 3; width: 100%; overflow-x: auto; justify-content: flex-start; padding-bottom: 8px; }
  .admin-nav a { flex: 0 0 auto; text-align: center; }
  .admin-header { display: grid; justify-content: stretch; gap: 14px; padding: 28px 2px 20px; }
  .header-counter { justify-self: start; }
  .admin-header h1 { font-size: 31px; }
  .live-status { display: none; }
  .metrics-grid { gap: 10px; }
  .metric-card { min-height: 126px; padding: 16px; }
  .metric-card__value { display: block; margin-top: 18px; }
  .metric-card__value strong { font-size: 34px; }
  .metric-card__value small { display: block; margin-top: 7px; }
  .secondary-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-metric, .mini-metric:nth-child(3) { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .mini-metric:nth-child(even) { border-right: 0; }
  .mini-metric:nth-last-child(-n+2) { border-bottom: 0; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .dashboard-section--chart, .dashboard-section--offices, .dashboard-section--queue,
  .dashboard-section--activity, .dashboard-section--audit, .dashboard-section--system { grid-column: auto; }
  .dashboard-section { padding: 18px; }
  .chart { height: 210px; gap: 3px; }
  .chart-column > span { display: none; }
  .chart-column { grid-template-rows: 0 1fr 20px; }
  .dashboard-list li { align-items: flex-start; }
  .compact-actions { flex-direction: column; }
  .feedback-card > header { display: grid; gap: 12px; }
  .feedback-state { justify-items: start; }
  .analytics-note { text-align: left; }
  .user-list-card { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .user-list-card__identity, .user-list-card__summary, .user-list-card__state { grid-column: 1 / -1; grid-row: auto; }
  .user-list-card__summary { padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .user-list-card__state { display: flex; flex-wrap: wrap; width: 100%; }
  .user-card-open { grid-column: 1 / -1; grid-row: auto; width: 100%; }
  .user-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); }
  .user-dialog__panel { max-height: calc(100dvh - 20px); }
  .user-dialog__body { padding: 12px; }
  .user-dialog__section { padding: 16px; }
  .user-card-form { grid-template-columns: 1fr; }
  .user-card-form__wide, .user-card-form__save { grid-column: auto; }
  .user-card-form__save { width: 100%; justify-self: stretch; }
  .user-activity-grid { grid-template-columns: 1fr; }
  .user-activity-grid > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .user-activity-grid > div:last-child { border-bottom: 0; }
  .user-dialog__danger { align-items: stretch; flex-direction: column; }
  .user-dialog__danger form, .user-dialog__danger button { width: 100%; }
}

@media (max-width: 460px) {
  .auth-shellbar .site-brand > span:last-child { display: none; }
  .auth-main:not(.auth-main--wide) { width: calc(100% - 24px); margin: 24px auto; padding: 26px 22px; }
  .admin-brand > span:last-child { display: none; }
  .admin-actions > a:first-child { display: none; }
  .metrics-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 116px; }
  .metric-card__value { display: flex; }
  .dashboard-list li { flex-direction: column; }
  .compact-actions { width: 100%; flex-direction: row; }
  .compact-actions form { flex: 1; }
  .compact-actions button { width: 100%; }
  .user-list-card { padding: 15px; }
  .user-dialog__header { gap: 12px; padding: 15px 16px; }
  .user-dialog__header .user-list-card__identity { min-width: 0; }
  .user-dialog__heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .user-card-form__save { min-width: 0; }
  .user-dialog__actions, .user-dialog__actions .inline-form, .user-dialog__actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
