:root {
  --ink: #1F3864;
  --ink-light: #2E4E8C;
  --paper: #F5F6F8;
  --bg: #EEF1F6;
  --text: #22262F;
  --line: #E4E7EC;
  --ok: #3F7D58;
  --ok-bg: #EAF4EE;
  --warn: #B8863B;
  --warn-bg: #FBF1E2;
  --danger: #A5453B;
  --danger-bg: #FBEAE8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(31, 56, 100, 0.05), 0 6px 20px rgba(31, 56, 100, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.num { font-variant-numeric: tabular-nums; }

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--ink-light); }

h1, h2, h3 { margin: 0; letter-spacing: -0.2px; }

button, .btn {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- topbar ---------- */
.topbar {
  background: var(--ink);
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.topbar .brand { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; white-space: nowrap; }
.topbar-left { display: flex; align-items: center; gap: 32px; }
.topbar-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.topbar-nav a {
  color: #fff;
  opacity: 0.8;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.topbar-nav a:hover { opacity: 1; color: #fff; background: rgba(255,255,255,0.10); }
.topbar-nav a.active { opacity: 1; background: rgba(255,255,255,0.16); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.topbar-right a { color: #fff; opacity: 0.9; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12.5px; color: #fff; flex-shrink: 0;
}

/* ---------- layout ---------- */
.page { padding: 28px 24px 60px; max-width: 1280px; margin: 0 auto; }
.page-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header .subtitle { font-size: 13.5px; color: var(--text); opacity: 0.55; margin-top: 2px; }
.page-narrow { max-width: 640px; margin: 0 auto; padding: 36px 20px 80px; }

/* ---------- card ---------- */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 24px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border: none; border-radius: 10px;
  font-size: 14px; font-weight: 600; text-decoration: none;
}
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 2px 8px rgba(31,56,100,0.22); }
.btn-primary:hover { background: var(--ink-light); color: #fff; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn-secondary:hover { background: var(--paper); color: var(--text); }
.btn-danger { background: var(--danger-bg); color: var(--danger); box-shadow: none; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field { margin-bottom: 18px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
input[type=text], input[type=password], input[type=email], input[type=date],
input[type=number], input[type=time], select, textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #F9FAFB;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--ink-light);
  outline-offset: 1px;
  background: #fff;
}
textarea { resize: vertical; min-height: 80px; }
.help { font-size: 12.5px; color: var(--text); opacity: 0.55; margin-top: 4px; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th {
  text-align: left; font-size: 12px; font-weight: 600;
  color: var(--text); opacity: 0.5; padding: 12px 16px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr.row:last-child td { border-bottom: none; }
tr.row:hover td { background: #FAFBFC; }

/* ---------- pill / status ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }

/* ---------- hero number (client view) ---------- */
.hero-number {
  padding: 36px; text-align: center; margin-bottom: 20px;
  background: linear-gradient(150deg, #1F3864 0%, #2E4E8C 100%);
  box-shadow: 0 8px 28px rgba(31,56,100,0.28);
}
.hero-number .value { font-size: 60px; font-weight: 700; color: #fff; line-height: 1; letter-spacing: -1px; }
.hero-number .label { font-size: 14px; color: rgba(255,255,255,0.8); margin-top: 8px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-grid .card-pad { padding: 18px; }
.stat-label { font-size: 12px; color: var(--text); opacity: 0.55; margin-bottom: 6px; }
.stat-value { font-size: 20px; font-weight: 700; }

/* ---------- ledger / receipt list ---------- */
.receipt-row {
  display: flex; gap: 14px; padding: 13px 0;
  border-bottom: 1px solid var(--line); align-items: flex-start;
}
.receipt-row:last-child { border-bottom: none; }
.receipt-icon {
  width: 34px; height: 34px; border-radius: 9px; background: var(--bg);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.receipt-desc { flex: 1; font-size: 14px; }
.receipt-date { font-size: 12.5px; color: var(--text); opacity: 0.5; margin-top: 2px; }
.receipt-hours { font-size: 14px; font-weight: 600; flex-shrink: 0; }

/* ---------- flash messages ---------- */
.flash {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 14px;
}
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--danger-bg); color: var(--danger); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px; background: linear-gradient(160deg,#EEF1F6 0%,#E7ECF3 100%); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; box-shadow: 0 1px 3px rgba(31,56,100,0.06), 0 12px 32px rgba(31,56,100,0.10); padding: 44px 40px; }
.login-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--ink); display: flex; align-items: center; justify-content: center; margin-bottom: 20px; }
.login-title { font-size: 21px; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { font-size: 14px; color: var(--text); opacity: 0.55; margin-bottom: 32px; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 10px; }
  .topbar-left { flex-wrap: wrap; gap: 12px; }
  .stat-grid { grid-template-columns: 1fr; }
  .page { padding: 20px 14px 48px; }
  td, th { padding: 10px 12px; }
}
