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

:root {
  --bg:         #0d0f14;
  --surface:    #161922;
  --surface-2:  #1e222d;
  --border:     #2a2f3d;
  --text:       #e2e5ec;
  --text-muted: #6b7280;
  --accent:     #e8a035;
  --accent-dim: #b37c25;
  --danger:     #e85454;
  --success:    #3ecf8e;
  --radius:     6px;
  --shadow:     0 2px 8px rgba(0,0,0,.45);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.main-content { flex: 1; padding: 2rem 1.25rem; }

/* ===== Header ===== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .04em;
  text-decoration: none;
}

.nav { display: flex; align-items: center; gap: .75rem; }

.nav-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text-muted);
  font-size: .85rem;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  color: var(--text-muted);
  font-size: .8rem;
  text-align: center;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); text-decoration: none; }
.chart-range-active { background: var(--gold-400) !important; color: var(--surface-base) !important; border-color: var(--gold-400) !important; }
.btn-expand { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: .7rem; padding: .2rem .3rem; line-height: 1; }
.btn-expand:hover { color: var(--text); }

.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-full { width: 100%; }

.inline-form { display: inline; }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: .15em .55em;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-role   { background: #1c2540; color: #7faee8; border-color: #2c3f6a; }
.badge-lg     { font-size: .85rem; padding: .3em .75em; }
.badge-position { background: var(--surface-2); color: var(--text-muted); }

/* ===== Alerts ===== */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .875rem;
}
.alert-error   { background: rgba(232,84,84,.12); border: 1px solid rgba(232,84,84,.4); color: #f08080; }
.alert-success { background: rgba(62,207,142,.12); border: 1px solid rgba(62,207,142,.4); color: var(--success); }
.alert-warning { background: rgba(255,193,7,.10); border: 1px solid rgba(255,193,7,.4); color: #ffc107; }

/* ===== Auth page ===== */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px - 48px);
  padding: 2rem 1rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  margin-bottom: .25rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  font-size: .875rem;
}

/* ===== Forms ===== */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  margin-bottom: .4rem;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: .55rem .75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .9rem;
  transition: border-color .15s;
  outline: none;
}
.form-control:focus { border-color: var(--accent); }

.form-hint { display: block; margin-top: .4rem; color: var(--text-muted); font-size: .78rem; }

/* ===== Page header ===== */
.page-header { margin-bottom: 1.75rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-subhead { color: var(--text-muted); margin-top: .25rem; }

/* ===== Summary cards ===== */
.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.card-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: .3rem; }
.card-value { font-size: 1.2rem; font-weight: 600; }
.card-meta  { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }

/* ===== Sections ===== */
.section { margin-top: 1.5rem; }
.section h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }

/* ===== Tables ===== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.data-table th,
.data-table td {
  padding: .65rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--surface-2);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 600;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }

.torn-link { color: var(--accent); }
.torn-link:hover { text-decoration: underline; }

.text-muted { color: var(--text-muted); }

/* ===== Error page ===== */
.error-page { padding: 4rem 0; text-align: center; }
.error-page h1 { font-size: 2rem; margin-bottom: .75rem; }
.error-page p  { color: var(--text-muted); margin-bottom: 1.5rem; }

/* ===== Auth card wide (login with steps) ===== */
.auth-card-wide { max-width: 520px; }

/* ===== ToS banner on login ===== */
.tos-banner {
  background: rgba(232,160,53,.08);
  border: 1px solid rgba(232,160,53,.25);
  border-radius: var(--radius);
  padding: .65rem .9rem;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.tos-banner a { color: var(--accent); }

/* ===== Login step labels ===== */
.form-section-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin: 1.25rem 0 .5rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--border);
}

/* ===== Custom key instructions ===== */
.key-instructions {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  margin-bottom: .5rem;
  font-size: .85rem;
}
.key-instructions p { margin-bottom: .65rem; }
.key-instructions .btn { margin-bottom: .65rem; }

.key-perms-list {
  list-style: none;
  margin: .5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.key-perms-list li { font-size: .78rem; color: var(--text-muted); }
.key-perms-list code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: .1em .4em;
  font-size: .78rem;
  color: var(--accent);
}

/* ===== Checkbox form group ===== */
.checkbox-group { margin-bottom: 1.25rem; }

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  cursor: pointer;
  font-size: .85rem;
  color: var(--text-muted);
  font-weight: normal;
}
.checkbox-label input[type='checkbox'] {
  margin-top: .15rem;
  flex-shrink: 0;
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.checkbox-label a { color: var(--accent); }

/* ===== Terms of Service page ===== */
.tos-section { margin-bottom: 2.5rem; }
.tos-section h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: .75rem; }
.tos-intro { color: var(--text-muted); margin-bottom: 1rem; font-size: .9rem; }
.tos-note  { margin-top: .75rem; color: var(--text-muted); font-size: .82rem; }

