:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #f9fbff;
  --surface-strong: #0f172a;
  --line: #d8e0ee;
  --text: #162033;
  --muted: #64748b;
  --accent: #d13f35;
  --accent-strong: #9f2f28;
  --accent-soft: #fff1ef;
  --green: #15803d;
  --green-soft: #ecfdf3;
  --amber: #b45309;
  --amber-soft: #fff7ed;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --blue: #1d4ed8;
  --blue-soft: #eff6ff;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --sidebar-w: 260px;
  --sidebar-collapsed-w: 92px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(209, 63, 53, 0.10), transparent 32%),
    linear-gradient(180deg, #f8fbff 0%, #eef3fa 100%);
}
button, input, select, textarea { font: inherit; }

.hidden { display: none !important; }
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(209, 63, 53, 0.12), transparent 32%),
    linear-gradient(180deg, #f8fbff 0%, #eef3fa 100%);
}
.boot-card {
  min-width: 220px;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 28px 24px;
  border-radius: 24px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(216, 224, 238, 0.9);
  box-shadow: var(--shadow);
  text-align: center;
}
.boot-card strong {
  font-size: 1.04rem;
}
.boot-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.muted-text { color: var(--muted); font-size: 0.88rem; }
.eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}
.login-shell {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: stretch;
}
.login-brand,
.login-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(216, 224, 238, 0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.login-brand {
  padding: 42px;
  display: flex;
  gap: 24px;
  align-items: center;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.96), rgba(248,250,252,0.96)),
    linear-gradient(135deg, rgba(209,63,53,0.08), transparent 50%);
}
.brand-mark {
  width: 74px;
  height: 74px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.06em;
  box-shadow: 0 16px 34px rgba(209, 63, 53, 0.28);
}
.brand-mark.small {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 0.95rem;
  box-shadow: none;
}
.login-brand h1 {
  margin: 8px 0 10px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
}
.login-brand p {
  margin: 0;
  max-width: 420px;
  color: var(--muted);
  line-height: 1.6;
}
.login-card {
  padding: 34px;
}
.login-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #eef2f8;
  padding: 8px;
  border-radius: 18px;
  margin-bottom: 24px;
}
.switch-btn {
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 700;
}
.switch-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}
.field-label {
  display: block;
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}
.form-field {
  display: grid;
  gap: 8px;
}
.field-input,
.toolbar-input,
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.field-textarea {
  min-height: 120px;
  resize: vertical;
}
.field-input:focus,
.toolbar-input:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: none;
  border-color: rgba(209, 63, 53, 0.55);
  box-shadow: 0 0 0 4px rgba(209, 63, 53, 0.08);
}
.field-help {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}
.login-error {
  min-height: 22px;
  margin: 14px 0;
  color: var(--red);
  font-size: 0.88rem;
}
.login-btn { width: 100%; justify-content: center; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}
.sidebar {
  background: var(--surface-strong);
  color: #fff;
  padding: 26px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: visible;
  transition: width 0.22s ease, padding 0.22s ease;
}
.sidebar-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 8px 6px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.09);
  position: relative;
}
.sidebar-brand-text {
  min-width: 0;
}
.sidebar-brand strong { display: block; margin-top: 4px; }
.sidebar .eyebrow { color: rgba(255,255,255,0.58); }
.sidebar-toggle {
  position: absolute;
  top: 0;
  right: -15px;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(216, 224, 238, 0.36);
  border-radius: 999px;
  background: #162136;
  color: #fff;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.28);
  transition: transform 0.18s ease, background 0.18s ease;
  z-index: 3;
}
.sidebar-toggle:hover {
  transform: translateX(1px);
  background: #1c2a44;
}
.nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
}
.nav-item {
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: rgba(255,255,255,0.72);
  text-align: left;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.94rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-icon {
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex: 0 0 20px;
}
.nav-label {
  white-space: nowrap;
}
.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: linear-gradient(135deg, rgba(209,63,53,0.28), rgba(209,63,53,0.16));
}
.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-w) 1fr;
}
.app-shell.sidebar-collapsed .sidebar {
  padding: 26px 12px;
}
.app-shell.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding-top: 34px;
}
.app-shell.sidebar-collapsed .sidebar-brand-text {
  display: none;
}
.app-shell.sidebar-collapsed .nav-item {
  justify-content: center;
  padding-left: 12px;
  padding-right: 12px;
}
.app-shell.sidebar-collapsed .nav-label {
  display: none;
}
.app-shell.sidebar-collapsed .sidebar-toggle {
  right: -15px;
  pointer-events: auto;
}
.app-shell.sidebar-collapsed .sidebar-toggle:hover {
  transform: translateX(1px);
}

