:root {
  --cr-bg: #edf4f3;
  --cr-surface: #fbfefd;
  --cr-panel: #ffffff;
  --cr-panel-soft: #f6faf9;
  --cr-ink: #10283f;
  --cr-text: #25384d;
  --cr-muted: #647383;
  --cr-border: #d4e0df;
  --cr-border-strong: #aebfbd;
  --cr-primary: #2454d6;
  --cr-primary-dark: #173a9e;
  --cr-teal: #0e8f8c;
  --cr-teal-dark: #076b69;
  --cr-success: #157347;
  --cr-warning: #a16207;
  --cr-danger: #b42318;
  --cr-sidebar: #10283f;
  --cr-sidebar-2: #0d5661;
  --cr-radius: 8px;
  --cr-shadow: 0 20px 54px rgba(16, 40, 63, 0.14);
  --cr-soft-shadow: 0 10px 28px rgba(16, 40, 63, 0.08);
  --cr-font: Inter, Poppins, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--cr-text);
  background: var(--cr-bg);
  font-family: var(--cr-font);
  letter-spacing: 0;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

body[data-report-chat-resizing="width"] {
  cursor: col-resize;
  user-select: none;
}

body[data-report-chat-resizing="height"] {
  cursor: row-resize;
  user-select: none;
}

[hidden],
.is-hidden {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: var(--cr-primary);
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke-width: 2.1;
}

.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;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-run,
.btn-buy,
.btn-pdf,
.btn-view,
.btn-dl,
.ai-button,
.logout-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: var(--cr-radius);
  background: var(--cr-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.btn:hover,
.btn-primary:hover,
.btn-run:hover,
.btn-pdf:hover,
.ai-button:hover {
  background: var(--cr-primary-dark);
  transform: translateY(-1px);
}

.btn:disabled,
.btn-primary:disabled,
.btn-run:disabled,
.btn-buy:disabled,
.btn-pdf:disabled {
  opacity: 0.64;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary,
.btn-buy,
.btn-dl {
  background: var(--cr-teal);
}

.btn-secondary:hover,
.btn-buy:hover,
.btn-dl:hover {
  background: var(--cr-teal-dark);
}

.btn-ghost,
.btn-view,
.logout-btn {
  background: #fff;
  color: var(--cr-ink);
  border-color: var(--cr-border);
}

.btn-ghost:hover,
.btn-view:hover,
.logout-btn:hover {
  color: var(--cr-primary);
  border-color: var(--cr-primary);
  background: #fff;
}

.toast-container {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 3000;
  display: grid;
  gap: 10px;
}

.toast {
  width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid var(--cr-border);
  border-left: 4px solid var(--cr-primary);
  border-radius: var(--cr-radius);
  background: #fff;
  color: var(--cr-ink);
  box-shadow: var(--cr-soft-shadow);
  font-size: 13px;
  line-height: 1.45;
}

.toast.success { border-left-color: var(--cr-success); }
.toast.error { border-left-color: var(--cr-danger); }
.toast.info { border-left-color: var(--cr-primary); }

/* Auth */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(14, 143, 140, 0.08), rgba(36, 84, 214, 0.08)),
    var(--cr-bg);
}

.auth-shell {
  width: min(1160px, 100%);
  min-height: 700px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 476px;
  overflow: hidden;
  border: 1px solid rgba(16, 40, 63, 0.12);
  border-radius: 12px;
  background: var(--cr-panel);
  box-shadow: var(--cr-shadow);
}

.auth-brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 38px;
  color: #edfafa;
  background:
    linear-gradient(180deg, rgba(16, 40, 63, 0.97), rgba(13, 86, 97, 0.93)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: auto, 34px 34px, 34px 34px;
}

.auth-logo-row,
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-logo {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--cr-radius);
  background: #fff;
  overflow: hidden;
}

.auth-logo img,
.logo-circle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-text-main {
  font-size: 18px;
  line-height: 1.1;
  font-weight: 900;
}

.logo-text-sub {
  margin-top: 3px;
  color: #b9d8d8;
  font-size: 12px;
  font-weight: 700;
}

