/* ==========================================================================
   PayTrack — design tokens
   Concept: a payroll ledger rebuilt as a terminal. Deep charcoal-navy base,
   amber for "ink" (positive/primary values), cyan for live/data states,
   red for deductions. Numbers always render in monospace, like a punch-card
   or calculator display — headers stay geometric/humanist to keep the UI
   from feeling like a raw terminal emulator.
   ========================================================================== */

:root {
  --bg:        #0B0F14;
  --bg-grid:   #0E1420;
  --surface:   #121821;
  --surface-2: #1A2230;
  --surface-3: #232D3F;
  --border:    #263042;

  --ink:       #E8ECF1;
  --ink-muted: #7C8798;
  --ink-dim:   #4A5568;

  --amber:     #FFB100;
  --amber-dim: #7A5A18;
  --cyan:      #33D6C0;
  --cyan-dim:  #1B6E63;
  --red:       #FF5D5D;
  --red-dim:   #7A2E2E;

  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body:    'Inter', 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

  --radius: 10px;
  --radius-sm: 6px;
}

* { 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;
}

/* Subtle circuit/grid texture behind everything — signature ambient detail */
body {
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  background-attachment: fixed;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
  color: var(--ink);
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono, .num, td.num, .amount { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------- */
/* Layout                                                                  */
/* ---------------------------------------------------------------------- */

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 8px 20px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.brand .mark {
  font-family: var(--font-mono);
  color: var(--amber);
  font-size: 20px;
}
.brand .name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-item.active { background: var(--surface-2); color: var(--amber); }
.nav-item .glyph { font-family: var(--font-mono); width: 1.4em; text-align: center; opacity: .8; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--ink-dim);
}

.content-area {
  display: flex;
  justify-content: center;
  width: 100%;
  min-width: 0; /* let it shrink below the sidebar's fixed width if needed */
}

.main {
  padding: 28px 36px 60px;
  max-width: 1180px;
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}
.topbar h1 { font-size: 22px; }
.topbar .subtitle { color: var(--ink-muted); font-size: 13.5px; margin-top: -2px; }

/* ---------------------------------------------------------------------- */
/* Cards / surfaces                                                        */
/* ---------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.card + .card { margin-top: 20px; }

.grid {
  display: grid;
  gap: 18px;
}
.grid.cols-1 { grid-template-columns: 1fr; max-width: 340px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-card .label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-muted);
  margin-bottom: 8px;
}
.stat-card .value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 500;
  color: var(--ink);
}
.stat-card .value.accent-amber { color: var(--amber); }
.stat-card .value.accent-cyan { color: var(--cyan); }
.stat-card .value.accent-red { color: var(--red); }

/* ---------------------------------------------------------------------- */
/* Signature element: the punch-clock display                             */
/* ---------------------------------------------------------------------- */

.punch-clock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 30px;
}
.punch-clock .time-display {
  font-family: var(--font-mono);
  font-size: 42px;
  font-weight: 500;
  color: var(--amber);
  letter-spacing: .02em;
  text-shadow: 0 0 18px rgba(255, 177, 0, 0.25);
  font-variant-numeric: tabular-nums;
}
.punch-clock .date-display {
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.punch-clock .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--cyan-dim);
  color: var(--cyan);
  background: rgba(51, 214, 192, .08);
}
.punch-clock .status-pill.off {
  border-color: var(--ink-dim);
  color: var(--ink-muted);
  background: transparent;
}
.punch-clock .status-pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--amber); color: #1A1200; }
.btn-primary:hover { filter: brightness(1.08); }

.btn-clockout { background: var(--red); color: #2A0A0A; }
.btn-clockout:hover { filter: brightness(1.08); }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--ink);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------------------------------------------------------------------- */
/* Forms                                                                   */
/* ---------------------------------------------------------------------- */

label {
  display: block;
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 6px;
}
input[type=text], input[type=password], input[type=number], input[type=date], select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  margin-bottom: 16px;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 177, 0, 0.15);
}

/* ---------------------------------------------------------------------- */
/* Tables (ledger style)                                                   */
/* ---------------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-dim);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }

.badge {
  display: inline-block;
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 100px;
  font-weight: 600;
}
.badge.admin { background: rgba(255,177,0,.12); color: var(--amber); }
.badge.staff { background: rgba(51,214,192,.12); color: var(--cyan); }
.badge.active { background: rgba(51,214,192,.12); color: var(--cyan); }
.badge.inactive { background: rgba(124,135,152,.12); color: var(--ink-muted); }
.badge.finalized { background: rgba(255,177,0,.12); color: var(--amber); }
.badge.paid { background: rgba(51,214,192,.12); color: var(--cyan); }

.text-muted { color: var(--ink-muted); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-cyan { color: var(--cyan); }

.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  border: 1px solid;
}
.flash.success { background: rgba(51,214,192,.08); border-color: var(--cyan-dim); color: var(--cyan); }
.flash.error   { background: rgba(255,93,93,.08); border-color: var(--red-dim); color: var(--red); }

/* ---------------------------------------------------------------------- */
/* Login page                                                              */
/* ---------------------------------------------------------------------- */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 34px;
}
.login-card .mark {
  font-family: var(--font-mono);
  color: var(--amber);
  font-size: 28px;
  display: block;
  margin-bottom: 4px;
}
.login-card .tagline {
  color: var(--ink-muted);
  font-size: 13.5px;
  margin-bottom: 26px;
}

/* Employee badge, echoes an ID card / barcode motif */
.employee-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.employee-badge .avatar {
  width: 42px; height: 42px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--amber), #7A5A18);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: #1A1200;
}
.employee-badge .code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: .04em;
}

/* ---------------------------------------------------------------------- */
/* Modal dialog — replaces browser alert() for in-app notices             */
/* ---------------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.7);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 26px 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: modal-in .15s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-card .modal-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,93,93,.12);
  color: var(--red);
  font-family: var(--font-mono);
  font-weight: 600;
  margin-bottom: 14px;
}
.modal-card h4 {
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 8px;
}
.modal-card p {
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 20px;
}
.modal-card p strong { color: var(--amber); font-weight: 600; }
.modal-card .btn { width: 100%; justify-content: center; }
