:root {
  --primary: #1e4d3b;
  --primary-light: #2d6b54;
  --primary-pale: #e8f1ec;
  --accent: #d97706;
  --accent-light: #fef3c7;
  --bg: #fafaf7;
  --surface: #ffffff;
  --border: #e5e3dc;
  --border-strong: #c9c5b9;
  --text: #1c1b18;
  --text-muted: #6b6862;
  --text-light: #9a968c;
  --success: #16a34a;
  --success-pale: #dcfce7;
  --danger: #dc2626;
  --danger-pale: #fee2e2;
  --warning: #d97706;
  --warning-pale: #fef3c7;
  --info: #0891b2;
  --info-pale: #cffafe;
  --weekend: #f5f3ed;
  --holiday: #fce7f3;
  --pu-bg: #ede9fe;
  --pu-color: #6d28d9;
  --ru-bg: #ecfeff;
  --ru-color: #0e7490;
  --shadow-sm: 0 1px 2px rgba(28,27,24,0.04);
  --shadow: 0 1px 3px rgba(28,27,24,0.08), 0 1px 2px rgba(28,27,24,0.04);
  --shadow-lg: 0 10px 25px rgba(28,27,24,0.08), 0 4px 10px rgba(28,27,24,0.04);
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3, .display { font-family: 'Fraunces', Georgia, serif; font-weight: 600; letter-spacing: -0.02em; }

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

.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 48px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
}

.login-card h1 {
  font-size: 28px;
  margin-bottom: 8px;
  color: var(--primary);
}

.login-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 14px;
}

.demo-users {
  background: var(--primary-pale);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 24px;
}

.demo-users-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 12px;
}

.demo-user {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: white;
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
}

.demo-user:last-child { margin-bottom: 0; }
.demo-user:hover { background: var(--primary); color: white; }
.demo-user .role { color: var(--text-muted); font-size: 11px; }
.demo-user:hover .role { color: rgba(255,255,255,0.8); }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-pale);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: white; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg); border-color: var(--text-muted); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* === APP LAYOUT === */
.app { display: none; min-height: 100vh; }
.app.active { display: block; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--primary);
}

.brand-mark {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

.user-info { display: flex; align-items: center; gap: 16px; }
.user-info .name { font-weight: 500; }
.user-info .role-badge {
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.container { max-width: 1700px; margin: 0 auto; padding: 24px; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab {
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.15s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.view { display: none; }
.view.active { display: block; }

/* === CARDS === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title { font-size: 16px; font-weight: 600; }

/* === STATS GRID === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
}

.stat-card.accent::before { background: var(--accent); }
.stat-card.success::before { background: var(--success); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.info::before { background: var(--info); }
.stat-card.pu::before { background: var(--pu-color); }
.stat-card.ru::before { background: var(--ru-color); }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
}

.stat-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* === SCHOOL YEAR SELECTOR BAR === */
.school-year-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.school-year-bar:empty { display: none; }
.school-year-bar .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.school-year-bar select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-weight: 500; background: var(--bg); cursor: pointer; }
.school-year-bar .badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.school-year-bar .badge.active { background: var(--success-pale); color: var(--success); }
.school-year-bar .badge.archived { background: var(--warning-pale); color: var(--warning); }
.school-year-bar .badge.readonly { background: var(--info-pale); color: var(--info); }

/* === MONTHLY TABLE === */
.month-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.month-nav { display: flex; align-items: center; gap: 8px; }

.month-name {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 600;
  min-width: 200px;
  text-align: center;
}

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
}

.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
}

.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  box-shadow: var(--shadow-sm);
}

table.evidence {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  table-layout: fixed;
}

table.evidence th, table.evidence td {
  border: 1px solid var(--border);
  padding: 6px 2px;
  text-align: center;
  height: 34px;
  vertical-align: middle;
}