.auth-copy {
  max-width: 580px;
  margin-top: 16px;
}

.auth-kicker,
.page-kicker,
.landing-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--cr-teal);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-brand-panel .auth-kicker {
  padding: 8px 10px;
  border: 1px solid rgba(223, 244, 238, 0.24);
  border-radius: var(--cr-radius);
  color: #dff4ee;
  background: rgba(223, 244, 238, 0.12);
}

.hero-title {
  margin: 0;
  max-width: 620px;
  color: #fff;
  font-size: 42px;
  line-height: 1.08;
  font-weight: 900;
}

.hero-subtitle {
  max-width: 580px;
  margin: 14px 0 0;
  color: #d6e2e6;
  font-size: 15px;
  line-height: 1.7;
}

.auth-insight-panel {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
}

.insight-card,
.metric-card {
  min-height: 96px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--cr-radius);
  background: rgba(255, 255, 255, 0.1);
}

.insight-label,
.metric-label {
  color: #b9d8d8;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.insight-value,
.metric-value {
  margin-top: 8px;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}

.insight-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.insight-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #eefafa;
  font-size: 13px;
  font-weight: 700;
}

.auth-trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-trust-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: var(--cr-radius);
  background: rgba(223, 244, 238, 0.12);
  color: #f3fffd;
  font-size: 12px;
  font-weight: 800;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: linear-gradient(180deg, rgba(251, 254, 253, 0.72), rgba(233, 242, 241, 0.95));
}

.login-card {
  width: 100%;
  max-width: 430px;
  padding: 26px;
  border: 1px solid rgba(16, 40, 63, 0.12);
  border-radius: 10px;
  background: rgba(251, 254, 253, 0.95);
  box-shadow: 0 18px 48px rgba(16, 40, 63, 0.12);
}

.auth-card-head {
  margin-bottom: 18px;
}

.auth-card-kicker {
  color: var(--cr-teal);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-card-head h1 {
  margin: 6px 0 6px;
  color: var(--cr-ink);
  font-size: 28px;
  line-height: 1.15;
  font-weight: 900;
}

.auth-card-head p {
  margin: 0;
  color: var(--cr-muted);
  font-size: 13px;
  line-height: 1.55;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 18px;
  padding: 6px;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: #edf5f3;
}

.tab-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--cr-radius);
  background: transparent;
  color: var(--cr-muted);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.tab-btn.active {
  background: #fbfefd;
  color: var(--cr-teal-dark);
  box-shadow: 0 6px 18px rgba(16, 40, 63, 0.1);
}

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

.auth-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 12px;
}

.span-2 {
  grid-column: 1 / -1;
}

.form-group,
.input-row {
  display: grid;
  gap: 7px;
}

.form-label,
.input-row label {
  color: var(--cr-ink);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 850;
}

.input-field,
.input-row input,
.input-row select,
.input-row textarea,
.section-actions input,
.section-actions select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #cbd9dd;
  border-radius: var(--cr-radius);
  background: #f7fbfa;
  color: var(--cr-ink);
  font-size: 14px;
  outline: 3px solid transparent;
  transition: border-color 160ms ease, background 160ms ease, outline-color 160ms ease;
}

.input-row textarea {
  min-height: 92px;
  padding-top: 12px;
  resize: vertical;
}

.input-field:focus,
.input-row input:focus,
.input-row select:focus,
.input-row textarea:focus,
.section-actions input:focus,
.section-actions select:focus {
  border-color: var(--cr-teal);
  background: #fff;
  outline-color: rgba(14, 143, 140, 0.14);
}

.input-wrapper {
  position: relative;
}

.input-wrapper .input-field {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border-radius: var(--cr-radius);
  background: transparent;
  color: var(--cr-muted);
  cursor: pointer;
}

.password-toggle:hover {
  background: #e8f2f1;
  color: var(--cr-teal-dark);
}

.input-error {
  min-height: 16px;
  color: var(--cr-danger);
  font-size: 11px;
  line-height: 1.35;
}