.main-shell { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(244, 247, 251, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(216, 224, 238, 0.9);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.credit-chip {
  padding: 8px 12px;
  border: 1px solid #d7e2f0;
  border-radius: 16px;
  background: rgba(255,255,255,0.9);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
}
.user-chip-main {
  display: flex;
  gap: 8px;
  align-items: center;
}
.user-chip-main span {
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}
.main-content { padding: 28px; }
.mobile-context-strip {
  display: none;
  margin-bottom: 18px;
}
.mobile-context-card {
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(216, 224, 238, 0.9);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}
.mobile-context-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.mobile-context-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.mobile-context-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.section { display: none; }
.section.active { display: block; }
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}
.section-header h2 {
  margin: 0 0 6px;
  font-size: 1.55rem;
  line-height: 1.15;
}
.section-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.stat-card,
.panel-card {
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(216, 224, 238, 0.9);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}
.stat-card {
  padding: 18px;
}
.stat-card strong {
  display: block;
  font-size: 1.7rem;
  margin-bottom: 6px;
}
.stat-card span { color: var(--muted); }
.panel-card {
  padding: 18px;
}
.panel-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-card-header h3 {
  margin: 0;
  font-size: 0.98rem;
}
.activity-list {
  display: grid;
  gap: 10px;
}
.activity-card {
  border: 1px solid #e7eef8;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,251,255,0.98) 100%);
  padding: 14px;
}
.activity-card-summary {
  margin-bottom: 10px;
  color: #1e293b;
  font-size: 0.86rem;
  line-height: 1.55;
}
.activity-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.activity-card-meta {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}
.activity-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding-top: 6px;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
}
.activity-meta-row span {
  color: var(--muted);
}
.activity-meta-row strong {
  color: #0f172a;
  text-align: right;
}

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar-input { min-width: 210px; background: rgba(255,255,255,0.92); }
.licensing-toolbar .toolbar-input:first-child { flex: 1 1 320px; }

