:root {
  --bg: #FDFCF8;
  --surface: #FFFFFF;
  --ink: #17231D;
  --ink-soft: #586158;
  --ink-faint: #8A9089;
  --border: #E5E7EB;
  --border-soft: #F3F4F6;
  --primary: #FBBF24;       
  --primary-dark: #D97706;  
  --primary-tint: #FEF3C7;  
  --present: #10B981;
  --present-tint: #D1FAE5;
  --absent: #EF4444;
  --absent-tint: #FEE2E2;
  --late: #F59E0B;
  --late-tint: #FEF3C7;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --font-head: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .headline { font-family: var(--font-head); font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
button, input, select, textarea { font-family: var(--font-body); font-size: 15px; }
a { color: var(--primary-dark); }

#app { min-height: 100vh; display: flex; flex-direction: column; position: relative; }
.center-shell { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar .brand-wrap { display: flex; align-items: center; gap: 10px; }
.topbar .brand-logo { height: 32px; width: auto; object-fit: contain; }
.topbar .brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.topbar .brand-text .mark { font-family: var(--font-head); font-weight: 700; font-size: 22px; color: var(--primary-dark); }
.topbar .brand-text .caption { font-weight: 600; font-size: 10px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 2px; }
.topbar .who { display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: var(--ink-soft); }

.btn { border: 1px solid var(--border); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; font-weight: 600; transition: all .15s ease; }
.btn:hover { background: var(--border-soft); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #000; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-danger { border-color: var(--absent); color: var(--absent); background: #fff; }
.btn-danger:hover { background: var(--absent-tint); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }

.admin-trigger { position: absolute; top: 20px; right: 24px; z-index: 100; }
.btn-ghost { border: transparent; background: transparent; color: var(--primary-dark); }
.btn-ghost:hover { background: var(--primary-tint); }

.auth-wrap { width: 100%; max-width: 440px; margin: 0 auto; }
.auth-hero { text-align: center; margin-bottom: 28px; }
.hero-logo { width: 85px; height: auto; margin: 0 auto 12px auto; display: block; }
.auth-hero .mark { font-family: var(--font-head); font-size: 52px; font-weight: 700; color: var(--primary-dark); line-height: 1.1; }
.auth-hero .caption { font-size: 14px; font-weight: 600; letter-spacing: 3px; text-transform: uppercase; color: var(--ink-soft); margin-top: 4px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 16px; font-size: 19px; text-align: center; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; color: var(--ink); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary-dark); outline-offset: 1px; }

.body-flex { flex: 1; display: flex; width: 100%; }
.sidebar { width: 220px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px; }
.sidebar .nav-item { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: var(--radius-sm); background: transparent; border: none; color: var(--ink-soft); font-size: 14.5px; font-weight: 600; cursor: pointer; margin-bottom: 2px; }
.sidebar .nav-item:hover { background: var(--border-soft); color: var(--ink); }
.sidebar .nav-item.active { background: var(--primary-tint); color: var(--primary-dark); }
.content { flex: 1; padding: 26px 30px; min-width: 0; }

.page-title { font-size: 24px; margin: 0 0 4px; }
.page-sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 22px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat-box .num { font-family: var(--font-head); font-size: 30px; font-weight: 700; color: var(--primary-dark); }
.stat-box .lbl { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; text-transform: uppercase; color: var(--ink-faint); padding: 9px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px 10px; border-bottom: 1px solid var(--border-soft); font-size: 14.5px; vertical-align: middle; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; -webkit-overflow-scrolling: touch; box-shadow: var(--shadow); }

.section-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 22px; box-shadow: var(--shadow); }
.section-block h3 { margin: 0 0 14px; font-size: 17px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }

.report-card-print { border: 2px solid var(--ink); padding: 25px; border-radius: 8px; background: #fff; margin-top: 20px; }
.report-header { text-align: center; margin-bottom: 20px; border-bottom: 2px solid var(--border); padding-bottom: 10px; }


/* ============================================================
   📱 MOBILE & TABLET RESPONSIVE DESIGN
============================================================ */
@media (max-width: 768px) {
  /* 1. Stack the sidebar and main content vertically */
  .body-flex {
    flex-direction: column;
  }
  
  /* 2. Turn the sidebar into a horizontal swipeable menu */
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    overflow-x: auto;
    padding: 10px;
    gap: 8px;
    white-space: nowrap; /* Keeps buttons on one line */
    -webkit-overflow-scrolling: touch;
  }
  
  .sidebar .nav-item {
    width: auto;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  /* 3. Reduce padding to save screen real estate */
  .content {
    padding: 15px;
  }
  
  .center-shell {
    padding: 15px 10px;
  }

  .section-block {
    padding: 15px;
  }

  .card {
    padding: 20px 15px;
  }
  
  /* 4. Shrink the top navigation bar slightly */
  .topbar {
    padding: 12px 15px;
  }
  .topbar .brand-text .mark {
    font-size: 18px; 
  }
  
  /* 5. Make all form fields and buttons take full width */
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }
  .inline-form .field {
    width: 100%;
    margin-bottom: 10px;
  }
  .inline-form .btn {
    width: 100%;
    margin-top: 5px;
  }
  
  /* 6. Override the specific Staff Name/PIN side-by-side layout in JS */
  div[style*="display:flex;gap:10px;margin-bottom:10px;"] {
    flex-direction: column;
    gap: 0 !important;
  }
}


/* 🖨️ PDF PRINTING STYLES */
@media print {
  .topbar, .sidebar, .admin-trigger, .no-print, button { display: none !important; }
  .body-flex { display: block; }
  .content { padding: 0 !important; margin: 0 !important; width: 100% !important; }
  body { background: #fff; color: #000; }
  .section-block, .table-wrap { box-shadow: none; border: none; padding: 0; }
  table { border: 1px solid #ddd; }
  th, td { border-bottom: 1px solid #ddd; color: #000; }
  .report-card-print { border: none; padding: 0; }
}
