/* Canonical LM Mail Admin enterprise theme */
:root {
  color-scheme: light;
  /* Корпоративная палитра resspb.ru: графит + оранжевый #ea5621, Montserrat */
  --page: #f4f5f7;
  --surface: #ffffff;
  --surface-soft: #f7f7f8;
  --surface-hover: #ececee;
  --surface-selected: #fdeee7;
  --nav: #141619;
  --nav-deep: #0e0f11;
  --nav-active: #ea5621;
  --accent: #ea5621;
  --accent-hover: #d64a15;
  --accent-text: #cf4513;
  --accent-soft: #fdeee7;
  --accent-soft-strong: #f7dcd0;
  --text: #141619;
  --text-body: #3d3f43;
  --muted: #6c6d74;
  --subtle: #9a9ca1;
  --border: #e5e5e7;
  --border-strong: #d0d1d4;
  --green: #1c8a5a;
  --green-soft: #e9f5ef;
  --amber: #b06a00;
  --amber-soft: #fbf1df;
  --red: #c52e3e;
  --red-hover: #a92836;
  --red-soft: #fbecee;
  --success: var(--green);
  --danger: var(--red);
  --shadow-modal: 0 24px 70px rgba(20, 22, 25, 0.24);
  --sidebar-width: 244px;
  --control-height: 40px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  --font: "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
[data-theme="dark"] {
  color-scheme: dark;
  --page: #141619; --surface: #1b1b1d; --surface-soft: #1e1f21; --surface-hover: #2a2c2f; --surface-selected: #33231c;
  --nav: #101113; --nav-deep: #0b0c0d; --nav-active: #ea5621;
  --accent: #ea5621; --accent-hover: #ff7a3d; --accent-text: #ff8a55; --accent-soft: #33231c; --accent-soft-strong: #452a20;
  --text: #ececee; --text-body: #d6d7da; --muted: #9a9ca1; --subtle: #828489;
  --border: #2c2e31; --border-strong: #3a3d41;
  --green: #4fd08a; --green-soft: #173126;
  --amber: #ffc45b; --amber-soft: #362a13;
  --red: #ff6b6b; --red-hover: #ff8585; --red-soft: #381d21;
  --success: var(--green); --danger: var(--red);
  --shadow-modal: 0 24px 70px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
}
body {
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.drawer-open,
body.modal-open {
  overflow: hidden;
}
button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
:focus-visible {
  outline: 3px solid rgba(234, 86, 33, 0.30);
  outline-offset: 2px;
}
.hidden {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.ui-icon,
.nav-icon,
.search-icon,
.mobile-tab-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mono {
  font-family: var(--mono);
  font-size: 0.96em;
}
.align-right {
  text-align: right;
}
.primary-btn,
.ghost-btn,
.danger-btn,
.warning-btn,
.chip-btn,
.icon-btn,
.btn-xs,
.timeline-filter-btn {
  min-height: var(--control-height);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease;
}
.primary-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(234, 86, 33, 0.28);
}
.primary-btn:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}
.ghost-btn,
.chip-btn,
.icon-btn,
.btn-xs,
.timeline-filter-btn {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text-body);
}
.ghost-btn:hover,
.chip-btn:hover,
.icon-btn:hover,
.btn-xs:hover,
.timeline-filter-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-soft);
  color: var(--accent);
}
.danger-btn,
.btn-xs.danger {
  border-color: rgba(197, 46, 62, 0.45);
  background: var(--surface);
  color: var(--red);
}
.danger-btn:hover,
.btn-xs.danger:hover {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red-hover);
}
.warning-btn {
  border-color: rgba(176, 106, 0, 0.45);
  background: var(--surface);
  color: #8a5300;
}
.warning-btn:hover {
  border-color: var(--amber);
  background: var(--amber-soft);
}
.primary-btn:disabled,
.ghost-btn:disabled,
.danger-btn:disabled,
.warning-btn:disabled {
  opacity: 0.46;
  box-shadow: none;
}
.primary-btn[aria-busy="true"],
.ghost-btn[aria-busy="true"],
.danger-btn[aria-busy="true"],
.warning-btn[aria-busy="true"] {
  cursor: wait;
}
.icon-btn {
  width: var(--control-height);
  min-width: var(--control-height);
  padding: 0;
}
.btn-xs {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}
.full {
  width: 100%;
}
.field-label {
  display: block;
  margin: 0 0 6px;
  color: var(--text-body);
  font-size: 12px;
  font-weight: 600;
}
.text-field,
.hero-search {
  width: 100%;
  min-height: var(--control-height);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  font-size: 14px;
  line-height: 1.35;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}
