/* ============================================
   AUDIOCOSTRUZIONI HR — Design System
   Brand: Terracotta #c45428 + Teal #2d7b9a
   Theme: Light / Warm Cream
   Fonts: Nunito (headings) + DM Sans (body)
   ============================================ */

:root {
  /* Brand colours */
  --terra:          #c45428;
  --terra-dim:      #a83e1c;
  --terra-light:    #d9693c;
  --terra-glow:     rgba(196, 84, 40, 0.12);
  --terra-soft:     rgba(196, 84, 40, 0.07);

  --teal:           #2d7b9a;
  --teal-dim:       #1e5f7a;
  --teal-glow:      rgba(45, 123, 154, 0.12);
  --teal-soft:      rgba(45, 123, 154, 0.07);

  /* Backgrounds — warm cream hierarchy */
  --bg-base:        #f2ece5;
  --bg-surface:     #ffffff;
  --bg-elevated:    #faf7f4;
  --bg-hover:       #f5ede6;
  --border:         #e2d8ce;
  --border-light:   #ede5db;

  /* Text */
  --text-primary:   #1c1917;
  --text-secondary: #6b5f57;
  --text-muted:     #a0948b;

  /* Semantic colours */
  --green:          #2a9d6a;
  --green-soft:     rgba(42, 157, 106, 0.10);
  --red:            #d64040;
  --red-soft:       rgba(214, 64, 64, 0.10);
  --blue:           #2d7b9a;
  --blue-soft:      rgba(45, 123, 154, 0.10);
  --yellow:         #c48c14;
  --yellow-soft:    rgba(196, 140, 20, 0.10);

  /* Layout */
  --sidebar-w:      248px;
  --topbar-h:       60px;
  --radius:         8px;
  --radius-lg:      12px;
  --shadow:         0 4px 24px rgba(28, 25, 23, 0.10);
  --shadow-sm:      0 2px 8px rgba(28, 25, 23, 0.07);

  /* Typography */
  --font-head:      'Nunito', sans-serif;
  --font-body:      'DM Sans', sans-serif;

  --transition:     0.15s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   UTILITIES
   ============================================ */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ============================================
   LOGIN PAGE
   ============================================ */
.page { position: fixed; inset: 0; }
.page.active { display: flex; }
.page.hidden  { display: none; }

#page-login {
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-base);
}

/* Warm geometric background */
.login-bg {
  position: absolute;
  inset: 0;
  background: var(--bg-base);
  z-index: 0;
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 52px 52px;
  opacity: 0.5;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 80%);
}

.login-noise {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.5;
}

/* Terracotta decorative stripe top */
#page-login::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--terra), var(--teal));
  z-index: 2;
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 24px;
  animation: fadeUp 0.4s ease both;
}

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

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  box-shadow: var(--shadow), 0 0 60px rgba(196, 84, 40, 0.05);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 40px;
}

.logo-mark  { flex-shrink: 0; }
.logo-icon svg { width: 44px; height: 44px; }

.logo-text {
  display: flex;
  flex-direction: column;
}

/* Two-colour brand name matching logo */
.logo-name {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: -0.3px;
}
.logo-name .word-audio { color: var(--teal); }
.logo-name .word-costruzioni { color: var(--terra); }

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-top: 2px;
}

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

.form-group { display: flex; flex-direction: column; gap: 8px; }

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.input-wrap input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 44px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.input-wrap input:focus {
  border-color: var(--terra);
  box-shadow: 0 0 0 3px var(--terra-glow);
  background: var(--bg-surface);
}

.input-wrap input::placeholder { color: var(--text-muted); }

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  display: flex;
  align-items: center;
}
.toggle-password svg { width: 16px; height: 16px; }
.toggle-password:hover { color: var(--text-secondary); }

.form-error {
  background: var(--red-soft);
  border: 1px solid rgba(214, 64, 64, 0.25);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--red);
}

.btn-login {
  background: var(--terra);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  padding: 13px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-login:hover  { background: var(--terra-dim); box-shadow: 0 4px 12px rgba(196, 84, 40, 0.3); }
.btn-login:active { transform: scale(0.98); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-loader {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.login-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================
   APP SHELL
   ============================================ */
#page-app { display: flex; overflow: hidden; }
#page-app.active { display: flex; }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
  transition: width 0.2s ease, transform 0.2s ease;
}

/* Terracotta accent stripe on left edge */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--terra) 0%, var(--teal) 100%);
}

