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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.5;
}

/* ---- Kiosk ---- */
.kiosk-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  color: white;
}

.kiosk-container h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.kiosk-container .subtitle { font-size: 1.1rem; opacity: 0.8; margin-bottom: 2rem; }

.kiosk-card {
  background: white;
  color: var(--gray-900);
  border-radius: 1rem;
  padding: 2.5rem;
  width: 100%;
  max-width: 450px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.pin-display {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.pin-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  background: white;
  transition: background 0.15s;
}

.pin-dot.filled { background: var(--primary); border-color: var(--primary); }

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.pin-btn {
  padding: 1.25rem;
  font-size: 1.5rem;
  font-weight: 600;
  border: 1px solid var(--gray-200);
  border-radius: 0.75rem;
  background: var(--gray-50);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}

.pin-btn:hover { background: var(--gray-200); }
.pin-btn:active { background: var(--gray-300); transform: scale(0.95); }
.pin-btn.clear { font-size: 1rem; color: var(--danger); }

/* Employee view */
.employee-view { text-align: center; }
.employee-view h2 { font-size: 1.8rem; margin-bottom: 0.25rem; }
.employee-view .role { color: var(--gray-500); margin-bottom: 1rem; }
.employee-view .status {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  border-radius: 2rem;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
.status.clocked-in { background: #dcfce7; color: #166534; }
.status.clocked-out { background: #fee2e2; color: #991b1b; }

.holiday-info {
  background: var(--gray-50);
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.action-buttons { display: flex; flex-direction: column; gap: 0.75rem; }

/* ---- Buttons ---- */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--warning); color: white; }
.btn-outline {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1.2rem; width: 100%; }

/* ---- Confirmation message ---- */
.confirmation {
  text-align: center;
  padding: 2rem;
}
.confirmation .check {
  font-size: 4rem;
  color: var(--success);
  margin-bottom: 1rem;
}
.confirmation h2 { margin-bottom: 0.5rem; }
.confirmation .time { color: var(--gray-500); font-size: 1.1rem; }

/* ---- Holiday Form ---- */
.holiday-form { text-align: left; }
.holiday-form h3 { margin-bottom: 1rem; text-align: center; }

/* ---- Admin ---- */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--gray-100);
}

.login-card {
  background: white;
  padding: 2.5rem;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
}

.login-card h1 { text-align: center; margin-bottom: 1.5rem; }

.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--gray-900);
  color: white;
  padding: 1.5rem 0;
  flex-shrink: 0;
}

.sidebar h2 {
  padding: 0 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
}

.sidebar nav a {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--gray-300);
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.15s;
}

.sidebar nav a:hover,
.sidebar nav a.active { background: rgba(255,255,255,0.1); color: white; }

.sidebar nav a .badge {
  background: var(--danger);
  color: white;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

.main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.main-content h1 { margin-bottom: 1.5rem; font-size: 1.8rem; }

/* Cards */
.card {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 1.5rem;
}

.card h3 { margin-bottom: 1rem; color: var(--gray-700); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  padding: 1.25rem;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card .label { font-size: 0.85rem; color: var(--gray-500); }
.stat-card .value { font-size: 2rem; font-weight: 700; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.5rem;
  font-size: 0.95rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group { flex: 1; }

.error-msg { color: var(--danger); font-size: 0.9rem; margin-bottom: 1rem; }
.success-msg { color: var(--success); font-size: 0.9rem; margin-bottom: 1rem; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

table th, table td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.9rem;
}

table th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-700);
}

table tr:hover { background: var(--gray-50); }

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-badge.pending { background: #fef3c7; color: #92400e; }
.status-badge.approved { background: #dcfce7; color: #166534; }
.status-badge.rejected { background: #fee2e2; color: #991b1b; }

/* Toolbar */
.toolbar {
  display: flex;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.toolbar .form-group { margin-bottom: 0; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 { margin-bottom: 1.5rem; }
.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Weekly grid */
#weeklyTable td { padding: 0.5rem; }
#weeklyTable th { padding: 0.5rem; font-size: 0.85rem; }

/* Monthly grid */
#monthlyTable { border-collapse: collapse; }
#monthlyTable td, #monthlyTable th { border: 1px solid var(--gray-200); }
#monthlyTable th { position: sticky; top: 0; z-index: 2; }

/* Toggle buttons */
.ts-toggle { transition: all 0.15s; }
.ts-toggle.active { background: var(--primary) !important; color: white !important; }

/* Responsive */
@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    padding: 1rem 0;
  }
  .sidebar nav { display: flex; overflow-x: auto; }
  .sidebar nav a { white-space: nowrap; }
  .main-content { padding: 1rem; }
  .form-row { flex-direction: column; gap: 0; }
}
