/* ============================================================
   DeptPay — Design System
   Extracted from the AVALON/DeptPay Figma screens.
   One stylesheet reused by every page (app shell + auth + public).
   ============================================================ */

:root{
  color-scheme: light;

  /* Brand & accents */
  --blue:        #2563EB;
  --blue-dark:   #1D4ED8;
  --blue-soft:   #EFF4FF;
  --navy:        #0F172A;   /* app sidebar */
  --navy-2:      #131C31;
  --hero-navy:   #1F2A5C;   /* login / landing hero panel */
  --emerald:     #10B981;   /* admin-portal accent */
  --emerald-dark:#059669;

  /* Status */
  --success:#10B981; --success-bg:#ECFDF5; --success-tx:#047857;
  --warning:#F59E0B; --warning-bg:#FFFBEB; --warning-tx:#B45309;
  --danger:#EF4444; --danger-bg:#FEF2F2; --danger-tx:#DC2626;
  --info:#2563EB;   --info-bg:#EFF4FF;   --info-tx:#1D4ED8;
  --violet:#7C3AED; --violet-bg:#F5F3FF; --violet-tx:#6D28D9;

  /* Neutrals */
  --bg:#F8FAFC;
  --surface:#FFFFFF;
  --border:#E2E8F0;
  --border-2:#EDF1F6;
  --text:#0F172A;
  --text-body:#334155;
  --muted:#64748B;
  --muted-2:#94A3B8;

  /* Shape */
  --r-card:14px;
  --r-btn:10px;
  --r-input:10px;
  --r-pill:999px;

  /* Shadow */
  --sh-sm:0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
  --sh-card:0 1px 2px rgba(15,23,42,.03), 0 6px 20px rgba(15,23,42,.05);
  --sh-lg:0 20px 45px rgba(15,23,42,.12);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;

  --sidebar-w:248px;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
html{-webkit-text-size-adjust:100%}
body{
  font-family:var(--font);
  background:var(--bg);
  color:var(--text);
  font-size:14px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
}
a{color:inherit;text-decoration:none}
img{max-width:100%;display:block}
/* Lucide replaces [data-lucide] elements with a sized <svg> at runtime, but
   until that script runs (or if its CDN is ever slow/unreachable) a bare
   inline <i> ignores width/height entirely and has no intrinsic size. An
   icon-only control (logout links, the mobile hamburger, etc.) with no other
   content then collapses to a 0x0 hit box - unclickable, not just unstyled.
   inline-block gives it real dimensions in both states. */
i[data-lucide]{display:inline-block}
.serif{font-family:var(--serif)}
.muted{color:var(--muted)}
.text-blue{color:var(--blue)}
.text-green{color:var(--emerald-dark)}

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  font-family:var(--font);font-weight:600;font-size:14px;
  padding:11px 18px;border-radius:var(--r-btn);border:1px solid transparent;
  cursor:pointer;transition:.15s ease;white-space:nowrap;
}
/* Feedback on the press itself, not just the hover color swap - a button
   that only changes on hover reads as inert on touch devices, which never
   fire :hover at all. */
.btn:active{transform:scale(.97)}
@media (prefers-reduced-motion:reduce){.btn:active{transform:none}}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn:disabled:active{transform:none}
.btn i,.btn svg{width:17px;height:17px}
/* Shared loading-spinner animation - most loader-2/loader-circle icons
   across the app rendered as a static, inert-looking icon because nothing
   defined this class. One rule here instead of redefining it per page. */