.sidebar-header {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

/* Sidebar brand name — two colour matching logo */
.sidebar-brand {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 15px;
  line-height: 1.15;
  display: flex;
  flex-direction: column;
}
.sidebar-brand .w-audio       { color: var(--teal); }
.sidebar-brand .w-costruzioni { color: var(--terra); font-size: 13px; }

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: none;
  flex-direction: column;
  gap: 4px;
}
.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.nav-section { display: flex; flex-direction: column; gap: 2px; }

.nav-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}

.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--terra-soft);
  color: var(--terra);
  font-weight: 700;
}
.nav-item.active svg { color: var(--terra); }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
}

.user-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--terra-soft);
  border: 1.5px solid var(--terra-light);
  color: var(--terra);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.sidebar-footer-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.btn-logout,
.btn-change-password {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color var(--transition), background var(--transition);
}
.btn-logout svg,
.btn-change-password svg { width: 16px; height: 16px; }
.btn-logout:hover { color: var(--red); background: var(--red-soft); }
.btn-change-password:hover { color: var(--primary); background: var(--primary-soft, rgba(196,84,40,0.08)); }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: none;
  padding: 4px;
}
.topbar-menu-btn svg { width: 20px; height: 20px; }

.topbar-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 18px;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.notif-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
  display: flex;
  align-items: center;
}
.notif-btn svg { width: 20px; height: 20px; }
.notif-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }

.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--terra);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 5px;
  line-height: 1.4;
  min-width: 16px;
  text-align: center;
}

.notif-panel {
  position: absolute;
  top: var(--topbar-h);
  right: 16px;
  width: 340px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 200;
  overflow: hidden;
  max-height: 480px;
  display: flex;
  flex-direction: column;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-text-sm {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--terra);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
}

.notif-list { overflow-y: auto; flex: 1; }

.notif-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.notif-item:hover { background: var(--bg-elevated); }
.notif-item.unread { border-left: 3px solid var(--terra); }
.notif-item .notif-title  { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.notif-item .notif-msg    { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.notif-item .notif-time   { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ============================================
   VIEW CONTAINER
   ============================================ */
.view-container {
  flex: 1;
  overflow-y: auto;
  padding: 32px 28px;
  background: var(--bg-base);
}

.view { display: none; }
.view.active { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================================
   CARDS & LAYOUT COMPONENTS
   ============================================ */
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}

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

.card-title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================================
   STAT CARDS — Fixed number rendering
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-sm); }

/* Colour accent — top border */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card.amber::before { background: var(--terra); }
.stat-card.green::before { background: var(--green); }
.stat-card.blue::before  { background: var(--teal); }
.stat-card.red::before   { background: var(--red); }

.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

/* Fixed: use DM Sans for numbers to avoid Syne "0" oval rendering */
.stat-value {
  font-family: var(--font-body);
  font-size: 30px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

/* Fixed: "Inviato" status should be smaller inline text, not a large number */
.stat-value.status-text {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-head);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0;
}

.stat-value.amber { color: var(--terra); }
.stat-value.green { color: var(--green); }
.stat-value.blue  { color: var(--teal); }
.stat-value.red   { color: var(--red); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }

.btn-primary {
  background: var(--terra);
  color: #ffffff;
}
.btn-primary:hover { background: var(--terra-dim); box-shadow: 0 3px 10px rgba(196, 84, 40, 0.25); }

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-elevated); border-color: var(--border-light); }

.btn-teal {
  background: var(--teal);
  color: #ffffff;
}
.btn-teal:hover { background: var(--teal-dim); }

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(214, 64, 64, 0.25);
}
.btn-danger:hover { background: rgba(214, 64, 64, 0.18); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }

.btn-outline {
  background: transparent;
  color: var(--terra);
  border: 1.5px solid var(--terra);
}
.btn-outline:hover { background: var(--terra-soft); }

.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============================================
   CALENDAR / TIMESHEET
   ============================================ */
.timesheet-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
}

.month-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}
.month-nav-btn:hover { color: var(--terra); }
.month-nav-btn svg { width: 16px; height: 16px; }

.month-label {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 160px;
  text-align: center;
}

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

.cal-day-header {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 8px 4px;
}