.customer-data-grid tbody tr {
  cursor: pointer;
  transition: background 0.16s ease;
}
.customer-data-grid tbody tr:hover {
  background: #f8fbff;
}
.customer-data-grid td {
  min-width: 120px;
}
.detail-modal-layout {
  display: grid;
  gap: 24px;
}
.detail-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 4px 2px 0;
}
.detail-modal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 2px;
}
.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.detail-tab {
  border: 1px solid #d9e4f3;
  background: rgba(255,255,255,0.92);
  color: #5f7088;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.86);
  transition: all 0.18s ease;
}
.detail-tab.active {
  background: linear-gradient(180deg, #fff5f2 0%, #ffefea 100%);
  border-color: rgba(209, 63, 53, 0.22);
  color: var(--accent-strong);
  box-shadow: 0 10px 24px rgba(209, 63, 53, 0.12);
}
.detail-tab:hover {
  border-color: #c8d7ea;
  color: var(--text);
}
.detail-panel { display: none; }
.detail-panel.active { display: block; }
.empty-state {
  padding: 34px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: var(--surface-alt);
}
.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.detail-grid,
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.detail-grid.single,
.form-grid.single {
  grid-template-columns: 1fr;
}
.detail-card,
.placeholder-card {
  border: 1px solid #e4ebf5;
  border-radius: 18px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(248,251,255,0.96) 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}
.detail-card strong,
.placeholder-card strong { display: block; margin-bottom: 6px; }
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.placeholder-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.table-wrap {
  overflow: auto;
  border: 1px solid #edf2f8;
  border-radius: 16px;
}
thead th {
  text-align: left;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(248, 251, 255, 0.9);
}
tbody td {
  border-bottom: 1px solid #edf2f8;
  padding: 11px 12px;
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: 0; }
.row-title {
  font-weight: 600;
  margin-bottom: 2px;
  font-size: 0.92rem;
  line-height: 1.25;
}
.row-meta {
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.35;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.1;
}
.status-green { background: var(--green-soft); color: var(--green); }
.status-red { background: var(--red-soft); color: var(--red); }
.status-amber { background: var(--amber-soft); color: var(--amber); }
.status-blue { background: var(--blue-soft); color: var(--blue); }
.status-muted { background: #eef2f7; color: var(--muted); }
.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.hierarchy-header-card {
  margin-bottom: 14px;
}
.hierarchy-breadcrumb {
  margin-top: 10px;
}
.hierarchy-breadcrumb-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.breadcrumb-btn {
  border: 1px solid #d7e2f0;
  background: rgba(255,255,255,0.96);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.breadcrumb-btn.active,
.breadcrumb-btn:disabled {
  background: #eff4fb;
  color: var(--muted);
  cursor: default;
}
.breadcrumb-sep {
  color: var(--muted);
  font-weight: 700;
}
.hierarchy-tabs {
  margin-bottom: 14px;
}
.hierarchy-row-clickable {
  cursor: pointer;
}
.hierarchy-row-clickable:hover td {
  background: #f8fbff;
}
.field-error-text {
  color: #b42318;
  font-size: 0.78rem;
  font-weight: 600;
}

.desktop-table-view { display: block; }
.mobile-card-list { display: none; }
.mobile-list-card {
  background: rgba(255,255,255,0.97);
  border: 1px solid rgba(216, 224, 238, 0.9);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}
.mobile-list-card + .mobile-list-card {
  margin-top: 12px;
}
.mobile-list-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.mobile-list-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-bottom: 12px;
}
.mobile-list-grid strong {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mobile-list-grid span {
  display: block;
  font-size: 0.86rem;
  line-height: 1.35;
}

.primary-btn,
.ghost-btn {
  border: 0;
  border-radius: 16px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 14px 28px rgba(209, 63, 53, 0.18);
}
.ghost-btn {
  background: rgba(255,255,255,0.96);
  color: var(--text);
  border: 1px solid #d7e2f0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.86);
}
.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}
.primary-btn:hover {
  box-shadow: 0 18px 34px rgba(209, 63, 53, 0.24);
}
.ghost-btn:hover {
  border-color: #c7d5e8;
  background: #fff;
}
.danger-btn {
  border-color: rgba(185, 28, 28, 0.22);
  color: var(--red);
  background: rgba(254, 242, 242, 0.95);
}
.danger-btn:hover {
  border-color: rgba(185, 28, 28, 0.36);
  background: #fff3f3;
}
.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.account-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #edf2f8;
}
.account-row:last-child { border-bottom: 0; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 20, 33, 0.34);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 30;
}
.modal-shell {
  width: min(1040px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(249,251,255,0.98) 100%);
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.22);
  border: 1px solid rgba(226, 234, 244, 0.9);
}
.modal-header,
.modal-body {
  padding: 24px 28px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(252,253,255,0.94) 100%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #eef3f9;
}
.modal-header h3 {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.15;
  letter-spacing: 0;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}