.spin{animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.spin{animation:none}}
.btn--primary{background:var(--blue);color:#fff}
.btn--primary:hover{background:var(--blue-dark)}
.btn--dark{background:var(--navy);color:#fff}
.btn--dark:hover{background:#1e293b}
.btn--green{background:var(--emerald);color:#fff}
.btn--green:hover{background:var(--emerald-dark)}
.btn--ghost{background:#fff;color:var(--text-body);border-color:var(--border)}
.btn--ghost:hover{background:#f8fafc;border-color:#cbd5e1}
.btn--soft{background:var(--blue-soft);color:var(--blue-dark)}
.btn--danger{background:var(--danger);color:#fff}
.btn--block{width:100%}
.btn--sm{padding:8px 13px;font-size:13px}
.btn--lg{padding:13px 22px;font-size:15px}

/* ---------- Badges / pills ---------- */
.badge{
  display:inline-flex;align-items:center;gap:5px;
  font-size:11.5px;font-weight:600;line-height:1;
  padding:5px 10px;border-radius:var(--r-pill);
}
.badge::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor;opacity:.9}
.badge--plain::before{display:none}
.badge--success{background:var(--success-bg);color:var(--success-tx)}
.badge--warning{background:var(--warning-bg);color:var(--warning-tx)}
.badge--danger{background:var(--danger-bg);color:var(--danger-tx)}
.badge--info{background:var(--info-bg);color:var(--info-tx)}
.badge--violet{background:var(--violet-bg);color:var(--violet-tx)}
.badge--neutral{background:#F1F5F9;color:#475569}

/* ---------- Cards ---------- */
.card{
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--r-card);box-shadow:var(--sh-card);
}
.card__head{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:18px 20px;border-bottom:1px solid var(--border-2);
}
.card__title{font-size:15px;font-weight:700;margin:0}
.card__link{font-size:13px;font-weight:600;color:var(--blue)}
.card__body{padding:20px}

/* ---------- Grids ---------- */
.grid{display:grid;gap:16px}
.grid-2{grid-template-columns:repeat(2,1fr)}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-4{grid-template-columns:repeat(4,1fr)}
.col-2{display:grid;grid-template-columns:1fr 340px;gap:16px}

/* ---------- Stat cards ---------- */
.stat{
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--r-card);padding:18px 18px 16px;box-shadow:var(--sh-card);
}
.stat__top{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px}
.stat__label{font-size:12.5px;color:var(--muted);font-weight:500}
.stat__value{font-size:26px;font-weight:800;letter-spacing:-.02em;color:var(--text)}
.stat__value--blue{color:var(--blue)}
.stat__value--green{color:var(--emerald-dark)}

/* ---------- Tables ---------- */
.table-wrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.table{width:100%;border-collapse:collapse}
.table-wrap .table{min-width:600px}
.table th{
  text-align:left;font-size:11.5px;font-weight:600;color:var(--muted-2);
  text-transform:none;padding:12px 16px;border-bottom:1px solid var(--border-2);white-space:nowrap;
}
.table td{padding:14px 16px;border-bottom:1px solid var(--border-2);font-size:13.5px;color:var(--text-body)}
.table tr:last-child td{border-bottom:none}
.table tbody tr:hover{background:#FBFCFE}
.table .amount{font-weight:700;color:var(--text)}
.cell-user{display:flex;align-items:center;gap:10px}
.cell-user img,.avatar{width:32px;height:32px;border-radius:50%;object-fit:cover;background:#dbe3ef;flex-shrink:0}
.cell-user .name{font-weight:600;color:var(--text)}

/* ---------- App shell ---------- */
.app{display:flex;min-height:100vh}
.sidebar{
  width:var(--sidebar-w);flex-shrink:0;background:var(--navy);color:#cbd5e1;
  display:flex;flex-direction:column;position:sticky;top:0;height:100vh;
}
.sidebar__brand{display:flex;align-items:center;gap:10px;padding:20px 20px 18px}
.brand-mark{width:30px;height:30px;flex-shrink:0;display:block}
.brand-name{font-weight:800;letter-spacing:.02em;color:#fff;font-size:15px}
.brand-sub{font-size:9.5px;letter-spacing:.14em;color:#64748b;font-weight:600;margin-top:1px}
.nav{padding:6px 12px;flex:1;overflow-y:auto}
.nav__item{
  display:flex;align-items:center;gap:11px;padding:10px 12px;border-radius:9px;
  color:#94a3b8;font-weight:500;font-size:13.5px;margin-bottom:2px;cursor:pointer;
  transition:background-color .15s ease,color .15s ease;
}
.nav__item i,.nav__item svg{width:18px;height:18px}
.nav__item:hover{background:rgba(148,163,184,.10);color:#e2e8f0}
.nav__item.is-active{background:var(--blue);color:#fff}
.sidebar--green .nav__item.is-active{background:var(--emerald)}
.nav__badge{margin-left:auto;background:var(--danger);color:#fff;font-size:10.5px;
  font-weight:700;padding:1px 7px;border-radius:var(--r-pill)}
.sidebar__user{
  display:flex;align-items:center;gap:10px;padding:14px 16px;border-top:1px solid rgba(148,163,184,.14);
}
.sidebar__user .name{color:#fff;font-weight:600;font-size:13px}
.sidebar__user .sub{color:#64748b;font-size:11px}
.sidebar__user .logout{margin-left:auto;color:#64748b;cursor:pointer}

/* Mobile sidebar backdrop */
.backdrop{position:fixed;inset:0;background:rgba(15,23,42,.5);z-index:50;opacity:0;visibility:hidden;transition:.25s}
.backdrop.show{opacity:1;visibility:visible}
@media(min-width:821px){.backdrop{display:none!important}}

/* Main column */
.main{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{
  display:flex;align-items:center;gap:16px;padding:16px 26px;
  background:rgba(248,250,252,.85);backdrop-filter:blur(6px);
  border-bottom:1px solid var(--border-2);position:sticky;top:0;z-index:20;
}
.topbar__title{font-size:19px;font-weight:800;letter-spacing:-.01em;margin:0}
.search{flex:1;max-width:360px;margin:0 auto;position:relative}
.search input{
  width:100%;border:1px solid var(--border);background:#fff;border-radius:var(--r-pill);
  padding:9px 14px 9px 36px;font-size:13px;font-family:var(--font);color:var(--text);
}
.search input:focus{outline:none;border-color:var(--blue);box-shadow:0 0 0 3px var(--blue-soft)}
.search i,.search svg{position:absolute;left:12px;top:50%;transform:translateY(-50%);width:16px;height:16px;color:var(--muted-2);z-index:2;pointer-events:none;stroke:currentColor}
.topbar__actions{display:flex;align-items:center;gap:14px;margin-left:auto}
.icon-btn{position:relative;color:var(--muted);cursor:pointer;display:grid;place-items:center}
.icon-btn .dot{position:absolute;top:-2px;right:-2px;width:8px;height:8px;border-radius:50%;background:var(--danger);border:2px solid var(--bg)}
.user-chip{display:flex;align-items:center;gap:9px}
.user-chip .name{font-weight:600;font-size:13px}
.user-chip .sub{font-size:11px;color:var(--muted)}
.content{padding:24px 26px;max-width:1240px;width:100%}
.page-head{margin-bottom:18px}
.page-head h2{font-size:18px;font-weight:800;margin:0 0 4px}
.page-head p{margin:0;color:var(--muted);font-size:13px}

/* Recent activity / deadlines / quick actions */
.list-row{display:flex;align-items:center;gap:12px;padding:13px 20px;border-bottom:1px solid var(--border-2)}
.list-row:last-child{border-bottom:none}
.deadline{display:flex;align-items:flex-start;gap:12px;padding:14px 20px;border-bottom:1px solid var(--border-2)}
.deadline:last-child{border-bottom:none}
.deadline .d-title{font-weight:600;font-size:13.5px}
.deadline .d-sub{font-size:12px;color:var(--muted)}
.deadline .d-amt{margin-left:auto;text-align:right;font-weight:700}
.qa{display:flex;flex-direction:column;gap:9px}

/* ---------- Auth (split screen) ---------- */
.auth{display:grid;grid-template-columns:1fr 1fr;min-height:100vh}
.auth__brand{
  background:var(--hero-navy);color:#fff;padding:40px 46px;
  display:flex;flex-direction:column;justify-content:space-between;position:relative;overflow:hidden;
}
/* Same ambient depth as the landing hero, so the first screen someone signs
   in through doesn't read as a flatter, unfinished cousin of the marketing
   page. Static (no loop/drift) - a glow that's always mid-pulse reads as
   distracting, not alive. */
.auth__brand::before{content:"";position:absolute;width:460px;height:460px;border-radius:50%;
  background:radial-gradient(circle,rgba(37,99,235,.28),transparent 70%);top:-140px;right:-140px;pointer-events:none}
.auth__brand::after{content:"";position:absolute;width:360px;height:360px;border-radius:50%;
  background:radial-gradient(circle,rgba(16,185,129,.14),transparent 70%);bottom:-140px;left:-100px;pointer-events:none}
.auth__brand > *{position:relative;z-index:1}
.auth__brand--slate{background:linear-gradient(160deg,#101a2e,#16233d)}
.auth__brand h1{font-family:var(--serif);font-size:40px;line-height:1.1;font-weight:700;margin:0 0 14px}
.auth__brand p{color:#b8c2da;max-width:360px;font-size:14px}
.auth__panel{display:flex;align-items:center;justify-content:center;padding:40px 24px;background:#fff}
.auth__card{width:100%;max-width:400px}
.auth__logo{display:flex;align-items:center;justify-content:center;gap:9px;margin-bottom:6px}
.auth__title{text-align:center;font-size:22px;font-weight:800;margin:6px 0 20px}
.tabs{display:flex;background:#F1F5F9;border-radius:var(--r-btn);padding:4px;margin-bottom:20px}
.tabs button{
  flex:1;border:none;background:transparent;padding:9px;border-radius:8px;
  font-family:var(--font);font-weight:600;font-size:13px;color:var(--muted);cursor:pointer;
  transition:background-color .15s ease,color .15s ease,box-shadow .15s ease;
}
.tabs button.is-active{background:#fff;color:var(--blue);box-shadow:var(--sh-sm)}

.field{margin-bottom:15px}
.field label{display:block;font-size:12.5px;font-weight:600;margin-bottom:6px;color:var(--text-body)}
.input-wrap{position:relative;display:flex;align-items:center}
.input-wrap i,.input-wrap svg{position:absolute;left:12px;top:50%;transform:translateY(-50%);width:16px;height:16px;color:var(--muted-2);z-index:2;pointer-events:none;stroke:currentColor}
.input-wrap .eye{left:auto;right:12px;cursor:pointer}
.input{
  width:100%;border:1px solid var(--border);border-radius:var(--r-input);
  padding:11px 12px 11px 36px;font-size:14px;font-family:var(--font);color:var(--text);background:#fff;
  transition:border-color .15s ease,box-shadow .15s ease;
}
.input:focus{outline:none;border-color:var(--blue);box-shadow:0 0 0 3px var(--blue-soft)}
.input--plain{padding-left:12px}
.row-between{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}
.check{display:flex;align-items:center;gap:7px;font-size:13px;color:var(--text-body)}
.link{color:var(--blue);font-weight:600;font-size:13px}
.divider{display:flex;align-items:center;gap:12px;color:var(--muted-2);font-size:12px;margin:18px 0}
.divider::before,.divider::after{content:"";flex:1;height:1px;background:var(--border)}

/* ---------- Utilities ---------- */
.stack{display:flex;flex-direction:column}
.mt-2{margin-top:8px}.mt-4{margin-top:16px}.mb-4{margin-bottom:16px}
.flex{display:flex}.items-center{align-items:center}.gap-2{gap:8px}.gap-3{gap:12px}
.hamburger{display:none}

/* ---------- Responsive ---------- */
@media (max-width:1024px){
  .grid-4{grid-template-columns:repeat(2,1fr)}
  .grid-3{grid-template-columns:repeat(3,1fr)}
  .col-2{grid-template-columns:1fr}
  /* Allow the topbar to wrap on narrower laptops/tablets to prevent overflow */
  .topbar{flex-wrap:wrap}
}
@media (max-width:820px){
  .auth{grid-template-columns:1fr}
  .auth__brand{display:none}
  /* Sidebar becomes an off-canvas drawer */
  .sidebar{position:fixed;left:0;top:0;z-index:60;width:min(264px,84vw);height:100vh;height:100dvh;
    overflow-y:auto;transform:translateX(-100%);transition:transform .25s ease}
  .sidebar.is-open{transform:translateX(0);box-shadow:var(--sh-lg)}
  .hamburger{display:grid;place-items:center;color:var(--text);cursor:pointer}
  /* Keep the search visible on tablets (more usable) but limit its width */
  .search{max-width:420px;margin:0 12px}
  .topbar{padding:14px 18px;gap:12px}
  .content{padding:20px 18px}
  .grid-3{grid-template-columns:repeat(2,1fr)}
  /* Any flex header row (title + action buttons) should wrap instead of overflow */
  .page-head{width:100%}
}
@media (max-width:640px){
  .grid-3{grid-template-columns:1fr 1fr}
  .user-chip{display:none}
  .stat__value{font-size:23px}
}
@media (max-width:560px){
  /* Keep stat cards 2-up so dashboards stay compact, not one giant column */
  .grid-2,.grid-3,.grid-4{grid-template-columns:repeat(2,1fr)}
  .grid{gap:12px}
  .content{padding:16px 14px}
  .topbar{padding:12px 14px;gap:10px}
  .topbar__title{font-size:17px}
  .card__head{padding:14px 16px;flex-wrap:wrap}
  .card__body{padding:16px}
  .row-between{flex-wrap:wrap}
  .page-head h2{font-size:16px}
  .stat{padding:15px 15px 14px}
  .stat__value{font-size:22px}
  .auth__panel{padding:28px 18px}
  /* Button groups inside headers wrap and can go full-width */
  .page-head > div{width:100%}
}
@media (max-width:400px){
  /* Single column on very small phones */
  .grid-2,.grid-3,.grid-4{grid-template-columns:1fr}
  .stat__value{font-size:21px}
  .topbar__title{font-size:16px}
  .btn--lg{padding:12px 16px;font-size:14px}
}

/* ============================================================
   Mobile responsiveness fix
   - Prevent grid/table children from forcing the dashboard wider
     than the viewport.
   - Keep dashboard tables readable without horizontal clipping.
   ============================================================ */

/* Grid/flex children are allowed to shrink below their intrinsic width. */
.card,
.stack,
.col-2 > *,
.grid > *{
  min-width:0;
  max-width:100%;
}

/* A table inside the main dashboard column must not determine the grid width. */
.col-2{
  grid-template-columns:minmax(0,1fr) minmax(0,340px);
  width:100%;
  max-width:100%;
}

.table-wrap{
  max-width:100%;
}

@media (max-width:1024px){
  .col-2{grid-template-columns:minmax(0,1fr)}
}

@media (max-width:640px){
  /* Dashboard tables fit the phone instead of being clipped at 600px. */
  .col-2 .table-wrap{
    overflow-x:hidden;
    width:100%;
  }

  .col-2 .table-wrap .table{
    width:100%;
    min-width:0;
    table-layout:fixed;
  }

  .col-2 .table th,
  .col-2 .table td{
    padding:10px 6px;
    font-size:11px;
    line-height:1.35;
    white-space:normal;
    overflow-wrap:anywhere;
    word-break:normal;
    vertical-align:middle;
  }

  .col-2 .table th{
    font-size:10px;
  }

  /* Give names/payment titles more room than the compact columns. */
  .col-2 .table th:first-child,
  .col-2 .table td:first-child{
    width:34%;
  }

  .col-2 .cell-user{
    gap:6px;
    min-width:0;
  }

  .col-2 .cell-user img{
    width:26px;
    height:26px;
  }

  .col-2 .cell-user > div{
    min-width:0;
  }

  .col-2 .cell-user .name,
  .col-2 .table td > div{
    overflow-wrap:anywhere;
  }

  .col-2 .badge{
    padding:4px 6px;
    font-size:9.5px;
    gap:4px;
  }

  .col-2 .badge::before{
    width:5px;
    height:5px;
  }

  .col-2 .card__link{
    font-size:11px;
  }
}

@media (max-width:400px){
  .col-2 .table th,
  .col-2 .table td{
    padding:9px 4px;
    font-size:10px;
  }

  .col-2 .table th{
    font-size:9px;
  }

  .col-2 .table th:first-child,
  .col-2 .table td:first-child{
    width:35%;
  }
}

/* Hide the central search on small phones and tighten the topbar spacing */
@media (max-width:520px){
  .search{display:none}
  .topbar{padding:12px 14px;gap:10px}
}
