/* ── Imperial Exchange House — Theme ─────────────────────────────────────── */
:root {
  --gold:        #c9a227;
  --gold-light:  #e8c84a;
  --dark-bg:     #0e0b06;
  --sidebar-bg:  #1a1100;
  --card-bg:     #1e1608;
  --card-border: rgba(201, 162, 39, 0.25);
  --text-main:   #ddd0b0;
  --text-muted:  #7a6f58;
  --sidebar-w:   230px;
}

/* ── Base ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  background: var(--dark-bg);
  color: var(--text-main);
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 0.92rem;
  min-height: 100vh;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--dark-bg); }
::-webkit-scrollbar-thumb { background: rgba(201,162,39,.35); border-radius: 3px; }

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.1rem 1rem;
  border-bottom: 1px solid var(--card-border);
}
.brand-icon { font-size: 1.6rem; color: var(--gold); line-height: 1; }
.brand-name { font-size: 0.85rem; font-weight: bold; color: var(--gold); letter-spacing: 0.5px; }
.brand-sub  { font-size: 0.7rem; color: var(--text-muted); }

.sidebar-user {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--card-border);
}
.user-name { font-size: 0.8rem; color: var(--text-main); font-weight: bold; }

.sidebar-nav { padding: 0.4rem 0; flex-grow: 1; }
.nav-section {
  padding: 0.6rem 1rem 0.2rem;
  font-size: 0.65rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.sidebar-nav .nav-link {
  color: #b0a080;
  padding: 0.45rem 0.9rem;
  margin: 1px 6px;
  border-radius: 5px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s, color 0.15s;
}
.sidebar-nav .nav-link:hover { background: rgba(201,162,39,.12); color: var(--gold); }
.sidebar-nav .nav-link.active { background: rgba(201,162,39,.2); color: var(--gold); }
.sidebar-nav .nav-link i { width: 16px; text-align: center; }

.sidebar-footer { padding: 0.8rem; border-top: 1px solid var(--card-border); }

/* ── Main Content ──────────────────────────────────────────────────────────── */
.main-content { background: var(--dark-bg); min-height: 100vh; }

