:root {
  --navy: #123a63;
  --blue: #1d5f9e;
  --sky: #2e90c8;
  --cyan: #00a7d6;
  --orange: #f26a21;
  --ink: #17212b;
  --muted: #607d8b;
  --line: #d5dee7;
  --surface: #ffffff;
  --canvas: #f4f7fa;
  --success: #2e7d32;
  --success-bg: #e8f7ed;
  --warning: #8a5b00;
  --warning-bg: #fff5d9;
  --danger: #c62828;
  --danger-bg: #feeceb;
  --shadow: 0 10px 30px rgba(18, 58, 99, .10);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(420px, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 10px 16px;
  color: #fff;
  background: linear-gradient(120deg, #0f3153, var(--blue));
  box-shadow: 0 5px 20px rgba(18, 58, 99, .26);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; color: #fff; }
.top-logo {
  width: 52px;
  height: 42px;
  flex: 0 0 52px;
  display: grid;
  place-items: center;
}
.top-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.18));
}
.brand-text { min-width: 0; }
.brand-text strong, .brand-text small { display: block; white-space: nowrap; }
.brand-text strong { font-size: 17px; line-height: 1.2; letter-spacing: .1px; }
.brand-text small { margin-top: 2px; color: rgba(255,255,255,.78); font-size: 11px; }
.event-control {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto;
  align-items: end;
  gap: 10px;
}
.event-picker { min-width: 0; display: grid; gap: 4px; }
.event-picker label {
  color: rgba(255,255,255,.82);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .09em;
}
.event-picker select {
  min-width: 0;
  width: 100%;
  min-height: 42px;
  padding: 8px 38px 8px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(255,255,255,.52);
  border-radius: 11px;
  box-shadow: 0 3px 10px rgba(0,0,0,.10);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
}
.event-status-filter {
  display: inline-grid;
  grid-template-columns: repeat(2, auto);
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255,255,255,.26);
  border-radius: 12px;
  background: rgba(5,31,55,.28);
}
.filter-btn {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 9px;
  color: rgba(255,255,255,.82);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  transition: color .16s ease, background .16s ease, box-shadow .16s ease;
}
.filter-btn:hover { color: #fff; background: rgba(255,255,255,.11); }
.filter-btn.active {
  color: #fff;
  box-shadow: 0 4px 11px rgba(0,0,0,.20);
}
.filter-btn.filter-open.active {
  background: linear-gradient(135deg, #a85a00, #f28a1a);
  border-color: rgba(255,199,122,.72);
}
.filter-btn.filter-closed.active {
  background: linear-gradient(135deg, #1b5e20, #3b9a45);
  border-color: rgba(142,220,151,.72);
}
.filter-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #f9ab00; }
.filter-btn.filter-closed .filter-dot { background: #55b96a; }
.filter-btn.active .filter-dot {
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,.18);
}
.filter-count {
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding-inline: 5px;
  color: #fff;
  background: rgba(255,255,255,.17);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
}
.filter-btn.active .filter-count { color: var(--navy); background: #fff; }
.filter-btn.filter-open.active .filter-count { color: #8f4c00; }
.filter-btn.filter-closed.active .filter-count { color: #1f6c29; }
.topbar-context { min-width: 0; color: rgba(255,255,255,.82); font-weight: 750; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.user-chip {
  max-width: 190px;
  display: grid;
  gap: 1px;
  padding: 6px 10px;
  color: #fff;
  background: rgba(5,31,55,.24);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 11px;
  line-height: 1.15;
}
.user-chip strong, .user-chip small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip strong { font-size: 10px; }
.user-chip small { color: rgba(255,255,255,.72); font-size: 8px; font-weight: 800; letter-spacing: .05em; }
.icon-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  color: #fff;
  background: rgba(255,255,255,.11);
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 11px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.icon-btn svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn:hover { color: #fff; background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.66); transform: translateY(-1px); }
.icon-btn-primary { background: linear-gradient(135deg, #ff7b2f, #e85b13); border-color: #ff9a5a; box-shadow: 0 6px 15px rgba(105,42,7,.30); }
.icon-btn-primary:hover { background: #df5711; border-color: #ffab75; }
.top-action-form { margin: 0; }

.app-shell { min-height: calc(100vh - 72px); display: grid; grid-template-columns: 196px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  padding: 18px 12px;
  background: #fff;
  border-right: 1px solid var(--line);
  z-index: 20;
}
.nav { display: grid; gap: 7px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 11px;
  color: #455a64;
  font-weight: 750;
  transition: color .15s ease, background .15s ease, transform .15s ease;
}
.nav a:hover { color: var(--navy); background: #edf4fa; }
.nav a.active { color: #fff; background: var(--blue); box-shadow: 0 6px 14px rgba(29,95,158,.22); }
.nav-icon { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: currentColor; opacity: .72; }
.main { min-width: 0; width: 100%; padding: 24px; overflow: hidden; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 22px; }
.page-header { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 20px; }
.page-header h1 { margin: 0; }
.page-header p { margin: 5px 0 0; color: var(--muted); }
.selected-chip {
  max-width: min(440px, 50vw);
  overflow: hidden;
  padding: 8px 12px;
  color: var(--blue);
  background: #e9f3fb;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 3px; font-size: clamp(24px, 3vw, 34px); line-height: 1.2; color: var(--navy); }
h2 { font-size: 19px; color: var(--navy); }
h3 { font-size: 15px; color: var(--navy); }
.subtitle, .muted { color: var(--muted); }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 800;
  line-height: 1;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(9, 63, 107, .12); }
.btn-primary { color: #fff; background: var(--orange); }
.btn-secondary { color: var(--navy); background: #eaf4fb; border-color: #c8deee; }
.btn-outline { color: var(--blue); background: #fff; border-color: #b8cedf; }
.btn-danger { color: var(--danger); background: var(--danger-bg); }
.btn-sm { min-height: 32px; padding: 7px 10px; border-radius: 8px; font-size: 12px; }
.btn-block { width: 100%; }
.link-button { border: 0; padding: 0; color: var(--blue); background: none; font-weight: 800; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.card-body { padding: 20px; }
.card-header { padding: 17px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.card-header h2, .card-header h3 { margin: 0; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.kpi {
  position: relative;
  min-height: 116px;
  overflow: hidden;
  padding: 17px;
  background: #fff;
  border: 1px solid rgba(213,222,231,.88);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.kpi::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -38px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(46,144,200,.08);
}
.kpi-label {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.kpi-value {
  position: relative;
  z-index: 1;
  margin-top: 15px;
  color: var(--navy);
  font-size: clamp(22px, 2.1vw, 31px);
  font-weight: 900;
  line-height: 1.05;
}
.kpi-note { position: relative; z-index: 1; margin-top: 8px; color: var(--muted); font-size: 11px; }
.kpi.good { background: linear-gradient(145deg, #fff, #edf8ef); border-color: #cfe8d3; }
.kpi.featured {
  grid-column: span 2;
  min-height: 136px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 21px;
  color: #fff;
  border: 0;
  box-shadow: 0 14px 30px rgba(18,58,99,.20);
}
.kpi.featured::after { right: -36px; bottom: -72px; width: 190px; height: 190px; background: rgba(255,255,255,.10); }
.kpi.featured::before {
  content: "";
  position: absolute;
  right: 68px;
  top: -68px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.kpi.featured .kpi-label, .kpi.featured .kpi-note { color: rgba(255,255,255,.82); }
.kpi.featured .kpi-value { color: #fff; font-size: clamp(29px, 3vw, 41px); }
.featured-sales { background: linear-gradient(135deg, #123a63, #2477b9); }
.featured-balance.warn { background: linear-gradient(135deg, #a85a00, #f28a1a); }
.featured-balance.good { background: linear-gradient(135deg, #1b5e20, #3b9a45); }
.featured-balance.bad { background: linear-gradient(135deg, #8e1b1b, #d43c36); }
.dashboard-charts { margin-top: 16px; }
.dashboard-charts h2 { margin-bottom: 14px; font-size: 15px; }
.dashboard-events { margin-top: 16px; }
.filter-empty-panel { padding: 34px 24px; text-align: center; color: var(--muted); }
.filter-empty-panel strong { display: block; margin-bottom: 6px; color: var(--navy); font-size: 18px; }
.selected-row { background: #f1f7fb; box-shadow: inset 4px 0 0 var(--blue); }

.metric {
  position: relative;
  min-height: 132px;
  padding: 19px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.metric::after {
  content: "";
  position: absolute;
  width: 96px;
  height: 96px;
  right: -24px;
  bottom: -34px;
  border-radius: 50%;
  background: #edf5fb;
}
.metric.featured { color: #fff; border: 0; background: linear-gradient(135deg, #0d5b97, #07365d); box-shadow: 0 13px 32px rgba(8, 70, 117, .24); }
.metric.featured::after { background: rgba(255,255,255,.09); }
.metric.warning { background: #fffaf0; border-color: #f4d27c; }
.metric.success { background: #f2fbf5; border-color: #bddfc8; }
.metric-label { position: relative; z-index: 1; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.metric.featured .metric-label { color: #bfe5f5; }
.metric-value { position: relative; z-index: 1; margin: 9px 0 2px; font-size: clamp(22px, 2.4vw, 31px); font-weight: 900; line-height: 1.1; color: var(--navy); }
.metric.featured .metric-value { color: #fff; }
.metric-note { position: relative; z-index: 1; font-size: 12px; color: var(--muted); }
.metric.featured .metric-note { color: #d9eef7; }
.metrics { margin-bottom: 16px; }

.filterbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; padding: 14px; margin-bottom: 16px; background: #eaf2f8; border-radius: 13px; }
.filterbar .field { margin: 0; flex: 1 1 220px; }
.status-tabs { display: inline-flex; padding: 4px; border-radius: 11px; background: #dceaf4; }
.status-tabs a { padding: 8px 13px; border-radius: 8px; font-size: 12px; font-weight: 900; color: var(--muted); }
.status-tabs a.active { color: var(--navy); background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; font-size: 11px; font-weight: 900; text-transform: uppercase; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-open { color: var(--warning); background: var(--warning-bg); }
.badge-closed, .badge-success { color: var(--success); background: var(--success-bg); }
.badge-info { color: var(--blue); background: #e4f2fb; }
.badge-danger { color: var(--danger); background: var(--danger-bg); }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 13px; color: #fff; background: var(--blue); font-size: 11px; text-align: left; text-transform: uppercase; letter-spacing: .03em; }
th:first-child { border-radius: 9px 0 0 0; }
th:last-child { border-radius: 0 9px 0 0; }
td { padding: 12px 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover { background: #f8fbfd; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 800; }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.empty { padding: 38px 20px; text-align: center; color: var(--muted); }

.field { margin-bottom: 15px; }
.field label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 900; color: var(--ink); }
.required { color: var(--danger); }
input, select, textarea {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c9d8e5;
  border-radius: 10px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(10,165,210,.12); }
textarea { min-height: 96px; resize: vertical; }
.help { margin-top: 5px; color: var(--muted); font-size: 11px; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.notice { padding: 12px 14px; margin-bottom: 16px; border-radius: 10px; border-left: 4px solid; }
.notice-success { color: #145f32; background: var(--success-bg); border-color: var(--success); }
.notice-warning { color: #754e00; background: var(--warning-bg); border-color: #f6a800; }
.notice-error { color: #8f1d15; background: var(--danger-bg); border-color: var(--danger); }
.notice ul { margin: 0; padding-left: 18px; }

.users-heading { align-items: center; }
.automation-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid #c7e6d0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.automation-chip > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(46,125,50,.10);
}
.users-layout {
  display: grid;
  grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}
.users-form { position: sticky; top: 94px; }
.users-card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.users-card-title h2 { margin: 3px 0 0; }
.users-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}
.field-full { grid-column: 1 / -1; }
.multi-select {
  min-height: 172px;
  padding: 7px;
}
.multi-select option {
  padding: 8px 9px;
  border-radius: 7px;
}
.multi-select option:checked { color: #fff; background: var(--blue); }
.access-helper {
  display: grid;
  gap: 3px;
  padding: 12px 13px;
  color: #6f5200;
  background: var(--warning-bg);
  border-left: 4px solid var(--orange);
  border-radius: 9px;
  font-size: 11px;
}
.access-helper strong { color: var(--navy); font-size: 12px; }
.users-table-card { min-width: 0; overflow: hidden; }
.users-table-header p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.users-table { min-width: 900px; }
.users-table td { font-size: 12px; }
.users-table td:first-child { min-width: 145px; }
.users-table td:nth-child(2) { min-width: 175px; }
.users-table td:nth-child(4) { min-width: 170px; }
.users-table td:last-child { min-width: 142px; }
.access-tag {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  margin: 0 4px 4px 0;
  padding: 4px 8px;
  overflow: hidden;
  color: var(--blue);
  background: #e8f3fb;
  border: 1px solid #d0e6f5;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.access-role { color: var(--navy); background: #edf3f8; border-color: #d7e2eb; }
.access-all { color: var(--success); background: var(--success-bg); border-color: #cbe8d3; }
.table-subtext {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}
.current-user-label, .protected-label {
  display: inline-flex;
  margin-left: 5px;
  padding: 3px 7px;
  color: var(--muted);
  background: #edf2f6;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}
.protected-label { margin: 0; }
.users-pagination { padding-top: 2px; }

.company-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.company-kpi-open { background: linear-gradient(135deg, #123a63, #2477b9); }
.company-kpi-profit.good { background: linear-gradient(135deg, #1b5e20, #3b9a45); }
.company-kpi-profit.bad { background: linear-gradient(135deg, #8e1b1b, #d43c36); }
.kpi.warn { background: #fff9ed; border-color: #f0d28c; }
.company-period {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-top: 16px;
  margin-bottom: 16px;
}
.company-period h2 { margin-bottom: 12px; }
.company-period-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 220px));
  gap: 12px;
}
.company-period-fields .field { margin-bottom: 0; }
.company-period-side { display: grid; justify-items: end; gap: 8px; }
.company-period-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.company-period-label { color: var(--muted); font-size: 11px; font-weight: 800; }
.company-analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, .7fr);
  align-items: stretch;
  gap: 16px;
  margin-top: 16px;
}
.company-breakdown-table { min-width: 720px; }
.company-formula-card {
  color: #40515c;
  background: linear-gradient(145deg, #fff, #f1f7fb);
}
.company-formula-card p { margin-bottom: 12px; }
.company-formula-values { display: grid; gap: 8px; margin: 18px 0 0; }
.company-formula-values div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.company-formula-values dt { color: var(--muted); }
.company-formula-values dd { margin: 0; color: var(--navy); font-weight: 900; }
.company-fees-layout {
  display: grid;
  grid-template-columns: minmax(350px, 430px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  margin-top: 16px;
}
.company-fees-card { min-width: 0; overflow: hidden; }
.company-fees-table { min-width: 880px; }
.value-success { color: var(--success); }
.value-danger { color: var(--danger); }

.audit-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.audit-kpi-grid .metric { min-height: 118px; }
.audit-last-activity { font-size: clamp(20px, 2vw, 27px); }
.audit-filters { margin-bottom: 16px; }
.audit-filter-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) repeat(5, minmax(130px, 1fr));
  gap: 12px;
}
.audit-filter-grid .field { margin-bottom: 0; }
.audit-filter-actions { margin-top: 14px; }
.audit-table-card { min-width: 0; overflow: hidden; }
.audit-table { min-width: 1080px; }
.audit-date { white-space: nowrap; }
.audit-details-cell { width: 300px; max-width: 380px; }
.audit-details-cell details { min-width: 130px; }
.audit-details-cell summary {
  color: var(--blue);
  font-weight: 850;
  cursor: pointer;
}
.audit-details-cell pre {
  max-height: 240px;
  margin: 8px 0 0;
  padding: 10px;
  overflow: auto;
  color: #294250;
  background: #f2f6f9;
  border: 1px solid #dbe5ec;
  border-radius: 8px;
  font: 10px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.tabs { display: flex; overflow-x: auto; gap: 7px; padding: 5px; margin-bottom: 16px; border-radius: 12px; background: #e2edf5; }
.tab-button { flex: 0 0 auto; border: 0; border-radius: 9px; padding: 10px 15px; color: var(--muted); background: transparent; font-weight: 900; }
.tab-button.active { color: var(--navy); background: #fff; box-shadow: 0 3px 9px rgba(0,0,0,.07); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.bar-row { display: grid; grid-template-columns: minmax(105px, 180px) 1fr auto; align-items: center; gap: 12px; margin: 10px 0; }
.bar-track { height: 9px; border-radius: 99px; background: #e8f0f6; overflow: hidden; }
.bar-fill { height: 100%; min-width: 3px; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--blue)); }

.modal { display: none; position: fixed; inset: 0; z-index: 100; align-items: center; justify-content: center; padding: 18px; background: rgba(4, 30, 50, .68); }
.modal.open { display: flex; }
.modal-card { width: min(520px, 100%); max-height: 90vh; overflow: auto; background: #fff; border-radius: 17px; box-shadow: 0 30px 70px rgba(0,0,0,.28); }
.modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; }
.modal-close { border: 0; background: transparent; font-size: 24px; color: var(--muted); }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 1fr) minmax(360px, 520px); background: #fff; }
.login-brand { display: flex; flex-direction: column; justify-content: center; padding: clamp(35px, 7vw, 100px); color: #fff; background: linear-gradient(145deg, #07365d, #0a5287); overflow: hidden; position: relative; }
.login-brand::after { content: ""; position: absolute; width: 430px; height: 430px; right: -190px; bottom: -230px; border-radius: 50%; background: rgba(15, 165, 211, .15); }
.login-brand img { width: min(360px, 80%); height: auto; margin-bottom: 36px; position: relative; z-index: 1; }
.login-brand h1 { color: #fff; font-size: clamp(42px, 6vw, 72px); max-width: 650px; }
.login-brand p { position: relative; z-index: 1; color: #d3e9f6; font-size: 17px; }
.login-form { display: flex; align-items: center; padding: 36px clamp(28px, 5vw, 64px); }
.login-box { width: 100%; }
.login-box h2 { font-size: 27px; margin-bottom: 6px; }

.pagination { display: flex; justify-content: flex-end; gap: 6px; margin-top: 17px; }
.pagination a, .pagination span { min-width: 34px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; text-align: center; }
.pagination .current { color: #fff; background: var(--blue); border-color: var(--blue); }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: auto minmax(340px, 1fr) auto; }
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding-inline: 8px; }
  .nav a { justify-content: center; padding-inline: 8px; }
  .nav a span:last-child { display: none; }
  .brand-text small { display: none; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .users-layout { grid-template-columns: 1fr; }
  .users-form { position: static; }
  .company-analysis-grid, .company-fees-layout { grid-template-columns: 1fr; }
  .audit-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .audit-search-field { grid-column: span 2; }
}

@media (max-width: 920px) {
  .brand-text { display: none; }
  .user-chip { display: none; }
  .icon-btn { width: 42px; padding-inline: 0; }
  .icon-btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

@media (max-width: 760px) {
  .topbar {
    position: relative;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    padding: 9px 12px 12px;
  }
  .event-control { grid-column: 1 / -1; width: 100%; }
  .topbar-context { grid-column: 1 / -1; }
  .top-actions { grid-column: 2; grid-row: 1; }
  .app-shell { display: block; }
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    overflow-x: auto;
    padding: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav { display: flex; width: max-content; }
  .nav a { min-width: 48px; min-height: 42px; }
  .main { padding: 18px 14px 32px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .page-heading .actions .btn { flex: 1 1 auto; }
  .automation-chip { align-self: flex-start; }
  .selected-chip { max-width: 100%; }
  .dashboard-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .company-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi.featured { grid-column: span 1; min-height: 128px; }
  .company-period { align-items: stretch; flex-direction: column; }
  .company-period-side { justify-items: stretch; }
  .company-period-actions .btn { flex: 1; }
  .company-period-label { text-align: right; }
  .audit-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-page { grid-template-columns: 1fr; }
  .login-brand { min-height: 290px; padding: 34px 28px; }
  .login-brand img { width: 250px; margin-bottom: 18px; }
  .login-brand h1 { font-size: 40px; margin-bottom: 8px; }
  .login-form { padding: 34px 24px 54px; }
}

@media (max-width: 560px) {
  .event-control { grid-template-columns: 1fr; }
  .event-status-filter { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-btn { padding-inline: 8px; }
  .top-logo { width: 48px; height: 40px; flex-basis: 48px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .users-form-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }
  .users-card-title { align-items: stretch; flex-direction: column; }
  .users-card-title .btn { width: 100%; }
  .company-period-fields, .audit-filter-grid { grid-template-columns: 1fr; }
  .audit-search-field { grid-column: auto; }
  .audit-filter-actions .btn { flex: 1 1 100%; }
  .audit-kpi-grid { grid-template-columns: 1fr; }
  .dashboard-kpi-grid { grid-template-columns: 1fr; }
  .metrics.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 116px; padding: 15px; }
  .metric-value { font-size: 21px; }
  .kpi { min-height: 108px; padding: 15px; }
  .kpi.featured { min-height: 122px; }
  .kpi-value { font-size: 24px; }
  .card-body { padding: 15px; }
  .card-header { padding: 14px 15px; }
  .filterbar { align-items: stretch; }
  .filterbar .btn, .filterbar .status-tabs { width: 100%; }
  .status-tabs a { flex: 1; text-align: center; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  td, th { padding: 10px; }
}
