/* ─── Proxima Nova ─── */
@font-face { font-family:'Proxima Nova'; font-weight:100; src:url('../fonts/ProximaNova-Thin.otf') format('opentype'); }
@font-face { font-family:'Proxima Nova'; font-weight:300; src:url('../fonts/ProximaNova-Light.otf') format('opentype'); }
@font-face { font-family:'Proxima Nova'; font-weight:400; src:url('../fonts/ProximaNova-Regular.otf') format('opentype'); }
@font-face { font-family:'Proxima Nova'; font-weight:400; font-style:italic; src:url('../fonts/ProximaNova-RegularItalic.otf') format('opentype'); }
@font-face { font-family:'Proxima Nova'; font-weight:600; src:url('../fonts/ProximaNova-Semibold.otf') format('opentype'); }
@font-face { font-family:'Proxima Nova'; font-weight:700; src:url('../fonts/ProximaNova-Bold.otf') format('opentype'); }
@font-face { font-family:'Proxima Nova'; font-weight:800; src:url('../fonts/ProximaNova-Extrabold.otf') format('opentype'); }
@font-face { font-family:'Proxima Nova'; font-weight:900; src:url('../fonts/ProximaNova-Black.otf') format('opentype'); }

/* ─── Midnight Mint palette ─── */
:root {
  --primary:      #0B2B4E;
  --primary-dark: #071D35;
  --accent:       #EEF2F6;
  --mint:         #22C55E;
  --mint-dark:    #16A34A;
  --gold:         #D6A756;
  --danger:       #D42551;
  --success:      #22C55E;
  --text:         #0F172A;
  --muted:        #64748B;
  --border:       #CBD5E1;
  --bg:           #F8FAFC;
  --white:        #ffffff;
  --shadow:       0 2px 8px rgba(0,0,0,0.08);
  --radius:       6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Proxima Nova', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Nav ─── */
nav {
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
nav .brand .brand-ledger { opacity: 0.6; font-weight: 700; }

nav .nav-links { display: flex; gap: 4px; }
nav .nav-links a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
}
nav .nav-links a:hover, nav .nav-links a.active {
  background: rgba(255,255,255,0.15);
  color: white;
}

nav .nav-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255,255,255,0.8); }
nav .nav-user button {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  padding: 4px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
}
nav .nav-user button:hover { background: rgba(255,255,255,0.22); }

/* ─── Layout ─── */
.page { display: none; padding: 24px; max-width: 1100px; margin: 0 auto; }
.page.active { display: block; }

/* ─── Cards ─── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card h2 { font-size: 16px; font-weight: 600; color: var(--text); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: filter 0.15s, opacity 0.15s;
  text-decoration: none;
}
.btn:hover { filter: brightness(0.92); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--mint); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ─── Forms ─── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: white;
  transition: border-color 0.15s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11,43,78,0.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ─── Tables ─── */
table { width: 100%; border-collapse: collapse; }
th {
  background: var(--accent);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--accent); }
.clickable-row { cursor: pointer; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); font-size: 12px; }
.mono { font-family: monospace; font-size: 12px; }

/* ─── Status badges ─── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-open   { background: #dcfce7; color: #15803d; }
.badge-closed { background: #fce4ec; color: #c62828; }
.badge-active { background: #dbeafe; color: #1e40af; animation: pulse 1.5s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ─── Auth pages ─── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.auth-card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
  padding: 40px;
  width: 100%;
  max-width: 380px;
}
.auth-card h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 9px;
}
.auth-card p.sub { color: var(--muted); margin-bottom: 24px; font-size: 13px; }

/* ─── Landing page ─── */
.auth-wrap:has(#page-landing:not([style*="display:none"])),
.auth-wrap:has(#page-landing:not([style*="display: none"])) {
  align-items: stretch;
}
.landing {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: white;
  border-bottom: 1px solid var(--border);
}
.landing-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--primary);
}
.landing-brand .brand-ledger { opacity: 0.55; font-weight: 700; }

.landing-hero {
  text-align: center;
  padding: 80px 24px 64px;
  max-width: 760px;
  margin: 0 auto;
}
.landing-hero h1 {
  font-size: 44px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}
.landing-tagline {
  font-size: 17px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 36px;
}
.landing-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.btn-cta {
  background: var(--mint);
  color: white;
  border: none;
  padding: 14px 36px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(34,197,94,0.35);
  transition: transform 0.08s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn-cta:hover {
  background: var(--mint-dark);
  box-shadow: 0 6px 18px rgba(34,197,94,0.45);
  transform: translateY(-1px);
}
.landing-secondary {
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
}
.landing-secondary:hover { color: var(--primary); }

.landing-benefits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 32px 72px;
  width: 100%;
}
.benefit {
  background: white;
  border-radius: 12px;
  padding: 28px 24px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  border: 1px solid var(--border);
}
.benefit-icon { font-size: 28px; margin-bottom: 12px; }
.benefit h3 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.benefit p  { font-size: 14px; color: var(--muted); line-height: 1.55; }

.landing-closer {
  text-align: center;
  padding: 64px 24px 80px;
  background: var(--primary);
  border-top: 1px solid var(--border);
}
.landing-closer h2 {
  font-size: 28px;
  font-weight: 800;
  color: white;
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}
.landing-closer .btn-cta {
  box-shadow: 0 4px 14px rgba(34,197,94,0.4);
}
.landing-footer {
  padding: 20px 32px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: white;
  border-top: 1px solid var(--border);
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.landing-footer a { color: var(--muted); text-decoration: none; }
.landing-footer a:hover { color: var(--primary); text-decoration: underline; }

@media (max-width: 600px) {
  .landing-hero { padding: 48px 20px 40px; }
  .landing-hero h1 { font-size: 32px; }
  .landing-tagline { font-size: 15px; }
  .landing-closer h2 { font-size: 22px; }
}

/* ─── Alerts ─── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 13px;
}
.alert-error   { background: #fdecea; color: #b71c1c; border: 1px solid #ef9a9a; }
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }

/* ─── Invoice detail ─── */
.invoice-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.meta-item label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.meta-item .value { font-size: 16px; font-weight: 600; color: var(--text); margin-top: 2px; }
.meta-item .value.large { font-size: 22px; color: var(--mint); }
.meta-item .value a { color: inherit; text-decoration: none; cursor: pointer; }
.meta-item .value a:hover { text-decoration: underline; }

.punch-notes {
  width: 100%;
  min-width: 180px;
  max-width: 400px;
  border: 1px solid transparent;
  background: transparent;
  resize: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  padding: 4px 6px;
  border-radius: 4px;
  field-sizing: content;
  max-height: 100px;
}
.punch-notes:hover { border-color: var(--border); }
.punch-notes:focus { border-color: var(--primary); outline: none; background: white; }

.editable-time {
  cursor: pointer;
  border-bottom: 1px dashed var(--border);
  padding: 2px 0;
}
.editable-time:hover { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fade-in 0.15s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow: auto;
  animation: slide-up 0.2s ease-out;
}
@keyframes slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 700; }
.modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 8px 8px;
}

/* ─── Spinner ─── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 40px; color: var(--muted); }
.empty-state p { margin-top: 8px; }

/* ─── Selector bar ─── */
.selector-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.selector-bar select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  min-width: 200px;
  background: white;
}
.selector-bar select:focus { outline: none; border-color: var(--primary); }

/* ─── Client KPI boxes ─── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  text-align: center;
  box-shadow: var(--shadow);
}
.kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .invoice-meta { grid-template-columns: 1fr 1fr; }
  nav { padding: 0 14px; }
  .page { padding: 14px; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
}
