/* ════════════════════════════════════════════════
   hexgold Admin — style.css
   Industry-Level Dark UI
════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ───────────────────────────── */
:root {
  --gold: #C9921A;
  --gold-l: #E8AE2A;
  --gold-d: #9C6E10;
  --gold-glow: rgba(201, 146, 26, 0.15);

  --bg: #08090E;
  --bg2: #0D0F17;
  --bg3: #111420;
  --bg4: #161928;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-h: rgba(255, 255, 255, 0.06);
  --bdr: rgba(255, 255, 255, 0.07);
  --bdr2: rgba(255, 255, 255, 0.12);
  --bdr-gold: rgba(201, 146, 26, 0.35);

  --tx: #DDE0EE;
  --tx2: #6B7190;
  --tx3: #3A3F5C;

  --green: #16A34A;
  --green-bg: rgba(22, 163, 74, 0.12);
  --red: #DC2626;
  --red-bg: rgba(220, 38, 38, 0.12);
  --blue: #2563EB;
  --blue-bg: rgba(37, 99, 235, 0.12);
  --amber: #D97706;
  --amber-bg: rgba(217, 119, 6, 0.12);
  --purple: #7C3AED;
  --purple-bg: rgba(124, 58, 237, 0.12);

  --sidebar: 252px;
  --topbar: 56px;
  --ease: 0.18s cubic-bezier(0.4, 0, 0.2, 1);

  --r4: 4px;
  --r6: 6px;
  --r8: 8px;
  --r12: 12px;
  --r16: 16px;
  --r20: 20px;
}

/* ── Reset ───────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--tx);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--gold);
  text-decoration: none;
}

ul {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 13.5px;
}

/* ── Scrollbar ───────────────────────────────── */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .07);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .14);
}

/* ── Utility ─────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ════════════════════════════════════════════════
   LOGIN
════════════════════════════════════════════════ */
#login-container {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 420px;
  margin: 0 16px;
  background: var(--bg3);
  border: 1px solid var(--bdr2);
  border-radius: var(--r20);
  padding: 44px 40px;
  box-shadow: 0 40px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .02);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.login-logo h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--tx);
}

.login-logo span {
  font-size: 12px;
  color: var(--tx2);
  display: block;
  margin-top: 2px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--tx2);
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--bdr);
}

.login-footer {
  text-align: center;
  font-size: 11.5px;
  color: var(--tx3);
  margin-top: 24px;
}

.login-footer i {
  margin-right: 4px;
}

/* ── Logo Icon ───────────────────────────────── */
.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r12);
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-icon i {
  font-size: 20px;
  color: #000;
}

.logo-icon.sm {
  width: 32px;
  height: 32px;
  border-radius: var(--r8);
}

.logo-icon.sm i {
  font-size: 15px;
}

/* ── Inputs ──────────────────────────────────── */
.field-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field-wrap label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.field-wrap input,
.field-wrap select,
.field-wrap textarea {
  background: var(--bg);
  border: 1px solid var(--bdr2);
  border-radius: var(--r8);
  padding: 10px 13px;
  color: var(--tx);
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
  width: 100%;
}

.field-wrap input:focus,
.field-wrap select:focus,
.field-wrap textarea:focus {
  border-color: var(--bdr-gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.field-wrap select option {
  background: var(--bg2);
}

.field-wrap textarea {
  resize: vertical;
  min-height: 90px;
}

.file-input {
  padding: 8px 13px;
  color: var(--tx2);
}

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

.req {
  color: var(--red);
}

.input-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon>i:first-child {
  position: absolute;
  left: 13px;
  color: var(--tx3);
  font-size: 14px;
  pointer-events: none;
}

.input-icon input {
  padding-left: 38px;
}

.eye-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--tx3);
  padding: 4px;
  line-height: 1;
  transition: color var(--ease);
}

.eye-btn:hover {
  color: var(--tx2);
}

.error-msg {
  color: var(--red);
  font-size: 12.5px;
  text-align: center;
  min-height: 18px;
  margin-bottom: 10px;
}

/* ── Buttons ─────────────────────────────────── */
.btn-gold {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--r8);
  background: var(--gold);
  color: #000;
  border: none;
  font-size: 13.5px;
  font-weight: 700;
  transition: all var(--ease);
  white-space: nowrap;
}

.btn-gold:hover {
  background: var(--gold-l);
  box-shadow: 0 4px 16px var(--gold-glow);
  transform: translateY(-1px);
}

.btn-gold:active {
  transform: translateY(0);
}

.btn-full {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r6);
  background: transparent;
  border: 1px solid var(--bdr2);
  color: var(--tx2);
  font-size: 12.5px;
  font-weight: 500;
  transition: all var(--ease);
  white-space: nowrap;
}