.text-field:hover,
.hero-search:hover {
  border-color: var(--border-strong);
}
.text-field:focus,
.hero-search:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(234, 86, 33, 0.16);
}
.text-field[readonly] {
  background: var(--surface-soft);
  color: var(--muted);
}
.text-field.compact {
  width: min(300px, 100%);
}
.textarea-field {
  min-height: 104px;
  padding: 10px 12px;
  resize: vertical;
}
.mailbox-picker { min-height: 154px; padding: 6px; }
.mailbox-picker option { padding: 7px 8px; }
/* Login */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: var(--page);
}
.login-panel {
  width: min(440px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 34px;
  box-shadow: 0 16px 46px rgba(20, 22, 25, 0.10);
}
.login-product,
.sidebar-brand,
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.product-mark {
  width: 50px;
  height: 50px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #ffffff;
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
}
.product-mark.small {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  font-size: 16px;
}
.login-mark,
.sidebar-mark {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.login-domain,
.sidebar-sub {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}
.login-panel h1 {
  margin: 30px 0 10px;
  color: var(--text);
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}
.login-copy {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}
.login-form {
  margin-top: 26px;
  display: grid;
  gap: 10px;
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 2px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.055em;
}
.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}
.inline-error {
  min-height: 20px;
  color: var(--red);
  font-size: 12px;
}
/* Application shell */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--nav);
  color: #ffffff;
}
.sidebar-brand {
  min-height: 86px;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.sidebar-brand .product-mark {
  background: var(--accent);
  color: #ffffff;
}
.sidebar-mark {
  color: #ffffff;
}
.sidebar-sub {
  color: rgba(255, 255, 255, 0.68);
}
.sidebar-nav {
  display: grid;
  gap: 4px;
  padding: 18px 12px;
}
.nav-link {
  position: relative;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  transition:
    background-color 140ms ease,
    color 140ms ease;
}
.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}
.nav-link.active {
  background: var(--nav-active);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(234, 86, 33, 0.32);
}
.nav-icon {
  width: 19px;
  height: 19px;
}
.nav-badge,
.mobile-queue-badge {
  min-width: 22px;
  height: 22px;
  margin-left: auto;
  border-radius: 11px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  background: #ffffff;
  color: var(--nav-active);
  font-size: 11px;
  font-weight: 700;
}
.sidebar-account {
  margin: auto 16px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 4px 14px;
}
button.sidebar-account {
  width: 100%;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
button.sidebar-account:hover,
button.sidebar-account:focus-visible {
  background: rgba(255, 255, 255, .08);
  outline: 0;
}
button.sidebar-account:focus-visible {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .9);
}
.personal-profile-card { width: min(520px, calc(100vw - 28px)); }
.personal-profile-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.personal-profile-dialog-avatar {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}
.personal-profile-dialog-avatar img,
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.personal-profile-role {
  display: inline-flex;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 99px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 600;
}
.personal-profile-details { padding: 10px 24px; }
.personal-profile-details > div,
.personal-profile-integrations > div > div {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.personal-profile-details span,
.personal-profile-integrations span { color: var(--muted); }
.personal-profile-details strong,
.personal-profile-integrations strong { overflow-wrap: anywhere; }
.personal-profile-integrations {
  margin: 0 24px 24px;
  padding: 15px;
  border-radius: 10px;
  background: var(--accent-soft);
}
.personal-profile-integrations h3 { margin: 0 0 8px; font-size: 14px; }
.sidebar-avatar {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.sidebar-avatar .ui-icon {
  width: 19px;
  height: 19px;
}
.sidebar-user {
  min-width: 0;
  display: grid;
}
.sidebar-user-label {
  color: rgba(255, 255, 255, 0.64);
  font-size: 11px;
}
.sidebar-user strong {
  overflow: hidden;
  color: #ffffff;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-footer {
  padding: 0 16px 18px;
}
.sidebar-logout,
.mobile-drawer-logout {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 600;
}
.sidebar-logout:hover {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}
.main-shell {
  grid-column: 2;
  min-width: 0;
  min-height: 100vh;
}
.mobile-topbar,
.mobile-bottom-nav,
.mobile-drawer {
  display: none;
}
.app-header {
  min-height: 100px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 20px 32px;
  background: var(--surface);
}
.app-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.03em;
}
.app-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.create-mailbox-btn {
  flex: 0 0 auto;
}
.action-label-short {
  display: none;
}
/* Health */
.mail-health-banner {
  min-height: 68px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 32px;
  background: var(--surface);
}
.mail-health-main {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 18px;
}
.mail-health-title-row {
  min-width: 250px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.mail-health-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--green);
  color: transparent;
  font-size: 0;
  font-weight: 700;
}
.mail-health-banner.warn .mail-health-icon {
  background: var(--amber);
}
.mail-health-banner.fail .mail-health-icon {
  background: var(--red);
}
.mail-health-banner.loading .mail-health-icon {
  background: var(--subtle);
}
.mail-health-title {
  font-size: 13px;
  font-weight: 700;
}
.mail-health-headline {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}
.mail-health-pills,
.mail-health-issues,
.summary-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.mail-health-issues {
  margin-left: 4px;
}
.mail-health-side {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.mail-health-meta {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.health-refresh-btn {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
}
.issue-pill {
  max-width: 300px;
  overflow: hidden;
  color: var(--red);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Pages */
.page {
  display: none;
  padding: 24px 32px 40px;
}
.page.active {
  display: block;
}
.section-toolbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.section-copy {
  margin: 0;
  color: var(--muted);
}
.head-actions,
.inline-actions,
.action-row,
.credential-actions,
.qr-actions,
.table-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.search-command {
  min-height: 74px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
}
.search-field-wrap {
  position: relative;
}
.search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--subtle);
  pointer-events: none;
  transform: translateY(-50%);
}
.hero-search {
  min-height: 46px;
  padding-left: 40px;
  font-size: 15px;
}
.refresh-context-btn {
  min-height: 46px;
}
.search-facts,
.stats-strip {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.metric {
  min-width: 88px;
  border-left: 1px solid var(--border);
  display: grid;
  align-content: center;
  padding: 0 18px;
}
.metric-value {
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.metric-label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}
.desk-grid {
  min-height: calc(100vh - 306px);
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
  overflow: hidden;
  background: var(--surface);
}
.results-panel {
  min-width: 0;
  border-right: 1px solid var(--border);
  background: var(--surface-soft);
}
.workspace-panel-shell {
  min-width: 0;
  background: var(--surface);
}
.panel-head {
  min-height: 58px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
}
.panel-head.split {
  flex-wrap: wrap;
}
.panel-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}
.panel-head small {
  color: var(--muted);
  font-weight: 500;
}
.panel-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.support-results {
  max-height: calc(100vh - 365px);
  overflow: auto;
}
.support-result {
  position: relative;
  border: 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 10px;
  padding: 15px 16px;
  background: var(--surface);
  transition:
    background-color 140ms ease,
    box-shadow 140ms ease;
}
.support-result:hover {
  background: var(--surface-hover);
}
.support-result.active {
  background: var(--surface-selected);
  box-shadow: inset 3px 0 0 var(--accent);
}
.support-result.suspended {
  box-shadow: inset 3px 0 0 var(--red);
}
.support-top,
.support-bottom,
.workspace-top,
.workspace-title-row,
.mailbox-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.support-main {
  min-width: 0;
}
.support-title,
.workspace-title {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.support-copy,
.workspace-copy,
.ops-copy,
.subtle,
.empty-copy,
.table-meta {
  color: var(--muted);
  font-size: 12px;
}
.support-copy {
  margin-top: 3px;
}
.support-bottom {
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 5px;
}
.support-bottom .support-open-btn {
  min-height: 30px;
  margin-left: auto;
  padding: 0 10px;
}
.status-pill,
.pill,
.audit-pill,
.summary-pill,
.severity-pill,
.queue-status {
  min-height: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.status-pill.good,
.audit-pill.ok,
.summary-pill.good,
.severity-pill.info,
.queue-status.active {
  border-color: rgba(28, 138, 90, 0.35);
  background: var(--green-soft);
  color: var(--green);
}
.status-pill.warn,
.summary-pill.warn,
.severity-pill.warn,
.queue-status.deferred {
  border-color: rgba(176, 106, 0, 0.35);
  background: var(--amber-soft);
  color: #8a5300;
}
.status-pill.bad,
.audit-pill.fail,
.summary-pill.bad,
.severity-pill.error,
.queue-status.hold {
  border-color: rgba(197, 46, 62, 0.35);
  background: var(--red-soft);
  color: var(--red);
}
.status-pill.neutral {
  border-color: var(--border);
  background: var(--surface-soft);
  color: var(--muted);
}
.good-text {
  color: var(--green);
}
.warn-text {
  color: var(--amber);
}
.bad-text {
  color: var(--red);
}
/* Mailbox workspace */
.support-workspace {
  min-width: 0;
}
.workspace-panel {
  min-width: 0;
}
.mailbox-identity {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 18px 20px 16px;
}
.mailbox-identity-main {
  display: flex;
  align-items: center;
  gap: 13px;
}
.mailbox-avatar {
  width: 48px;
  height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--surface-soft);
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
}
.mailbox-title-row {
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.mailbox-title-row h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.action-row {
  justify-content: flex-end;
}
.inline-notice {
  grid-column: 1 / -1;
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  padding: 8px 10px;
  background: var(--accent-soft);
  color: var(--text-body);
  font-size: 12px;
}
.inline-notice.warn {
  border-left-color: var(--amber);
  background: var(--amber-soft);
  color: #82510a;
}
.workspace-tabs {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.workspace-tabs::-webkit-scrollbar {
  display: none;
}
.workspace-tab {
  position: relative;
  min-width: max-content;
  min-height: 46px;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.workspace-tab::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 2px;
  background: transparent;
}
.workspace-tab:hover {
  color: var(--text);
}
.workspace-tab.active {
  color: var(--accent);
}
.workspace-tab.active::after {
  background: var(--accent);
}
.workspace-tab-panel {
  display: none;
  padding: 14px;
}
.workspace-tab-panel.active {
  display: block;
}
.overview-grid,
.settings-grid,
.provision-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.overview-grid > .ops-card {
  border: 0;
  border-radius: 0;
  padding: 4px 16px 8px 2px;
}
.overview-grid > .ops-card + .ops-card {
  border-left: 1px solid var(--border);
  padding-right: 2px;
  padding-left: 22px;
}
.settings-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.ops-card,
.workspace-card-block,
.data-panel,
.metric-card,
.result-box,
.danger-box,
.empty-state,
.credential-summary,
.qr-card,
.queue-preview-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.ops-card,
.workspace-card-block {
  min-width: 0;
  padding: 15px;
}
.ops-card h4,
.workspace-card-block h4 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}
.ops-copy {
  margin: -6px 0 14px;
}
#workspaceSharedAccess {
  grid-column: 1 / -1;
  order: 1;
}
.workspace-shared-list { display: grid; gap: 8px; }
.workspace-shared-row { display: grid; grid-template-columns: minmax(220px, 1fr) max-content max-content; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft); }
.workspace-shared-identity { display: grid; min-width: 0; gap: 2px; }
.workspace-shared-identity strong, .workspace-shared-identity span { overflow-wrap: anywhere; }
.workspace-shared-control { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; white-space: nowrap; }
.workspace-shared-control input { accent-color: var(--accent); }
@media (max-width: 760px) {
  .workspace-shared-row { grid-template-columns: 1fr; }
}
.detail-kv {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1.3fr);
  gap: 8px 14px;
}
.detail-kv .k {
  color: var(--muted);
  font-size: 12px;
}
.detail-kv .v {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12px;
  font-weight: 550;
}
.storage-facts {
  display: grid;
  gap: 0;
}
.storage-facts > div,
.service-check {
  min-height: 38px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 12px;
}
.storage-facts > div:last-child,
.service-check:last-child {
  border-bottom: 0;
}
.storage-facts span,
.service-check span {
  color: var(--muted);
}
.storage-facts strong,
.service-check strong {
  font-variant-numeric: tabular-nums;
}
.service-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
}
.queue-preview {
  margin-top: 12px;
}
.queue-preview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 9px;
  padding: 12px;
  background: var(--surface-soft);
}
.queue-preview-main {
  min-width: 0;
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
}
.queue-preview-main strong {
  color: var(--text);
  font-size: 12px;
}
.queue-preview-row .details-code,
.queue-preview-row .inline-actions {
  grid-column: 1 / -1;
}
.summary-strip {
  margin: 12px 0;
}
.timeline-filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}
.timeline-filter-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 11px;
}
.timeline-filter-btn.active {
  border-color: rgba(234, 86, 33, 0.40);
  background: var(--accent-soft);
  color: var(--accent);
}
.timeline-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.timeline-event {
  border: 1px solid var(--border);
  border-left: 3px solid #b4b5ba;
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--surface);
}
.timeline-event.warn {
  border-left-color: var(--amber);
}
.timeline-event.error {
  border-left-color: var(--red);
}
.timeline-summary {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}
.timeline-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}
.details-code,
.queue-error {
  max-width: 100%;
  overflow: auto;
  border-radius: var(--radius-sm);
  padding: 8px 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.provision-card {
  display: grid;
  align-content: start;
  gap: 11px;
}
.workspace-card-block + .provision-layout {
  margin-top: 12px;
}
.workspace-card-block + .workspace-card-block {
  margin-top: 10px;
}
.result-box,
.danger-box {
  padding: 11px 12px;
  background: var(--surface-soft);
  color: var(--text-body);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.result-box.error,
.danger-box {
  border-color: rgba(197, 46, 62, 0.35);
  background: var(--red-soft);
  color: var(--red-hover);
}
.empty-state {
  min-height: 128px;
  display: grid;
  place-content: center;
  gap: 5px;
  padding: 22px;
  text-align: center;
}
.empty-state h3 {
  margin: 0;
  font-size: 14px;
}
.empty-copy {
  max-width: 460px;
}
/* Tables and secondary pages */
.data-panel {
  min-width: 0;
  margin-bottom: 14px;
  overflow: hidden;
}
.stats-strip {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.metric-card {
  min-width: 130px;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  display: grid;
  align-content: center;
  padding: 12px 18px;
}
.metric-card:last-child {
  border-right: 0;
}
.toolbar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 14px;
  padding: 16px;
}
.toolbar-grid.audit-filters {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}
.toolbar-action {
  min-width: 130px;
}
.table-wrap {
  width: 100%;
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
thead {
  background: var(--surface-soft);
}
th {
  height: 38px;
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  white-space: nowrap;
}
td {
  min-height: 44px;
  border-bottom: 1px solid var(--border);
  padding: 9px 12px;
  color: var(--text-body);
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: var(--surface-hover);
}
.context-link,
.context-link-btn {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-align: left;
}
.context-link:hover,
.context-link-btn:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
.cell-stack {
  display: grid;
  gap: 3px;
}
.admin-section-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.admin-section-tab {
  min-width: max-content;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.admin-section-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.table-meta {
  line-height: 1.4;
}
.queue-error {
  max-width: 330px;
  max-height: 76px;
}
/* Managed addresses */
.managed-address-filters { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(180px, 240px); gap: 12px; margin-bottom: 16px; }
.managed-address-search { padding-left: 40px; }
.managed-address-layout { min-height: 520px; border: 1px solid var(--border); border-radius: var(--radius); display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); overflow: hidden; background: var(--surface); }
.managed-address-list-panel { min-width: 0; border-right: 1px solid var(--border); background: var(--surface-soft); }
.managed-address-workspace-panel { min-width: 0; }
.managed-address-list { display: grid; }
.managed-address-company-group { display: grid; }
.managed-address-company-title { align-items: center; color: var(--muted); display: flex; font-size: 11px; justify-content: space-between; letter-spacing: .04em; padding: 12px 16px 6px; text-transform: uppercase; }
.managed-address-item { width: 100%; border: 0; border-bottom: 1px solid var(--border); display: grid; gap: 7px; padding: 14px 16px; background: transparent; color: var(--text); text-align: left; }
.managed-address-item:hover,
.managed-address-item.active { background: var(--accent-soft); }
.managed-address-item.active { box-shadow: inset 3px 0 var(--accent); }
.managed-address-item-head,
.managed-address-item-foot,
.managed-address-summary,
.managed-address-fact { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.managed-address-item-foot,
.managed-address-email,
.managed-address-description,
.field-help { color: var(--muted); font-size: 11px; }
.managed-address-workspace { padding: 22px; }
.managed-address-summary { align-items: flex-start; }
.managed-address-summary h3 { margin: 3px 0; font-size: 22px; }
.managed-address-kicker { color: var(--accent); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.055em; }
.managed-address-description { margin: 18px 0; font-size: 13px; line-height: 1.55; }
.managed-address-fact { border-top: 1px solid var(--border); padding: 12px 0; }
.managed-address-relations { margin-top: 20px; }
.managed-address-relations h4 { margin: 0 0 8px; font-size: 12px; }
.managed-address-relations ul { border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 0; padding: 0; list-style: none; }
.managed-address-relations li { min-height: 42px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; }
.managed-address-relations li:last-child { border-bottom: 0; }
.managed-address-actions { border-top: 1px solid var(--border); margin-top: 22px; padding-top: 16px; }
.managed-address-back-btn,
.mailbox-list-back-btn { display: none; margin-bottom: 14px; }
.managed-address-modal { width: min(720px, 100%); }
.managed-address-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.technical-preset-panel { border: 1px solid var(--border); border-radius: var(--radius-sm); display: grid; gap: 12px; padding: 14px; background: var(--surface-soft); }
.technical-preset-panel strong { font-size: 13px; }
.technical-preset-panel p { margin: 5px 0 0; line-height: 1.5; }
.technical-preset-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.technical-preset-btn { min-height: 38px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 11px; font-weight: 700; padding: 8px; }
.technical-preset-btn:hover,
.technical-preset-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.admin-settings-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 16px; }
.settings-panel { min-width: 0; }
.identity-settings-panel { grid-column: 1 / -1; }
.identity-settings-body { display: grid; gap: 18px; padding: 0 20px 20px; }
.identity-status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.identity-status-card { display: grid; gap: 5px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; background: var(--surface-soft); }
.identity-status-card > span { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .055em; text-transform: uppercase; }
.identity-status-card > strong { font-size: 15px; }
.identity-status-card > small { color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.identity-ok { color: var(--success); }
.identity-bad { color: var(--danger); }
.identity-group-select { min-height: 150px; padding: 6px; }
.identity-group-select option { border-radius: 5px; padding: 7px 8px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.checkbox-row input { margin-top: 2px; accent-color: var(--accent); }
.compact-checkbox { margin-top: 10px; color: var(--text); font-size: 12px; line-height: 1.4; }
.panel-copy { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.server-settings-list { margin: 0; padding: 0 20px 20px; }
.server-settings-list > div { min-height: 54px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: minmax(120px, .6fr) minmax(0, 1.4fr); gap: 18px; align-items: center; }
.server-settings-list > div:last-child { border-bottom: 0; }
.server-settings-list dt { color: var(--muted); }
.server-settings-list dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-family: var(--mono); font-weight: 600; }
.server-settings-list a { color: var(--accent); }
.appearance-setting { padding: 20px; }
.appearance-setting .text-field { width: 100%; }
.field-help { margin: 6px 0 0; line-height: 1.45; }
/* Modals */
.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 22, 25, 0.55);
}
.modal-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
  background: var(--surface);
  box-shadow: var(--shadow-modal);
}
.credential-modal {
  width: min(930px, 100%);
}
.modal-head {
  min-height: 64px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
}
.modal-head h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}
.modal-kicker {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.055em;
}
.modal-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}
.modal-copy {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.modal-actions {
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 18px;
}
.credential-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.9fr);
  align-items: start;
}
.credential-main {
  min-width: 0;
}
.credential-summary {
  min-height: 210px;
  padding: 14px;
  background: var(--surface-soft);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.credential-actions {
  margin-top: 12px;
}
.credential-side {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.qr-card {
  padding: 12px;
  text-align: center;
}
.qr-head {
  min-height: 36px;
  font-size: 12px;
  font-weight: 700;
}
.qr-box {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}
.qr-box img,
.qr-box canvas {
  max-width: 100%;
  height: auto !important;
}
.qr-actions {
  justify-content: center;
}
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 130;
  max-width: min(440px, calc(100vw - 44px));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  padding: 11px 14px;
  background: #141619;
  color: #ffffff;
  font-size: 12px;
  box-shadow: 0 12px 34px rgba(20, 22, 25, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
@media (max-width: 1200px) {
  :root {
    --sidebar-width: 218px;
  }
  .app-header,
  .mail-health-banner,
  .page {
    padding-right: 24px;
    padding-left: 24px;
  }
  .desk-grid {
    grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
  }
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mail-health-title-row {
    min-width: 220px;
  }
  .mail-health-pills .status-pill:nth-child(n + 6) {
    display: none;
  }
}
@media (max-width: 1024px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    min-height: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    background: var(--nav);
  }
  .sidebar-brand {
    min-height: 64px;
    border: 0;
    padding: 12px 16px;
  }
  .sidebar-brand .sidebar-sub {
    display: none;
  }
  .sidebar-nav {
    min-width: 0;
    display: flex;
    gap: 2px;
    padding: 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }
  .nav-link {
    width: auto;
    min-width: max-content;
    min-height: 40px;
    padding: 0 10px;
    font-size: 11px;
  }
  .nav-icon {
    width: 17px;
    height: 17px;
  }
  .sidebar-account {
    display: none;
  }
  .sidebar-user {
    display: none;
  }
  .sidebar-footer {
    padding: 0 12px 0 0;
  }
  .sidebar-logout {
    width: 40px;
    min-height: 40px;
    justify-content: center;
    padding: 0;
  }
  .sidebar-logout span {
    display: none;
  }
  .main-shell {
    min-height: calc(100vh - 64px);
  }
  .app-header {
    min-height: 88px;
  }
  .mail-health-banner {
    align-items: flex-start;
  }
  .mail-health-main {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px 16px;
  }
  .mail-health-title-row {
    min-width: 100%;
  }
  .search-command {
    grid-template-columns: minmax(260px, 1fr) auto;
  }
  .search-facts {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
    padding-top: 10px;
  }
  .search-facts .metric:first-child {
    border-left: 0;
    padding-left: 0;
  }
  .desk-grid {
    min-height: auto;
    grid-template-columns: minmax(230px, 290px) minmax(0, 1fr);
  }
  .support-results {
    max-height: none;
  }
  .mailbox-identity {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }
  .action-row {
    justify-content: flex-start;
  }
  .action-row .secondary-action {
    margin-left: 0;
  }
  .overview-grid,
  .settings-grid,
  .provision-layout {
    grid-template-columns: 1fr;
  }
  .toolbar-grid.audit-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  html,
  body,
  .app-shell,
  .main-shell {
    max-width: 100%;
    overflow-x: hidden;
  }
  .identity-status-grid { grid-template-columns: 1fr; }
  .sidebar {
    display: none;
  }
  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 45;
    min-height: 66px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: var(--surface);
  }
  .mobile-brand > div strong,
  .mobile-brand > div span {
    display: block;
  }
  .mobile-brand > div strong {
    font-size: 14px;
  }
  .mobile-brand > div span {
    color: var(--muted);
    font-size: 10px;
  }
  .mobile-menu-btn {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
  }
  .main-shell {
    min-height: auto;
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }
  .app-header {
    min-height: 84px;
    align-items: flex-start;
    padding: 16px;
  }
  .app-header h1 {
    font-size: 22px;
  }
  .app-header p {
    display: none;
  }
  .create-mailbox-btn {
    min-width: 104px;
    padding: 0 12px;
  }
  .create-mailbox-btn .action-label-full {
    display: none;
  }
  .create-mailbox-btn .action-label-short {
    display: inline;
  }
  .mail-health-banner {
    min-height: 0;
    width: calc(100% - 24px);
    margin: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    padding: 12px 16px;
  }
  .mail-health-main {
    display: grid;
    gap: 9px;
  }
  .mail-health-title-row {
    min-width: 0;
  }
  .mail-health-title {
    font-size: 12px;
  }
  .mail-health-headline {
    display: none;
  }
  .mail-health-pills {
    grid-column: 1 / -1;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .mail-health-pills::-webkit-scrollbar {
    display: none;
  }
  .mail-health-pills .status-pill:nth-child(n) {
    display: inline-flex;
  }
  .mail-health-pills .health-value {
    display: none;
  }
  .mail-health-issues {
    grid-column: 1 / -1;
  }
  .mail-health-meta {
    display: none;
  }
  .health-refresh-btn {
    width: 38px;
    min-width: 38px;
    min-height: 38px;
  }
  .page {
    padding: 14px 12px 24px;
  }
  .search-command {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px;
  }
  .hero-search {
    min-height: 44px;
    font-size: 14px;
  }
  .refresh-context-btn {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
  }
  .refresh-context-btn span {
    display: none;
  }
  .search-facts {
    justify-content: space-between;
    padding-top: 9px;
  }
  .metric {
    min-width: 0;
    flex: 1;
    padding: 0 10px;
  }
  .metric:first-child {
    padding-left: 0;
  }
  .metric-value {
    font-size: 17px;
  }
  .metric-label {
    font-size: 9px;
  }
  .desk-grid {
    border: 0;
    display: block;
    overflow: visible;
    background: transparent;
  }
  .managed-address-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .managed-address-layout.has-selection .managed-address-list-panel {
    display: none;
  }
  .managed-address-layout.has-selection .managed-address-back-btn {
    display: inline-flex;
  }
  .mailbox-list-back-btn {
    display: inline-flex;
  }
  .results-panel,
  .workspace-panel-shell {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
  }
  .results-panel {
    margin-bottom: 12px;
  }
  .app-shell.has-mailbox-selection .results-panel {
    display: none;
  }
  .panel-head {
    min-height: 52px;
    padding: 10px 12px;
  }
  .panel-meta {
    max-width: 55%;
  }
  .support-results {
    max-height: 260px;
  }
  .support-result {
    padding: 13px 12px;
  }
  .workspace-panel-head {
    display: none;
  }
  .mailbox-identity {
    grid-template-columns: 1fr;
    padding: 14px 12px;
  }
  .mailbox-avatar {
    width: 42px;
    height: 42px;
  }
  .mailbox-title-row h3 {
    font-size: 16px;
  }
  .action-row {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .action-row::-webkit-scrollbar {
    display: none;
  }
  .action-row > * {
    width: auto;
    min-width: max-content;
  }
  .managed-address-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .managed-address-actions > * {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }
  #workspaceResetPasswordBtn,
  #workspaceSuspendMailboxBtn,
  #workspaceRestoreMailboxBtn,
  #workspaceDeleteMailboxBtn {
    min-width: 0;
    flex: 1;
    padding-right: 10px;
    padding-left: 10px;
  }
  .action-row .action-label-full {
    display: none;
  }
  .action-row .action-label-short {
    display: inline;
    font-size: 12px;
  }
  .workspace-tabs {
    padding: 0 4px;
  }
  .workspace-tab {
    min-height: 44px;
    padding: 0 11px;
    font-size: 12px;
  }
  .workspace-tab-panel {
    padding: 10px;
  }
  .overview-grid,
  .ops-grid,
  .settings-grid,
  .provision-layout,
  .service-check-grid {
    grid-template-columns: 1fr;
  }
  .overview-grid > .ops-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 13px;
  }
  .overview-grid > .ops-card + .ops-card {
    padding: 13px;
  }
  .ops-card,
  .workspace-card-block {
    padding: 13px;
  }
  .detail-kv {
    grid-template-columns: minmax(110px, 0.85fr) minmax(0, 1.15fr);
    gap: 8px 10px;
  }
  .workspace-title-row {
    display: grid;
  }
  .timeline-filter-row {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }
  .timeline-filter-btn {
    min-width: max-content;
  }
  .timeline-meta {
    margin-top: 8px;
  }
  .queue-preview-row {
    grid-template-columns: 1fr;
  }
  .queue-preview-row .queue-status {
    justify-self: start;
  }
  .queue-preview-row .details-code,
  .queue-preview-row .inline-actions {
    grid-column: auto;
  }
  .section-toolbar {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 12px;
  }
  .section-toolbar > .ghost-btn,
  .section-toolbar > .head-actions {
    align-self: stretch;
  }
  .head-actions > * {
    flex: 1;
  }
  .stats-strip {
    width: 100%;
    overflow-x: auto;
  }
  .metric-card {
    min-width: 116px;
    padding: 10px 12px;
  }
  .toolbar-grid,
  .toolbar-grid.audit-filters {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .toolbar-action {
    min-width: 0;
  }
  .table-wrap {
    overscroll-behavior-x: contain;
  }
  table {
    min-width: 720px;
  }
  #page-accounts table,
  #page-stats table {
    min-width: 560px;
  }
  .mobile-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    height: calc(70px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    box-shadow: 0 -8px 24px rgba(20, 22, 25, 0.10);
  }
  .mobile-tab {
    position: relative;
    min-width: 0;
    border: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 3px;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
  }
  .mobile-tab.active {
    color: var(--accent);
  }
  .mobile-tab-icon {
    width: 21px;
    height: 21px;
  }
  .mobile-queue-badge {
    position: absolute;
    top: 7px;
    left: calc(50% + 7px);
    min-width: 17px;
    height: 17px;
    border: 2px solid var(--surface);
    border-radius: 9px;
    padding: 0 4px;
    background: var(--red);
    color: #ffffff;
    font-size: 9px;
  }
  .mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: block;
  }
  .mobile-drawer-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    background: rgba(20, 22, 25, 0.55);
  }
  .mobile-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 86vw);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    box-shadow: -16px 0 42px rgba(0, 0, 0, 0.30);
  }
  .mobile-drawer-head {
    min-height: 66px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 10px 18px;
  }
  .mobile-drawer-nav {
    display: grid;
    gap: 3px;
    padding: 12px;
  }
  .mobile-nav-link {
    min-height: 44px;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 0 12px;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
  }
  .mobile-nav-link:hover,
  .mobile-nav-link.active {
    background: var(--accent-soft);
    color: var(--accent);
  }
  .mobile-drawer-logout {
    width: auto;
    margin: auto 12px 14px;
    border-color: rgba(197, 46, 62, 0.35);
    justify-content: center;
    background: var(--red-soft);
    color: var(--red);
  }
  .modal-shell {
    align-items: end;
    padding: 0;
  }
  .modal-card {
    width: 100%;
    max-height: 94vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .credential-grid,
  .credential-side {
    grid-template-columns: 1fr;
  }
  .modal-actions > * {
    flex: 1;
  }
  .toast {
    right: 12px;
    bottom: 82px;
    left: 12px;
    max-width: none;
  }
}
@media (max-width: 420px) {
  .login-shell {
    padding: 14px;
  }
  .login-panel {
    padding: 24px 20px;
  }
  .login-panel h1 {
    font-size: 23px;
  }
  .app-header {
    min-height: 76px;
  }
  .app-header h1 {
    font-size: 20px;
  }
  .search-facts .metric {
    padding-right: 7px;
    padding-left: 7px;
  }
  .panel-meta { display: none; }
  .workspace-tab {
    padding: 0 9px;
    font-size: 11px;
  }
}
@media (max-width: 860px) {
  .managed-address-layout,
  .managed-address-filters,
  .managed-address-form-grid,
  .technical-preset-grid,
  .admin-settings-grid { grid-template-columns: 1fr; }
  .managed-address-list-panel { border-right: 0; border-bottom: 1px solid var(--border); }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ============================================================================
   Корпоративный шрифт Montserrat (self-hosted, из фирменного дистрибутива resspb.ru)
   ========================================================================== */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/static/fonts/montserrat-300-montserrat-88e65f67.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/static/fonts/montserrat-300-montserrat-0f73558f.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/static/fonts/montserrat-300-montserrat-e8baea2c.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/static/fonts/montserrat-300-montserrat-352c33a9.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/static/fonts/montserrat-300-montserrat-0dc98610.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/fonts/montserrat-400-montserrat-67146b73.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/fonts/montserrat-400-montserrat-e081619b.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/fonts/montserrat-400-montserrat-0748de38.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/fonts/montserrat-400-montserrat-dade07bd.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/fonts/montserrat-400-montserrat-ab105b20.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/static/fonts/montserrat-500-montserrat-afa71617.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/static/fonts/montserrat-500-montserrat-28321cff.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/static/fonts/montserrat-500-montserrat-cffba35c.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/static/fonts/montserrat-500-montserrat-126d7ad9.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/static/fonts/montserrat-500-montserrat-552d3dce.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/static/fonts/montserrat-600-montserrat-f05a0e21.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/static/fonts/montserrat-600-montserrat-77cf04c9.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/static/fonts/montserrat-600-montserrat-9006bb6a.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/static/fonts/montserrat-600-montserrat-4d9062ef.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/static/fonts/montserrat-600-montserrat-a77dae9d.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


/* ============================================================================
   Корпоративный слой resspb.ru (графит + оранжевый #ea5621, Montserrat)
   Финальные переопределения: глубина, состояния, тёмная тема.
   ========================================================================== */

::selection {
  background: rgba(234, 86, 33, 0.22);
}

body {
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --- Логин: графитовая страница с мягким фирменным свечением --- */
.login-shell {
  background:
    radial-gradient(760px 460px at 16% -8%, rgba(234, 86, 33, 0.10), transparent 62%),
    radial-gradient(620px 420px at 106% 14%, rgba(20, 22, 25, 0.05), transparent 58%),
    var(--page);
}
.login-panel {
  border-color: var(--border);
}
.login-product .product-mark {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(234, 86, 33, 0.30);
}
.login-panel h1 {
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* --- Сайдбар: графит с лёгким градиентом --- */
.sidebar {
  background: linear-gradient(180deg, #17191c 0%, #141619 32%, #101113 100%);
  border-right: 1px solid #0b0c0d;
}
.sidebar-brand {
  border-bottom-color: rgba(255, 255, 255, 0.10);
}
.nav-link.active {
  background: var(--nav-active);
  box-shadow: 0 4px 14px rgba(234, 86, 33, 0.32);
}
.nav-link:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
}
.nav-badge {
  background: var(--accent);
  color: #ffffff;
}

/* --- Кнопки --- */
.primary-btn {
  box-shadow: 0 2px 6px rgba(234, 86, 33, 0.28);
}
.ghost-btn:hover,
.chip-btn:hover,
.icon-btn:hover,
.btn-xs:hover,
.timeline-filter-btn:hover {
  border-color: rgba(234, 86, 33, 0.45);
  color: var(--accent-hover);
}
.context-link,
.context-link-btn {
  color: var(--accent-text);
}
.context-link:hover,
.context-link-btn:hover {
  color: var(--accent-hover);
}

/* --- Заголовки и метрики --- */
.app-header h1 {
  font-weight: 600;
  letter-spacing: -0.02em;
}
.metric-value {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.sidebar-mark,
.login-mark,
.mobile-brand strong {
  font-weight: 600;
}

/* --- Таблицы --- */
thead {
  background: var(--surface-soft);
}
th {
  color: var(--muted);
  font-weight: 600;
}
td {
  color: var(--text-body);
}

/* --- Статусные пилюли --- */
.status-pill.good,
.audit-pill.ok,
.summary-pill.good,
.severity-pill.info,
.queue-status.active {
  border-color: rgba(28, 138, 90, 0.35);
  background: var(--green-soft);
  color: var(--green);
}
.status-pill.warn,
.summary-pill.warn,
.severity-pill.warn,
.queue-status.deferred {
  border-color: rgba(176, 106, 0, 0.35);
  background: var(--amber-soft);
  color: #8a5300;
}
.status-pill.bad,
.audit-pill.fail,
.summary-pill.bad,
.severity-pill.error,
.queue-status.hold {
  border-color: rgba(197, 46, 62, 0.35);
  background: var(--red-soft);
  color: var(--red);
}

/* --- Вкладки --- */
.workspace-tab.active {
  color: var(--accent-text);
}
.workspace-tab.active::after {
  background: var(--accent);
}
.timeline-filter-btn.active {
  border-color: rgba(234, 86, 33, 0.40);
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* --- Активные состояния списков --- */
.support-result.active {
  background: var(--surface-selected);
  box-shadow: inset 3px 0 0 var(--accent);
}
.support-result.suspended {
  box-shadow: inset 3px 0 0 var(--red);
}
.managed-address-item.active {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 var(--accent);
}
.mobile-nav-link:hover,
.mobile-nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.mobile-tab.active {
  color: var(--accent-text);
}

/* --- Тосты и модалки --- */
.toast {
  background: #141619;
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 34px rgba(20, 22, 25, 0.28);
}
.modal-shell {
  background: rgba(20, 22, 25, 0.55);
}

/* --- Тёмная тема: доводка хардкод-тонов --- */
[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #17181a 0%, #101113 46%, #0b0c0d 100%);
  border-right-color: #08090a;
}
[data-theme="dark"] .login-shell {
  background:
    radial-gradient(760px 460px at 16% -8%, rgba(234, 86, 33, 0.14), transparent 62%),
    var(--page);
}
[data-theme="dark"] .login-panel {
  background: #1b1b1d;
  border-color: #2c2e31;
}
[data-theme="dark"] .toast {
  background: #232527;
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .credential-summary,
[data-theme="dark"] .details-code {
  background: #1e1f21;
  color: #9a9ca1;
}
[data-theme="dark"] .result-box {
  color: #d6d7da;
}
[data-theme="dark"] thead {
  background: #1e1f21;
}
[data-theme="dark"] th {
  color: #9a9ca1;
}
[data-theme="dark"] td {
  color: #d6d7da;
}
[data-theme="dark"] tbody tr:hover,
[data-theme="dark"] .support-result:hover {
  background: #232527;
}
[data-theme="dark"] .text-field[readonly] {
  background: #1e1f21;
}
[data-theme="dark"] .mobile-topbar,
[data-theme="dark"] .mobile-bottom-nav {
  background: #1b1b1d;
}
[data-theme="dark"] .mobile-drawer-panel {
  background: #1b1b1d;
}
[data-theme="dark"] .mobile-drawer-logout {
  border-color: rgba(255, 107, 107, 0.40);
}
[data-theme="dark"] .mailbox-avatar {
  border-color: #3a3d41;
  background: #1e1f21;
}

/* ============================================================================
   MailAdmin UX v2 — операционный слой улучшений (только CSS, поверх темы resspb)
   Дата: 2026-08-14 | Согласован: review.md (subagent_01..04 + перекрёстная проверка)
   Правила: не трогаем .hidden, .page без .active, механизм data-theme, admin.js.
   Порядок: токены → светлая тема → тёмная тема → desktop-уточнения → мобильный.
   ============================================================================ */

/* ---------- (T1/T2) Токены заливок с AA-контрастом ---------- */
:root {
  --accent-deep: #cc4514;      /* заливка primary/active-навигации: белый текст 4.74:1 */
  --accent-deep-hover: #b93a10;/* hover заливки: белый текст 5.71:1 */
  --green-deep: #177a4f;       /* текст good-пилюль на светлом: 4.77:1 */
  --pill-radius: 99px;         /* капсульные пилюли статусов */
}
[data-theme="dark"] {
  --accent-deep: #cc4514;      /* тот же AA-запас в тёмной теме */
  --accent-deep-hover: #b93a10;
  --surface-selected: #3a281e; /* активная строка теплее и светлее hover */
}

/* ---------- (C1-C4) Заливки primary: кнопка, навигация, бейдж ---------- */
.primary-btn {
  border-color: var(--accent-deep);
  background: var(--accent-deep);
}
.primary-btn:hover {
  border-color: var(--accent-deep-hover);
  background: var(--accent-deep-hover);
  box-shadow: 0 3px 10px rgba(204, 69, 20, 0.34);
}
.nav-link.active {
  background: var(--accent-deep);
}
.nav-badge {
  background: #ffffff;
  color: var(--accent-deep);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}

/* ---------- (C6) Иконка поиска и делитель логина: контраст на светлой ---------- */
:root:not([data-theme="dark"]) .search-icon,
:root:not([data-theme="dark"]) .login-divider {
  color: var(--muted);
}

/* ---------- (C7/C8) Статус-цвета на светлой теме ---------- */
:root:not([data-theme="dark"]) .status-pill.good,
:root:not([data-theme="dark"]) .audit-pill.ok,
:root:not([data-theme="dark"]) .summary-pill.good,
:root:not([data-theme="dark"]) .severity-pill.info,
:root:not([data-theme="dark"]) .queue-status.active {
  color: var(--green-deep);
}
:root:not([data-theme="dark"]) .warn-text {
  color: #8a5300;
}

/* ---------- (C9) Нейтральный hover вторичных кнопок (оранжевый = только primary/active) ---------- */
.ghost-btn:hover:not(.active),
.chip-btn:hover:not(.active),
.icon-btn:hover:not(.active),
.btn-xs:hover:not(.active),
.timeline-filter-btn:hover:not(.active) {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text-body);
}

/* ---------- (C10) Единый токен активного текста вкладок ---------- */
.admin-section-tab.active,
.technical-preset-btn:hover,
.technical-preset-btn.active {
  color: var(--accent-text);
}

/* ---------- (C14) Пустые состояния ---------- */
.empty-state {
  min-height: 180px;
}
.empty-state h3 {
  font-weight: 600;
}

/* ---------- (C15) Строка загрузки/пустоты таблиц: центрирование ---------- */
tbody > tr > td.table-meta {
  text-align: center;
  padding: 26px 12px;
}

/* ---------- (C16) Лог ошибки очереди: максимум 2 строки ---------- */
.queue-error {
  max-width: 330px;
  max-height: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- (C17) Карточка письма очереди: воздух под действиями ---------- */
.queue-preview-row {
  padding: 12px 12px 14px;
}
.queue-preview-row .inline-actions {
  margin-top: 8px;
}

/* ---------- (C19/A3) Инлайн-уведомление: блок с точкой вместо полосы ---------- */
.inline-notice {
  position: relative;
  border: 1px solid rgba(234, 86, 33, 0.25);
  border-left-width: 1px;
  border-radius: var(--radius-sm);
  padding-left: 22px;
}
.inline-notice::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 10px;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--accent);
}
.inline-notice.warn {
  border-color: rgba(176, 106, 0, 0.35);
}
.inline-notice.warn::before {
  background: var(--amber);
}

/* ---------- (C20) Вкладки рабочей области: читаемая активная ---------- */
.workspace-tab {
  border-radius: 6px 6px 0 0;
}
.workspace-tab:hover {
  background: var(--surface-soft);
}
.workspace-tab.active {
  background: var(--accent-soft);
}

/* ---------- (C21) Единый язык радиусов ---------- */
.workspace-shared-row {
  border-radius: var(--radius);
}
.personal-profile-integrations {
  border-radius: var(--radius);
}
.identity-group-select option {
  border-radius: var(--radius-sm);
}

/* ---------- (C22) Профиль в сайдбаре: аккуратный hover ---------- */
button.sidebar-account {
  border-radius: var(--radius-sm);
}

/* ---------- (C24) Аффорданс сортировки таблиц (подготовка под JS) ---------- */
th[aria-sort] {
  cursor: pointer;
  user-select: none;
}
th[aria-sort="ascending"]::after {
  content: " ↑";
  color: var(--accent-text);
  font-size: 10px;
}
th[aria-sort="descending"]::after {
  content: " ↓";
  color: var(--accent-text);
  font-size: 10px;
}
th[aria-sort="none"]::after {
  content: " ⇅";
  color: var(--subtle);
  font-size: 10px;
}

/* ---------- (G1/G2) Типографика: только загруженные веса Montserrat ---------- */
.product-mark,
.mail-health-title,
.panel-head h2,
.support-title,
.workspace-title,
.ops-card h4,
.workspace-card-block h4,
.timeline-summary,
.qr-head,
.technical-preset-btn,
.empty-state h3,
.personal-profile-dialog-avatar,
.nav-badge,
.mobile-queue-badge {
  font-weight: 600;
}
.detail-kv .v {
  font-weight: 500;
}

/* ---------- (G3-G7) Крупнее мелкие тексты ---------- */
th {
  font-size: 11px;
  letter-spacing: 0.04em;
}
.metric-label {
  font-size: 11px;
}
.details-code,
.queue-error {
  font-size: 11px;
}
.managed-address-kicker,
.modal-kicker,
.identity-status-card > span {
  font-size: 11px;
}
.field-help,
.managed-address-email,
.managed-address-item-foot,
.queue-preview-main {
  font-size: 12px;
}

/* ---------- (G9/G10) Таблицы: читаемость и тач-зона строк ---------- */
table {
  font-size: 12.5px;
}
td {
  padding: 11px 12px;
}

/* ---------- (T9) Пилюли статусов: капсулы, крупнее ---------- */
.status-pill,
.pill,
.audit-pill,
.summary-pill,
.severity-pill,
.queue-status {
  min-height: 26px;
  border-radius: var(--pill-radius);
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
}

/* ---------- (A1/A2) Убрать левые полоски активных строк списков ---------- */
.support-result.active {
  box-shadow: none;
}
.support-result.active .support-title {
  color: var(--accent-text);
}
.support-result.suspended {
  box-shadow: inset 3px 0 0 var(--red);
}
.managed-address-item.active {
  box-shadow: none;
}
.managed-address-item.active .managed-address-email {
  color: var(--accent-text);
}

/* ---------- (S1) Тактильные :active-состояния ---------- */
.primary-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 3px rgba(20, 22, 25, 0.25);
}
.ghost-btn:active,
.chip-btn:active,
.icon-btn:active,
.btn-xs:active,
.timeline-filter-btn:active {
  background: var(--surface-hover);
}
.nav-link:active {
  background: rgba(255, 255, 255, 0.12);
}
.workspace-tab:active {
  color: var(--accent-text);
}

/* ---------- (S2) Отключённые вторичные кнопки ---------- */
.icon-btn:disabled,
.btn-xs:disabled,
.timeline-filter-btn:disabled {
  opacity: 0.46;
  pointer-events: none;
}

/* ---------- (S3) Видимый прогресс для aria-busy ---------- */
@keyframes ux2spin {
  to { transform: rotate(360deg); }
}
.primary-btn[aria-busy="true"]::after,
.ghost-btn[aria-busy="true"]::after,
.danger-btn[aria-busy="true"]::after,
.warning-btn[aria-busy="true"]::after {
  content: "";
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: ux2spin 0.7s linear infinite;
}
.ghost-btn[aria-busy="true"]::after,
.warning-btn[aria-busy="true"]::after {
  border-color: rgba(204, 69, 20, 0.35);
  border-top-color: var(--accent-deep);
}
.danger-btn[aria-busy="true"]::after {
  border-color: rgba(197, 46, 62, 0.35);
  border-top-color: var(--red);
}

/* ---------- (S4) Сплошной focus-ринг с AA-контрастом ---------- */
:focus-visible {
  outline: 3px solid var(--accent-text);
  outline-offset: 2px;
}

/* ---------- (S5) Свечение полей ввода ---------- */
.text-field:focus,
.hero-search:focus {
  box-shadow: 0 0 0 3px rgba(234, 86, 33, 0.30);
}

/* ---------- (S6) Тосты: сигнал успех/ошибка (классы добавит JS) ---------- */
.toast.success {
  border-left: 3px solid #4fd08a;
}
.toast.error {
  border-left: 3px solid #ff6b6b;
}

/* ---------- (H13) Поля с ошибкой (класс добавит JS) ---------- */
.text-field.invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(197, 46, 62, 0.14);
}
.field-error {
  color: var(--red);
  font-size: 12px;
  margin-top: 6px;
}

/* ---------- (H15) Бейдж очереди по семантике ---------- */
.queue-badge.is-error {
  background: var(--red);
  color: #ffffff;
}
.queue-badge.is-info {
  background: var(--accent-deep);
  color: #ffffff;
}

/* ---------- (H16-H19) Заготовки под будущие фичи (инертны, без разметки не видны) ---------- */
.quota-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-hover);
  overflow: hidden;
}
.quota-bar > i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--green-deep);
  transition: width 0.3s ease;
}
.quota-bar.warn > i {
  background: var(--amber);
}
.quota-bar.over > i {
  background: var(--red);
}
.bulk-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(20, 22, 25, 0.08);
}
.status-pill.stale {
  opacity: 0.55;
  border-style: dashed;
}
.row-menu {
  position: relative;
}