.form-note,
.small-note,
.divider {
  color: var(--cr-muted);
  font-size: 12px;
  line-height: 1.55;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 24px;
}

.forgot-link,
.text-link {
  display: inline-flex;
  color: var(--cr-primary);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.forgot-link:hover,
.text-link:hover {
  text-decoration: underline;
}

.password-rules {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: #fff;
  color: var(--cr-muted);
  font-size: 11px;
}

.password-rules p {
  margin: 0;
}

.password-rules .valid {
  color: var(--cr-success);
}

.password-rules .invalid {
  color: var(--cr-muted);
}

/* Dashboard */
.app-body {
  min-height: 100vh;
  background: var(--cr-bg);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 80;
  width: 264px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  background: linear-gradient(180deg, var(--cr-sidebar), #123d4b 72%, #0b343f);
  color: #fff;
  overflow-y: auto;
}

.brand {
  padding: 8px 8px 20px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--cr-radius);
  background: #fff;
  color: var(--cr-sidebar);
  font-size: 12px;
  font-weight: 900;
}

.brand-name {
  color: #fff;
  font-size: 16px;
  font-weight: 900;
}

.menu {
  display: grid;
  gap: 7px;
}

.menu-item {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--cr-radius);
  background: transparent;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 780;
  cursor: pointer;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.menu-item.active {
  background: #fff;
  color: var(--cr-sidebar);
}

.top-header {
  position: fixed;
  top: 0;
  left: 264px;
  right: 0;
  z-index: 60;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--cr-border);
  background: rgba(251, 254, 253, 0.94);
  box-shadow: 0 10px 28px rgba(16, 40, 63, 0.06);
  backdrop-filter: blur(16px);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-circle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: #fff;
}

.user-info {
  display: grid;
  gap: 3px;
}

.user-name {
  color: var(--cr-ink);
  font-size: 15px;
  line-height: 1.25;
  font-weight: 900;
}

.user-email {
  color: var(--cr-muted);
  font-size: 12px;
}

.credit-badge {
  min-width: 300px;
  max-width: 420px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: #fff;
}

.credit-icon,
.stat-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--cr-radius);
  background: #eef4ff;
  color: var(--cr-primary);
}

.credit-label,
.stat-label {
  color: var(--cr-ink);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.credit-value,
.stat-value {
  color: var(--cr-muted);
  font-size: 12px;
  line-height: 1.35;
}

.main {
  min-height: 100vh;
  margin-left: 264px;
  padding: 104px 30px 38px;
}

.page-section {
  display: none;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.page-section.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.page-section h1,
.page-section h2,
.landing-title,
.form-container h1 {
  margin: 4px 0 8px;
  color: var(--cr-ink);
  font-size: 32px;
  line-height: 1.18;
  font-weight: 900;
}

.subtitle,
.landing-subtitle {
  max-width: 760px;
  margin: 0;
  color: var(--cr-muted);
  font-size: 14px;
  line-height: 1.65;
}

.compliance-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.workspace-hero,
.form-container,
.credit-card,
.side-panel,
.reports-shell {
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: var(--cr-panel);
  box-shadow: var(--cr-soft-shadow);
}

.workspace-hero {
  padding: 28px;
  margin-bottom: 18px;
  background:
    linear-gradient(90deg, rgba(251, 254, 253, 0.98), rgba(251, 254, 253, 0.9)),
    linear-gradient(135deg, rgba(14, 143, 140, 0.14), rgba(36, 84, 214, 0.11));
}

.workspace-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.stat-grid {
  display: grid;
  gap: 12px;
}

.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: var(--cr-panel-soft);
}

.side-panel {
  padding: 18px;
}

.side-panel h3,
.credit-card h3,
.form-container h3 {
  margin: 0 0 12px;
  color: var(--cr-ink);
  font-size: 15px;
  font-weight: 900;
}

.check-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: flex;
  gap: 9px;
  color: var(--cr-text);
  font-size: 13px;
  line-height: 1.45;
}

.check-list svg {
  color: var(--cr-teal);
}