.btn-outline:hover {
  background: var(--surface-h);
  color: var(--tx);
  border-color: var(--bdr-gold);
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: var(--r6);
  background: var(--surface);
  border: 1px solid var(--bdr);
  color: var(--tx2);
  font-size: 12px;
  font-weight: 500;
  transition: all var(--ease);
}

.btn-sm:hover {
  background: var(--surface-h);
  color: var(--tx);
}

.btn-sm.danger {
  color: var(--red);
}

.btn-sm.danger:hover {
  background: var(--red-bg);
  border-color: rgba(220, 38, 38, .2);
}

/* ════════════════════════════════════════════════
   DASHBOARD SHELL
════════════════════════════════════════════════ */
#dashboard-container {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

/* ── Mobile Top Bar ──────────────────────────── */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--topbar);
  background: var(--bg2);
  border-bottom: 1px solid var(--bdr);
  padding: 0 16px;
  align-items: center;
  gap: 12px;
}

.mobile-logo {
  display: flex;
  align-items: center;
  gap: 9px;
}

.mobile-logo span {
  font-weight: 700;
  font-size: 15px;
}

.sidebar-toggle {
  background: none;
  border: 1px solid var(--bdr2);
  color: var(--tx2);
  padding: 7px 10px;
  border-radius: var(--r6);
  line-height: 1;
  transition: all var(--ease);
}

.sidebar-toggle:hover {
  color: var(--tx);
  border-color: var(--bdr-gold);
}

/* ── Sidebar Overlay ─────────────────────────── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(2px);
}

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
  overflow: hidden;
}

.sidebar-head {
  padding: 18px 16px;
  border-bottom: 1px solid var(--bdr);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
}

.sidebar-brand h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--tx);
}

.sidebar-brand small {
  font-size: 10.5px;
  color: var(--tx3);
}

.sidebar-close {
  margin-left: auto;
  background: none;
  border: 1px solid var(--bdr2);
  color: var(--tx2);
  width: 28px;
  height: 28px;
  border-radius: var(--r6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.nav-links {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 0;
}

.nav-links li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r8);
  color: var(--tx2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--ease);
  margin-bottom: 2px;
  position: relative;
  white-space: nowrap;
}

.nav-links li i {
  font-size: 14px;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.nav-links li:hover {
  background: var(--surface-h);
  color: var(--tx);
}

.nav-links li.active {
  background: linear-gradient(90deg, rgba(201, 146, 26, .14), rgba(201, 146, 26, .06));
  color: var(--gold);
  border: 1px solid rgba(201, 146, 26, .18);
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--tx3);
  padding: 14px 12px 5px;
  cursor: default !important;
  display: block;
}

.nav-label:hover {
  background: transparent !important;
  color: var(--tx3) !important;
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  background: var(--gold);
  color: #000;
  padding: 2px 6px;
  border-radius: 99px;
  line-height: 1.4;
}

.sidebar-foot {
  padding: 12px 10px;
  border-top: 1px solid var(--bdr);
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-pill {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r8);
  background: var(--surface);
  border: 1px solid var(--bdr);
  min-width: 0;
  overflow: hidden;
}

.admin-info {
  min-width: 0;
}

.admin-info span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--tx);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-info small {
  font-size: 11px;
  color: var(--tx2);
}

.btn-logout {
  width: 36px;
  height: 36px;
  border-radius: var(--r8);
  background: transparent;
  border: 1px solid var(--bdr2);
  color: var(--tx2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: all var(--ease);
}

.btn-logout:hover {
  background: var(--red-bg);
  color: var(--red);
  border-color: rgba(220, 38, 38, .2);
}

/* ── Avatar ──────────────────────────────────── */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #000;
  font-weight: 800;
  flex-shrink: 0;
}

.avatar.sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

/* ── Main Content ────────────────────────────── */
.main-wrap {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Topbar ──────────────────────────────────── */
.topbar {
  height: var(--topbar);
  background: rgba(13, 15, 23, .85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bdr);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.breadcrumb-root {
  color: var(--tx3);
}

.breadcrumb i {
  font-size: 9px;
  color: var(--tx3);
}

#currentViewTitle {
  font-weight: 600;
  color: var(--tx);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-time {
  font-size: 12px;
  color: var(--tx3);
  font-feature-settings: "tnum";
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--bdr);
  border-radius: 99px;
  padding: 4px 14px 4px 5px;
}

.user-pill span {
  font-size: 13px;
  font-weight: 600;
}

/* ── Page Content ────────────────────────────── */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 48px;
}

.view {
  display: block;
}

.page-head {
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--tx);
  letter-spacing: -.4px;
}

.page-desc {
  font-size: 13px;
  color: var(--tx2);
  margin-top: 4px;
}