/* ============================ ТЁМНАЯ ТЕМА ============================ */

/* ---------- (T3) Поверхности: развести уровни «фон/карточка/подложка» ---------- */
[data-theme="dark"] {
  --page: #0f1012;
  --surface: #1e1e21;
  --surface-soft: #242529;
  --surface-hover: #2d2e32;
}
[data-theme="dark"] .login-panel {
  background: var(--surface);
}
[data-theme="dark"] .toast {
  background: var(--surface-soft);
}
[data-theme="dark"] .credential-summary,
[data-theme="dark"] .details-code {
  background: var(--surface-soft);
}
[data-theme="dark"] thead {
  background: var(--surface-soft);
}
[data-theme="dark"] tbody tr:hover,
[data-theme="dark"] .support-result:hover {
  background: var(--surface-hover);
}
[data-theme="dark"] .text-field[readonly] {
  background: var(--surface-soft);
}
[data-theme="dark"] .mobile-topbar,
[data-theme="dark"] .mobile-bottom-nav,
[data-theme="dark"] .mobile-drawer-panel {
  background: var(--surface);
}
[data-theme="dark"] .mailbox-avatar {
  background: var(--surface-soft);
}

/* ---------- (T4/T8) P0: warn-тексты читаемы в тёмной ---------- */
[data-theme="dark"] .status-pill.warn,
[data-theme="dark"] .summary-pill.warn,
[data-theme="dark"] .severity-pill.warn,
[data-theme="dark"] .queue-status.deferred {
  color: var(--amber);
}
[data-theme="dark"] .inline-notice.warn {
  color: var(--amber);
}

