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

:root {
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --success: #16a34a;
  --warning: #d97706;
  --error: #dc2626;
  --bg: #f0f4f8;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --nav-height: 64px;
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

body.has-nav { padding-bottom: calc(var(--nav-height) + 1rem); }
body.auth-page { background: linear-gradient(160deg, #1e3a5f, #1e40af); min-height: 100vh; }

/* Auth */
.auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  color: white;
  text-align: center;
}
.auth-logo { font-size: 2.5rem; font-weight: 800; margin-bottom: 0.5rem; }
.auth-screen h1 { font-size: 1.25rem; font-weight: 500; opacity: 0.9; }
.auth-sub { opacity: 0.7; font-size: 0.875rem; margin-bottom: 2rem; }
.auth-form {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.5rem;
  width: 100%;
  max-width: 380px;
  color: var(--text);
  text-align: left;
}
.demo-hint { margin-top: 1.5rem; font-size: 0.8rem; opacity: 0.6; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.25rem; color: var(--muted); }
.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
}
.form-group input:focus { outline: none; border-color: var(--primary-light); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-block { width: 100%; }
.btn-lg { padding: 1rem; font-size: 1.0625rem; border-radius: 12px; }
.btn-icon { color: var(--muted); text-decoration: none; font-size: 1.25rem; padding: 0.25rem; }

/* Header */
.app-header {
  background: var(--surface);
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-header h1 { font-size: 1.125rem; }
.greeting { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.app-main { padding: 1rem 1.25rem; }

/* Cards */
.status-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--muted);
}
.status-card.active { border-left-color: var(--success); }
.status-card.done { border-left-color: var(--primary); }
.status-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; }
.status-value { display: block; font-size: 1.25rem; font-weight: 700; margin-top: 0.25rem; }
.status-time { font-size: 0.8rem; color: var(--muted); }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.action-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem 0.5rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.action-icon { display: block; font-size: 1.5rem; margin-bottom: 0.25rem; }

.section { margin-bottom: 1.5rem; }
.section h2 { font-size: 0.875rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }

.balance-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.balance-item {
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
}
.balance-type { display: block; font-size: 0.75rem; color: var(--muted); text-transform: capitalize; }
.balance-days { display: block; font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.balance-label { font-size: 0.7rem; color: var(--muted); }

.list-item {
  background: var(--surface);
  border-radius: 10px;
  padding: 0.875rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

.clock-card {
  background: var(--primary);
  color: white;
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  margin-bottom: 1.25rem;
}
.clock-time { font-size: 2.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.clock-date { opacity: 0.8; font-size: 0.875rem; margin-top: 0.25rem; }

.attendance-status {
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.att-row { display: flex; justify-content: space-between; padding: 0.5rem 0; font-size: 0.9375rem; }
.attendance-buttons { margin-bottom: 1.5rem; }
.completed-msg { text-align: center; color: var(--success); font-weight: 600; padding: 1rem; }

.payslip-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 0.75rem;
}
.payslip-period { font-size: 0.8rem; color: var(--muted); }
.payslip-amount { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin: 0.25rem 0; }
.payslip-detail { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); }

.profile-summary {
  background: var(--surface);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.profile-summary h2 { font-size: 1.125rem; }

.progress-bar-item { margin-bottom: 1rem; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 0.375rem; text-transform: capitalize; }
.progress-track { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary-light); border-radius: 4px; }

.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  background: #f1f5f9;
  color: var(--muted);
  text-transform: capitalize;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #dcfce7; color: #166534; }

.alert { padding: 0.75rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: 0.875rem; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-info { background: #e0f2fe; color: #075985; }
.alert-info a, .alert-success a { color: inherit; text-decoration: underline; }

.text-muted { color: var(--muted); font-size: 0.8rem; }
.empty-state { text-align: center; padding: 2rem; color: var(--muted); }

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 500;
  gap: 0.125rem;
  padding: 0.25rem 0.5rem;
}
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 1.25rem; }

/* Error screens */
.error-screen .error-code {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0.25rem 0;
  opacity: 0.95;
}
.error-screen .error-actions {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.error-screen .error-detail {
  margin-top: 1rem;
  max-width: 320px;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
  font-size: 0.8rem;
  word-break: break-word;
}
.btn-outline-light {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.55);
}
.btn-outline-light:hover { background: rgba(255,255,255,0.1); }

@media (min-width: 480px) {
  .app-main, .app-header { max-width: 480px; margin-left: auto; margin-right: auto; }
  .bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; }
}
