:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #746d66;
  --line: #e3ddd6;
  --surface: #ffffff;
  --surface-soft: #f7f4f0;
  --navy: #111111;
  --navy-soft: #242424;
  --teal: #202020;
  --teal-soft: #fff0e3;
  --blue: #383838;
  --blue-soft: #efebe7;
  --amber: #ec741c;
  --amber-soft: #fff0e3;
  --red: #c95658;
  --red-soft: #fbe9ea;
  --shadow: 0 14px 36px rgba(28, 22, 17, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: #f2efeb;
  color: var(--ink);
  font-family: Calibri, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: 246px;
  display: flex;
  flex-direction: column;
  padding: 30px 20px 24px;
  color: #f1ece7;
  background:
    radial-gradient(circle at 18% 8%, rgba(236, 116, 28, 0.22), transparent 30%),
    linear-gradient(165deg, #1c1c1c 0%, #111111 74%, #080808 100%);
  box-shadow: 8px 0 30px rgba(18, 13, 9, 0.18);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 8px 38px;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.23);
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #f08a3d, #d95d0b);
  font-family: inherit;
  font-size: 22px;
  box-shadow: 0 8px 22px rgba(236, 116, 28, 0.28);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: #fff;
  font-family: inherit;
  font-size: 20px;
  letter-spacing: 0.12em;
}