/* ── Page Header ───────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 {
  font-size: 1.5rem;
  color: var(--gold);
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text-main);
}
.card-header {
  background: rgba(201,162,39,.08);
  border-bottom: 1px solid var(--card-border);
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: bold;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.bg-dark-card { background: var(--card-bg) !important; border: 1px solid var(--card-border); }

/* ── Stat Cards ────────────────────────────────────────────────────────────── */
.stat-card {
  background: linear-gradient(135deg, var(--card-bg), #2a1e00);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
}
.stat-value {
  font-size: 1.6rem;
  font-weight: bold;
  color: var(--gold);
  line-height: 1.1;
}
.stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table { color: var(--text-main); margin-bottom: 0; }
.table thead th {
  background: rgba(201,162,39,.06);
  border-bottom: 1px solid var(--card-border);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
}
.table td { border-color: rgba(255,255,255,.04); padding: 0.5rem 0.75rem; vertical-align: middle; }
.table-hover tbody tr:hover { background: rgba(201,162,39,.05); }
.table-sm td, .table-sm th { padding: 0.35rem 0.6rem; }
.sticky-top { position: sticky; top: 0; z-index: 1; background: var(--card-bg); }
.loan-progress-row td { background: rgba(0,0,0,.2) !important; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-control, .form-select {
  background: #140f05;
  border: 1px solid rgba(201,162,39,.3);
  color: var(--text-main);
  border-radius: 5px;
  font-size: 0.88rem;
}
.form-control:focus, .form-select:focus {
  background: #140f05;
  border-color: var(--gold);
  color: var(--text-main);
  box-shadow: 0 0 0 2px rgba(201,162,39,.2);
}
.form-control::placeholder { color: var(--text-muted); }
.form-label { color: #a09070; font-size: 0.82rem; margin-bottom: 0.3rem; }
.form-text  { color: var(--text-muted); font-size: 0.78rem; }
select option { background: #1a1100; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-gold {
  background: var(--gold);
  color: #1a1100;
  border: none;
  font-weight: bold;
  font-size: 0.85rem;
}
.btn-gold:hover { background: var(--gold-light); color: #1a1100; }
.btn-outline-secondary {
  border-color: rgba(201,162,39,.3);
  color: #a09070;
  font-size: 0.82rem;
}
.btn-outline-secondary:hover { background: rgba(201,162,39,.12); color: var(--gold); border-color: var(--gold); }
.btn-close-white { filter: invert(1); }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge { font-weight: 600; font-size: 0.7rem; }

.role-badge { padding: 0.25em 0.55em; }
.role-chairman { background: #7b1fa2; }
.role-governor  { background: #1565c0; }
.role-manager   { background: #2e7d32; }
.role-clerk     { background: #e65100; }
.role-auditor   { background: #424242; }

.type-individual { background: #1565c0; }
.type-business   { background: #2e7d32; }
.type-hold       { background: #7b1fa2; }

.status-badge-active   { background: #2e7d32; color: #fff; padding: 0.25em 0.55em; border-radius: 4px; font-size: 0.7rem; }
.status-badge-frozen   { background: #546e7a; color: #fff; padding: 0.25em 0.55em; border-radius: 4px; font-size: 0.7rem; }
.status-badge-closed   { background: #424242; color: #fff; padding: 0.25em 0.55em; border-radius: 4px; font-size: 0.7rem; }

.size-minor  { background: #2e7d32; }
.size-medium { background: #e65100; }
.size-major  { background: #b71c1c; }

/* ── Transaction Types ─────────────────────────────────────────────────────── */
.txn-type { font-size: 0.78rem; font-weight: 600; }
.txn-deposit        { color: #66bb6a; }
.txn-withdrawal     { color: #ef5350; }
.txn-transfer_in    { color: #42a5f5; }
.txn-transfer_out   { color: #ab47bc; }
.txn-interest       { color: #ffa726; }
.txn-opening_fee, .txn-maintenance_fee, .txn-fee { color: #78909c; }
.txn-open           { color: #66bb6a; }
.txn-close          { color: #ef5350; }
.txn-reserve_to_till, .txn-till_to_reserve { color: #42a5f5; }
.txn-loan_disbursement { color: #ef5350; }
.txn-loan_payment   { color: #66bb6a; }

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert { font-size: 0.87rem; border-radius: 6px; }
.alert-success { background: rgba(76,175,80,.12); border-color: rgba(76,175,80,.3); color: #a5d6a7; }
.alert-danger  { background: rgba(244,67,54,.12); border-color: rgba(244,67,54,.3); color: #ef9a9a; }
.alert-warning { background: rgba(255,152,0,.12); border-color: rgba(255,152,0,.3); color: #ffcc80; }
.alert-info    { background: rgba(33,150,243,.12); border-color: rgba(33,150,243,.3); color: #90caf9; }
.alert-link    { font-weight: bold; }

/* ── Modals ────────────────────────────────────────────────────────────────── */
.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-main);
}
.modal-header  { border-bottom: 1px solid var(--card-border); }
.modal-footer  { border-top: 1px solid var(--card-border); }
.modal-body    { color: var(--text-main); }
.modal-title   { color: var(--gold); }

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.nav-tabs { border-bottom: 1px solid var(--card-border); }
.nav-tabs .nav-link {
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}
.nav-tabs .nav-link:hover { color: var(--gold); border-color: transparent; background: transparent; }
.nav-tabs .nav-link.active { color: var(--gold); border-bottom: 2px solid var(--gold); background: transparent; }

/* ── Misc ──────────────────────────────────────────────────────────────────── */
.text-gold { color: var(--gold) !important; }
.imperial-divider { border-color: var(--card-border); margin: 1rem 0; }
.acct-number { color: var(--gold); font-size: 1.4rem; }
code { color: var(--gold); background: rgba(201,162,39,.1); padding: 0.1em 0.35em; border-radius: 3px; font-size: 0.85em; }
.loan-link { text-decoration: none; }
.loan-link:hover code { background: rgba(201,162,39,.25); }
h1, h2, h3 { color: var(--gold); }
a { color: var(--gold); }
a:hover { color: var(--gold-light); }
.progress { background: rgba(255,255,255,.07); }

/* ── Login Page ────────────────────────────────────────────────────────────── */
.login-body {
  background: radial-gradient(ellipse at center, #1a1100 0%, #0a0700 100%);
  min-height: 100vh;
}
.login-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 0 60px rgba(201,162,39,.1);
}
.login-logo   { font-size: 3rem; color: var(--gold); text-align: center; margin-bottom: 0.5rem; }
.login-title  { text-align: center; color: var(--gold); font-size: 1.3rem; margin-bottom: 0.2rem; }
.login-sub    { text-align: center; color: var(--text-muted); font-size: 0.8rem; margin-bottom: 1.5rem; }
.login-footer { text-align: center; color: var(--text-muted); font-size: 0.7rem; margin-top: 1.5rem; }

/* ── Tom-Select Dark Theme ─────────────────────────────────────────────────── */
.ts-wrapper { width: 100%; }
.ts-control {
  background: #140f05 !important;
  border: 1px solid rgba(201,162,39,.3) !important;
  color: var(--text-main) !important;
  border-radius: 5px !important;
  font-size: 0.88rem !important;
  box-shadow: none !important;
  padding: 0.375rem 0.6rem !important;
  min-height: 36px;
}
.ts-wrapper.focus .ts-control { border-color: var(--gold) !important; box-shadow: 0 0 0 2px rgba(201,162,39,.2) !important; }
.ts-control input { color: var(--text-main) !important; }
.ts-control input::placeholder { color: var(--text-muted) !important; }
.ts-control .item { color: var(--text-main); }
.ts-dropdown {
  background: #1a1100 !important;
  border: 1px solid rgba(201,162,39,.3) !important;
  color: var(--text-main) !important;
  border-radius: 5px !important;
  font-size: 0.88rem !important;
}
.ts-dropdown .option { color: var(--text-main) !important; padding: 0.4rem 0.75rem; }
.ts-dropdown .option:hover,
.ts-dropdown .option.active { background: rgba(201,162,39,.15) !important; color: var(--gold) !important; }
.ts-dropdown .option.selected { background: rgba(201,162,39,.1) !important; color: var(--gold) !important; }
.ts-dropdown-content { max-height: 220px; }

/* ── Global dark-on-dark fixes ─────────────────────────────────────────────── */
p, span, div, td, th, li, label { color: inherit; }
.text-muted { color: var(--text-muted) !important; }
.input-group-text {
  background: #140f05;
  border-color: rgba(201,162,39,.3);
  color: var(--text-muted);
}
.list-group-item {
  background: var(--card-bg);
  border-color: var(--card-border);
  color: var(--text-main);
}
.dropdown-menu {
  background: #1a1100;
  border-color: var(--card-border);
}
.dropdown-item { color: var(--text-main); }
.dropdown-item:hover { background: rgba(201,162,39,.12); color: var(--gold); }
