/* ============================================================
   ROOFTOP Accounts — App Styles
   Design: Dark sidebar, crisp white cards, teal accents
   ============================================================ */

:root {
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --teal: #0ea5b0;
  --teal-dark: #0c8e98;
  --teal-light: #e0f7f8;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #fff;
  --sidebar-active-bg: rgba(14,165,176,0.15);
  --surface: #fff;
  --bg: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform .25s ease;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  color: var(--teal);
  font-size: 22px;
}

.logo-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: 18px;
  cursor: pointer;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  margin: 16px 12px;
  background: rgba(255,255,255,.04);
  border-radius: 10px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.user-role {
  font-size: 12px;
  color: var(--sidebar-text);
  text-transform: capitalize;
}

.sidebar-nav {
  list-style: none;
  padding: 0 12px;
  flex: 1;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #475569;
  padding: 14px 10px 6px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

.sidebar-nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--teal);
  border-left: 3px solid var(--teal);
}

.sidebar-nav a i {
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #ef4444;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s;
}

.logout-btn:hover {
  background: rgba(239,68,68,.1);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-menu-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
}

.topbar-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 600;
  flex: 1;
}

.topbar-date {
  font-size: 13px;
  color: var(--muted);
}

.page-content {
  padding: 28px;
  flex: 1;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 15px;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: transform .15s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.teal   { background: var(--teal-light); color: var(--teal); }
.stat-icon.green  { background: #dcfce7; color: var(--green); }
.stat-icon.red    { background: #fee2e2; color: var(--red); }
.stat-icon.amber  { background: #fef3c7; color: var(--amber); }
.stat-icon.blue   { background: #dbeafe; color: #3b82f6; }

.stat-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}

.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }

/* ============================================================
   BALANCE BADGES
   ============================================================ */
.badge-credit {
  background: #dcfce7;
  color: #166534;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
}

.badge-debit {
  background: #fee2e2;
  color: #991b1b;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
}

.badge-zero {
  background: #f1f5f9;
  color: var(--muted);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
}

/* ============================================================
   SETTLEMENT FLOW
   ============================================================ */
.settlement-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}

.settlement-from, .settlement-to {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settlement-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.settlement-arrow {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.settlement-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.settlement-amount {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--red);
  white-space: nowrap;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  transition: border-color .15s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14,165,176,.15);
}

.btn-primary {
  background: var(--teal);
  border-color: var(--teal);
}

.btn-primary:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

/* ============================================================
   PARTICIPANTS CHECKLIST
   ============================================================ */
.participant-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.participant-check {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}

.participant-check:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-light);
}

.participant-check input {
  margin-right: 8px;
  accent-color: var(--teal);
}

/* ============================================================
   TABLES
   ============================================================ */
.table th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom-width: 1px;
}

.table td {
  font-size: 14px;
  vertical-align: middle;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
}

.login-logo .logo-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.login-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
}

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .main-content {
    margin-left: 0;
  }
  .topbar {
    padding: 0 16px;
  }
  .page-content {
    padding: 16px;
  }
}

/* Category pill */
.cat-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
/* ── Category Pills ── */
.cat-Khana       { background:#fff7ed; color:#9a3412; border:1px solid #fed7aa; }
.cat-Chaye       { background:#fefce8; color:#854d0e; border:1px solid #fde68a; }
.cat-Lassi       { background:#f0fdf4; color:#166534; border:1px solid #bbf7d0; }
.cat-Refreshment { background:#eff6ff; color:#1e40af; border:1px solid #bfdbfe; }
.cat-Fast-Food  { background:#fdf4ff; color:#7e22ce; border:1px solid #e9d5ff; }
.cat-Other       { background:#f8fafc; color:#475569; border:1px solid #e2e8f0; }
/* Legacy categories — keep for old data */
.cat-Food    { background:#fff7ed; color:#9a3412; border:1px solid #fed7aa; }
.cat-Grocery { background:#ede9fe; color:#5b21b6; }
.cat-Tea     { background:#fefce8; color:#854d0e; border:1px solid #fde68a; }
.cat-Meal    { background:#fef3c7; color:#92400e; }
.cat-Fuel    { background:#fee2e2; color:#991b1b; }

.table-responsive { border-radius: 0 0 var(--radius) var(--radius); }

/* Page section title */
.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}