.brand small {
  margin-top: 2px;
  color: #b9aea4;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #c5bbb2;
  font-size: 14px;
  text-decoration: none;
  transition: 160ms ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.nav-link.active {
  border-color: rgba(236, 116, 28, 0.44);
  color: #fff;
  background: rgba(236, 116, 28, 0.15);
}

.nav-icon {
  width: 26px;
  color: #f28a3c;
  font-size: 21px;
  text-align: center;
}

.readonly-card {
  display: flex;
  gap: 11px;
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(236, 116, 28, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.readonly-icon {
  color: #f28a3c;
  font-size: 24px;
}

.readonly-card strong {
  color: #fff;
  font-size: 13px;
}

.readonly-card p {
  margin: 4px 0 0;
  color: #aa9e94;
  font-size: 11px;
  line-height: 1.45;
}

.main-content {
  min-height: 100vh;
  margin-left: 246px;
  padding: 34px 38px 24px;
}

#systems,
#operations,
#users,
#all-users,
#tickets,
#privacy,
#settings,
#ai,
#months,
#subscriptions,
#alerts {
  scroll-margin-top: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 5px;
  color: #857970;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 7px;
  font-family: inherit;
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 500;
  letter-spacing: -0.025em;
}

h2 {
  margin-bottom: 0;
  font-family: inherit;
  font-size: 22px;
  font-weight: 500;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-pill,
.timestamp {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 7px 20px rgba(28, 22, 17, 0.05);
}

.mode-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  color: #a94d0d;
  font-size: 12px;
  font-weight: 700;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(217, 148, 49, 0.15);
}

.timestamp {
  min-width: 152px;
  padding: 9px 13px;
}

.timestamp span,
.timestamp strong {
  display: block;
}

.timestamp span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.timestamp strong {
  margin-top: 2px;
  font-size: 12px;
}

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 11px 15px;
  border: 1px solid #f0d4bf;
  border-radius: 12px;
  color: #7c3e13;
  background: #fff5ec;
  font-size: 12px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.section-heading h2 {
  font-size: 20px;
}

.section-heading p:last-child {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.section-number {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--amber);
  font-size: 12px;
  font-weight: 750;
}

.section-overview {
  margin: 24px 0 14px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric-card,
.panel {
  border: 1px solid rgba(221, 213, 205, 0.94);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  position: relative;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 126px;
  padding: 20px;
  overflow: hidden;
  border-radius: 16px;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: auto -24px -44px auto;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.04;
}

.metric-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 22px;
  background: var(--blue-soft);
  color: var(--blue);
}

.metric-users .metric-icon {
  background: var(--teal-soft);
  color: var(--teal);
}

.metric-warnings .metric-icon {
  background: var(--amber-soft);
  color: var(--amber);
}

.metric-errors .metric-icon {
  background: var(--red-soft);
  color: var(--red);
}

.metric-card p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  display: block;
  font-family: inherit;
  font-size: 30px;
  font-weight: 500;
}

.metric-card small {
  color: #8c8178;
  font-size: 10px;
}

.metric-state {
  align-self: start;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-state.good {
  color: #242424;
  background: var(--teal-soft);
}

.metric-state.neutral {
  color: #383838;
  background: var(--blue-soft);
}

.metric-state.warn {
  color: #a94d0d;
  background: var(--amber-soft);
}

.metric-state.danger {
  color: #a73d40;
  background: var(--red-soft);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  gap: 18px;
}

.dashboard-grid > .section-heading {
  grid-column: 1 / -1;
  margin: 22px 0 -3px;
  padding-top: 22px;
  border-top: 1px solid #ddd5ce;
}

.section-system { order: 1; }
.panel-status { order: 2; grid-column: 1 / -1; }
.section-activity { order: 3; }
.panel-operations,
.panel-users { order: 4; }
.panel-all-users { order: 4; grid-column: 1 / -1; }
.section-ai-speed { order: 5; }
.monthly-cost-card { order: 6; grid-column: 1 / -1; }
.panel-ai,
.panel-performance { order: 7; }
.panel-months { order: 8; grid-column: 1 / -1; }
.section-commercial { order: 9; }
.panel-subscriptions { order: 10; grid-column: 1 / -1; }
.section-administration { order: 11; }
.panel-admin-state { order: 12; grid-column: 1 / -1; }
.panel-tickets { order: 13; grid-column: 1 / -1; }
.panel-privacy { order: 14; }
.panel-settings { order: 14; }
.section-attention { order: 15; }
.panel-alerts { order: 16; grid-column: 1 / -1; }

.panel {
  min-width: 0;
  padding: 22px;
  border-radius: var(--radius);
}

.monthly-cost-card {
  position: relative;
  overflow: hidden;
  padding: 26px 28px;
  border: 1px solid rgba(230, 105, 20, 0.5);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 88% 20%, rgba(237, 122, 39, 0.18), transparent 30%),
    linear-gradient(135deg, #fffaf6, #ffffff 56%, #f8eee6);
  box-shadow: 0 16px 38px rgba(55, 36, 22, 0.1);
}

.monthly-cost-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: linear-gradient(180deg, #ee7a27, #151515);
}

.monthly-cost-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.monthly-cost-main h2 {
  margin-top: 4px;
  font-size: 23px;
}

.monthly-cost-main p:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.estimate-label {
  padding: 7px 10px;
  border-radius: 999px;
  color: #8e3f0a;
  background: #fde5d4;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.monthly-cost-value {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 22px 0;
}

.monthly-cost-value strong {
  color: #151515;
  font-size: clamp(38px, 5vw, 58px);
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.monthly-cost-value span {
  max-width: 210px;
  color: #74685f;
  font-size: 11px;
  line-height: 1.35;
}

.monthly-cost-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.monthly-cost-details > div {
  padding: 12px 14px;
  border: 1px solid #eaded5;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
}

.monthly-cost-details span,
.monthly-cost-details strong {
  display: block;
}

.monthly-cost-details span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.monthly-cost-details strong {
  font-size: 15px;
}

.monthly-cost-note {
  margin: 12px 0 0;
  color: #83766c;
  font-size: 9px;
  line-height: 1.45;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.panel-description {
  max-width: 580px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.overall-status,
.view-label,
.privacy-label,
.panel-total {
  color: var(--muted);
  font-size: 11px;
}

.overall-status {
  display: flex;
  align-items: center;
  gap: 7px;
}

.status-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
}

.status-dot.healthy {
  background: var(--teal);
  box-shadow: 0 0 0 4px var(--teal-soft);
}

.status-dot.warning {
  background: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-soft);
}

.status-dot.error {
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
}

.component-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
}

.component-card {
  min-height: 91px;
  padding: 14px;
  border: 1px solid #e9e1da;
  border-radius: 13px;
  background: #fcfaf8;
}

.component-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.component-card strong {
  font-size: 13px;
}

.component-card p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.server-usage-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 0 12px;
  padding-top: 18px;
  border-top: 1px solid #ebe4de;
}

.server-usage-heading strong,
.server-usage-heading span {
  display: block;
}

.server-usage-heading strong {
  font-size: 13px;
}

.server-usage-heading span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.server-usage-heading .source-label {
  padding: 5px 8px;
  border-radius: 999px;
  color: #a94d0d;
  background: var(--amber-soft);
  font-weight: 750;
  text-transform: uppercase;
}

.server-usage {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.server-metric {
  padding: 12px;
  border: 1px solid #e9e1da;
  border-radius: 12px;
  background: #fcfaf8;
}

.server-metric > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.server-metric span {
  color: var(--muted);
  font-size: 9px;
}

.server-metric strong {
  color: var(--ink);
  font-size: 11px;
}

.server-metric small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
}

.server-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #ebe5df;
}