.form-container,
.credit-card {
  padding: 24px;
}

.form-card-grid {
  display: grid;
  gap: 18px;
}

.section-title,
.section-subtitle {
  margin: 8px 0 10px;
  color: var(--cr-ink);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 900;
  text-transform: uppercase;
}

.option-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.option-box {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: var(--cr-panel-soft);
  color: var(--cr-text);
  font-size: 13px;
  font-weight: 780;
  line-height: 1.25;
  cursor: pointer;
}

.option-box input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--cr-primary);
}

.option-box:has(input:checked) {
  border-color: var(--cr-primary);
  background: #eef4ff;
  color: var(--cr-primary-dark);
}

.upload-card {
  display: grid;
  gap: 10px;
}

.admin-ai-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid #b8d5d3;
  border-radius: var(--cr-radius);
  background: #f1fbfa;
}

.admin-ai-control p {
  margin: 0;
  color: var(--cr-teal-dark);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 700;
}

.admin-ai-control select {
  width: min(220px, 100%);
  background: #fff;
}

.upload-box {
  min-height: 142px;
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 24px;
  border: 1.5px dashed var(--cr-border-strong);
  border-radius: var(--cr-radius);
  background: #fbfcfe;
  color: var(--cr-ink);
  text-align: center;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}

.upload-box small {
  display: block;
  color: var(--cr-muted);
  font-size: 12px;
  font-weight: 600;
}

.upload-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--cr-radius);
  background: #eef4ff;
  color: var(--cr-primary);
}

.upload-box.drag-over,
.upload-box:hover {
  border-color: var(--cr-primary);
  background: #eef4ff;
}

#fileName {
  min-height: 22px;
  color: var(--cr-primary);
  font-size: 13px;
  font-weight: 800;
}

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

.section-actions input {
  width: min(460px, 100%);
  background: #fff;
}

.section-actions select {
  width: auto;
  background: #fff;
}

.report-filters input[type="text"] {
  min-width: 260px;
  flex: 1 1 300px;
}

.report-filters select,
.report-filters input[type="date"] {
  width: auto;
  min-width: 160px;
  flex: 0 1 190px;
}

.btn-filter-clear {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: #fff;
  color: var(--cr-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.btn-filter-clear:hover {
  border-color: var(--cr-primary);
  background: #f4f7ff;
  color: var(--cr-primary);
}

.reports-shell {
  padding: 18px;
}

.reports-summary {
  margin-bottom: 12px;
  color: var(--cr-muted);
  font-size: 13px;
  font-weight: 800;
}

.company-block {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.company-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: #f8fbfa;
  color: var(--cr-ink);
  font-size: 14px;
  font-weight: 900;
}

.reports-container,
#purchase-list,
#reports-list {
  display: grid;
  gap: 10px;
}

.report-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: #fff;
}

.rc-title {
  color: var(--cr-ink);
  font-size: 14px;
  font-weight: 900;
}

.rc-company {
  margin-top: 4px;
  color: var(--cr-primary);
  font-size: 13px;
  font-weight: 850;
}

.rc-date,
.rc-info {
  margin-top: 4px;
  color: var(--cr-muted);
  font-size: 12px;
  line-height: 1.4;
}

.rc-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.empty-state,
.loading-state,
.error-state {
  padding: 18px;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: #fff;
  color: var(--cr-muted);
  font-size: 13px;
  line-height: 1.5;
}

.error-state {
  border-color: #f4b4ad;
  color: var(--cr-danger);
  background: #fff7f6;
}