table.evidence thead th {
  background: var(--primary);
  color: white;
  font-weight: 500;
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* First column: fixed width to fit longest label */
table.evidence thead th:first-child,
table.evidence thead th.label,
table.evidence tbody td.label {
  width: 190px;
  min-width: 190px;
  max-width: 190px;
  text-align: left;
  padding-left: 12px;
  padding-right: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Last column (sum): fixed width */
table.evidence thead th.sum-header,
table.evidence thead th:last-child,
table.evidence tbody td.sum-col {
  width: 50px;
  min-width: 50px;
  max-width: 50px;
  font-weight: 600;
  background: var(--bg);
}

/* Day columns: auto-distribute remaining space */
table.evidence thead th:not(:first-child):not(:last-child):not(.sum-header):not(.label),
table.evidence tbody td.day-cell {
  width: auto;
  min-width: 24px;
}

table.evidence thead th.weekend-header { background: var(--primary-light); }
table.evidence thead th.holiday-header { background: var(--accent); }

/* User table filter row */
.users-filter-row th {
  background: var(--bg) !important;
  padding: 6px 8px !important;
  border-bottom: 2px solid var(--border) !important;
  text-transform: none !important;
  font-weight: normal !important;
  letter-spacing: normal !important;
  color: var(--text) !important;
  font-size: 12px !important;
}
.filter-input {
  font-size: 12px !important;
  padding: 4px 6px !important;
  height: auto !important;
  width: 100% !important;
  min-width: 60px;
}

table.evidence tbody td.label {
  font-weight: 500;
  background: var(--bg);
  position: sticky;
  left: 0;
  z-index: 5;
  font-size: 12.5px;
}

/* Compact variant for summary tables (e.g. "Pregled po mesecih") */
table.evidence.evidence-compact {
  table-layout: auto;
}
table.evidence.evidence-compact tbody td.label,
table.evidence.evidence-compact thead th:first-child,
table.evidence.evidence-compact thead th.label {
  width: auto;
  min-width: 0;
  max-width: none;
  white-space: nowrap;
  padding-right: 14px;
}
table.evidence.evidence-compact thead th {
  white-space: nowrap;
  padding-left: 10px;
  padding-right: 10px;
  width: auto;
  min-width: 0;
  max-width: none;
}
table.evidence.evidence-compact tbody td {
  white-space: nowrap;
  padding-left: 10px;
  padding-right: 10px;
}

table.evidence tbody tr:hover td.label { background: var(--primary-pale); }
table.evidence tbody td.weekend { background: var(--weekend); color: var(--text-light); }
table.evidence tbody td.holiday { background: var(--holiday); }

table.evidence tbody td.editable {
  cursor: pointer;
  transition: background 0.1s;
}

table.evidence tbody td.editable:hover { background: var(--primary-pale); }

/* Section dividers within evidence table */
table.evidence tbody tr.section-header td {
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 6px 12px;
  height: auto;
}

table.evidence tbody tr.section-header td.label {
  background: var(--primary);
  color: white;
}

table.evidence tbody tr.pu-row td.label { background: var(--pu-bg); color: var(--pu-color); border-left: 3px solid var(--pu-color); padding-left: 9px; }
table.evidence tbody tr.ru-row td.label { background: var(--ru-bg); color: var(--ru-color); border-left: 3px solid var(--ru-color); padding-left: 9px; }
table.evidence tbody tr.summary-row td.label { background: var(--primary-pale); color: var(--primary); font-weight: 700; }
table.evidence tbody tr.summary-row td { font-weight: 700; }
table.evidence tbody tr.summary-row.pu-summary td.label { background: var(--pu-bg); color: var(--pu-color); border-left: 3px solid var(--pu-color); padding-left: 9px; }
table.evidence tbody tr.summary-row.pu-summary td { color: var(--pu-color); }
table.evidence tbody tr.summary-row.ru-summary td.label { background: var(--ru-bg); color: var(--ru-color); border-left: 3px solid var(--ru-color); padding-left: 9px; }
table.evidence tbody tr.summary-row.ru-summary td { color: var(--ru-color); }

/* Cell value styling by type */
.val-sd { background: var(--info-pale); color: var(--info); font-weight: 600; }
.val-d { background: var(--success-pale); color: var(--success); font-weight: 600; }
.val-i { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.val-b { background: var(--danger-pale); color: var(--danger); font-weight: 600; }

.diff-positive { color: var(--success); font-weight: 600; }
.diff-negative { color: var(--danger); font-weight: 600; }
.diff-zero { color: var(--text-muted); }

table.evidence td.sum-col {
  background: var(--primary-pale);
  font-weight: 600;
  color: var(--primary);
  width: 60px;
  min-width: 60px;
  position: sticky;
  right: 0;
  z-index: 5;
}

table.evidence thead th.sum-header {
  background: var(--primary-light);
  position: sticky;
  right: 0;
  z-index: 11;
}

/* === MONTH SUMMARY GRID (3 boxes) === */
.month-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}
.month-summary-grid[data-cols="4"] {
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
}

.summary-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.summary-box h4 {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.summary-box.pu-box h4 { color: var(--pu-color); }
.summary-box.ru-box h4 { color: var(--ru-color); }
.summary-box.pu-box { border-left: 3px solid var(--pu-color); }
.summary-box.ru-box { border-left: 3px solid var(--ru-color); }

.summary-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}

.summary-line:last-child { border-bottom: none; }
.summary-line strong { font-weight: 600; }

/* === MODAL === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28,27,24,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal {
  background: var(--surface);
  border-radius: 12px;
  padding: 24px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal h3 { font-size: 18px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

.cell-options {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.cell-option {
  padding: 12px 8px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  background: white;
}

.cell-option:hover { border-color: var(--primary); background: var(--primary-pale); }
.cell-option.selected { border-color: var(--primary); background: var(--primary-pale); }
.cell-option .code { font-family: 'Fraunces', serif; font-weight: 600; font-size: 16px; display: block; }
.cell-option .desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.2; }

/* PU/RU input groups */
.input-group-section {
  background: var(--bg);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.input-group-section.pu-section { background: var(--pu-bg); }
.input-group-section.ru-section { background: var(--ru-bg); }

.input-group-section h5 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.input-group-section.pu-section h5 { color: var(--pu-color); }
.input-group-section.ru-section h5 { color: var(--ru-color); }

.input-row {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.input-row label { font-size: 12px; }
.input-row input { padding: 6px 10px; font-size: 13px; }

/* === EMPLOYEE LIST === */
.employee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.employee-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.15s;
}

.employee-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.employee-card .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-pale);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 12px;
}

.employee-card .ename { font-weight: 600; margin-bottom: 2px; }
.employee-card .erole { font-size: 12px; color: var(--text-muted); }
.employee-card .eunit { font-size: 12px; color: var(--text-light); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

.employee-card .estats {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  font-size: 11px;
  flex-wrap: wrap;
}

.employee-card .estats span {
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--text-muted);
}

.employee-card .estats .type-strokovni { background: var(--pu-bg); color: var(--pu-color); }
.employee-card .estats .type-tehnicni { background: var(--accent-light); color: var(--accent); }
.employee-card .estats .type-vodstveni { background: var(--info-pale); color: var(--info); }
.employee-card .estats .type-zgodnja-obravnava { background: var(--success-pale); color: var(--success); }

.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-bar .form-control { width: auto; min-width: 180px; }

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  border-left: 3px solid;
}

