:root {
  --primary: #4f7942;
  --primary-dark: #3a5c30;
  --primary-light: #6aa659;
  --accent: #e8f5e2;
  --danger: #d9534f;
  --warning: #f0ad4e;
  --text: #2c3e50;
  --text-muted: #7f8c8d;
  --border: #dde3d9;
  --bg: #f4f6f3;
  --white: #ffffff;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
}

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

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

/* Navigation */
.navbar {
  background: var(--primary);
  color: white;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-size: 1.3rem;
  font-weight: 700;
  text-decoration: none;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-nav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  list-style: none;
}

.navbar-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: background 0.15s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  background: rgba(255,255,255,0.2);
  color: white;
}

.navbar-user {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
}

/* Layout */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Grid */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }

/* Timer Card */
.timer-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  margin-bottom: 1rem;
}

.timer-status {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timer-time {
  font-size: 3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.timer-date {
  font-size: 0.9rem;
  opacity: 0.7;
  margin-bottom: 1.5rem;
}

.timer-start-info {
  font-size: 0.9rem;
  opacity: 0.85;
  margin-bottom: 1.25rem;
}

.btn-timer {
  background: white;
  color: var(--primary);
  border: none;
  border-radius: 50px;
  padding: 0.75rem 2.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-timer:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

.btn-timer:active { transform: translateY(0); }

.btn-timer.stop {
  background: #fde8e8;
  color: var(--danger);
}

/* Balance Card */
.balance-card {
  border-left: 4px solid var(--primary);
}

.balance-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.balance-value.negative { color: var(--danger); }

.balance-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover { background: var(--primary-dark); color: white; }

.btn-secondary {
  background: var(--accent);
  color: var(--primary-dark);
}

.btn-secondary:hover { background: #d8edcc; }

.btn-danger {
  background: #fde8e8;
  color: var(--danger);
}

.btn-danger:hover { background: #fdd; }

.btn-sm {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 121, 66, 0.15);
}

.form-control-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}

/* Checkboxes for work days */
.day-picker {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.day-picker input[type=checkbox] { display: none; }

.day-picker label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 2px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
}

.day-picker input[type=checkbox]:checked + label {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-danger {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}

/* Absence day in week overview */
.week-day.absence {
  background: #e8f0fe;
  border-color: #90caf9;
}

.btn-warning {
  background: #fff3cd;
  color: #856404;
}
.btn-warning:hover { background: #ffe69c; }

/* Week Navigation */
.week-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.week-nav h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  min-width: 180px;
  text-align: center;
}

/* Time entries table */
.entries-table {
  width: 100%;
  border-collapse: collapse;
}

.entries-table th {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--border);
}

.entries-table td {
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.entries-table tr:last-child td { border-bottom: none; }

.entries-table tr:hover td { background: var(--accent); }

.entries-table tr.holiday td { background: #fff8e1; }

.duration-pill {
  display: inline-block;
  background: var(--accent);
  color: var(--primary-dark);
  padding: 0.15rem 0.5rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Week days overview */
.week-overview {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.week-day {
  background: white;
  border-radius: var(--radius);
  padding: 0.6rem 0.5rem;
  text-align: center;
  border: 2px solid var(--border);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
}

.week-day:hover { border-color: var(--primary); }

.week-day.today { border-color: var(--primary); background: var(--accent); }

.week-day.has-entry { border-color: var(--primary-light); }

.week-day.holiday { background: #fff8e1; border-color: var(--warning); }

.week-day .day-name {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.week-day .day-date { font-size: 1.1rem; font-weight: 700; margin: 0.15rem 0; }

.week-day .day-hours {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
}

.week-day .day-holiday-name {
  font-size: 0.65rem;
  color: #856404;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Login page */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.auth-card {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-logo h1 {
  font-size: 2rem;
  color: var(--primary);
  font-weight: 800;
}

.auth-logo p { color: var(--text-muted); font-size: 0.9rem; }

/* Holidays table */
.holidays-table {
  width: 100%;
  border-collapse: collapse;
}

.holidays-table th {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--border);
}

.holidays-table td {
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.holidays-table tr:last-child td { border-bottom: none; }

/* Running indicator */
.running-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #4caf50;
  border-radius: 50%;
  margin-right: 4px;
  animation: pulse 1.5s infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .week-overview { grid-template-columns: repeat(4, 1fr); }
  .timer-time { font-size: 2.2rem; }
  .container { padding: 1rem; }

  .entries-table th:nth-child(4),
  .entries-table td:nth-child(4) { display: none; }

  .navbar-nav { gap: 0; }
  .navbar-nav a { padding: 0.4rem 0.5rem; font-size: 0.8rem; }
}

@media (max-width: 480px) {
  .week-overview { grid-template-columns: repeat(4, 1fr); }
  .week-day { padding: 0.4rem 0.25rem; }
}

/* Utility */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--primary); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 0.5rem; }
.mb-0 { margin-bottom: 0; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }

hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

.settings-section { margin-bottom: 2rem; }
.settings-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
}