.usage-admin-note {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #b8d5d3;
  border-radius: var(--cr-radius);
  background: #f1fbfa;
  color: var(--cr-teal-dark);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

.usage-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.usage-card,
.usage-panel {
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: #fff;
  box-shadow: var(--cr-soft-shadow);
}

.usage-card {
  min-height: 118px;
  display: grid;
  gap: 6px;
  align-content: center;
  padding: 16px;
}

.usage-card-label {
  color: var(--cr-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.usage-card-value {
  color: var(--cr-ink);
  font-size: 24px;
  line-height: 1.1;
  font-weight: 900;
}

.usage-card-detail {
  color: var(--cr-muted);
  font-size: 12px;
  line-height: 1.35;
}

.usage-panel {
  margin-top: 16px;
  overflow: hidden;
}

.usage-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--cr-border);
  background: #f8fbfa;
}

.usage-panel-head h3 {
  margin: 0;
  color: var(--cr-ink);
  font-size: 15px;
  font-weight: 900;
}

.usage-panel-head span {
  color: var(--cr-muted);
  font-size: 12px;
  font-weight: 750;
}

.usage-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.usage-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  color: var(--cr-text);
  font-size: 12px;
}

.usage-table th,
.usage-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--cr-border);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.usage-table th {
  background: #fbfefd;
  color: var(--cr-ink);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.usage-table tbody tr:hover {
  background: #f7fafc;
}

.usage-muted {
  display: block;
  margin-top: 3px;
  color: var(--cr-muted);
  font-size: 11px;
}

.price-box {
  display: grid;
  gap: 8px;
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: var(--cr-panel-soft);
  color: var(--cr-text);
  font-size: 13px;
}

.calc-total {
  color: var(--cr-ink);
  font-weight: 900;
}

/* Modal and report */
.modal {
  display: none;
  position: fixed;
  inset: 24px;
  z-index: 1200;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: var(--cr-panel);
  box-shadow: 0 28px 80px rgba(16, 40, 63, 0.24);
}

.modal-header,
.modal-footer {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--cr-border);
  background: var(--cr-panel-soft);
}

.modal-footer {
  border-top: 1px solid var(--cr-border);
  border-bottom: 0;
}

.modal-title {
  margin: 0;
  color: var(--cr-ink);
  font-size: 17px;
  font-weight: 900;
}

.close-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--cr-radius);
  color: var(--cr-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.close-btn:hover {
  background: #e8f2f1;
  color: var(--cr-ink);
}

.close-btn.small {
  width: 30px;
  height: 30px;
  font-size: 20px;
}

.modal-body {
  min-height: 0;
  height: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}

.modal.has-report-chat .modal-body {
  grid-template-columns: minmax(0, 1fr) minmax(360px, var(--report-chat-width, 420px));
}

.chat-output,
#modal-content {
  min-width: 0;
  min-height: 0;
  height: auto;
  overflow: auto;
  padding: 22px;
  background: #fff;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.report-chat-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  overflow: visible;
  border-left: 1px solid var(--cr-border);
  background: #f4f8f8;
}

.report-chat-resizer {
  position: absolute;
  left: -7px;
  top: 0;
  z-index: 4;
  width: 14px;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
}

.report-chat-resizer::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  width: 3px;
  height: 64px;
  border-radius: 999px;
  background: #9cb2bd;
  opacity: 0.44;
  transform: translateY(-50%);
  transition: opacity 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.report-chat-resizer:hover::before,
.report-chat-resizer:focus-visible::before {
  background: var(--cr-primary);
  box-shadow: 0 0 0 4px rgba(36, 84, 214, 0.12);
  opacity: 1;
}

.report-chat-resizer:focus-visible {
  outline: 0;
}

.report-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--cr-border);
  background: #ffffff;
}

.report-chat-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.report-chat-brand > div {
  min-width: 0;
}

.report-chat-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #b8d5d3;
  border-radius: var(--cr-radius);
  background: #e9f8f7;
  color: var(--cr-teal-dark);
}