.alert-info { background: var(--info-pale); border-color: var(--info); color: #155e75; }
.alert-warning { background: var(--warning-pale); border-color: var(--warning); color: #92400e; }
.alert-success { background: var(--success-pale); border-color: var(--success); color: #15803d; }

.note-item {
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.note-item .note-date { color: var(--text-muted); font-size: 11px; flex-shrink: 0; }

#notesList { display: flex; flex-direction: column; gap: 6px; }

textarea.form-control { min-height: 60px; resize: vertical; font-family: inherit; }

/* ============================================ */
/* MOBILE VIEW - Day list (1 day = 1 card)     */
/* ============================================ */

.mobile-view { display: none; }
.desktop-view { display: block; }

@media (max-width: 900px) {
  .container { padding: 12px; }
  .month-summary-grid { grid-template-columns: 1fr; }
  .month-summary-grid[data-cols="4"] { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
  .cell-options { grid-template-columns: 1fr 1fr; }

  .topbar { padding: 10px 12px; }
  .topbar .name { display: none; }
  .brand { font-size: 16px; }

  .mobile-view { display: block; }
  .desktop-view { display: none; }

  .month-controls { flex-direction: column; align-items: stretch; gap: 8px; }
  .month-nav { justify-content: space-between; }
  .month-name { font-size: 18px; min-width: auto; flex: 1; }
  .legend { display: none; } /* hide legend on mobile, info shown per-day */

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 22px; }

  .filter-bar { flex-direction: column; }
  .filter-bar .form-control { width: 100%; }

  .tabs { gap: 0; }
  .tab { padding: 10px 12px; font-size: 13px; }

  /* Hide manager-tab labels on mobile, only icons */
  .tab .tab-text { display: none; }
}

/* === MOBILE DAY LIST === */
.mobile-day-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mday {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.mday:active { transform: scale(0.99); background: var(--primary-pale); }
.mday.weekend { background: var(--weekend); }
.mday.holiday { background: var(--holiday); }
.mday.future { opacity: 0.55; }

.mday-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: var(--bg);
  flex-shrink: 0;
}

.mday-date .num {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 20px;
  line-height: 1;
}

.mday-date .day {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
  letter-spacing: 0.05em;
}

.mday.weekend .mday-date,
.mday.holiday .mday-date { background: white; }

.mday-content {
  flex: 1;
  min-width: 0;
}

.mday-main {
  font-weight: 500;
  font-size: 14px;
  line-height: 1.3;
  margin-bottom: 2px;
}

.mday-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.mday-meta .pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-muted);
}

.mday-meta .pill.pu { background: var(--pu-bg); color: var(--pu-color); }
.mday-meta .pill.ru { background: var(--ru-bg); color: var(--ru-color); }
.mday-meta .pill.diff-pos { background: var(--success-pale); color: var(--success); }
.mday-meta .pill.diff-neg { background: var(--danger-pale); color: var(--danger); }

.mday-tag {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 14px;
  padding: 4px 10px;
  border-radius: 6px;
  flex-shrink: 0;
}

.mday-tag.SD { background: var(--info-pale); color: var(--info); }
.mday-tag.D { background: var(--success-pale); color: var(--success); }
.mday-tag.I { background: var(--accent-light); color: var(--accent); }
.mday-tag.B { background: var(--danger-pale); color: var(--danger); }
.mday-tag.holiday { background: var(--holiday); color: var(--accent); font-size: 11px; max-width: 110px; text-align: right; line-height: 1.2; }

.mday-arrow {
  color: var(--text-light);
  font-size: 18px;
  flex-shrink: 0;
}

.mday.empty .mday-main {
  color: var(--text-light);
  font-style: italic;
  font-weight: 400;
}

.mday.has-entry .mday-arrow { color: var(--primary); }

/* Mobile modal - full screen */
@media (max-width: 600px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 16px 16px 0 0;
    padding: 20px 16px;
  }
  .input-row { grid-template-columns: 1fr 80px; gap: 6px; }
  .input-row label { font-size: 11px; line-height: 1.25; }
  .input-row input { padding: 8px 10px; font-size: 14px; }
  .cell-options { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .cell-option { padding: 8px 4px; }
  .cell-option .code { font-size: 14px; }
  .cell-option .desc { font-size: 10px; }
  .input-group-section { padding: 10px; }
  .input-group-section h5 { font-size: 11px; margin-bottom: 8px; }

  /* Sticky modal header on small screens */
  .modal h3 { position: sticky; top: -20px; background: var(--surface); padding: 8px 0; margin: -8px 0 12px 0; z-index: 5; }
}

/* Mobile evidence summary boxes layout */
@media (max-width: 600px) {
  .summary-box { padding: 12px; }
  .summary-box h4 { font-size: 11px; }
  .summary-line { font-size: 12px; }

  /* employee cards - more compact */
  .employee-grid { grid-template-columns: 1fr; gap: 10px; }
  .employee-card { padding: 14px; display: flex; align-items: center; gap: 12px; }
  .employee-card .avatar { margin-bottom: 0; width: 40px; height: 40px; font-size: 14px; flex-shrink: 0; }
  .employee-card .ename, .employee-card .erole, .employee-card .estats, .employee-card .eunit { width: 100%; }
  .employee-card .ename { font-size: 14px; }
  .employee-card .erole { font-size: 12px; }
  .employee-card .eunit { font-size: 11px; padding-top: 4px; margin-top: 4px; }
  .employee-card .estats { margin-top: 4px; }
  .employee-card .estats span { font-size: 10px; padding: 2px 6px; }
}