/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:            #F5F3EF;
  --surface:       #FFFFFF;
  --surface-2:     #EEEBE5;
  --border:        #E2DDD6;
  --border-strong: #C4BAB0;

  --text:          #1A1614;
  --text-soft:     #6B6056;
  --text-muted:    #9E9388;

  --accent:        #C4704A;
  --accent-dark:   #A45839;
  --accent-light:  #F7EDE5;

  --sage:          #47876A;
  --sage-light:    #E6F2EB;

  --sidebar-bg:    #16192A;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.07);
  --shadow:    0 4px 16px rgba(0,0,0,0.09);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);

  --radius:    10px;
  --radius-sm: 6px;
  --sidebar-w: 220px;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== SCREENS ===== */
.screen { display: none; }
.screen.active { display: block; }

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

.login-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 48px 44px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-logo { text-align: center; margin-bottom: 36px; }
.logo-icon  { font-size: 36px; display: block; margin-bottom: 10px; }

.login-logo h1 {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 4px;
}

.login-subtitle { color: var(--text-soft); font-size: 14px; }

.login-form label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.login-form input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 22px;
  letter-spacing: 8px;
  text-align: center;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s;
  margin-bottom: 14px;
}
.login-form input:focus { outline: none; border-color: var(--accent); background: var(--surface); }

.error-msg { color: #B83232; font-size: 13px; text-align: center; margin-bottom: 8px; }

/* ===== APP LAYOUT ===== */
#app-screen { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
}

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

.logo-sm  { font-size: 18px; }
.app-name {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 600;
  color: #FFFFFF;
  letter-spacing: 0.2px;
}

.sidebar-nav {
  padding: 14px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-item:hover  { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.8); }
.nav-item.active { background: var(--accent); color: #FFFFFF; }
.nav-icon        { font-size: 15px; }

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

.user-badge {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  min-height: 100vh;
}

/* ===== VIEWS ===== */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.22s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.view-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  color: var(--text);
  font-weight: 700;
}

/* ===== CALENDAR ===== */
.month-nav { display: flex; align-items: center; gap: 10px; }
.month-nav h2 { min-width: 190px; text-align: center; }

.year-badge {
  background: var(--accent);
  color: #FFFFFF;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* Monthly summary */
.monthly-summary { margin-bottom: 14px; }

.sum-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  border: 1px solid var(--border);
  font-size: 13px;
}
.sum-item { color: var(--text); }
.sum-item strong { color: var(--accent); font-weight: 600; }
.sum-sep  { color: var(--border-strong); padding: 0 6px; }

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

.cal-header {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 8px 0;
}

.cal-day {
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1.5px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  padding: 6px 4px;
  box-shadow: var(--shadow-xs);
  min-height: 68px;
}