.server-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #242424, #ed7a27);
}

.security-heading {
  margin-top: 18px;
}

.security-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.security-metric {
  padding: 13px;
  border: 1px solid #e9e1da;
  border-left: 4px solid #e66f1a;
  border-radius: 12px;
  background: #fcfaf8;
}

.security-metric span,
.security-metric strong,
.security-metric small {
  display: block;
}

.security-metric span,
.security-metric small {
  color: var(--muted);
  font-size: 9px;
}

.security-metric strong {
  margin: 8px 0 5px;
  font-size: 22px;
}

.security-metric.warning,
.security-metric.error {
  border-left-color: var(--red);
  background: var(--red-soft);
}

.panel-ai {
  background:
    linear-gradient(165deg, rgba(36, 36, 36, 0.99), rgba(12, 12, 12, 1)),
    var(--navy);
  color: #fff;
}

.panel-ai .eyebrow,
.panel-ai .panel-total,
.panel-ai .ai-footer,
.panel-ai .panel-description,
.panel-ai .panel-explainer {
  color: #c0b4aa;
}

.panel-explainer {
  margin: -6px 0 16px;
  font-size: 9px;
  line-height: 1.45;
}

.panel-ai .panel-total strong {
  color: #fff;
  font-size: 19px;
}

.chart-wrap {
  display: flex;
  min-height: 118px;
  align-items: end;
  margin: 3px 0 18px;
  padding: 9px 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.bar-chart {
  width: 100%;
  height: 104px;
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.bar {
  flex: 1;
  height: 100%;
  min-width: 5px;
  opacity: 0.9;
}

.bar svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.bar rect {
  fill: #ed7a27;
}

.bar:nth-child(3n) rect {
  fill: #ffc08f;
}

.provider-list {
  display: grid;
  gap: 10px;
}

.token-usage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.token-usage > div {
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.token-usage span,
.token-usage strong {
  display: block;
}

.token-usage small {
  display: block;
  margin-top: 5px;
  color: #f1b98f;
  font-size: 9px;
}

.token-usage small b {
  color: #fff;
  font-size: 11px;
}

.token-usage span {
  margin-bottom: 4px;
  color: #c0b4aa;
  font-size: 9px;
  text-transform: uppercase;
}

.token-usage strong {
  color: #fff;
  font-size: 14px;
}

.token-usage .token-total {
  border-color: rgba(236, 116, 28, 0.46);
  background: rgba(236, 116, 28, 0.12);
}

.provider-row {
  display: grid;
  grid-template-columns: 112px 1fr 34px 150px;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}

.provider-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.provider-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #ed7a27;
}

.provider-row b {
  text-align: right;
}

.provider-name,
.provider-cost {
  min-width: 0;
}

.provider-name b,
.provider-name small,
.provider-cost strong,
.provider-cost small {
  display: block;
}

.provider-name small,
.provider-cost small {
  margin-top: 2px;
  color: #c0b4aa;
  font-size: 9px;
}

.provider-cost {
  text-align: right;
}

.provider-cost strong {
  color: #fff;
  font-size: 10px;
}

@media (max-width: 560px) {
  .provider-row {
    grid-template-columns: 100px 1fr 34px;
  }

  .provider-cost {
    grid-column: 1 / -1;
    padding-top: 2px;
  }
}

.ai-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 10px;
}

.ai-footer strong {
  color: #fff;
}

.month-select-label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.month-select-label select,
.subscription-dialog select {
  min-height: 38px;
  padding: 8px 34px 8px 11px;
  border: 1px solid #ded4cc;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.monthly-history-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(230px, 0.7fr);
  gap: 20px;
  align-items: stretch;
}

.monthly-bars {
  min-height: 242px;
  display: grid;
  grid-template-columns: repeat(6, minmax(54px, 1fr));
  align-items: end;
  gap: 10px;
  padding: 18px 14px 6px;
  border: 1px solid #ece3dc;
  border-radius: 14px;
  background: #fbf8f5;
}

.month-bar {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 154px auto;
  gap: 7px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.month-bar-value,
.month-bar-label {
  font-size: 9px;
  text-align: center;
}

.month-bar-track {
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-radius: 9px 9px 3px 3px;
  background: #ece6e0;
}

.month-bar-track svg {
  width: 100%;
  height: 100%;
  display: block;
}

.month-bar-track rect {
  fill: #e36811;
  transition: fill 180ms ease;
}

.month-bar:hover .month-bar-track rect,
.month-bar.active .month-bar-track rect {
  fill: #171717;
}

.month-bar.active .month-bar-label,
.month-bar.active .month-bar-value {
  color: var(--ink);
  font-weight: 750;
}

.month-detail {
  padding: 20px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(150deg, #26221f, #111);
}

.month-detail > span {
  color: #e6a77a;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.month-detail h3 {
  margin: 7px 0 20px;
  font-size: 22px;
}

.month-detail dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.month-detail dl div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.month-detail dt {
  color: #bdb2aa;
  font-size: 9px;
}

.month-detail dd {
  margin: 0;
  font-size: 12px;
  font-weight: 750;
}

.subscription-button,
.button-secondary,
.dialog-close {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.subscription-button {
  min-height: 38px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #fff;
  background: #e66f1a;
  font-size: 10px;
  font-weight: 750;
}

.admin-login-button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid #d86413;
  border-radius: 11px;
  color: #fff;
  background: #171717;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.admin-login-button:hover,
.admin-login-button:focus-visible {
  background: #e66f1a;
  outline: 3px solid rgba(230, 111, 26, 0.2);
}

.admin-connection-status,
.zdr-status {
  padding: 7px 10px;
  border-radius: 999px;
  color: #5f554e;
  background: #eee9e4;
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.admin-connection-status.connected,
.zdr-status.active {
  color: #9a4308;
  background: #fde7d7;
}

.isolation-grid,
.compliance-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.isolation-grid div,
.compliance-details div {
  padding: 14px;
  border: 1px solid #eadfd7;
  border-radius: 12px;
  background: #fcf9f7;
}

.isolation-grid span,
.isolation-grid strong,
.compliance-details dt,
.compliance-details dd {
  display: block;
}

.isolation-grid span,
.compliance-details dt {
  color: var(--muted);
  font-size: 9px;
}

.isolation-grid strong,
.compliance-details dd {
  margin: 7px 0 0;
  font-size: 12px;
  font-weight: 700;
}

.admin-feedback,
.compliance-evidence,
.empty-state {
  margin: 0;
  padding: 11px 13px;
  border-left: 4px solid #e66f1a;
  color: #665b53;
  background: #fff6ef;
  font-size: 10px;
  line-height: 1.5;
}

.admin-feedback.error {
  border-color: var(--red);
  color: #8f3437;
  background: var(--red-soft);
}

.ticket-list {
  display: grid;
  gap: 9px;
}

.ticket-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  border: 1px solid #ebe3dc;
  border-radius: 12px;
  background: #fcfaf8;
}

.ticket-row.ticket-new {
  border-color: #efc765;
  background: #fff8df;
}

.ticket-row.ticket-overdue {
  border-color: #df9294;
  background: var(--red-soft);
}

.ticket-row.ticket-resolved {
  border-color: #8bc3a3;
  background: #eaf7ef;
}

.ticket-age {
  padding: 5px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.ticket-age.ticket-new {
  color: #765500;
  background: #ffe9a6;
}

.ticket-age.ticket-overdue {
  color: #8f3437;
  background: #f5cacc;
}

.ticket-age.ticket-resolved {
  color: #246641;
  background: #ccebd8;
}

.alert-details {
  margin-top: 10px;
}

.alert-details summary {
  width: fit-content;
  color: #8c430f;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.alert-details pre {
  max-width: 100%;
  margin: 10px 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid #e2d6cc;
  border-radius: 9px;
  color: #2c2723;
  background: #fff;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.alert-details button {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #d7c7bb;
  border-radius: 8px;
  color: #7d3507;
  background: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.ticket-row span,
.ticket-row strong,
.ticket-row small {
  display: block;
}

.ticket-row span,
.ticket-row small {
  color: var(--muted);
  font-size: 9px;
}

.ticket-row strong {
  margin: 5px 0;
  font-size: 11px;
}

.ticket-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ticket-actions select,
.settings-form input,
.subscription-dialog input,
.subscription-dialog textarea,
.subscription-dialog select {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #dcd2ca;
  border-radius: 9px;
  color: #26211e;
  background: #fff;
  font: inherit;
}

.ticket-priority {
  padding: 5px 8px;
  border-radius: 999px;
  background: #eee8e3;
}

.ticket-priority.high {
  color: #9a4308;
  background: #fde7d7;
}

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

.settings-form label {
  display: grid;
  gap: 6px;
  color: #665b53;
  font-size: 10px;
  font-weight: 700;
}

.settings-form button {
  align-self: end;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 210px;
}

.row-actions button {
  padding: 6px 8px;
  border: 1px solid #dfd4cc;
  border-radius: 8px;
  color: #443b35;
  background: #f7f2ee;
  font: inherit;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.row-actions button:hover,
.row-actions button:focus-visible {
  border-color: #e66f1a;
  outline: none;
}

.row-actions .danger-action {
  color: #9b3f42;
  background: #fbe9ea;
}

.table-subline {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.retention-check {
  grid-template-columns: auto 1fr !important;
  align-items: center;
}

.retention-check input {
  min-height: auto;
}

.commercial-summary {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.4fr);
  gap: 14px;
  margin-bottom: 18px;
}

.revenue-total {
  padding: 20px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #28231f, #111);
}

.revenue-total span,
.revenue-total strong,
.revenue-total small {
  display: block;
}

.revenue-total span {
  color: #cfbdb0;
  font-size: 9px;
  text-transform: uppercase;
}

.revenue-total strong {
  margin: 10px 0 7px;
  color: #f3934f;
  font-size: 32px;
}

.revenue-total small {
  color: #e1d8d1;
  font-size: 10px;
}

.plan-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.plan-summary section {
  padding: 18px;
  border: 1px solid #e9ded6;
  border-radius: 14px;
  background: #fcf9f7;
}

.plan-summary span,
.plan-summary strong,
.plan-summary small {
  display: block;
}

.plan-summary span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.plan-summary strong {
  margin: 8px 0 5px;
  font-size: 18px;
}

.plan-summary small,
.commercial-note {
  color: var(--muted);
  font-size: 9px;
}

.subscription-table-wrap {
  max-height: 330px;
  overflow: auto;
  border: 1px solid #ece4de;
  border-radius: 12px;
}

.all-users-table-wrap {
  max-height: 330px;
  overflow: auto;
  border: 1px solid #ece4de;
  border-radius: 12px;
}

.all-users-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  box-shadow: inset 0 -1px #ebe4de;
}

.status-tag.offline {
  color: #6c625a;
  background: #ece7e2;
}

.subscription-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  box-shadow: inset 0 -1px #ebe4de;
}

.commercial-note {
  margin: 12px 2px 0;
  line-height: 1.45;
}

.assignment-tag {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  color: #3c3936;
  background: #eee9e4;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.assignment-tag.manual {
  color: #9d460b;
  background: #fde7d7;
}

.subscription-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid #e1d6ce;
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

.subscription-dialog::backdrop {
  background: rgba(14, 12, 11, 0.66);
  backdrop-filter: blur(3px);
}

.subscription-dialog form {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.dialog-heading h2 {
  margin-top: 4px;
}

.dialog-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #4b423c;
  background: #f2ece7;
  font-size: 20px;
}

.subscription-dialog label {
  display: grid;
  gap: 6px;
  color: #665b53;
  font-size: 10px;
  font-weight: 700;
}

.subscription-dialog p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.button-secondary {
  padding: 10px 14px;
  border-radius: 10px;
  color: #514840;
  background: #f0eae5;
  font-size: 10px;
  font-weight: 700;
}

.panel-operations,
.panel-ai {
  grid-column: 1;
}

.panel-users,
.panel-performance {
  grid-column: 2;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid #ebe4de;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #8a7e74;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

td {
  color: #61584f;
  font-size: 11px;
}

td strong {
  color: var(--ink);
  font-size: 12px;
}

.operation-type {
  display: flex;
  align-items: center;
  gap: 9px;
}

.type-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
}

.type-dot.download { background: #5d5d5d; }
.type-dot.analysis { background: var(--amber); }
.type-dot.ai { background: var(--teal); }

.status-tag {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  color: #343434;
  background: var(--blue-soft);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-tag.warning {
  color: #a94d0d;
  background: var(--amber-soft);
}

.progress-cell {
  min-width: 135px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9px;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #ebe5df;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #242424, #ed7a27);
}

.user-list,
.alert-list,
.performance-list {
  display: grid;
  gap: 10px;
}

.user-list {
  max-height: 278px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.scroll-region {
  scrollbar-width: thin;
  scrollbar-color: #ed7a27 #eee8e2;
}

.scroll-region.is-scrollable {
  padding-right: 6px;
}

.scroll-region:focus-visible {
  outline: 2px solid rgba(237, 122, 39, 0.7);
  outline-offset: 3px;
}

.scroll-region::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.scroll-region::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #eee8e2;
}

.scroll-region::-webkit-scrollbar-thumb {
  border: 2px solid #eee8e2;
  border-radius: 999px;
  background: #ed7a27;
}

.scroll-hint {
  margin: 10px 2px 0;
  color: #8a5a39;
  font-size: 9px;
  line-height: 1.45;
}

.scroll-hint[hidden] {
  display: none;
}

.user-row,
.alert-row,
.performance-row {
  border: 1px solid #e9e1da;
  border-radius: 13px;
  background: #fcfaf8;
}

.user-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #2b2b2b;
  background: var(--teal-soft);
  font-family: inherit;
  font-size: 13px;
}

.user-row strong,
.user-row small {
  display: block;
}

.user-row strong {
  margin-bottom: 2px;
  font-size: 11px;
}

.user-row small,
.user-time {
  color: var(--muted);
  font-size: 9px;
}

.alert-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 12px;
  padding: 13px;
}

.alert-accent {
  width: 4px;
  height: 100%;
  min-height: 42px;
  border-radius: 99px;
  background: var(--amber);
}

.alert-row.error .alert-accent {
  background: var(--red);
}

.alert-row strong,
.alert-row p {
  display: block;
}

.alert-row strong {
  margin-bottom: 4px;
  font-size: 11px;
}

.alert-row p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.affected {
  padding: 5px 7px;
  border-radius: 999px;
  color: #9f4c12;
  background: var(--amber-soft);
  font-size: 9px;
}

.alert-row.error .affected {
  color: #a44245;
  background: var(--red-soft);
}

.performance-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px;
}

.performance-row strong,
.performance-row small {
  display: block;
}

.performance-row strong {
  font-size: 11px;
}

.performance-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.trend {
  align-self: center;
  color: #2e2e2e;
  font-size: 10px;
  font-weight: 700;
}

.trend.up {
  color: #b6530d;
}

.footer-note {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
  padding: 15px 4px 0;
  color: #8c8178;
  font-size: 10px;
}

@media (max-width: 1180px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .panel-operations,
  .panel-alerts,
  .panel-users,
  .panel-performance {
    grid-column: auto;
    grid-row: auto;
  }

  .monthly-history-layout {
    grid-template-columns: 1fr;
  }

  .panel-privacy,
  .panel-settings {
    grid-column: auto;
  }
}

@media (max-width: 820px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
    padding: 18px;
  }

  .brand {
    margin: 0 0 18px;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 5px;
  }

  .nav-link {
    flex: 0 0 auto;
  }

  .readonly-card {
    margin-top: 16px;
  }

  .main-content {
    margin-left: 0;
    padding: 24px 18px;
  }

  .topbar {
    display: block;
  }

  .topbar-actions {
    margin-top: 18px;
  }

  .component-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .server-usage,
  .security-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .commercial-summary {
    grid-template-columns: 1fr;
  }

  .isolation-grid,
  .compliance-details,
  .settings-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .summary-grid,
  .component-grid,
  .server-usage,
  .security-metrics {
    grid-template-columns: 1fr;
  }

  .metric-card {
    grid-template-columns: 44px 1fr;
  }

  .metric-state {
    display: none;
  }

  .topbar-actions,
  .notice,
  .footer-note {
    align-items: stretch;
    flex-direction: column;
  }

  .timestamp {
    width: 100%;
  }

  .monthly-cost-card {
    padding: 22px 20px 20px;
  }

  .monthly-cost-main,
  .monthly-cost-value {
    display: block;
  }

  .estimate-label {
    display: inline-block;
    margin-top: 12px;
  }

  .monthly-cost-value span {
    display: block;
    max-width: none;
    margin-top: 8px;
  }

  .monthly-cost-details,
  .plan-summary {
    grid-template-columns: 1fr;
  }

  .monthly-bars {
    grid-template-columns: repeat(6, minmax(42px, 1fr));
    gap: 5px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .panel-months .panel-heading,
  .panel-subscriptions .panel-heading {
    display: grid;
  }

  .month-select-label,
  .subscription-button {
    width: 100%;
  }

  .ticket-row,
  .ticket-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}