.report-chat-head h4 {
  margin: 3px 0 0;
  color: var(--cr-ink);
  font-size: 17px;
  line-height: 1.15;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-chat-kicker {
  color: var(--cr-teal-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.report-chat-context {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--cr-border);
  background: #fbfefd;
}

.report-chat-context span {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: #fff;
  color: var(--cr-text);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-chat-context span:first-child {
  border-color: #b8d5d3;
  background: #edf9f8;
  color: var(--cr-teal-dark);
}

.report-chat-context span svg {
  width: 14px;
  height: 14px;
}

.report-chat-messages {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding: 14px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.report-chat-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 22px 18px;
  border: 1px dashed #b8d5d3;
  border-radius: var(--cr-radius);
  background: #ffffff;
  color: var(--cr-text);
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
}

.report-chat-empty strong {
  color: var(--cr-ink);
  font-size: 15px;
  font-weight: 900;
}

.report-chat-empty span {
  max-width: 300px;
  color: var(--cr-muted);
}

.report-chat-empty-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--cr-radius);
  background: #eef4ff;
  color: var(--cr-primary);
}

.report-chat-message {
  display: grid;
  gap: 5px;
}

.report-chat-message.user {
  justify-items: end;
}

.report-chat-role {
  color: var(--cr-muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.report-chat-bubble {
  max-width: 92%;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: #fff;
  color: var(--cr-text);
  box-shadow: 0 8px 18px rgba(16, 40, 63, 0.05);
  font-size: 13px;
  line-height: 1.58;
  overflow-wrap: anywhere;
}

.report-chat-bubble ul,
.report-chat-bubble ol {
  margin: 8px 0 8px 18px;
  padding: 0;
}

.report-chat-bubble li + li {
  margin-top: 5px;
}

.report-chat-bubble table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 12px;
}

.report-chat-bubble th,
.report-chat-bubble td {
  padding: 7px;
  border: 1px solid var(--cr-border);
  text-align: left;
  vertical-align: top;
}

.report-chat-bubble pre,
.report-chat-bubble code {
  white-space: pre-wrap;
  word-break: break-word;
}

.report-chat-message.user .report-chat-bubble {
  border-color: #b8d5d3;
  background: #e9f8f7;
  color: var(--cr-ink);
  box-shadow: none;
}

.report-chat-message.assistant .report-chat-bubble {
  border-left: 3px solid var(--cr-primary);
}

.report-chat-bubble p {
  margin: 0 0 8px;
}

.report-chat-bubble p:last-child {
  margin-bottom: 0;
}

.report-chat-thinking {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--cr-muted);
  font-size: 12px;
  font-weight: 750;
}

.report-chat-thinking span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--cr-primary);
  animation: chatPulse 1000ms ease-in-out infinite;
}

.report-chat-thinking span:nth-child(2) { animation-delay: 120ms; }
.report-chat-thinking span:nth-child(3) { animation-delay: 240ms; }

@keyframes chatPulse {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

.report-chat-prompts {
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 14px 0;
  scrollbar-width: thin;
}

.report-chat-prompts button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: #fff;
  color: var(--cr-text);
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}

.report-chat-prompts button:hover {
  border-color: #b8d5d3;
  background: #edf9f8;
  color: var(--cr-teal-dark);
}

.report-chat-form {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--cr-border);
  background: #fff;
}

.report-chat-form textarea {
  min-height: 86px;
  max-height: 142px;
  resize: none;
  overflow: auto;
  background: #fbfefd;
}

#modal-content h1,
#modal-content h2,
#modal-content h3,
#modal-content h4 {
  color: var(--cr-ink);
  line-height: 1.25;
}

#modal-content p,
#modal-content li {
  color: var(--cr-text);
  line-height: 1.6;
}

#modal-content table {
  width: 100%;
  margin: 14px 0;
  border-collapse: collapse;
  font-size: 12px;
}

#modal-content th,
#modal-content td {
  padding: 10px;
  border: 1px solid var(--cr-border);
  vertical-align: top;
  word-break: break-word;
}

#modal-content th {
  background: #edf5f3;
  color: var(--cr-ink);
  font-weight: 900;
}

#loaderai {
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.loader-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #dbe8e8;
  border-top-color: var(--cr-primary);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.loader-text,
.analysis-status {
  color: var(--cr-muted);
  font-size: 14px;
}

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

.compliance-loader-container {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  place-items: center;
  background: rgba(16, 40, 63, 0.45);
  backdrop-filter: blur(6px);
}

.compliance-loader-container[style*="block"] {
  display: grid !important;
}

