@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;1,9..144,500&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg-void: #0b0705;
  --bg-void-2: #120b07;
  --glow-amber: #ff8a3d;
  --glow-deep: #c2410c;
  --surface: rgba(255,255,255,0.045);
  --surface-strong: rgba(255,255,255,0.07);
  --border-hair: rgba(255,255,255,0.09);
  --text-primary: #f5efe6;
  --text-secondary: #948c82;
  --text-dim: #635b53;
  --danger: #e35b4f;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;
}

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

body {
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}

body.modal-open { overflow: hidden; }

.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
}

::selection { background: var(--glow-amber); color: #1a0f06; }

/* ---------- Hero / header ---------- */

.hero {
  position: relative;
  padding: calc(20px + env(safe-area-inset-top)) 20px 28px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255,138,61,0.28) 0%, rgba(194,65,12,0.14) 32%, rgba(11,7,5,0) 68%),
    var(--bg-void);
}
.hero-compact { padding-bottom: 18px; }

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
}
.wordmark {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 0.01em;
}
.clock {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.hero-greeting {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 34px;
  line-height: 1.15;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.hero-greeting em {
  font-style: italic;
  color: var(--glow-amber);
}
.hero-greeting.small { font-size: 26px; }

.hero-sub {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* ---------- Content / cards ---------- */

.content {
  padding: 16px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-lg);
  padding: 18px;
  backdrop-filter: blur(20px);
}

.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty-card { text-align: center; padding: 26px 18px; }
.empty-text { color: var(--text-dim); font-size: 14px; margin: 0; }

/* glow-card: next shift */
.glow-card {
  position: relative;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255,138,61,0.16) 0%, rgba(255,138,61,0) 55%),
    var(--surface);
}
.shift-title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-style: italic;
  font-size: 20px;
  margin: 0 0 10px;
  line-height: 1.3;
}
.shift-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.shift-meta.muted { color: var(--text-secondary); font-size: 12px; }
.shift-when { color: var(--glow-amber); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.dot { color: var(--text-dim); }

.pill {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 100px;
  border: 1px solid var(--border-hair);
}
.pill-stat {
  color: var(--glow-amber);
  border-color: rgba(255,138,61,0.35);
  background: rgba(255,138,61,0.08);
}

/* ---------- Payday ring (signature element) ---------- */

.payday-card {
  display: flex;
  align-items: center;
  gap: 16px;
}
.payday-ring {
  --pct: 0;
  flex: none;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background:
    conic-gradient(var(--glow-amber) calc(var(--pct) * 360deg), rgba(255,255,255,0.08) 0deg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}
.payday-ring-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #140d08;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.payday-days {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 500;
}
.payday-days-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-top: -2px;
}
.payday-info { flex: 1; min-width: 0; }
.payday-amount {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  font-weight: 500;
  margin: 0 0 4px;
  color: var(--text-primary);
}
.payday-sub { font-size: 11.5px; color: var(--text-secondary); margin: 0; }

/* ---------- Calendar ---------- */

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.cal-month-label {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 16px;
  margin: 0;
}
.icon-btn {
  background: var(--surface-strong);
  border: 1px solid var(--border-hair);
  color: var(--text-primary);
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-cell {
  aspect-ratio: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 13px;
  position: relative;
}
.cal-cell.empty { pointer-events: none; }
.cal-cell.has-shift { background: rgba(255,255,255,0.035); }
.cal-cell.is-today .cal-daynum {
  color: #140d08;
  background: var(--glow-amber);
  border-radius: 50%;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
}
.cal-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--glow-amber);
}
.cal-dot.stat { background: #ffd08a; box-shadow: 0 0 0 2px rgba(255,208,138,0.2); }

/* ---------- Shift rows ---------- */

.shift-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--border-hair);
}
.shift-row:first-of-type { border-top: none; }
.shift-row-title { margin: 0 0 3px; font-size: 13.5px; }
.shift-row-time { margin: 0; font-size: 11px; color: var(--text-secondary); }
.shift-row-actions { display: flex; gap: 10px; flex: none; }