/* ---------- (T10) Warning-кнопка в тёмной ---------- */
[data-theme="dark"] .warning-btn {
  color: var(--amber);
  border-color: rgba(255, 196, 91, 0.35);
}

/* ---------- (T6/M8) Красный бейдж очереди на мобильном ---------- */
@media (max-width: 720px) {
  [data-theme="dark"] .mobile-queue-badge {
    background: #c52e3e;
    color: #ffffff;
    font-size: 10px;
  }
}

/* ============================ DESKTOP (>1024) ============================ */

/* ---------- (C12) Панель результатов: не режется на ноутбуках ---------- */
@media (min-width: 1025px) {
  .support-results {
    max-height: clamp(360px, calc(100vh - 320px), 780px);
  }
}

/* ---------- (C23) Аудит: сетка под поля «С/По» и пагинацию ---------- */
@media (min-width: 1025px) {
  .toolbar-grid.audit-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  }
}

/* ---------- (C13) Рабочий стол: без магической минимальной высоты ---------- */
.desk-grid {
  min-height: auto;
}

/* ============================ DESKTOP-СРЕДНИЙ (721–1024) ============================ */

/* ---------- (C11) Баннер здоровья: пилюли на второй строке ---------- */
@media (min-width: 721px) {
  .mail-health-main {
    flex-wrap: wrap;
  }
  .mail-health-pills {
    order: 2;
    flex-basis: 100%;
    margin-left: 0;
  }
  .mail-health-side {
    align-self: flex-start;
  }
}