.compliance-loader {
  width: min(280px, calc(100vw - 40px));
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 28px;
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  background: #fff;
  box-shadow: var(--cr-shadow);
  color: var(--cr-ink);
}

.ai-ring {
  width: 58px;
  height: 58px;
  border: 4px solid #dbe8e8;
  border-top-color: var(--cr-teal);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.ai-core {
  margin-top: -48px;
  color: var(--cr-teal-dark);
  font-size: 13px;
  font-weight: 900;
}

.scan-line {
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--cr-teal), transparent);
}

@media (max-width: 1080px) {
  .auth-shell {
    grid-template-columns: 1fr;
    width: min(560px, 100%);
  }

  .auth-brand-panel {
    padding: 26px;
  }

  .auth-insight-panel,
  .auth-trust-row {
    display: none;
  }

  .hero-title {
    font-size: 30px;
  }

  .compliance-workbench {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    padding: 12px;
  }

  .brand {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }

  .menu {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .menu-item {
    flex: 0 0 auto;
  }

  .top-header {
    position: relative;
    left: 0;
    min-height: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
  }

  .header-left,
  .header-right {
    justify-content: space-between;
  }

  .credit-badge {
    min-width: 0;
    width: 100%;
  }

  .main {
    margin-left: 0;
    padding: 24px 16px 34px;
  }
}

@media (max-width: 720px) {
  .auth-body {
    align-items: stretch;
    padding: 0;
  }

  .auth-shell {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .auth-panel,
  .auth-brand-panel {
    padding: 20px;
  }

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

  .span-2 {
    grid-column: auto;
  }

  .section-head,
  .header-left,
  .header-right,
  .admin-ai-control,
  .report-card {
    align-items: stretch;
    flex-direction: column;
  }

  .section-actions,
  .rc-actions {
    justify-content: stretch;
  }

  .section-actions input,
  .section-actions select,
  .admin-ai-control select,
  .btn-filter-clear,
  .btn-view,
  .btn-dl,
  .btn-pdf {
    width: 100%;
  }

  .workspace-hero,
  .form-container,
  .credit-card,
  .reports-shell,
  .side-panel {
    padding: 18px;
  }

  .page-section h1,
  .page-section h2,
  .landing-title {
    font-size: 25px;
  }

  .modal {
    inset: 10px;
    max-height: calc(100vh - 20px);
  }

  .modal.has-report-chat .modal-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(320px, var(--report-chat-height, 46vh));
  }

  .report-chat-panel {
    min-height: 0;
    border-left: 0;
    border-top: 1px solid var(--cr-border);
  }

  .report-chat-resizer {
    left: 0;
    top: -1px;
    width: 100%;
    height: 15px;
    cursor: row-resize;
  }

  .report-chat-resizer::before {
    left: 50%;
    top: 5px;
    width: 64px;
    height: 4px;
    transform: translateX(-50%);
  }

  .chat-output,
  #modal-content {
    min-height: 0;
    height: auto;
    padding: 14px;
  }
}

@media (max-width: 460px) {
  .login-card {
    padding: 20px;
  }

  .auth-card-head h1 {
    font-size: 24px;
  }

  .hero-title {
    font-size: 25px;
  }

  .option-group {
    grid-template-columns: 1fr;
  }

  .modal-header,
  .modal-footer {
    min-height: 56px;
    padding: 10px 12px;
  }

  .modal-title {
    font-size: 15px;
  }

  .modal.has-report-chat .modal-body {
    grid-template-rows: minmax(0, 0.88fr) minmax(330px, var(--report-chat-height, 52vh));
  }

  .report-chat-head {
    padding: 12px;
  }

  .report-chat-mark {
    width: 36px;
    height: 36px;
  }

  .report-chat-context {
    padding: 10px 12px;
  }

  .report-chat-messages {
    padding: 12px;
  }

  .report-chat-bubble {
    max-width: 96%;
    font-size: 12.5px;
  }

  .report-chat-prompts {
    padding: 10px 12px 0;
  }

  .report-chat-form {
    padding: 12px;
  }
}
