:root {
  color-scheme: light;

  /* База: белый + фирменный красный */
  --red: #ed1b24;
  --red-hover: #d41820;
  --red-dark: #b8141c;

  /* Постельные оттенки красного */
  --red-pastel-50: #fff8f8;
  --red-pastel-100: #fff0f1;
  --red-pastel-200: #fde2e4;
  --red-pastel-300: #f9cdd0;
  --red-pastel-border: #f3d9db;

  --white: #ffffff;
  --text: #1f1f1f;
  --text-muted: #6e6e6e;

  --bg: var(--white);
  --bg-elevated: var(--white);
  --bg-subtle: var(--red-pastel-50);
  --bg-hover: var(--red-pastel-100);
  --bg-active: var(--red-pastel-200);
  --border: var(--red-pastel-border);

  --accent: var(--red);
  --accent-hover: var(--red-hover);
  --danger: var(--red);

  --shadow-sm: 0 1px 3px rgba(237, 27, 36, 0.06);
  --shadow-md: 0 4px 20px rgba(237, 27, 36, 0.08);

  --sidebar-w: 240px;
  --radius: 12px;
  --font-legacy: "Helvetica Neue", Arial, sans-serif;
  --font-montserrat: "Montserrat", var(--font-legacy);
  --font: var(--font-montserrat);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

body.portal {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

code {
  font-family: ui-monospace, monospace;
  font-size: 0.92em;
  background: var(--red-pastel-100);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* ——— Auth ——— */

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 90% 70% at 50% -20%, var(--red-pastel-200), transparent 60%),
    linear-gradient(180deg, var(--red-pastel-50) 0%, var(--white) 45%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.auth-card__brand {
  text-align: center;
  margin-bottom: 28px;
}

.auth-card__logo {
  display: block;
  width: min(100%, 280px);
  height: auto;
  margin: 0 auto 16px;
}

.auth-card__logo img {
  display: block;
  width: 100%;
  height: auto;
}

.auth-card__logo--fallback {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--red);
  color: var(--white);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 12px;
}

.auth-card__title {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
}

.auth-card__subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field__label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.field__input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(237, 27, 36, 0.12);
}

.field__input.is-error {
  border-color: var(--danger);
}

.field__input--area {
  resize: vertical;
  min-height: 96px;
}

.field__input--select {
  padding: 9px 12px;
}

.field__error {
  color: var(--red-dark);
  font-size: 0.82rem;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.92rem;
  cursor: pointer;
}

.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.form-errors {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--red-pastel-100);
  border: 1px solid var(--red-pastel-300);
  color: var(--red-dark);
  font-size: 0.9rem;
}

.form-errors p {
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 0.94rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn--primary {
  background: #bf454a;
  color: var(--white);
  font-weight: 700;
}

.btn--primary:disabled,
.btn--primary.is-disabled {
  background: #d1d5db;
  color: #9ca3af;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--primary:hover:not(:disabled):not(.is-disabled) {
  background: #a83c40;
  color: var(--white);
}

.btn--ghost {
  background: var(--white);
  border-color: var(--border);
  color: var(--text);
}

.btn--ghost:hover {
  background: var(--bg-hover);
  border-color: var(--red-pastel-300);
}

.btn--block {
  width: 100%;
}

/* ——— Shell ——— */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  flex: 1;
  min-height: 0;
  background: var(--bg-subtle);
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  border-right: 1px solid var(--border);
  background: var(--red-pastel-50);
  padding: 16px 12px;
}

.sidebar__brand {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 4px clamp(28px, 22%, 52px) 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  flex-shrink: 0;
}