/* ---------- (C18) Опасная кнопка в ряду действий: визуально отделена ---------- */
@media (min-width: 721px) {
  .action-row .danger-btn {
    margin-left: 6px;
    padding-left: 14px;
    border-left: 1px solid var(--border);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  }
}

/* ============================ МОБИЛЬНЫЙ (≤720) ============================ */

@media (max-width: 720px) {
  /* (M1/M2) Тач-цели 44px */
  .mobile-menu-btn {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .health-refresh-btn {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  /* (M3) Кнопки строк и нижние действия */
  .btn-xs,
  .timeline-filter-btn {
    min-height: 40px;
  }
  .support-bottom .support-open-btn {
    min-height: 40px;
  }

  /* (M4) Ряд действий: сетка 2×2, полные подписи, опасная кнопка во всю ширину */
  .action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
  }
  .action-row > * {
    width: 100%;
    min-width: 0;
  }
  .action-row .action-label-full {
    display: inline;
  }
  .action-row .action-label-short {
    display: none;
  }
  .action-row .danger-btn {
    grid-column: 1 / -1;
  }

  /* (M5) Таблицы: внутренний скролл + липкая шапка + намёк на прокрутку */
  .table-wrap {
    max-height: min(60vh, 480px);
    overflow: auto;
    box-shadow: inset -14px 0 14px -14px rgba(20, 22, 25, 0.22),
                inset 0 -14px 14px -14px rgba(20, 22, 25, 0.18);
  }
  .table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-soft);
  }

  /* (M6) Пилюли баннера здоровья: тач-чипы */
  .mail-health-pills .status-pill {
    min-height: 34px;
    padding: 4px 12px;
    font-size: 11px;
  }

  /* (M7) Ширина тач-цели вкладок */
  .workspace-tab {
    padding: 0 14px;
  }

  /* (G4) Метрики на мобильном */
  .metric-label {
    font-size: 10px;
  }

  /* (G8) Нижняя навигация */
  .mobile-tab {
    font-size: 11px;
  }
  .mobile-tab.active {
    color: var(--accent-text);
  }
}

/* ---------- Уточнения ≤420 ---------- */
@media (max-width: 420px) {
  .workspace-tab {
    padding: 0 12px;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .primary-btn[aria-busy="true"]::after,
  .ghost-btn[aria-busy="true"]::after,
  .danger-btn[aria-busy="true"]::after,
  .warning-btn[aria-busy="true"]::after {
    animation: none;
  }
  .primary-btn:active {
    transform: none;
  }
}