/* ════════════════════════════════════════════════
   CARDS
════════════════════════════════════════════════ */
.card {
  background: var(--bg3);
  border: 1px solid var(--bdr);
  border-radius: var(--r16);
  overflow: hidden;
  margin-bottom: 20px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--bdr);
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--tx);
}

.card-desc {
  font-size: 12px;
  color: var(--tx2);
  margin-top: 3px;
}

.card-body {
  padding: 22px;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--bdr);
  border-radius: 99px;
  padding: 1px 9px;
  font-size: 11.5px;
  color: var(--tx2);
  font-weight: 600;
  margin-left: 8px;
}

/* ════════════════════════════════════════════════
   OVERVIEW
════════════════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg3);
  border: 1px solid var(--bdr);
  border-radius: var(--r16);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: border-color var(--ease), transform var(--ease);
}

.stat-card:hover {
  border-color: var(--bdr-gold);
  transform: translateY(-2px);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--r10, 10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  border-radius: var(--r8);
}

.gold-icon {
  background: var(--amber-bg);
  color: var(--gold);
}

.blue-icon {
  background: var(--blue-bg);
  color: var(--blue);
}

.green-icon {
  background: var(--green-bg);
  color: var(--green);
}

.purple-icon {
  background: var(--purple-bg);
  color: var(--purple);
}

.amber-icon {
  background: var(--amber-bg);
  color: var(--amber);
}

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx2);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--tx);
  letter-spacing: -.5px;
  margin: 5px 0 4px;
}

.stat-sub {
  font-size: 11.5px;
}

.stat-sub.positive {
  color: var(--green);
}

.stat-sub.neutral {
  color: var(--tx3);
}

/* Chart */
.chart-card {
  padding: 0;
}

.chart-card .card-head {
  padding: 18px 22px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--tx2);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.blue {
  background: var(--blue);
}

.chart-wrap {
  padding: 8px 16px 20px;
  height: 280px;
  position: relative;
}

/* Two col */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Activity List */
.activity-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--bdr);
  font-size: 13px;
  color: var(--tx2);
}

.activity-list li:last-child {
  border-bottom: none;
}

.activity-empty {
  justify-content: center;
  color: var(--tx3);
}

/* Status List */
.status-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--bdr);
  font-size: 13px;
}

.status-list li:last-child {
  border-bottom: none;
}

.status-list li>span:nth-child(2) {
  flex: 1;
  color: var(--tx2);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.green {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.dot.amber {
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber);
}

.dot.red {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}

.status-val {
  font-size: 12px;
  font-weight: 600;
}

.status-val.ok {
  color: var(--green);
}

.status-val.warn {
  color: var(--amber);
}

/* ════════════════════════════════════════════════
   TABLES
════════════════════════════════════════════════ */
.tbl-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  padding: 11px 20px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--tx3);
  background: rgba(0, 0, 0, .18);
  border-bottom: 1px solid var(--bdr);
  white-space: nowrap;
}

tbody td {
  padding: 13px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .035);
  color: var(--tx2);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--surface);
  color: var(--tx);
}

.tbl-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--bdr);
}

.tbl-meta {
  font-size: 12px;
  color: var(--tx3);
}

/* Search */
.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrap i {
  position: absolute;
  left: 11px;
  color: var(--tx3);
  font-size: 13px;
}

.search-wrap input {
  background: var(--bg);
  border: 1px solid var(--bdr2);
  border-radius: var(--r8);
  padding: 7px 12px 7px 34px;
  color: var(--tx);
  outline: none;
  width: 200px;
  transition: border-color var(--ease);
}

.search-wrap input:focus {
  border-color: var(--bdr-gold);
}

/* ── Tabs ────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 6px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--bdr);
  overflow-x: auto;
}

.tab {
  padding: 7px 16px;
  border-radius: var(--r6);
  background: var(--surface);
  border: 1px solid var(--bdr);
  color: var(--tx2);
  font-size: 12.5px;
  font-weight: 600;
  transition: all var(--ease);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab:hover {
  background: var(--surface-h);
  color: var(--tx);
}

.tab.active {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
  box-shadow: 0 2px 10px var(--gold-glow);
}

/* ── Badges ──────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.badge-success,
.badge-active {
  background: var(--green-bg);
  color: var(--green);
}

.badge-pending {
  background: var(--amber-bg);
  color: var(--amber);
}

.badge-failed,
.badge-blocked {
  background: var(--red-bg);
  color: var(--red);
}

.badge-draft {
  background: var(--blue-bg);
  color: var(--blue);
}

.badge-archived {
  background: var(--surface);
  color: var(--tx3);
  border: 1px solid var(--bdr);
}

.badge-gold {
  background: var(--gold-glow);
  color: var(--gold);
}

/* ── Split Layout ────────────────────────────── */
.split-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: start;
}