.sidebar__brand img {
  display: block;
  width: 100%;
  max-width: 180px;
  max-height: 72px;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.sidebar__logo {
  display: none;
}

.sidebar__title {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar__shell-exit {
  display: block;
  margin-top: 2px;
  padding: 4px 8px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
}

.sidebar__shell-exit:hover {
  color: var(--text);
  background: rgba(15, 23, 42, 0.06);
}

/* Оболочка НАРЯД-ПРО: тот же портал, другой shell-меню. */
.portal--naryad-shell .sidebar {
  background: #f4f6f8;
  border-right-color: #cbd5e1;
}

.portal--naryad-shell .sidebar__brand {
  border-bottom-color: #cbd5e1;
}

.portal--naryad-shell .sidebar__title {
  color: #334155;
  letter-spacing: 0.08em;
}

.portal--naryad-shell .sidebar__link.is-active {
  background: #e2e8f0;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  align-content: flex-start;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  align-self: flex-start;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.94rem;
  transition: background 0.15s, color 0.15s;
}

.sidebar__link:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.sidebar__link.is-active {
  background: var(--bg-active);
  color: var(--text);
  font-weight: 500;
}

.sidebar__folder {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__folder-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.94rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sidebar__folder-toggle:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.sidebar__folder-toggle.is-active {
  color: var(--text);
  font-weight: 500;
}

.sidebar__folder-label {
  flex: 1;
  min-width: 0;
}

.sidebar__folder-chevron {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.7;
  transition: transform 0.15s ease;
  flex-shrink: 0;
  margin-right: 2px;
}

.sidebar__folder.is-open > .sidebar__folder-toggle .sidebar__folder-chevron {
  transform: rotate(45deg);
}

.sidebar__folder-items {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 0 0 2px 0.35rem;
}

.sidebar__folder.is-open > .sidebar__folder-items {
  display: flex;
}

.sidebar__folder-items[hidden] {
  display: none !important;
}

.sidebar__link--nested {
  padding-left: 2.35rem;
}

.sidebar__badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.sidebar__icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--red-pastel-300);
  flex-shrink: 0;
}

.sidebar__icon--users {
  background: linear-gradient(135deg, var(--red), #ff6b72);
}

.sidebar__icon--accounts {
  background: linear-gradient(135deg, #6b7280, #9ca3af);
}

.sidebar__icon--home {
  background: linear-gradient(135deg, #2563eb, #60a5fa);
}

.sidebar__icon--directories {
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
}

.sidebar__icon--employees {
  background: linear-gradient(135deg, #059669, #34d399);
}

.sidebar__icon--network_drive {
  background: linear-gradient(135deg, #d97706, #fbbf24);
}

.sidebar__icon--mail {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
}

.sidebar__icon--view_as {
  background: linear-gradient(135deg, #4f46e5, #818cf8);
}

.sidebar__icon--online {
  background: linear-gradient(135deg, #15803d, #4ade80);
}

.sidebar__icon--timesheets {
  background: linear-gradient(135deg, #0d9488, #2dd4bf);
}

.sidebar__icon--expenses {
  background: linear-gradient(135deg, #e11d48, #fb7185);
}

.sidebar__icon--advances {
  background: linear-gradient(135deg, #ca8a04, #facc15);
}

.sidebar__icon--finances {
  background: linear-gradient(135deg, #047857, #34d399);
}

.sidebar__icon--bank_bumps {
  background: linear-gradient(135deg, #c026d3, #e879f9);
}

.sidebar__icon--money_accounts {
  background: linear-gradient(135deg, #0f766e, #5eead4);
}

.sidebar__icon--gap {
  background: linear-gradient(135deg, #0369a1, #7dd3fc);
}

.view-as-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: #fff8e1;
  border-bottom: 1px solid #facc15;
  color: #713f12;
  flex-shrink: 0;
}

.view-as-banner__hint {
  color: #92400e;
  font-size: 0.875rem;
}

.view-as-lead {
  margin: 0 0 12px;
  color: var(--text-muted, #6b7280);
}

.data-table__actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.btn--sm {
  padding: 6px 12px;
  font-size: 0.875rem;
}

.portal--view-as .sidebar__user {
  opacity: 0.75;
}

.mail-panel {
  width: 100%;
  max-width: 26rem;
  padding: 16px;
}

.mail-panel__lead {
  margin: 0 0 20px;
  color: var(--text-muted, #6b7280);
}

.mail-credentials {
  margin: 0;
  display: grid;
  gap: 16px;
}

.mail-credential {
  margin: 0;
}

.mail-credential__label {
  margin: 0 0 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
}

.mail-credential__value {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mail-credential__text {
  flex: 1 1 auto;
  width: 100%;
  max-width: 20rem;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  word-break: break-all;
}

.mail-credential__copy.is-copied {
  color: #059669;
}

.mail-panel__link {
  margin: 24px 0 0;
}

.disk-lk__hints {
  margin-top: 16px;
  color: var(--text-muted, #6b7280);
  font-size: 0.9375rem;
}

.disk-lk__hints p {
  margin: 0;
}

.disk-lk__setup-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin: 18px 0 0;
}

.disk-lk__setup-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent, #b42318);
  font: inherit;
  font-size: 0.9375rem;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}

.disk-lk__setup-link:hover {
  text-decoration: none;
}

.disk-lk__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 20px;
}

.disk-lk__nextcloud-label {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text);
}

.disk-setup-guide__steps {
  margin: 0 0 12px;
  padding-left: 1.25rem;
}

.disk-setup-guide__steps li {
  margin-bottom: 8px;
}

.disk-setup-guide__steps li:last-child {
  margin-bottom: 0;
}

.disk-setup-guide__path {
  display: block;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
  word-break: break-all;
}

.disk-setup-guide__note {
  margin: 0;
  color: var(--text-muted, #6b7280);
  font-size: 0.88rem;
  line-height: 1.4;
}

.portal-lightbox__body--custom .disk-setup-guide kbd {
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  font-size: 0.85em;
}

.portal-lightbox__dialog:has(.disk-setup-guide) {
  width: min(100%, 520px);
}

.disk-access-credential {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.disk-access-credential__value {
  display: inline-block;
  max-width: 11rem;
  padding: 4px 8px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

.disk-access-credential__copy {
  flex-shrink: 0;
  padding: 4px;
}

.disk-access-credential__copy.is-copied {
  color: #059669;
}

.data-table--disk-access td:nth-child(2),
.data-table--disk-access td:nth-child(3) {
  white-space: nowrap;
}

.account-password-modal__lead {
  margin: 0 0 16px;
  color: var(--text-muted, #6b7280);
  font-size: 0.9375rem;
}

.account-password-flash {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.account-password-flash__text {
  margin: 0;
  width: 100%;
  color: var(--text-muted, #6b7280);
  font-size: 0.9375rem;
}

.account-password-open {
  color: var(--text-muted, #6b7280);
}

.account-password-open:hover {
  color: var(--accent, #ed1b24);
}

.btn--icon {
  padding: 8px;
  min-width: 0;
}

.office-employee-form__mail {
  margin-top: 4px;
}

.field--pay-pair {
  min-width: 0;
}

.pay-pair {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 10px;
}

.pay-pair__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
}

.pay-pair__caption {
  font-size: 0.8125rem;
  color: var(--text-muted, #6b7280);
  line-height: 1.2;
}

.pay-pair__item .field__input {
  width: 100%;
  min-width: 0;
}

.panel--compact {
  padding: 12px 16px;
}

.panel__section-title--compact {
  margin: 0 0 8px;
  font-size: 1rem;
}

.office-employee-disk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.office-employee-disk-bar__title {
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.office-employee-disk-bar__content {
  display: flex;
  flex: 1 1 320px;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  min-width: 0;
}

.office-employee-disk-bar__own {
  margin: 0 0 0 auto;
  flex-shrink: 0;
}

.office-employee-disk-bar__check {
  margin: 0;
  flex-shrink: 0;
}

.account-form .office-employee-disk-bar .field--checkbox-inline {
  align-self: center;
  padding-bottom: 0;
}

.office-employee-disk-bar__meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  font-size: 0.88rem;
}

.office-employee-disk-bar__key {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.office-employee-disk-bar__meta code {
  font-size: 0.88rem;
}

.office-employee-disk-bar__dot {
  color: var(--border);
}

.office-employee-disk-bar__warn {
  font-size: 0.82rem;
  color: var(--danger, #b42318);
}

.office-employee-disk-bar__hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.office-employee-disk__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
}

.office-employee-disk__check {
  margin: 0;
  flex-shrink: 0;
  padding-bottom: 0;
}

.office-employee-disk__meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  font-size: 0.9rem;
  color: var(--text);
}

.office-employee-disk__pair {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.office-employee-disk__key {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.office-employee-disk__meta code {
  font-size: 0.9rem;
}

.office-employee-disk__dot {
  color: var(--border);
  user-select: none;
}

.office-employee-disk__warn {
  font-size: 0.85rem;
  color: var(--danger, #b42318);
}

.office-employee-disk__hint {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.office-link-required__hint {
  color: #6b7280;
  font-size: 0.95rem;
}

.office-link-required__admin {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
  text-align: left;
}

.office-link-required__admin-label {
  margin: 0 0 10px;
  font-size: 0.875rem;
  color: #6b7280;
}

.office-link-required__url {
  max-width: 100%;
  font-size: 0.8rem;
}

.disk-access-search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 12px;
  max-height: 220px;
  overflow: auto;
}

.disk-access-search-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.disk-access-search-item span {
  color: var(--muted);
  font-size: 13px;
}

.disk-access-selected {
  margin: 0 0 12px;
  color: var(--muted);
}

.sidebar__footer {
  padding: 12px 10px 4px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar__userbar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.sidebar__tool-form {
  flex-shrink: 0;
  margin: 0;
}

.sidebar__tool {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.sidebar__tool:hover:not(:disabled) {
  color: var(--accent);
  background: var(--bg-hover);
}

.sidebar__tool.is-busy,
.sidebar__tool:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sidebar__tool.is-busy svg {
  animation: sidebar-tool-spin 1s linear infinite;
}

@keyframes sidebar-tool-spin {
  to {
    transform: rotate(360deg);
  }
}

.sidebar__user {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__logout {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  padding: 0;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.sidebar__logout:hover {
  color: var(--accent);
  background: var(--bg-hover);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  background: var(--white);
}

.topbar {
  padding: 10px 16px 6px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}

.topbar__head {
  width: 100%;
}

.topbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar__lead {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.topbar__menu-btn {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
}

.topbar__menu-btn:hover {
  background: var(--bg-hover);
}

.sidebar-backdrop {
  display: none;
}

.sidebar__close {
  display: none;
}

.page-back {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
}

.page-back:hover {
  color: var(--text);
}

.topbar__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
}

.topbar__actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.accounts-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.accounts-toolbar__field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.accounts-toolbar__label {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.accounts-toolbar__select,
.accounts-toolbar__search {
  width: auto;
  height: 38px;
  box-sizing: border-box;
  padding: 0 12px;
  font-size: 0.85rem;
  line-height: 1.2;
}

.accounts-toolbar__select {
  min-width: 120px;
  padding-right: 32px;
  appearance: none;
  background-color: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.accounts-toolbar__search {
  width: min(280px, 42vw);
  min-width: 180px;
  appearance: none;
}

.accounts-toolbar__search::-webkit-search-decoration,
.accounts-toolbar__search::-webkit-search-cancel-button {
  appearance: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.content {
  padding: 12px 16px 24px;
  background: var(--white);
  flex: 1;
}

.panel {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.panel--section,
.tile-card.panel,
.portal-modal__dialog.panel,
.portal-lightbox__dialog.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}

.panel--section {
  margin-bottom: 16px;
  padding: 16px;
}

.tile-card.panel,
.portal-modal__dialog.panel,
.portal-lightbox__dialog.panel {
  box-shadow: var(--shadow-md);
}

.panel__hint {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.panel__section-title {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 600;
}

.welcome-card__title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 600;
}

.welcome-card__text {
  margin: 0;
  color: var(--text-muted);
}

.candidate-form .anketa-grid {
  margin-top: 4px;
}

.candidate-section .field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.candidate-section .field__req {
  color: var(--red);
  margin-left: 2px;
}

.candidate-meta {
  margin-top: 0;
}

.account-meta {
  margin-top: 0;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.tile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 88px;
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.tile-card:hover {
  border-color: var(--red-pastel-300);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.tile-card--static {
  cursor: default;
}

.tile-card--static:hover {
  transform: none;
}

.tile-card__title {
  flex: 1;
  min-width: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.tile-card__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.tile-card__edit,
.tile-card__icon-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.tile-card__edit:hover,
.tile-card__icon-btn:hover {
  color: var(--text);
  border-color: var(--red-pastel-300);
  background: var(--bg-hover);
}

.tile-card__icon-btn--danger:hover {
  color: var(--accent);
  border-color: var(--red-pastel-300);
  background: var(--red-pastel-100);
}

.directory-add__form {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.directory-add__field {
  flex: 1;
  min-width: min(100%, 320px);
  margin: 0;
}

.portal-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.portal-modal[hidden] {
  display: none;
}

.portal-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, 0.45);
}

.portal-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  padding: 24px;
}

.portal-modal__title {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 600;
}

.portal-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.role-sections {
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

.role-sections legend {
  padding: 0;
  margin-bottom: 10px;
}

.role-sections__item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.94rem;
}

.role-sections__item--locked {
  color: var(--text-muted);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--red-pastel-50);
}

.data-table th:has(.data-table__sort) {
  padding: 0;
}

.data-table__sort {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  box-sizing: border-box;
  color: inherit;
  text-decoration: none;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
}

.data-table__sort:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.03);
}

.data-table__sort-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0.45;
  font-size: 17px;
  line-height: 1;
}

.data-table__sort:hover .data-table__sort-icon {
  opacity: 0.7;
}

.data-table__sort-icon::before {
  content: "↕";
}

.data-table__sort.is-active {
  color: var(--text);
  font-weight: 600;
}

.data-table__sort.is-active .data-table__sort-icon {
  opacity: 1;
}

.data-table__sort.is-active.is-asc .data-table__sort-icon::before {
  content: "↑";
}

.data-table__sort.is-active.is-desc .data-table__sort-icon::before {
  content: "↓";
}

.data-table__row {
  cursor: pointer;
  transition: background 0.12s;
}

.data-table__row:hover {
  background: var(--bg-hover);
}

.data-table a {
  color: var(--text);
  font-weight: 500;
}

.data-table a:hover {
  color: var(--accent);
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
}

.badge--ok {
  background: var(--red-pastel-100);
  color: var(--red-dark);
  border: 1px solid var(--red-pastel-300);
}

.badge--muted {
  background: #f5f5f5;
  color: var(--text-muted);
  border: 1px solid #e8e8e8;
}

.badge--rejected {
  background: #f5f5f5;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.badge--postponed {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge--new {
  background: var(--red-pastel-100);
  color: var(--red-dark);
  border: 1px solid var(--red-pastel-300);
}

.candidate-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.empty-state {
  padding: 32px 12px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state__hint {
  font-size: 0.9rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  font-size: 0.9rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 28px;
  margin: 0;
}

.detail-item dt {
  margin: 0 0 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.detail-item dd {
  margin: 0;
  font-size: 1rem;
}

.employee-dismiss__status {
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.employee-dismiss__status-label {
  color: var(--text-muted, #6b7280);
  margin-right: 6px;
}

.employee-dismiss__alert {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 0.9rem;
}

.admin-alert {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 0.92rem;
  line-height: 1.45;
}

.admin-alert a {
  color: inherit;
  font-weight: 600;
}

.employee-dismiss__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.employee-dismiss__date {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.employee-dismiss__label {
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
}

.employee-dismiss__input {
  width: auto;
  min-width: 160px;
  max-width: 220px;
}

.employee-dismiss__btn {
  flex: 0 0 auto;
}

.detail-item--full {
  grid-column: 1 / -1;
}

.account-form__names {
  grid-column: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 20px;
}

.account-form .field--account-type {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}

.field--checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  grid-column: 1 / -1;
}

.account-form .field--checkbox-inline {
  grid-column: auto;
  align-self: end;
  padding-bottom: 12px;
}

.field--radio {
  grid-column: 1 / -1;
}

.field--radio .field__label {
  display: block;
  margin-bottom: 8px;
}

.field--radio ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.field--radio li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.field--radio label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.94rem;
}

.accounts-filter {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.accounts-filter__field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.accounts-filter__label {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.accounts-filter__select {
  width: auto;
  min-width: 120px;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.messages {
  margin-bottom: 16px;
}

.message {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.92rem;
}

.message--success {
  background: var(--red-pastel-100);
  border: 1px solid var(--red-pastel-300);
  color: var(--red-dark);
}

@media (max-width: 900px) {
  body.portal {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  body.portal.portal-menu-open {
    overflow: hidden;
  }

  .shell {
    grid-template-columns: 1fr;
    flex: none;
    min-height: auto;
  }

  .topbar {
    padding: 10px 12px 12px;
  }

  .topbar__row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .topbar__lead {
    flex: none;
    width: 100%;
    justify-content: flex-start;
  }

  .topbar__title {
    order: 1;
    font-size: 1.15rem;
    flex: 1;
    min-width: 0;
  }

  .topbar__menu-btn {
    display: inline-flex;
    order: 2;
    margin-left: auto;
  }

  .topbar__actions {
    width: 100%;
    justify-content: stretch;
  }

  .accounts-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
    width: 100%;
  }

  .accounts-toolbar__field {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-width: 0;
  }

  .accounts-toolbar__field--search {
    grid-column: 1 / -1;
  }

  .accounts-toolbar__label {
    font-size: 0.78rem;
  }

  .accounts-toolbar__select,
  .accounts-toolbar__search {
    width: 100%;
    min-width: 0;
  }

  .candidate-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .data-table th,
  .data-table td {
    padding: 10px 8px;
    font-size: 0.86rem;
  }

  .data-table th {
    font-size: 0.72rem;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    border: 0;
    padding: 0;
    background: rgba(31, 31, 31, 0.45);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  body.portal-menu-open .sidebar-backdrop {
    display: block;
    opacity: 1;
  }

  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    z-index: 201;
    width: min(280px, 88vw);
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding-top: 12px;
    border-right: none;
    border-left: 1px solid var(--border);
    border-bottom: none;
    box-shadow: -8px 0 32px rgba(31, 31, 31, 0.14);
    transform: translateX(100%);
    transition: transform 0.24s ease;
    overflow: hidden;
  }

  body.portal-menu-open .sidebar {
    transform: translateX(0);
  }

  .sidebar__close {
    display: inline-flex;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
  }

  .sidebar__close:hover {
    background: var(--bg-hover);
    color: var(--text);
  }

  .sidebar__brand {
    padding-top: 36px;
  }

  .main {
    overflow: visible;
  }

  .detail-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .account-form__names {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }

  .account-form .field--account-type {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}