.cal-day {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 7px;
  min-height: 72px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cal-day:hover:not(.locked) {
  border-color: var(--terra);
  background: var(--terra-soft);
}

.cal-day.locked  { cursor: default; opacity: 0.65; }
.cal-day.today   { border-color: var(--terra); }
.cal-day.today .cal-day-num { color: var(--terra); font-weight: 800; }

.cal-day-num {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.cal-day-type {
  font-size: 10px;
  border-radius: 3px;
  padding: 1px 5px;
  font-weight: 600;
  display: inline-block;
  width: fit-content;
}

.type-work     { background: var(--bg-elevated); color: var(--text-secondary); }
.type-sick     { background: var(--red-soft);    color: var(--red); }
.type-vacation { background: var(--blue-soft);   color: var(--teal); }
.type-holiday  { background: var(--terra-soft);  color: var(--terra); }
.type-weekend  { background: var(--bg-elevated); color: var(--text-muted); }
.type-closure  { background: var(--yellow-soft); color: var(--yellow); }

.cal-day-hours {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--green);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cal-day-note {
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-day.empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
  pointer-events: none;
}

.timesheet-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 22px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.summary-value {
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.submission-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  gap: 16px;
  flex-wrap: wrap;
}

.submission-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.submitted { background: var(--green); box-shadow: 0 0 6px rgba(42,157,106,0.5); }
.status-dot.draft     { background: var(--terra);  box-shadow: 0 0 6px rgba(196,84,40,0.4); }

/* ============================================
   TABLES
   ============================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-elevated); }

tbody td {
  padding: 12px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}

.td-muted { color: var(--text-muted); }
.td-mono  { font-variant-numeric: tabular-nums; font-size: 12px; }

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-submitted { background: var(--green-soft);  color: var(--green); }
.badge-draft     { background: var(--yellow-soft);  color: var(--yellow); }
.badge-pending   { background: var(--red-soft);     color: var(--red); }
.badge-hr        { background: var(--terra-soft);   color: var(--terra); }
.badge-employee  { background: var(--blue-soft);    color: var(--teal); }
.badge-inactive  { background: var(--bg-elevated);  color: var(--text-muted); }

/* ============================================
   FORMS
   ============================================ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.form-field input,
.form-field select,
.form-field textarea {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--terra);
  box-shadow: 0 0 0 3px var(--terra-glow);
  background: var(--bg-surface);
}

.form-field select option { background: var(--bg-surface); }
.form-field textarea { resize: vertical; min-height: 80px; }

.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-bar select,
.filter-bar input {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
}

.filter-bar select:focus,
.filter-bar input:focus {
  border-color: var(--terra);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.55);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(28, 25, 23, 0.18);
  animation: slideUp 0.2s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}
.modal-close svg { width: 18px; height: 18px; }
.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  max-width: 320px;
  pointer-events: all;
  animation: toastIn 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--terra); }

.toast-icon { width: 16px; height: 16px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--green); }
.toast.error   .toast-icon { color: var(--red); }
.toast.info    .toast-icon { color: var(--terra); }

/* ============================================
   PAYSLIPS
   ============================================ */
.payslips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.payslip-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
.payslip-card:hover {
  border-color: var(--terra);
  box-shadow: var(--shadow-sm);
}

.payslip-month {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.payslip-year {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.payslip-size {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================
   HR SPECIFIC
   ============================================ */
.employee-row-actions { display: flex; gap: 6px; }

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

.hr-cal-day {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 6px;
  min-height: 64px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.hr-cal-day:hover {
  border-color: var(--terra);
  background: var(--terra-soft);
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ============================================
   LOADING / EMPTY STATES
   ============================================ */
.loader-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.loader {
  width: 32px;
  height: 32px;
  border: 2.5px solid var(--border);
  border-top-color: var(--terra);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  opacity: 0.35;
}

.empty-state p { font-size: 14px; }

/* ============================================
   WELCOME BANNER (Dashboard)
   ============================================ */
.welcome-banner {
  background: linear-gradient(135deg, var(--terra) 0%, var(--terra-dim) 100%);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  color: #fff;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.welcome-banner::after {
  content: 'audiocostruzioni';
  position: absolute;
  right: -10px;
  bottom: -18px;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 52px;
  color: rgba(255,255,255,0.07);
  white-space: nowrap;
  pointer-events: none;
  letter-spacing: -1px;
}

.welcome-name {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 4px;
}

.welcome-date {
  font-size: 14px;
  opacity: 0.8;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 200;
    transition: transform 0.2s ease;
  }

  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(28,25,23,0.15); }

  .topbar-menu-btn { display: flex; }

  .view-container { padding: 16px; }

  .calendar-grid { gap: 2px; }
  .cal-day { min-height: 52px; padding: 5px 4px; }
  .cal-day-type { display: none; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 24px; }

  .form-row  { grid-template-columns: 1fr; }
  .modal     { max-width: 100%; }

  :root { --sidebar-w: 248px; }
}

@media (max-width: 480px) {
  .stats-grid    { grid-template-columns: 1fr; }
  .section-header { flex-direction: column; }
  .welcome-banner { padding: 18px 20px; }
  .welcome-name   { font-size: 20px; }
}