.cal-day:hover:not(.cal-empty) {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.cal-day.cal-empty  { background: transparent; box-shadow: none; cursor: default; }
.cal-day.cal-today  { border-color: var(--accent); background: var(--accent-light); }
.cal-day.cal-weekend { background: var(--surface-2); }
.cal-day.has-data   { border-color: var(--sage); }
.cal-day.validated  { border-color: var(--sage); background: var(--sage-light); }

.cal-day.cal-ferie   { background: #EDF2FF; border-color: #BACAF8; }
.cal-day.cal-vacation { background: #FFF4E8; border-color: #F5C49A; }
.cal-day.cal-absence  { background: #F6EEF9; border-color: #D8B5E8; }

.cal-icon {
  font-size: 10px;
  position: absolute;
  top: 3px;
  right: 4px;
  line-height: 1;
}

.cal-day-num {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}
.cal-day.cal-weekend .cal-day-num { color: var(--text-soft); }
.cal-day.cal-today .cal-day-num   { color: var(--accent); font-weight: 700; }

.cal-day-info {
  font-size: 8px;
  color: var(--text-soft);
  text-align: center;
  margin-top: 3px;
  line-height: 1.3;
}

.cal-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--sage);
  margin-top: 3px;
}

/* ===== DAY TYPE CHIPS ===== */
.day-type-chips { display: flex; flex-wrap: wrap; gap: 7px; }

.day-type-chip {
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.13s;
}
.day-type-chip:hover { border-color: var(--accent); color: var(--accent); }
.day-type-chip.active[data-type="normal"]   { background: var(--text);  border-color: var(--text);  color: #FFF; }
.day-type-chip.active[data-type="vacation"] { background: #C07020; border-color: #C07020; color: #FFF; }
.day-type-chip.active[data-type="absence"]  { background: #7750A0; border-color: #7750A0; color: #FFF; }
.day-type-chip:disabled { opacity: 0.38; cursor: default; pointer-events: none; }

/* ===== HISTORY ===== */
.history-list { display: flex; flex-direction: column; gap: 7px; }

.history-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 18px;
  border: 1.5px solid var(--border);
  border-left: 3px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: all 0.15s;
}
.history-item:hover     { transform: translateX(3px); border-left-color: var(--accent); box-shadow: var(--shadow-sm); }
.history-item.validated { border-left-color: var(--sage); }

.history-item-date  { font-family: 'Playfair Display', serif; font-size: 15px; font-weight: 600; color: var(--text); min-width: 170px; }
.history-item-hours { font-size: 13px; color: var(--text-soft); flex: 1; }
.history-item-tasks { font-size: 12px; color: var(--text-muted); }

/* ===== ADMIN ===== */
.admin-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; }

.admin-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
}

.admin-card h3 { font-family: 'Playfair Display', serif; font-size: 17px; margin-bottom: 14px; color: var(--text); font-weight: 700; }
.admin-card h4 { font-size: 11px; font-weight: 700; color: var(--text-muted); margin: 14px 0 8px; text-transform: uppercase; letter-spacing: 0.6px; }

.codes-display { display: flex; flex-direction: column; gap: 10px; }
.code-item     { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.code-item label { font-size: 12px; color: var(--text-soft); min-width: 120px; }
.code-value    { font-family: monospace; font-size: 15px; font-weight: 700; color: var(--text); }

.change-codes .form-row { display: flex; gap: 8px; margin-bottom: 8px; }
.change-codes input {
  flex: 1;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
}
.change-codes input:focus { outline: none; border-color: var(--accent); background: var(--surface); }

.admin-card p.hint { font-size: 12px; color: var(--text-soft); margin-bottom: 12px; }

#admin-stats { display: flex; flex-direction: column; gap: 5px; }
.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.stat-val { font-weight: 700; color: var(--accent); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,8,16,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(3px);
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: slideUp 0.22s ease;
}
.modal-sm { max-width: 400px; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-family: 'Playfair Display', serif; font-size: 19px; color: var(--text); font-weight: 700; }

.modal-body   { padding: 16px 24px; }
.modal-footer {
  padding: 12px 24px 18px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.modal-close {
  background: none;
  border: none;
  font-size: 17px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.13s;
  line-height: 1;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

/* ===== MODAL SECTIONS ===== */
.section-block {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.section-block:last-child { border-bottom: none; margin-bottom: 0; }

.section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* Hours */
.hours-quick { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.time-quick-col { display: flex; flex-direction: column; gap: 6px; }
.time-quick-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-muted); }
.hours-arrow  { font-size: 16px; color: var(--border-strong); margin-top: 24px; }
.time-quick-total { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 2px; }

/* Time chips */
.time-chips { display: flex; flex-wrap: wrap; gap: 5px; }

.time-chip {
  padding: 6px 11px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.time-chip:hover  { border-color: var(--accent); color: var(--accent); }
.time-chip.active { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }

.time-adjust {
  font-size: 12px;
  padding: 5px 9px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  color: var(--text-soft);
  background: transparent;
  width: 108px;
  transition: all 0.15s;
  cursor: pointer;
}
.time-adjust:focus { outline: none; border-color: var(--accent); border-style: solid; color: var(--text); background: var(--surface); }
.time-adjust:disabled { opacity: 0.38; cursor: default; }

.chips-disabled { pointer-events: none; opacity: 0.38; }
.opt-label { font-size: 10px; font-weight: 400; color: var(--text-muted); text-transform: none; letter-spacing: 0; }

.total-display {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  padding: 6px 12px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  min-width: 68px;
  text-align: center;
}

/* Tasks */
.tasks-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--border-strong);
}

.task-time  { font-weight: 700; font-size: 12px; color: var(--accent); min-width: 70px; font-variant-numeric: tabular-nums; }
.task-label { flex: 1; font-size: 13px; }
.task-qty   { font-size: 11px; color: var(--text-muted); }
.task-del   { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; padding: 0 4px; line-height: 1; transition: color 0.13s; }
.task-del:hover { color: #B83232; }

/* ===== TASK MODAL FORM ===== */
.form-group { margin-bottom: 11px; }
.form-group label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.13s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

#day-notes {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  resize: vertical;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.13s;
}
#day-notes:focus { outline: none; border-color: var(--accent); background: var(--surface); }

/* ===== STATUS BADGE ===== */
.status-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 4px;
}
.status-badge.open      { background: #FFF3CD; color: #7A5800; }
.status-badge.validated { background: var(--sage-light); color: var(--sage); }
.status-badge.empty     { background: var(--surface-2); color: var(--text-muted); }

.validated-notice { display: flex; flex-direction: column; gap: 4px; color: var(--sage); font-size: 13px; font-weight: 500; }
.validated-by     { font-size: 11px; color: var(--text-muted); }

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.2px;
}
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--text); }

.btn-danger {
  background: var(--sage);
  color: #FFFFFF;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-danger:hover { background: #386854; }

.btn-logout {
  width: 100%;
  background: transparent;
  color: rgba(255,255,255,0.42);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-logout:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.75); border-color: rgba(255,255,255,0.18); }

.btn-nav {
  background: var(--surface);
  border: 1.5px solid var(--border);
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  font-size: 17px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
}
.btn-nav:hover { border-color: var(--accent); color: var(--accent); }

.btn-add {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px dashed var(--border);
  color: var(--text-soft);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  justify-content: center;
}
.btn-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.btn-sm {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
  color: var(--text);
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }

.btn-success { background: var(--sage); color: #FFFFFF; border-color: var(--sage); }
.btn-success:hover { background: #386854; border-color: #386854; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--text);
  color: #FFFFFF;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.22s ease;
}
.toast.hidden  { display: none; }
.toast.success { background: var(--sage); }
.toast.error   { background: #B83232; }

/* ===== UTILITIES ===== */
.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
  .sidebar { width: 54px; }
  .app-name, .sidebar-footer .user-badge, .nav-item span:not(.nav-icon) { display: none; }
  .main-content { margin-left: 54px; padding: 14px; }
  .calendar-grid { gap: 3px; }
  .cal-day { min-height: 50px; }
  .cal-day-num { font-size: 13px; }
}