.tos-table-wrapper { overflow-x: auto; margin-bottom: .5rem; }

.tos-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .85rem;
}
.tos-table th,
.tos-table td {
  padding: .65rem .9rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.tos-table th {
  background: var(--surface-2);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.tos-table-narrow { max-width: 680px; }
.tos-table code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: .1em .4em;
  font-size: .8rem;
  color: var(--accent);
}

.tos-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  font-size: .9rem;
  color: var(--text-muted);
}
.tos-list li::before {
  content: '✓ ';
  color: var(--success);
  font-weight: 700;
}
.tos-list strong { color: var(--text); }

/* ===== Settings page ===== */
.settings-grid { display: flex; flex-direction: column; gap: 0; }

.settings-row {
  display: flex;
  align-items: center;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.settings-row:last-child { border-bottom: none; }

.settings-label {
  width: 160px;
  flex-shrink: 0;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 600;
}
.settings-value { font-size: .9rem; }

/* ===== Danger zone ===== */
.danger-zone {
  border: 1px solid rgba(232,84,84,.35);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: rgba(232,84,84,.04);
}
.danger-zone h2 { color: var(--danger); }
.danger-zone .text-muted { margin-bottom: 1rem; }

.delete-form { margin-top: .75rem; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: #c94040;
  border-color: #c94040;
  text-decoration: none;
}

/* ===== Admin ===== */
.admin-nav {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .75rem;
}
.admin-nav-link {
  padding: .35rem .75rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 500;
}
.admin-nav-link:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.admin-nav-link.active { color: var(--accent); background: var(--surface-2); }

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.admin-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.admin-stat-value { font-size: 1.5rem; font-weight: 700; }
.admin-stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }

.admin-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.admin-link-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  color: var(--text);
  display: block;
  transition: border-color .15s, background .15s;
}
.admin-link-card:hover { border-color: var(--accent); background: var(--surface-2); text-decoration: none; }
.admin-link-title { font-weight: 600; margin-bottom: .3rem; }
.admin-link-desc { font-size: .8rem; color: var(--text-muted); line-height: 1.45; }

