:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-alt: #f8faf9;
  --primary: #0f5132;
  --primary-dark: #0a3b24;
  --primary-light: #e6f4ed;
  --accent: #d97706;
  --accent-light: #fef3c7;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --success: #15803d;
  --success-light: #dcfce7;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ===== BUTTONS & INPUTS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: #b45309;
}

.btn-outline {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.82rem;
  border-radius: 8px;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-icon:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: #fecaca;
}

input, select, textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.92rem;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 81, 50, 0.12);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.alert-error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 0.86rem;
  margin-bottom: 12px;
  font-weight: 500;
}

/* ===== LANDING PAGE ===== */
.landing-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 12% 18%, rgba(15, 81, 50, 0.09), transparent 40%),
    radial-gradient(circle at 88% 82%, rgba(217, 119, 6, 0.08), transparent 40%),
    var(--bg);
}

.landing-nav {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-crest {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #198754);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
  box-shadow: 0 6px 16px rgba(15, 81, 50, 0.25);
}

.brand-crest.sm {
  width: 38px;
  height: 38px;
  font-size: 0.78rem;
}

.brand-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.nav-pill {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
}

.landing-grid {
  max-width: 1200px;
  width: 100%;
  margin: auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1.2fr 0.88fr;
  gap: 44px;
  align-items: center;
}

.hero-eyebrow {
  display: inline-block;
  background: var(--accent-light);
  color: #92400e;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.hero-headline {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2.3rem, 4.4vw, 3.4rem);
  line-height: 1.12;
  color: var(--primary-dark);
  margin-bottom: 10px;
}

.hero-org {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 58ch;
  margin-bottom: 28px;
}

.hero-pillars {
  display: grid;
  gap: 14px;
}

.pillar-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  padding: 14px 16px;
  border-radius: 12px;
}

.pillar-icon {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--primary);
  background: var(--primary-light);
  padding: 6px 9px;
  border-radius: 8px;
}

.pillar-item strong {
  display: block;
  font-size: 0.94rem;
  margin-bottom: 2px;
}

.pillar-item span {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.login-badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.login-header h3 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.login-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.demo-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0 14px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.demo-divider::before,
.demo-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.demo-divider span {
  padding: 0 10px;
}

.demo-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.demo-hint {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 12px;
}

.demo-hint code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.76rem;
}

.landing-footer {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ===== APP SHELL ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 268px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.sidebar-domain {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.nav-item:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

.nav-item.active .nav-dot {
  opacity: 1;
}

.tag-admin {
  margin-left: auto;
  font-size: 0.68rem;
  background: var(--accent-light);
  color: #92400e;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-meta {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-heading {
  font-size: 1.3rem;
  font-weight: 700;
}

.page-subheading {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.member-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: 999px;
}

.content-container {
  padding: 26px 28px;
  max-width: 1240px;
  width: 100%;
  flex: 1;
}

.app-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ===== CARDS & SECTIONS ===== */
.cards-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 26px;
}

.cards-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.stat-card.cta-card {
  background: linear-gradient(135deg, var(--primary), #157347);
  color: #fff;
  border: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.cta-card .stat-label {
  color: rgba(255, 255, 255, 0.85);
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.stat-foot {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.cta-card .stat-foot {
  color: rgba(255, 255, 255, 0.88);
  margin-bottom: 14px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-title {
  font-size: 1.08rem;
  font-weight: 700;
}

.panel-sub {
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* ===== SCHEDULE & ACCOUNTS ===== */
.account-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.account-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  background: var(--surface-alt);
}

.account-tag {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.account-box h4 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.account-amount {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 6px 0;
}

.account-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ===== RULES LIST ===== */
.rules-list {
  display: grid;
  gap: 12px;
  padding-left: 0;
  list-style: none;
}

.rule-item {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.rule-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== TABLES ===== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-alt);
  font-weight: 700;
  white-space: nowrap;
}

tr:hover td {
  background: #f9fbfa;
}

.text-right {
  text-align: right;
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-locked {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-open {
  background: var(--success-light);
  color: var(--success);
}

.badge-pending {
  background: var(--accent-light);
  color: #92400e;
}

.badge-active {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-paid {
  background: var(--success-light);
  color: var(--success);
}

.badge-rejected {
  background: #f1f5f9;
  color: #64748b;
}

/* ===== TABS & FILTERS ===== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar select, .toolbar input {
  width: auto;
  min-width: 180px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tab-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  color: var(--text-muted);
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== MODAL & TOAST ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-box {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 22px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 200;
}

.mobile-only {
  display: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 960px) {
  .landing-grid {
    grid-template-columns: 1fr;
  }
  .cards-3, .account-grid, .cards-2 {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: -280px;
    z-index: 90;
    transition: left 0.2s ease;
  }
  .sidebar.open {
    left: 0;
  }
  .mobile-only {
    display: inline-flex;
  }
}

@media print {
  .sidebar, .topbar, .no-print, .tabs {
    display: none !important;
  }
  .content-container {
    padding: 0;
  }
  .panel {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* ===== 2026 MATRIX REPORT STYLES ===== */
.matrix-table {
  font-size: 0.78rem;
  border-collapse: collapse;
}

.matrix-table th, .matrix-table td {
  padding: 7px 8px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.matrix-table th {
  background: #1e3a5f;
  color: #ffffff;
  font-size: 0.74rem;
}

.matrix-member-group td {
  background: #eff6ff;
  font-weight: 700;
  color: #0f172a;
}

.matrix-sub-account td.acct-name {
  padding-left: 22px;
  color: var(--text-muted);
}

.matrix-subtotal td {
  background: #f1f5f9;
  font-weight: 700;
  border-top: 1.5px solid #94a3b8;
}

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

.datetime-bar, .topbar-datetime {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.topbar-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-fullname {
  font-size: 0.86rem;
  color: var(--text);
}

.rules-agree-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  max-height: 130px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 14px;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
}

.matrix-grand-total td {
  background: var(--primary-dark);
  color: #ffffff;
  font-weight: 700;
}
