:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --warning: #ca8a04;
  --danger: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* Login Screen */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, var(--primary) 100%);
  padding: 20px;
}

.login-box {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo { width: 80px; height: 80px; object-fit: contain; margin-bottom: 12px; }
.login-brand h1 { font-size: 1.6rem; font-weight: 700; color: var(--gray-900); }
.login-brand p { color: var(--gray-500); margin-top: 4px; font-size: 0.95rem; }

.login-form { display: flex; flex-direction: column; gap: 16px; }

.lang-switcher-login {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

.lang-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--gray-300);
  background: white;
  color: var(--gray-600);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.lang-btn:hover { border-color: var(--primary); color: var(--primary); }
.lang-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* App Layout */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--gray-900);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0; top: 0;
}

.sidebar-brand {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 6px; }
.brand-text { font-weight: 700; font-size: 1rem; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.2s;
  cursor: pointer;
}

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

.nav-item span { font-size: 1.1rem; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info { margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.2); }
.user-info span { display: block; font-weight: 600; font-size: 0.9rem; }
.user-info small { color: rgba(255,255,255,0.5); font-size: 0.75rem; }

.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 32px;
  max-width: 1200px;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h2 { font-size: 1.5rem; font-weight: 700; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

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

.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }

.btn-ghost { background: transparent; color: var(--gray-500); }
.btn-ghost:hover { color: var(--gray-700); }

.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; color: var(--gray-600); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  background: white;
}

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

.form-error { color: var(--danger); font-size: 0.85rem; margin-top: 8px; text-align: center; }

.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* Camera Modal */
.camera-modal { text-align: center; max-width: 480px; }
.camera-preview {
  background: var(--gray-900);
  border-radius: 12px;
  overflow: hidden;
  margin: 16px 0;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-preview video, .camera-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-controls { display: flex; justify-content: center; gap: 10px; }

/* Report Form */
.report-form {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.time-block { margin-bottom: 24px; }
.time-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.time-block-header h3 { font-size: 1.1rem; font-weight: 600; }
.time-range { font-size: 0.85rem; color: var(--gray-500); background: var(--gray-100); padding: 4px 10px; border-radius: 20px; }

.task-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.task-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.task-row input[type="time"] {
  width: 110px;
  padding: 8px 10px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
}
.task-row input[type="text"] {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
}
.task-row .btn-danger {
  padding: 6px 10px;
  font-size: 0.75rem;
}

.save-status { font-size: 0.85rem; color: var(--success); margin-left: 10px; }

/* Calendar Panel */
.calendar-panel {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.calendar-panel h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 16px; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: default;
  background: var(--gray-100);
  color: var(--gray-500);
}

.cal-day.submitted { background: #dcfce7; color: var(--success); font-weight: 600; }
.cal-day.missing { background: #fee2e2; color: var(--danger); }
.cal-day.today { border: 2px solid var(--primary); }
.cal-day .cal-date { font-size: 0.75rem; opacity: 0.7; }

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-num { display: block; font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--gray-500); }

/* Panel & Tables */
.panel {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

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

.panel h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 16px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--gray-500);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--gray-200);
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--gray-100);
}

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

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-green { background: #dcfce7; color: var(--success); }
.badge-red { background: #fee2e2; color: var(--danger); }
.badge-blue { background: var(--primary-light); color: var(--primary-dark); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-content h3 { margin-bottom: 20px; }

/* Review */
.review-preview {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.rating-stars {
  display: flex;
  gap: 6px;
  font-size: 1.5rem;
  cursor: pointer;
}

.rating-stars span { opacity: 0.3; transition: opacity 0.15s; }
.rating-stars span.active { opacity: 1; }

/* Detail Report List */
.detail-report {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.detail-report h4 { font-size: 1rem; margin-bottom: 8px; }
.detail-report .tasks { margin: 8px 0; }
.detail-report .task-item { padding: 4px 0; font-size: 0.9rem; color: var(--gray-600); }
.detail-report .review-box {
  background: #fef3c7;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 0.85rem;
}

/* Date picker */
.date-picker {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-family: inherit;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .main-content { margin-left: 200px; padding: 20px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .login-box { padding: 24px; }
  .task-row { flex-wrap: wrap; }
  .task-row input[type="time"] { width: 100%; }
}