.admin-counts-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.admin-count-badge {
  padding: .25rem .65rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.badge-admin    { color: #f59e0b; border-color: #f59e0b44; }
.badge-leader   { color: var(--accent); border-color: var(--accent-dim); }
.badge-management { color: #60a5fa; border-color: #60a5fa44; }
.badge-member   { color: var(--text-muted); }

.admin-table-wrapper { overflow-x: auto; margin-bottom: 1rem; }
.form-select-inline {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .3rem .6rem;
  font-size: .85rem;
}
.form-select-inline:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.admin-info-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  color: var(--text-muted);
  font-size: .85rem;
  margin-top: 1rem;
}

.admin-form { max-width: 480px; }
.form-hint { font-size: .8rem; color: var(--text-muted); margin-top: .35rem; }
.form-actions { margin-top: 1.25rem; }

.admin-status-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot--active   { background: var(--success); }
.status-dot--inactive { background: var(--text-muted); }
.status-dot--error    { background: var(--danger); }

.feature-list { display: flex; flex-direction: column; gap: .75rem; max-width: 620px; }
.feature-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.feature-name { font-weight: 600; margin-bottom: .15rem; }
.feature-desc { font-size: .8rem; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform .2s, background .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); background: #fff; }

.radio-group { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
.radio-label { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; }

/* First-run banner */
.first-run-banner {
  background: var(--surface);
  border: 1px solid var(--accent-dim);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.first-run-banner p { color: var(--text-muted); font-size: .88rem; margin-top: .25rem; }
/* ── Error pages ─────────────────────────────────────────────────────────── */
.error-page { text-align: center; padding: 4rem 1rem; max-width: 480px; margin: 0 auto; }
.error-code { font-size: 5rem; font-weight: 700; color: var(--accent); line-height: 1; margin-bottom: 1rem; }
.error-title { font-size: 1.6rem; margin-bottom: .75rem; }
.error-message { color: var(--text-muted); margin-bottom: 2rem; }
.error-dev { text-align: left; margin-top: 2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.error-dev-message { color: #f08080; margin-bottom: .5rem; }
.error-stack { font-size: .75rem; color: var(--text-muted); overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

/* ── Flash messages ──────────────────────────────────────────────────────── */
.flash { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid transparent; }
.flash-success { background: rgba(62,207,142,.12); border-color: rgba(62,207,142,.4); color: var(--success); }
.flash-error   { background: rgba(232,84,84,.12);  border-color: rgba(232,84,84,.4);  color: #f08080; }
.flash-warning { background: rgba(255,193,7,.10);  border-color: rgba(255,193,7,.4);  color: #ffc107; }
.flash-info    { background: rgba(96,165,250,.10); border-color: rgba(96,165,250,.4); color: #60a5fa; }
.flash-message { flex: 1; }
.flash-close { background: none; border: none; cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 0 .25rem; color: inherit; opacity: .7; }
.flash-close:hover { opacity: 1; }
.flash-fade { opacity: 0; transition: opacity .3s ease; }

/* ── Confirm modal ───────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; max-width: 420px; width: 90%; }
.modal-message { margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; }
.btn-warning { background: rgba(255,193,7,.15); border: 1px solid rgba(255,193,7,.4); color: #ffc107; }
.btn-warning:hover { background: rgba(255,193,7,.25); }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin-top: 1.25rem; }
.pagination-btn { padding: .3rem .65rem; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-muted); text-decoration: none; font-size: .85rem; background: var(--surface); }
.pagination-btn:hover:not(.disabled):not(.active) { border-color: var(--accent); color: var(--accent); }
.pagination-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination-btn.disabled { opacity: .4; cursor: default; }
.pagination-ellipsis { color: var(--text-muted); padding: 0 .25rem; }

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.stat-card-label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .35rem; }
.stat-card-value { font-size: 1.35rem; font-weight: 700; line-height: 1; }
.stat-card-trend { font-size: .8rem; color: var(--text-muted); margin-top: .35rem; }

/* ── Accounting ledger ───────────────────────────────────────────────────── */
.ledger-table .col-in  { text-align: right; min-width: 9rem; }
.ledger-table .col-out { text-align: right; min-width: 9rem; }
.ledger-table tfoot td { border-top: 2px solid var(--border); padding-top: .6rem; font-weight: 600; }
.amount-in  { color: var(--color-success, #22c55e); }
.amount-out { color: var(--color-error, #ef4444); }

/* Month nav */
.month-nav { display: flex; align-items: center; gap: .75rem; }
.month-nav-label { font-weight: 600; font-size: .95rem; flex: 1; text-align: center; }

/* Collapsible filters */
.filter-details { border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .9rem; background: var(--surface); }
.filter-summary { cursor: pointer; font-size: .85rem; color: var(--text-muted); user-select: none; }
.filter-summary:hover { color: var(--text); }

/* Category filter checkboxes */
.filter-cats { display: flex; flex-direction: column; gap: .4rem; }
.filter-cats-head { display: flex; align-items: center; gap: .4rem; }
.filter-cats-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.filter-cats-grid { display: flex; flex-wrap: wrap; gap: .3rem .75rem; }
.filter-cat-item { display: flex; align-items: center; gap: .3rem; font-size: .82rem; cursor: pointer; white-space: nowrap; }
.filter-cat-item input[type="checkbox"] { cursor: pointer; accent-color: var(--color-accent); }
.btn-link { background: none; border: none; padding: 0; color: var(--color-accent); font-size: .78rem; cursor: pointer; text-decoration: underline; }
.btn-link:hover { opacity: .75; }
.filter-actions { display: flex; align-items: center; gap: .5rem; margin-top: .25rem; }
.filter-active-badge { display: inline-block; padding: .1rem .4rem; border-radius: 99px; background: rgba(99,102,241,.2); color: var(--color-accent); font-size: .7rem; font-weight: 600; vertical-align: middle; }

/* Category button / dropdown */
.btn-category { background: none; border: 1px dashed var(--border); border-radius: var(--radius-sm, 4px); color: var(--text); cursor: pointer; font-size: .82rem; padding: .15rem .45rem; white-space: nowrap; }
.btn-category:hover { border-color: var(--accent); color: var(--accent); }
.cat-auto-badge { font-size: .65rem; opacity: .55; }
.cat-dropdown { position: absolute; z-index: 200; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.3); min-width: 12rem; }
.cat-dropdown-inner { padding: .4rem; display: flex; flex-direction: column; gap: .15rem; }
.cat-option { background: none; border: none; color: var(--text); cursor: pointer; text-align: left; padding: .35rem .6rem; border-radius: var(--radius-sm, 4px); font-size: .85rem; }
.cat-option:hover { background: var(--surface-alt, rgba(255,255,255,.06)); }
.cat-divider { border: none; border-top: 1px solid var(--border); margin: .3rem 0; }
.cat-add-row { display: flex; gap: .4rem; }

/* Inline notes */
.inline-note { display: block; font-size: .8rem; color: var(--text-muted); min-width: 8rem; padding: .15rem .3rem; border-radius: var(--radius-sm, 4px); outline: none; border: 1px solid transparent; transition: border-color .15s; white-space: pre-wrap; word-break: break-word; }
.inline-note * { color: inherit; font: inherit; background: none; }
.inline-note:focus { border-color: var(--border); background: var(--surface); }
.inline-note.note-saved { border-color: var(--color-success, #22c55e); }
.inline-note.note-error { border-color: var(--color-error, #ef4444); }

/* Reconciliation */
.recon-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .65rem; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.recon-ok  { background: rgba(62,207,142,.15); color: #3ecf8e; }
.recon-err { background: rgba(232,84,84,.15);  color: #e85454; }
.recon-grid { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: .75rem; }
.recon-col { min-width: 9rem; }
.recon-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .2rem; }
.recon-value { font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Ledger tools section */
.ledger-tools-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .75rem; }

/* All-transactions page */
.tx-row-ledger { opacity: 1; }
.tx-row-nonledger { opacity: .65; }
.tx-row-nonledger:hover { opacity: 1; }
.tx-type-badge { display: inline-block; padding: .1rem .4rem; border-radius: 4px; font-size: .72rem; font-weight: 600; background: var(--surface-alt, rgba(255,255,255,.07)); color: var(--text-muted); white-space: nowrap; }
.ledger-badge { display: inline-block; padding: .1rem .45rem; border-radius: 99px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.ledger-auto    { background: rgba(99,102,241,.15); color: var(--color-accent, #6366f1); }
.ledger-override { background: rgba(251,191,36,.15); color: #f59e0b; }
.ledger-manual  { background: rgba(59,130,246,.15); color: #60a5fa; }
.ledger-none    { background: rgba(255,255,255,.05); color: var(--text-muted); }
.ledger-excluded { background: rgba(232,84,84,.12); color: var(--color-error, #e85454); }
.tx-row-excluded { opacity: .55; }
.tx-row-excluded:hover { opacity: 1; }
.btn-danger-ghost { color: var(--color-error, #e85454); }
.btn-danger-ghost:hover { background: rgba(232,84,84,.1); }

/* ── Loading spinner ─────────────────────────────────────────────────────── */
.loading-spinner { width: 1.5rem; height: 1.5rem; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Sortable table headers ──────────────────────────────────────────────── */
th.sortable:hover { color: var(--accent); }
th.sort-asc::after  { content: ' ↑'; color: var(--accent); }
th.sort-desc::after { content: ' ↓'; color: var(--accent); }

/* ── Sync status ─────────────────────────────────────────────────────────── */
.sync-status { font-size: .85rem; color: var(--text-muted); margin-top: .75rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.sync-status-dot { width: .55rem; height: .55rem; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.sync-status-success { background: var(--success); }
.sync-status-error   { background: var(--danger); }
.sync-status-none    { background: var(--text-muted); }

/* ── Audit log ───────────────────────────────────────────────────────────── */
.audit-filters { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.audit-total { margin-left: auto; font-size: .82rem; color: var(--text-muted); }
.audit-date { white-space: nowrap; font-size: .82rem; color: var(--text-muted); }
.audit-action { font-size: .8rem; background: var(--surface-2); padding: .15em .45em; border-radius: 3px; }
.audit-details { font-size: .82rem; color: var(--text-muted); }
.audit-detail-item { display: inline-block; margin-right: .75rem; }

/* ── OC Module ───────────────────────────────────────────────────────────── */
.badge-success  { background: rgba(62,207,142,.15); color: #3ecf8e; border-color: rgba(62,207,142,.3); }
.badge-danger   { background: rgba(232,84,84,.15);  color: #e85454; border-color: rgba(232,84,84,.3); }
.badge-warning  { background: rgba(251,191,36,.12); color: #f59e0b; border-color: rgba(251,191,36,.3); }
.badge-info     { background: rgba(96,165,250,.12); color: #60a5fa; border-color: rgba(96,165,250,.3); }
.badge-muted    { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

/* Sub-nav (OC / future feature tabs) */
.sub-nav { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-top: 1rem; }
.sub-nav-link { padding: .45rem .85rem; font-size: .88rem; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s; }
.sub-nav-link:hover { color: var(--text); }
.sub-nav-link.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* Paid toggle button */
.btn-paid-toggle { padding: .15rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; cursor: pointer; border: 1px solid; background: transparent; transition: background .15s, color .15s; }
.btn-paid-toggle[data-paid="false"] { color: #e85454; border-color: rgba(232,84,84,.4); }
.btn-paid-toggle[data-paid="false"]:hover { background: rgba(232,84,84,.1); }
.btn-paid-toggle[data-paid="true"]  { color: #3ecf8e; border-color: rgba(62,207,142,.4); }
.btn-paid-toggle[data-paid="true"]:hover { background: rgba(62,207,142,.1); }
.btn-paid-toggle:disabled { opacity: .5; cursor: default; }

/* Participant slot grid */
.oc-detail-summary { display: flex; gap: 1.5rem; font-size: .82rem; margin-bottom: .5rem; font-variant-numeric: tabular-nums; }
.oc-slots-grid { display: flex; flex-direction: column; gap: .3rem; font-size: .82rem; }
.oc-slot { display: flex; align-items: center; gap: .35rem; }
.oc-slot-label { color: var(--text-muted); min-width: 6rem; }
.oc-slot-player { font-weight: 500; }
.oc-slot-cpr { font-size: .72rem; }
.oc-slot-item { font-size: .72rem; }

/* Align text-right in oc table */
.oc-table .text-right { text-align: right; }

/* OC paid/unpaid column */
.oc-paid-label { font-size: .78rem; font-weight: 600; color: #3ecf8e; }
.btn-unpaid-link { display: inline-block; padding: .15rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; color: #e85454; border: 1px solid rgba(232,84,84,.4); text-decoration: none; transition: background .15s; }
.btn-unpaid-link:hover { background: rgba(232,84,84,.1); }
.oc-member-link { color: var(--text); text-decoration: none; }
.oc-member-link:hover { color: var(--accent); text-decoration: underline; }
.oc-cpr-badge { display: inline-block; padding: .1rem .45rem; border-radius: 99px; font-size: .8rem; font-weight: 600; background: rgba(62,207,142,.12); color: #3ecf8e; }
.oc-settings-scenario { margin-bottom: 1.75rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.oc-settings-scenario:last-of-type { border-bottom: none; }
.oc-settings-scenario-title { font-size: 1rem; font-weight: 600; margin: 0 0 .75rem; }
.oc-settings-roles { display: flex; flex-direction: column; gap: .5rem; }
.oc-settings-role-row { display: flex; align-items: center; gap: .75rem; }
.oc-settings-role-label { min-width: 12rem; font-size: .9rem; }
/* ── Admin / View-As side panel ──────────────────────────────────────────────── */
.va-panel {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: row;
  align-items: stretch;
  z-index: 9999;
  font-size: .82rem;
  color: #fff;
}
.va-tab {
  background: #5b21b6;
  border: none;
  color: #fff;
  padding: 1.5rem .35rem;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  box-shadow: -3px 0 14px rgba(0,0,0,.4);
  flex-shrink: 0;
}
.va-tab:hover { background: #6d28d9; }
.va-arrow { font-size: 1.1rem; line-height: 1; display: block; }
.va-content {
  background: #5b21b6;
  padding: .875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  min-width: 148px;
  overflow: hidden;
  border-left: 1px solid rgba(255,255,255,.12);
}
.va-panel.va-collapsed .va-content { display: none; }
.va-nav-link {
  display: block;
  color: #fff;
  text-decoration: none;
  padding: .3rem .5rem;
  border-radius: 4px;
  background: rgba(255,255,255,.12);
  text-align: center;
  font-weight: 500;
}
.va-nav-link:hover { background: rgba(255,255,255,.22); }
.va-divider { border: none; border-top: 1px solid rgba(255,255,255,.15); margin: .2rem 0; }
.va-label { margin: 0; font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; opacity: .65; }
.va-role { margin: 0; font-weight: 600; font-size: .9rem; text-transform: capitalize; }
.va-select { width: 100%; background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 4px; padding: .25rem .35rem; font-size: .8rem; cursor: pointer; }
.va-select option { background: #1e1e2e; color: #fff; }
.va-btn { width: 100%; margin-top: .3rem; padding: .3rem .5rem; border: 1px solid rgba(255,255,255,.3); border-radius: 4px; background: rgba(255,255,255,.15); color: #fff; font-size: .8rem; cursor: pointer; }
.va-btn:hover { background: rgba(255,255,255,.25); }
.va-btn-exit { margin-top: .15rem; background: rgba(234,179,8,.2); border-color: rgba(234,179,8,.5); color: #fde047; }
.va-btn-exit:hover { background: rgba(234,179,8,.35); }