.form-stack {
  display: grid;
  gap: 14px;
}
.form-section {
  border: 1px solid #e8eef7;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(247,250,255,0.98) 100%);
  padding: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    0 12px 28px rgba(15, 23, 42, 0.04);
}
.form-section-title {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 700;
}
.form-help {
  margin: 2px 0 0;
  color: #73839b;
  font-size: 0.78rem;
  line-height: 1.5;
}
.credit-intent-card {
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.45;
  border: 1px solid transparent;
}
.credit-intent-neutral {
  background: #f6f9fd;
  color: #607089;
  border-color: #e2eaf5;
}
.credit-intent-add {
  background: #effaf5;
  color: #0f7a44;
  border-color: #bce9d1;
}
.credit-intent-refund {
  background: #fff6ee;
  color: #b45309;
  border-color: #f3d2b4;
}
.modal-actions.spread {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.modal-actions-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.modal-shell .field-input {
  min-height: 44px;
  border-radius: 16px;
  border-color: #d6e1ef;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(251,253,255,0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    0 1px 2px rgba(15, 23, 42, 0.03);
  font-size: 0.92rem;
}
.modal-shell select.field-input {
  padding-right: 40px;
}
.modal-shell .field-input[readonly] {
  background: linear-gradient(180deg, #f3f7fc 0%, #edf3fb 100%);
  color: #607089;
  border-style: dashed;
}
.modal-shell .field-label {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}
.modal-shell .row-title {
  font-size: 1rem;
}
.modal-shell .row-meta {
  font-size: 0.84rem;
}

.customer-data-grid tbody tr {
  border-bottom: 1px solid #edf2f8;
}
.customer-data-grid tbody tr:hover td {
  background: #f8fbff;
}
.customer-data-grid tbody td {
  padding-top: 10px;
  padding-bottom: 10px;
}
.customer-data-grid .table-actions .ghost-btn,
.customer-data-grid .table-actions .primary-btn,
#resellers-table .table-actions .ghost-btn,
#transactions-table .table-actions .ghost-btn {
  min-width: 0;
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 0.82rem;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: var(--surface-strong);
  color: #fff;
  padding: 14px 16px;
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.22);
  z-index: 40;
}

.alert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 20, 33, 0.42);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 45;
}

.alert-shell {
  width: min(460px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(248,250,255,0.99) 100%);
  border-radius: 24px;
  border: 1px solid rgba(226, 234, 244, 0.95);
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.24);
  overflow: hidden;
}

.alert-header,
.alert-body,
.alert-actions {
  padding: 22px 24px;
}

.alert-header {
  border-bottom: 1px solid #eef3f9;
}

.alert-header h3 {
  margin: 0;
  font-size: 1.12rem;
}

.alert-body {
  color: #334155;
  font-size: 0.94rem;
  line-height: 1.6;
}

.alert-body p {
  margin: 0;
  white-space: pre-line;
}

.alert-actions {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid #eef3f9;
}

.loading {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .login-shell,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    padding-bottom: 8px;
  }
  .sidebar-toggle {
    display: none;
  }
  .nav-list {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .nav-item {
    flex: 1 1 180px;
  }
  .nav-label {
    display: inline;
  }
  .topbar,
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .topbar-actions,
  .user-chip {
    width: 100%;
    align-items: flex-start;
  }
  .topbar-actions {
    gap: 10px;
  }
  .credit-chip,
  .user-chip {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .detail-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .modal-header,
  .modal-body {
    padding: 18px 18px 20px;
  }
  .modal-shell {
    border-radius: 22px;
  }
  .modal-header h3 {
    font-size: 1.25rem;
  }
  .modal-actions.spread {
    align-items: stretch;
  }
  .modal-actions-group,
  .modal-actions.spread {
    width: 100%;
  }
  .modal-actions-group .ghost-btn,
  .modal-actions-group .primary-btn,
  .modal-actions.spread > .ghost-btn {
    flex: 1 1 0;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .login-card,
  .login-brand,
  .main-content,
  .topbar {
    padding: 18px;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .mobile-context-strip { display: block; }
  .topbar .user-chip,
  .topbar .credit-chip,
  .topbar .icon-btn,
  .topbar .ghost-btn:not(.nav-item) {
    display: none;
  }
  .desktop-table-view { display: none; }
  .mobile-card-list { display: block; }
  .mobile-list-grid { grid-template-columns: 1fr; }
  .table-actions .ghost-btn,
  .table-actions .primary-btn {
    flex: 1 1 0;
  }
  .mobile-context-actions .ghost-btn {
    flex: 1 1 0;
  }
  .hierarchy-breadcrumb-row {
    gap: 6px;
  }
  .breadcrumb-btn {
    width: 100%;
    justify-content: center;
  }
}