.text-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 4px 0;
}
.text-btn.danger { color: var(--danger); }
.text-btn:hover { color: var(--text-primary); }

/* ---------- Pay tab ---------- */

.job-pay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.job-pay-header h3 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 17px;
  margin: 0;
}

.period {
  border-top: 1px solid var(--border-hair);
  padding: 10px 0;
}
.period:first-of-type { border-top: none; padding-top: 14px; }
.period summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 13.5px;
  padding: 4px 0;
}
.period summary::-webkit-details-marker { display: none; }
.period-net { color: var(--glow-amber); font-weight: 600; }
.period-body { padding-top: 10px; }
.period-cheque { color: var(--text-secondary); font-size: 11px; margin: 0 0 10px; }

.line-items {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}
.line-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.line-item span:first-child { flex: 1; }

.calc-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-hair);
}
.calc-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.calc-row.deduction { color: var(--text-secondary); }
.calc-row.total-row {
  border-top: 1px solid var(--border-hair);
  padding-top: 8px;
  margin-top: 2px;
  font-weight: 600;
}
.calc-row.net-row {
  border-top: 1px solid var(--border-hair);
  color: var(--glow-amber);
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 500;
}

/* ---------- Jobs tab ---------- */

.job-card-header {
  width: 100%;
  background: none;
  border: none;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
  text-align: left;
  gap: 10px;
}
.job-card-header h3 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 17px;
  margin: 0 0 3px;
}
.job-card-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 11px;
  color: var(--text-secondary);
  flex: none;
}
.job-shift-list { margin-top: 12px; }

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

.btn {
  border-radius: 100px;
  padding: 13px 18px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid var(--border-hair);
  background: var(--surface-strong);
  color: var(--text-primary);
}
.btn-block { width: 100%; }
.btn-primary {
  background: var(--glow-amber);
  border-color: var(--glow-amber);
  color: #1a0f06;
}
.btn-ghost { background: transparent; }
.danger-outline { color: var(--danger); border-color: rgba(227,91,79,0.3); }

.btn-block + .btn-block { margin-top: 8px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field input, .field select {
  font-family: 'Inter', sans-serif;
  text-transform: none;
  letter-spacing: normal;
  font-size: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  color: var(--text-primary);
}
.field input:focus, .field select:focus {
  outline: 2px solid var(--glow-amber);
  outline-offset: 1px;
}
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.field-hint { font-size: 11.5px; color: var(--text-dim); margin: 0 0 14px; line-height: 1.5; }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.form-actions .btn { flex: 1; }

.modal-card {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 50;
  border-radius: 22px 22px 0 0;
  max-height: 88dvh;
  overflow-y: auto;
  animation: slideUp 0.22s ease;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- Tab bar ---------- */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-around;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  background: rgba(11,7,5,0.86);
  backdrop-filter: blur(24px);
  border-top: 1px solid var(--border-hair);
  z-index: 40;
}
.tabbar button {
  background: none;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  position: relative;
}
.tabbar button svg { width: 20px; height: 20px; }
.tabbar button.active { color: var(--glow-amber); }
.tabbar button.active::after {
  content: "";
  position: absolute;
  bottom: -8px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--glow-amber);
  box-shadow: 0 0 8px 1px var(--glow-amber);
}

/* ---------- Misc ---------- */

.muted { color: var(--text-secondary); }

@media (min-width: 640px) {
  .hero, .content { max-width: 560px; margin: 0 auto; }
  .tabbar { max-width: 560px; margin: 0 auto; left: 0; right: 0; border-radius: 22px 22px 0 0; border-left: 1px solid var(--border-hair); border-right: 1px solid var(--border-hair); }
}

@media (prefers-reduced-motion: reduce) {
  .modal-card { animation: none; }
}