.terms-layout {
  grid-template-columns: 420px 1fr;
}

.form-panel .card-body {
  padding: 20px;
}

/* ════════════════════════════════════════════════
   CONFIGURATION
════════════════════════════════════════════════ */
.config-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.config-card {
  background: var(--bg3);
  border: 1px solid var(--bdr);
  border-radius: var(--r16);
  overflow: hidden;
}

.config-card-head {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--bdr);
}

.config-card-head h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--tx);
}

.config-card-head p {
  font-size: 12px;
  color: var(--tx2);
  margin-top: 2px;
}

.config-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  padding: 18px 20px;
}

.config-grid-3 {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.config-grid-4 {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.config-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--tx3);
  padding: 0 20px;
  margin-bottom: 2px;
}

/* Gateway Cards */
.gw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 18px 20px;
}

.gw-card {
  background: var(--bg4);
  border: 1px solid var(--bdr);
  border-radius: var(--r12);
  padding: 16px;
  transition: border-color var(--ease);
}

.gw-card:hover {
  border-color: var(--bdr-gold);
}

.gw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.gw-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gw-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--r6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.gw-brand strong {
  font-size: 13.5px;
  font-weight: 700;
}

.gw-toggle {
  background: var(--bg3);
  border: 1px solid var(--bdr2);
  border-radius: var(--r6);
  padding: 4px 10px;
  color: var(--tx);
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.gw-limits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.config-save-row {
  padding: 24px 0 0;
  display: flex;
  justify-content: flex-end;
}

/* ════════════════════════════════════════════════
   TERMS & CONDITIONS
════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, .75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: var(--bg3);
  border: 1px solid var(--bdr2);
  border-radius: var(--r16);
  width: 100%;
  max-width: 680px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 80px rgba(0, 0, 0, .7);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
}

.modal-head h3 {
  font-size: 15px;
  font-weight: 700;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: var(--r6);
  background: var(--surface);
  border: 1px solid var(--bdr);
  color: var(--tx2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all var(--ease);
}

.modal-close:hover {
  background: var(--red-bg);
  color: var(--red);
}

.modal-meta {
  padding: 12px 22px;
  border-bottom: 1px solid var(--bdr);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--tx2);
  flex-shrink: 0;
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--tx2);
  white-space: pre-wrap;
}

/* ════════════════════════════════════════════════
   TOAST
════════════════════════════════════════════════ */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--r10, 10px);
  background: var(--bg3);
  border: 1px solid var(--bdr2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .6);
  font-size: 13.5px;
  font-weight: 500;
  transform: translateY(16px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  max-width: 340px;
  border-radius: var(--r12);
}

#toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

#toast.t-success {
  border-color: rgba(22, 163, 74, .35);
  color: var(--green);
}

#toast.t-error {
  border-color: rgba(220, 38, 38, .35);
  color: var(--red);
}

#toast i {
  font-size: 15px;
}

/* ════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════ */
@media (max-width: 1280px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1100px) {
  :root {
    --sidebar: 220px;
  }

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

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

  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  #dashboard-container {
    grid-template-columns: 1fr;
  }

  .mobile-topbar {
    display: flex;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 70;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: flex !important;
  }

  .main-wrap {
    padding-top: var(--topbar);
  }

  .topbar {
    display: none;
  }

  .page-content {
    padding: 20px 16px 48px;
  }
}

@media (max-width: 640px) {
  .stats-row {
    grid-template-columns: 1fr;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 32px 24px;
  }

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

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

  #toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: unset;
  }
}

/* ── Modal ───────────────────────────────────── */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--bg3);
  border: 1px solid var(--bdr2);
  border-radius: var(--r12);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--bdr);
  background: var(--bg4);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--tx);
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--tx2);
  font-size: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r6);
  transition: all var(--ease);
}

.modal-close:hover {
  background: var(--surface-h);
  color: var(--tx);
}

.modal-meta {
  display: flex;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg2);
  border-bottom: 1px solid var(--bdr);
  font-size: 12px;
  color: var(--tx2);
  flex-wrap: wrap;
}

.modal-meta span {
  display: flex;
  gap: 6px;
}

.modal-meta strong {
  color: var(--tx);
  font-weight: 600;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  color: var(--tx);
  line-height: 1.7;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Badge styles for Terms */
.badge-draft {
  background: var(--amber-bg);
  color: var(--amber);
  padding: 4px 10px;
  border-radius: var(--r6);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-pending {
  background: var(--blue-bg);
  color: var(--blue);
  padding: 4px 10px;
  border-radius: var(--r6);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
