:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --success-hover: #15803d;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --warning: #f59e0b;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --radius-sm: 8px;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #334155;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* HEADER */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}
.header-left h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--primary);
}
.session-badge {
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.session-badge.admin { background: var(--warning); }
.subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.clock {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.date { font-size: 11px; color: var(--muted); text-align: right; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--surface-2); }

/* TABS */
.tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1;
  min-width: 100px;
  padding: 14px 16px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* CONTENT */
.content {
  flex: 1;
  padding: 16px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  overflow-y: auto;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* TOOLBAR */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar input { flex: 1; }
.counter { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* FORM ELEMENTS */
input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}
label input, label select { margin-top: 4px; }

.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.form-row > * { flex: 1; min-width: 140px; }
.form-row > button { flex: 0 0 auto; min-width: auto; }

/* BUTTONS */
.btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
.btn:hover { background: var(--border); }
.btn.primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn.success { background: var(--success); color: white; border-color: var(--success); }
.btn.success:hover { background: var(--success-hover); border-color: var(--success-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}
.card.danger { border-color: var(--danger); }
.card.danger h2 { color: var(--danger); }

.muted { color: var(--muted); font-size: 13px; line-height: 1.5; margin-bottom: 12px; }

/* EMPLOYEE CARDS */
.employee-list { display: flex; flex-direction: column; gap: 10px; }
.employee-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.employee-card.working { border-left: 4px solid var(--success); }
.employee-card.idle { border-left: 4px solid var(--border); }

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.employee-info { flex: 1; min-width: 0; }
.employee-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.employee-role { font-size: 12px; color: var(--muted); margin-top: 2px; }
.employee-status {
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.on { background: var(--success); animation: pulse 2s infinite; }
.status-dot.off { background: var(--muted); }
.status-dot.lunch { background: var(--warning); animation: pulse 2s infinite; }

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

.employee-hours {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.action-btn {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  border: none;
  cursor: pointer;
  color: white;
  transition: transform 0.1s, background 0.15s;
  flex-shrink: 0;
}
.action-btn:active { transform: scale(0.95); }
.action-btn.in { background: var(--success); }
.action-btn.in:hover { background: var(--success-hover); }
.action-btn.out { background: var(--danger); }
.action-btn.out:hover { background: var(--danger-hover); }
.action-btn.lunch { background: var(--warning); }
.action-btn.lunch:hover { background: #d97706; }

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.action-buttons .action-btn { padding: 8px 14px; font-size: 11px; min-width: 100px; }
.action-buttons:has(.action-btn:only-child) .action-btn { padding: 12px 18px; font-size: 13px; }

/* TEAM LIST */
.team-list { display: flex; flex-direction: column; gap: 8px; }
.team-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.team-row .avatar { width: 36px; height: 36px; font-size: 14px; }
.team-row-info { flex: 1; min-width: 0; }
.team-row-info .name { font-size: 14px; font-weight: 500; }
.team-row-info .role { font-size: 12px; color: var(--muted); }
.team-actions { display: flex; gap: 6px; }
.team-actions button {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.team-actions button:hover { background: var(--border); }
.team-actions .delete { color: var(--danger); }

/* SUMMARY & ENTRIES */
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.summary-item {
  background: var(--surface-2);
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.summary-item .label { font-size: 12px; color: var(--muted); }
.summary-item .value {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.entries { display: flex; flex-direction: column; gap: 6px; max-height: 480px; overflow-y: auto; }
.entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.entry:hover { background: var(--border); }
.entry-type {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.entry-type.in { background: rgba(22, 163, 74, 0.15); color: var(--success); }
.entry-type.out { background: rgba(220, 38, 38, 0.15); color: var(--danger); }
.entry-type.lunch_out, .entry-type.lunch_in { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.entry-emp { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-time {
  font-family: "SF Mono", Consolas, monospace;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.empty-hint {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: all 0.3s;
  z-index: 100;
  max-width: 90%;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); color: white; }
.toast.error { background: var(--danger); color: white; }

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.modal-content h2 { margin-bottom: 16px; font-size: 17px; }

/* CALENDAR */
.cal-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.cal-toolbar h2 {
  flex: 1;
  text-align: center;
  text-transform: capitalize;
  margin: 0;
  font-size: 16px;
}
.cal-toolbar .icon-btn { font-size: 22px; padding: 4px 12px; line-height: 1; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-header {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 6px 0;
  font-weight: 600;
  text-transform: uppercase;
}
.cal-day {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  min-height: 64px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal-day.empty { background: transparent; border: none; cursor: default; min-height: 0; }
.cal-day:hover:not(.empty) { border-color: var(--primary); }
.cal-day.today { border-color: var(--primary); background: rgba(37, 99, 235, 0.08); }
.cal-day.has-work { background: rgba(22, 163, 74, 0.08); border-color: rgba(22, 163, 74, 0.3); }
.cal-day.today.has-work { background: rgba(22, 163, 74, 0.12); border-color: var(--primary); }
.cal-day.selected { outline: 2px solid var(--primary); outline-offset: 1px; }
.cal-day-num { font-weight: 600; font-size: 13px; }
.cal-day-hours {
  font-size: 11px;
  color: var(--success);
  font-weight: 700;
  margin-top: auto;
  font-variant-numeric: tabular-nums;
}
.cal-day-count { font-size: 10px; color: var(--muted); }
.cal-day.weekend .cal-day-num { color: var(--muted); }

.cal-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
}
.cal-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
}
.cal-legend .dot.has-work { background: rgba(22, 163, 74, 0.3); border: 1px solid rgba(22, 163, 74, 0.5); }
.cal-legend .dot.today { background: rgba(37, 99, 235, 0.15); border: 1px solid var(--primary); }

.cal-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cal-day-header h2 { margin: 0; text-transform: capitalize; }

/* HOLIDAYS & ABSENCES */
.holiday-list, .absence-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  max-height: 320px;
  overflow-y: auto;
}
.holiday-row, .absence-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.holiday-row .date, .absence-row .dates {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}
.holiday-row .name, .absence-row .info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.absence-row .info .note { color: var(--muted); font-size: 12px; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.badge.holiday { background: rgba(220, 38, 38, 0.15); color: var(--danger); }
.badge.vacation { background: rgba(37, 99, 235, 0.15); color: var(--primary); }
.badge.sick { background: rgba(245, 158, 11, 0.18); color: var(--warning); }
.badge.other { background: var(--border); color: var(--text); }
.btn-icon-x {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
}
.btn-icon-x:hover { color: var(--danger); }

/* Calendar holiday/absence markers */
.cal-day.holiday { background: rgba(220, 38, 38, 0.10); border-color: rgba(220, 38, 38, 0.35); }
.cal-day.holiday .cal-day-num { color: var(--danger); }
.cal-day-holiday-name {
  font-size: 9px;
  color: var(--danger);
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cal-day-absences {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  margin-top: auto;
}
.cal-day-absences .pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.cal-day-absences .pip.sick { background: var(--warning); }
.cal-day-absences .pip.other { background: var(--muted); }

/* TASKS, SKILLS, TEMPLATES */
.task-list, .template-list, .skill-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 480px; overflow-y: auto; }
.task-row, .template-row, .skill-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.task-row.done { opacity: 0.6; }
.task-row.done .task-title { text-decoration: line-through; }
.task-row .task-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.task-row .task-emp { font-size: 12px; color: var(--muted); white-space: nowrap; }
.task-row .task-due { font-size: 11px; color: var(--muted); font-family: "SF Mono", Consolas, monospace; }
.task-row .task-due.overdue { color: var(--danger); font-weight: 700; }
.task-check { width: 18px; height: 18px; cursor: pointer; }

.template-row .tmpl-meta { font-size: 11px; color: var(--muted); }
.template-row .tmpl-info { flex: 1; min-width: 0; }

.skill-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  margin-top: 12px;
  align-items: center;
}
.skill-grid .sk-name { font-size: 13px; }
.skill-grid .sk-cat { font-size: 11px; color: var(--muted); }
.sk-stars { display: inline-flex; gap: 2px; cursor: pointer; }
.sk-star { font-size: 18px; color: var(--border); user-select: none; }
.sk-star.filled { color: var(--warning); }

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.schedule-grid label { font-size: 11px; color: var(--muted); margin: 0; text-align: center; }
.schedule-grid input { padding: 6px 4px; text-align: center; font-size: 13px; }

/* Login modal extras */
#loginModal .modal-content, #pinModal .modal-content { max-width: 360px; }
#loginPin, #pinModalInput { letter-spacing: 8px; text-align: center; font-size: 22px; font-family: "SF Mono", Consolas, monospace; }

.muted h3 { font-weight: 600; }

/* SURVEYS */
.survey-lib, .survey-inbox { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.survey-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.survey-row .info { flex: 1; min-width: 0; }
.survey-row .title { font-weight: 600; }
.survey-row .meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.survey-row .actions { display: flex; gap: 4px; }
.survey-row .actions button { padding: 6px 10px; font-size: 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.survey-row .actions button:hover { background: var(--border); }
.survey-row.pending { border-left: 4px solid var(--warning); }
.survey-row.completed { opacity: 0.7; border-left: 4px solid var(--success); }

.survey-q-editor {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 8px;
}
.survey-q-editor .form-row { gap: 6px; }
.survey-q-editor textarea { min-height: 50px; }

.survey-answer-q {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.survey-answer-q:last-child { border-bottom: none; }
.survey-answer-q .q-text { font-weight: 600; margin-bottom: 8px; font-size: 14px; }
.survey-answer-q label { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 13px; }
.survey-answer-q label input { width: auto; margin-right: 6px; }

.rating-input { display: flex; gap: 6px; }
.rating-input .star { font-size: 26px; cursor: pointer; color: var(--border); }
.rating-input .star.filled { color: var(--warning); }

/* CHARTS */
.chart-wrap { width: 100%; overflow-x: auto; }
.chart-wrap svg { width: 100%; min-width: 300px; height: auto; max-height: 220px; display: block; }
.chart-bar { fill: var(--primary); transition: fill 0.15s; }
.chart-bar:hover { fill: var(--primary-hover); }
.chart-axis { stroke: var(--border); stroke-width: 1; }
.chart-label { font-size: 10px; fill: var(--muted); font-family: -apple-system, sans-serif; }
.chart-value { font-size: 10px; fill: var(--text); font-weight: 600; font-family: -apple-system, sans-serif; }
.chart-empty { color: var(--muted); padding: 20px; text-align: center; font-size: 13px; }

/* PRINT */
@media print {
  .app-header, .tabs, #toast, .modal, #installBtn { display: none !important; }
  body { background: white; color: black; }
  .card { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; }
  .tab-panel { display: block !important; }
  .tab-panel:not(.active) { display: none !important; }
}

/* MOBILE */
@media (max-width: 600px) {
  .app-header { padding: 12px 16px; }
  .header-left h1 { font-size: 17px; }
  .clock { font-size: 15px; }
  .date { font-size: 10px; }
  .content { padding: 12px; }
  .employee-card { padding: 12px; gap: 10px; }
  .avatar { width: 38px; height: 38px; font-size: 14px; }
  .action-btn { padding: 10px 14px; font-size: 12px; }
  .action-buttons .action-btn { min-width: 90px; padding: 7px 10px; font-size: 10px; }
  .cal-day { min-height: 52px; padding: 4px; }
  .cal-day-num { font-size: 12px; }
  .cal-day-hours { font-size: 10px; }
  .cal-day-count { display: none; }
  .cal-header { font-size: 10px; padding: 4px 0; }
  .form-row { flex-direction: column; }
  .form-row > * { width: 100%; }
  .tab { padding: 12px 8px; font-size: 13px; }
}

/* ═══════════════════════════════════════════════════════════════
   PICA-PONTO PREMIUM v1 — alinhamento total com CarCor Pro
   Navy + Gold · Fraunces editorial · Inter UI
   ═══════════════════════════════════════════════════════════════ */

:root {
  --pp-navy:#0a0e16;
  --pp-navy-2:#0c1d35;
  --pp-navy-3:#14375e;
  --pp-gold:#c9a961;
  --pp-gold-l:#e6c478;
  --pp-gold-bright:#f3e0a3;
  --pp-ink:#0f1422;
  --pp-line:#e4e4e7;
  --pp-line-soft:#f0f0f2;
  --pp-text:#0f1422;
  --pp-text-2:#3f3f46;
  --pp-muted:#71717a;
  --pp-bg:#fafafa;
  --pp-surface:#ffffff;

  --font-display:"Inter",-apple-system,BlinkMacSystemFont,"Segoe UI Variable","Segoe UI",system-ui,sans-serif;
  --font-editorial:"Fraunces","Iowan Old Style",Georgia,serif;

  /* Override existing */
  --bg:var(--pp-bg);
  --surface:var(--pp-surface);
  --surface-2:#f7f7f9;
  --text:var(--pp-text);
  --muted:var(--pp-muted);
  --border:var(--pp-line);
  --primary:var(--pp-navy-2);
  --primary-hover:var(--pp-navy-3);
  --shadow:0 1px 2px rgba(8,15,30,.04),0 1px 3px rgba(8,15,30,.06);
  --radius:12px;
  --radius-sm:8px;
}

[data-theme="dark"] {
  --pp-bg:#06080d;
  --pp-surface:#0e131e;
  --pp-text:#f5f5fa;
  --pp-muted:#8b94a8;
  --pp-line:#1c2438;
  --bg:var(--pp-bg);
  --surface:var(--pp-surface);
  --surface-2:#13182a;
  --text:var(--pp-text);
  --muted:var(--pp-muted);
  --border:var(--pp-line);
  --primary:var(--pp-gold);
  --primary-hover:var(--pp-gold-l);
}

html, body {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-feature-settings: "cv02","cv11","ss01","tnum";
  letter-spacing: -.005em;
  background: var(--pp-bg);
  -webkit-font-smoothing: antialiased;
}

/* HEADER — refinado, navy, com brand mark dourado */
.app-header {
  background: linear-gradient(135deg,#070b13 0%,#0c1d35 100%);
  color: #fff;
  border-bottom: 1px solid rgba(201,169,97,.15);
  padding: 14px 24px;
  box-shadow: 0 1px 0 rgba(255,255,255,.04);
  position: relative;
  overflow: hidden;
}
.app-header::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg,transparent,var(--pp-gold) 50%,transparent);
  opacity: .35;
}
.header-left h1 {
  font-family: var(--font-editorial);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -.02em;
  color: #fff;
  font-variation-settings: "opsz" 144;
  text-transform: none;
}
.header-left h1::before {
  content: "";
  display: inline-block;
  width: 32px;height: 32px;border-radius: 8px;
  background: linear-gradient(135deg,var(--pp-gold) 20%,var(--pp-gold-l) 60%,var(--pp-gold-bright) 100%);
  vertical-align: middle;
  margin-right: 12px;
  box-shadow: 0 4px 14px rgba(201,169,97,.35),inset 0 1px 0 rgba(255,255,255,.4);
}
.subtitle {
  color: rgba(230,196,120,.7);
  font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 500;
  margin-top: 2px;
}
.brand-logo {
  border-radius: 8px;
  width: 32px; height: 32px;
  box-shadow: 0 4px 14px rgba(201,169,97,.35);
}
.clock {
  font-family: ui-monospace,SFMono-Regular,Consolas,monospace;
  font-size: 16px; font-weight: 600;
  color: var(--pp-gold-l);
  letter-spacing: .02em;
}
.date { color: rgba(255,255,255,.55); font-size: 11px; letter-spacing: .02em; }

.icon-btn {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  transition: background .15s,border-color .15s,color .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.15) }
.session-badge {
  background: rgba(201,169,97,.16);
  color: var(--pp-gold-l);
  border: 1px solid rgba(201,169,97,.3);
  font-weight: 600;
  letter-spacing: .04em;
  padding: 4px 10px;
  border-radius: 8px;
  text-transform: uppercase;
  font-size: 10.5px;
}
.session-badge.admin {
  background: rgba(201,169,97,.18); color: var(--pp-gold-bright);
  border-color: rgba(201,169,97,.4);
}

/* TABS — premium, subtil */
.tabs {
  background: var(--surface);
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  display: flex;
}
.tabs::-webkit-scrollbar { display: none }
.tab {
  background: transparent;
  border: 0;
  padding: 14px 14px 14px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13.5px;
  color: var(--pp-muted);
  letter-spacing: -.005em;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: color .15s;
}
.tab:hover { color: var(--pp-text-2) }
.tab.active {
  color: var(--pp-navy-2);
  font-weight: 600;
}
.tab.active::after {
  content: "";
  position: absolute; bottom: -1px; left: 14px; right: 14px; height: 2px;
  background: linear-gradient(90deg,var(--pp-gold),var(--pp-gold-l));
  border-radius: 2px;
}
[data-theme="dark"] .tab.active { color: var(--pp-gold-l) }

/* CONTENT — mais respiração */
.content {
  padding: 28px 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* CARDS — refinados */
.card {
  background: var(--surface);
  border: 1px solid var(--pp-line-soft);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 1px 2px rgba(8,15,30,.04);
  margin-bottom: 16px;
  transition: box-shadow .2s,border-color .2s;
}
[data-theme="dark"] .card { border-color: rgba(255,255,255,.06) }
.card h2 {
  font-family: var(--font-editorial);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -.018em;
  color: var(--text);
  margin-bottom: 14px;
}
.card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--pp-text-2);
  letter-spacing: -.005em;
}
.card.danger {
  background: linear-gradient(180deg,rgba(220,38,38,.02),transparent);
  border-color: rgba(220,38,38,.18);
}

/* FORMS */
input[type="text"],input[type="password"],input[type="email"],input[type="number"],
input[type="search"],input[type="date"],input[type="datetime-local"],
input[type="color"],input[type="file"],
select,textarea {
  font-family: var(--font-display);
  font-size: 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 13px;
  color: var(--text);
  transition: border-color .15s,box-shadow .15s;
}
input:hover,select:hover,textarea:hover { border-color: #d4d4d8 }
input:focus,select:focus,textarea:focus {
  outline: none;
  border-color: var(--pp-navy-2);
  box-shadow: 0 0 0 4px rgba(12,29,53,.07);
}
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: var(--pp-gold);
  box-shadow: 0 0 0 4px rgba(201,169,97,.18);
}
label {
  display: block;
  font-size: 12px; font-weight: 500;
  color: var(--pp-text-2);
  margin-bottom: 12px;
}
label > input,label > select,label > textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
}

/* BUTTONS */
.btn {
  font-family: var(--font-display);
  font-weight: 500; letter-spacing: -.005em;
  font-size: 13.5px;
  border-radius: 9px;
  padding: 9px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: #d4d4d8; transform: translateY(-1px) }
.btn:active { transform: translateY(0) scale(.985) }
.btn.primary {
  background: var(--pp-navy-2);
  border-color: var(--pp-navy-2);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset,0 2px 4px -1px rgba(12,29,53,.2);
}
.btn.primary:hover {
  background: var(--pp-navy-3);
  box-shadow: 0 1px 0 rgba(255,255,255,.1) inset,0 8px 16px -4px rgba(12,29,53,.3);
}
.btn.danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}
.btn.danger:hover { background: #b91c1c }
[data-theme="dark"] .btn.primary {
  background: var(--pp-gold);
  border-color: var(--pp-gold);
  color: var(--pp-navy-2);
}

/* EMPLOYEE CARD — premium */
.employee-card {
  background: var(--surface);
  border: 1px solid var(--pp-line-soft);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(8,15,30,.04);
  transition: transform .2s,box-shadow .2s,border-color .2s;
  margin-bottom: 12px;
}
.employee-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -10px rgba(8,15,30,.15);
  border-color: var(--border);
}
.avatar {
  background: linear-gradient(135deg,var(--pp-navy-2),var(--pp-navy-3));
  color: var(--pp-gold-l);
  font-family: var(--font-editorial);
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 4px 12px rgba(12,29,53,.18),inset 0 1px 0 rgba(255,255,255,.06);
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 15px;
}

/* ACTION BUTTONS (in/out/lunch) — premium */
.action-btn {
  font-family: var(--font-display);
  font-weight: 600;
  border-radius: 9px;
  padding: 9px 14px;
  letter-spacing: -.005em;
  transition: all .15s;
  border: 1px solid var(--border);
}
.action-btn:hover { transform: translateY(-1px) }

/* TOOLBAR */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.toolbar input[type="search"] {
  flex: 1;
  max-width: 360px;
}
.counter {
  font-size: 12px;
  color: var(--pp-muted);
  letter-spacing: 0;
}

/* SUMMARY (resumo de relatório) */
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(140px,1fr));
  gap: 12px;
}
.summary-item {
  background: var(--surface-2);
  border: 1px solid var(--pp-line-soft);
  border-radius: 11px;
  padding: 14px 16px;
}
.summary-label {
  font-size: 11px; font-weight: 500;
  color: var(--pp-muted); letter-spacing: 0;
  margin-bottom: 6px;
}
.summary-value {
  font-family: var(--font-editorial);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -.02em;
  color: var(--text);
  font-variation-settings: "opsz" 144;
}

/* CALENDÁRIO — refinado */
.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}
.cal-toolbar h2 {
  font-family: var(--font-editorial);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -.02em;
  margin: 0;
  color: var(--text);
  flex: 1;
  text-align: center;
  text-transform: capitalize;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7,1fr);
  gap: 4px;
}
.cal-header {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--pp-muted);
  text-transform: uppercase;
  text-align: center;
  padding: 8px 0;
}
.cal-day {
  background: var(--surface-2);
  border: 1px solid var(--pp-line-soft);
  border-radius: 8px;
  padding: 8px;
  min-height: 64px;
  cursor: pointer;
  transition: background .15s,border-color .15s,transform .15s;
}
.cal-day:hover { background: var(--surface); border-color: var(--border); transform: translateY(-1px) }
.cal-day-num {
  font-family: var(--font-editorial);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.cal-day.has-work {
  background: linear-gradient(135deg,rgba(201,169,97,.06),transparent);
  border-color: rgba(201,169,97,.25);
}
.cal-day.today {
  background: var(--pp-navy-2);
  color: #fff;
  border-color: var(--pp-navy-2);
}
.cal-day.today .cal-day-num { color: var(--pp-gold-l) }
.cal-day.today .cal-day-hours { color: rgba(255,255,255,.85) }
.cal-day-hours { font-size: 11px; color: var(--pp-muted); margin-top: 4px; font-feature-settings: "tnum" }

/* MODAL — premium glass */
.modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(7,11,19,.55);
  backdrop-filter: blur(8px) saturate(1.2);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
  display: grid; place-items: center;
  padding: 20px;
  animation: ppFadeIn 180ms cubic-bezier(.22,.61,.36,1);
}
.modal[hidden] { display: none }
.modal-content {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  border: 1px solid var(--border);
  box-shadow:
    0 24px 60px -12px rgba(8,15,30,.4),
    0 0 0 1px rgba(12,29,53,.05);
  animation: ppScaleIn 220ms cubic-bezier(.22,.61,.36,1);
}
.modal-content h2 {
  font-family: var(--font-editorial);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -.02em;
  margin-bottom: 12px;
  color: var(--text);
}
@keyframes ppFadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes ppScaleIn {
  from { opacity: 0; transform: translateY(8px) scale(.98) }
  to { opacity: 1; transform: translateY(0) scale(1) }
}

/* TOAST */
.toast {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -.005em;
  background: var(--pp-navy);
  color: #fff;
  border-radius: 10px;
  padding: 12px 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}

/* MUTED helper */
.muted, p.muted { color: var(--pp-muted); font-size: 13px; line-height: 1.55 }

/* Selection */
::selection { background: rgba(201,169,97,.25); color: var(--text) }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration: .01ms!important; animation-iteration-count: 1!important; transition-duration: .01ms!important }
}

/* Mobile refinements */
@media (max-width: 640px) {
  .app-header { padding: 12px 16px }
  .header-left h1 { font-size: 18px }
  .header-left h1::before { width: 26px; height: 26px; margin-right: 8px }
  .tabs { padding: 0 14px; gap: 2px }
  .tab { padding: 12px 10px; font-size: 13px }
  .content { padding: 20px 14px }
  .card { padding: 18px; border-radius: 12px }
  .modal-content { padding: 22px; border-radius: 14px }
}
