:root {
  --brand-navy: #12263f;
  --brand-blue: #2c6ecb;
  --brand-teal: #1aa89a;
  --brand-bg: #f4f6f9;
  --brand-border: #e2e6ed;
  --brand-text: #1f2937;
  --brand-muted: #6b7280;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
}

/* ---------- Auth pages ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-blue));
}

.auth-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  width: 100%;
  max-width: 420px;
  padding: 2.2rem;
}

.auth-card h1 {
  font-size: 1.5rem;
  margin-bottom: .25rem;
  color: var(--brand-navy);
}

.auth-card p.subtitle {
  color: var(--brand-muted);
  margin-bottom: 1.5rem;
  font-size: .92rem;
}

/* ---------- App layout ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 230px;
  background: var(--brand-navy);
  color: #fff;
  flex-shrink: 0;
  padding: 1.2rem 0;
}

.sidebar .brand {
  font-weight: 700;
  font-size: 1.15rem;
  padding: 0 1.2rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: .8rem;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  padding: .7rem 1.2rem;
  font-size: .93rem;
}

.sidebar a:hover, .sidebar a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.main-content {
  flex: 1;
  min-width: 0;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--brand-border);
  padding: .8rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar .user-pill {
  background: var(--brand-bg);
  border-radius: 50px;
  padding: .35rem .9rem;
  font-size: .88rem;
  color: var(--brand-muted);
}

.page-body {
  padding: 1.4rem;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--brand-navy);
  cursor: pointer;
}

/* ---------- Cards / stats ---------- */
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--brand-border);
  padding: 1.1rem 1.3rem;
  height: 100%;
}

.stat-card .stat-num {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--brand-navy);
}

.stat-card .stat-label {
  color: var(--brand-muted);
  font-size: .85rem;
}

.panel {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--brand-border);
  padding: 1.2rem;
}

.table thead th {
  color: var(--brand-muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 2px solid var(--brand-border);
}

.badge-status {
  padding: .3rem .6rem;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-pending      { background: #fff3cd; color: #8a6d00; }
.badge-in_progress  { background: #cfe2ff; color: #084298; }
.badge-completed    { background: #d1f2eb; color: #0b6b5e; }
.badge-cancelled    { background: #f8d7da; color: #842029; }
.badge-paid         { background: #d1f2eb; color: #0b6b5e; }
.badge-overdue      { background: #f8d7da; color: #842029; }

.btn-brand {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #fff;
}
.btn-brand:hover { background: #2159a8; border-color: #2159a8; color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -230px;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: left .25s ease;
  }
  .sidebar.open { left: 0; }
  .mobile-toggle { display: inline-block; }
  .app-shell { position: relative; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 999;
  }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 576px) {
  .page-body { padding: 1rem; }
  .auth-card { padding: 1.5rem; }
  .table-responsive-cards thead { display: none; }
  .table-responsive-cards tr {
    display: block;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius);
    margin-bottom: .8rem;
    padding: .6rem .8rem;
  }
  .table-responsive-cards td {
    display: flex;
    justify-content: space-between;
    border: none;
    padding: .4rem 0;
  }
  .table-responsive-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--brand-muted);
    margin-right: .6rem;
  }
}
