/* ═══════════════════════════════════════════════════════════════
   Vaktplan — style.css
   Light + dark mode, public calendar, wage panel, search tab.
   Dark mode activates via [data-theme="dark"] on <html>.
═══════════════════════════════════════════════════════════════ */

/* ── Light mode variables ─────────────────────────────────── */
:root {
  --bg:             #f7f7f5;
  --bg-alt:         #f0efe9;
  --surface:        #ffffff;
  --surface-raised: #ffffff;
  --border:         #e2e0d8;
  --border-strong:  #c8c5bb;
  --text:           #1a1a18;
  --text-muted:     #6b6960;
  --text-faint:     #a09d94;
  --accent:         #1a5c8a;
  --accent-light:   #e8f2f9;
  --accent-mid:     #b3d2e8;
  --evening:        #7c4d9e;
  --evening-light:  #f2edf8;
  --night:          #1a3a5c;
  --night-light:    #e8eef5;
  --weekend:        #c26b1a;
  --weekend-light:  #fdf1e7;
  --redday:         #b02020;
  --redday-light:   #fdf0f0;
  --overtime:       #2a7a4a;
  --overtime-light: #edf7f2;
  --radius:         10px;
  --radius-sm:      6px;
  --shadow:         0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.08);
}

/* ── Dark mode variables ──────────────────────────────────── */
[data-theme="dark"] {
  --bg:             #111110;
  --bg-alt:         #191917;
  --surface:        #1e1e1b;
  --surface-raised: #252522;
  --border:         #2c2c28;
  --border-strong:  #3d3d38;
  --text:           #e8e6de;
  --text-muted:     #b8b5ac;
  --text-faint:     #7a7870;
  --accent:         #4a9fd4;
  --accent-light:   #1a2535;
  --accent-mid:     #1e3d55;
  --evening:        #7aabcf;
  --evening-light:  #1a2535;
  --night:          #7aabcf;
  --night-light:    #1a2535;
  --weekend:        #d4883a;
  --weekend-light:  #1e1e1b;
  --redday:         #d46060;
  --redday-light:   #1e1e1b;
  --overtime:       #5abf7a;
  --overtime-light: #0e2018;
  --shadow:         0 1px 3px rgba(0,0,0,0.5);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.6);
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, input, select, textarea { font-family: inherit; }

/* ── Base ─────────────────────────────────────────────────── */
/* Always reserve the scrollbar's width so the centered page doesn't shift sideways when a tab
   is short enough to hide the scrollbar (e.g. switching Personal <-> Shift calendar). */
html { transition: background 0.2s; scrollbar-gutter: stable; }

body {
  font-family: var(--heading-font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════════════ */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.logo {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
  flex-shrink: 0;
}
.logo span { color: var(--accent); }

[data-theme="dark"] .logo span { color: #4a9fd4; }

nav { display: flex; gap: 4px; }

nav button {
  background: none;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
nav button:hover  { background: var(--bg); color: var(--text); }
nav button.active { background: var(--accent-light); color: var(--accent); font-weight: 500; }

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

#header-username { font-size: 13px; color: var(--text-faint); }

.logout-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.logout-btn:hover { background: var(--bg); color: var(--text); }

.dark-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.dark-toggle:hover { background: var(--bg); border-color: var(--border-strong); }

/* User-chosen background image, behind the (opaque) UI cards. Set via
   applyUserBackground() in settings.js, which writes --user-bg-image /
   --user-bg-opacity as inline styles on this element. */
.user-bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
#app-screen > header, #app-screen > main { position: relative; z-index: 1; }
#public-screen > header, #public-screen > .public-main { position: relative; z-index: 1; }

/* Heading font choice — see applyHeadingFont() in settings.js.
   Applied to headings/labels only; body text stays in the system font. */
:root { --heading-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
[data-font="inter"]         { --heading-font: 'Inter', sans-serif; }
[data-font="poppins"]       { --heading-font: 'Poppins', sans-serif; }
[data-font="space-grotesk"] { --heading-font: 'Space Grotesk', sans-serif; }
[data-font="fraunces"]      { --heading-font: 'Fraunces', serif; }
[data-font="jetbrains-mono"]{ --heading-font: 'JetBrains Mono', monospace; }

/* ═══════════════════════════════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════════════════════════════ */
main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

.page { display: none; }
.page.visible { display: block; }

/* ═══════════════════════════════════════════════════════════════
   AUTH SCREEN
═══════════════════════════════════════════════════════════════ */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-md);
}

.auth-logo { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; color: var(--text); }
.auth-logo span { color: var(--accent); }
.auth-subtitle { font-size: 14px; color: var(--text-faint); margin-top: -4px; }

.auth-error {
  background: var(--redday-light);
  color: var(--redday);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
}

.auth-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.auth-btn:hover    { opacity: 0.88; }
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-toggle {
  text-align: center;
  font-size: 13px;
  color: var(--text-faint);
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
}
.auth-toggle-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════
   PUBLIC SCREEN
═══════════════════════════════════════════════════════════════ */
#public-screen { display: none; min-height: 100vh; flex-direction: column; }
#public-screen.visible { display: flex; }

.public-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.public-header-right { display: flex; align-items: center; gap: 10px; }

.login-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.login-btn:hover { opacity: 0.88; }

.public-main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; flex: 1; }

.public-intro { margin-bottom: 1.5rem; }
.public-intro h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.public-intro p  { font-size: 14px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════
   PUBLIC VIEW TABS
═══════════════════════════════════════════════════════════════ */
.pub-view-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
}

.pub-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 20px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
}
.pub-tab:hover        { color: var(--text); }
.pub-tab.active       { color: var(--accent); border-bottom-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   PUBLIC SALARY VIEW
═══════════════════════════════════════════════════════════════ */
.pub-salary-hint {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 1.5rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
  text-decoration: underline;
}

.pub-salary-layout {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 1.5rem;
  align-items: flex-start;
}

.pub-salary-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem;
  box-shadow: var(--shadow);
}

@media (max-width: 760px) {
  .pub-salary-layout { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   SYNC BAR
═══════════════════════════════════════════════════════════════ */
.sync-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-faint);
}

.sync-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
  white-space: nowrap;
}
.sync-btn:hover    { background: var(--bg); }
.sync-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════════════
   MONTH NAV
═══════════════════════════════════════════════════════════════ */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.month-label { font-size: 18px; font-weight: 700; }

.btn-icon {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-icon:hover    { border-color: var(--border-strong); color: var(--text); background: var(--bg); }
.btn-icon:disabled { opacity: 0.3; cursor: not-allowed; }

.save-changes-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-faint);
  cursor: pointer;
}
.save-changes-btn:disabled  { opacity: 0.5; cursor: default; }
.save-changes-btn:not(:disabled):hover { border-color: var(--border-strong); color: var(--text); }
.save-changes-btn.active {
  background: var(--overtime);
  color: #fff;
  border-color: var(--overtime);
  opacity: 1;
}

.ot-notice {
  background: var(--overtime-light);
  border: 1px solid var(--overtime);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--overtime);
  margin-bottom: 1rem;
  opacity: 0.9;
}

/* ═══════════════════════════════════════════════════════════════
   CALENDAR LAYOUT
   32px left padding when collapsed so calendar stays centered.
   :has() removes it when panel is expanded.
═══════════════════════════════════════════════════════════════ */
.calendar-layout {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding-left: 32px;
}

.calendar-layout:has(.wage-panel:not(.collapsed)) {
  padding-left: 0;
}

#calendar-grid        { flex: 1; min-width: 0; }
#public-calendar-grid { flex: 1; min-width: 0; }

/* ═══════════════════════════════════════════════════════════════
   WAGE PANEL
═══════════════════════════════════════════════════════════════ */
.wage-panel {
  width: 160px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: sticky;
  top: 72px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: width 0.2s;
}

/* Collapsed state — 32px strip, just the chevron visible */
.wage-panel.collapsed {
  width: 32px;
  min-width: 32px;
}
.wage-panel.collapsed .wage-panel-body  { display: none; }
.wage-panel.collapsed .wage-panel-title { display: none; }
.wage-panel.collapsed .wage-panel-header {
  padding: 8px 6px;
  justify-content: center;
  border-bottom: none;
}

.wage-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.875rem;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.wage-panel-header:hover { background: var(--bg); }

.wage-panel-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wage-panel-chevron {
  font-size: 10px;
  color: var(--text-faint);
  transition: transform 0.2s;
}
.wage-panel.collapsed .wage-panel-chevron { transform: rotate(-90deg); }

.wage-panel-body {
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
}

.wage-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.wage-stat:last-child  { border-bottom: none; padding-bottom: 0; }
.wage-stat:first-child { padding-top: 0; }

.wage-stat-label {
  font-size: 10px;
  color: var(--text-faint);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wage-stat-value { font-size: 15px; font-weight: 700; color: var(--text); }

/* After tax — prominent */
.wage-stat.net .wage-stat-label { color: var(--accent); opacity: 0.8; }
.wage-stat.net .wage-stat-value { font-size: 18px; color: var(--accent); }

/* Feriepenger */
.wage-stat.ferie .wage-stat-value { color: var(--overtime); font-size: 13px; font-weight: 600; }
.wage-stat.ferie .wage-stat-label { color: var(--overtime); opacity: 0.75; }

.wage-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Dark mode wage panel */
[data-theme="dark"] .wage-panel          { background: #171714; border-color: #252522; }
[data-theme="dark"] .wage-stat.net .wage-stat-value { color: #e8e6de; font-size: 18px; }
[data-theme="dark"] #sum-gross           { color: #e8e6de; font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════
   WEEK ROWS
═══════════════════════════════════════════════════════════════ */
.week-row { margin-bottom: 1rem; }

.week-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
  padding-left: 2px;
}
.week-header span { font-weight: 400; margin-left: 6px; text-transform: none; letter-spacing: 0; }

.week-cells {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: start;
  gap: 5px;
}

/* ═══════════════════════════════════════════════════════════════
   DAY CELL
═══════════════════════════════════════════════════════════════ */
.day-cell {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 5px 5px;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}

.day-cell.other-month       { background: var(--bg-alt); opacity: 0.55; }
.day-cell.is-weekend-window { background: var(--weekend-light); }
.day-cell.is-red-day        { background: var(--redday-light); }
.day-cell.has-shift         { border-color: var(--accent-mid); }
.day-cell.today             { border-color: var(--accent); }
.day-cell.today .day-num    { color: var(--accent); }

/* Nothing scheduled that day — just the number, no empty shift rows */
.day-cell.empty-day {
  min-height: unset;
  padding: 6px 5px;
  gap: 0;
}

/* Dark mode day cells — all same color, no tints */
[data-theme="dark"] .day-cell                  { background: #171714; border-color: #2c2c28; }
[data-theme="dark"] .day-cell.other-month      { background: #141412; opacity: 0.5; }
[data-theme="dark"] .day-cell.is-weekend-window { background: #171714; }
[data-theme="dark"] .day-cell.is-red-day       { background: #171714; }
[data-theme="dark"] .day-cell.has-shift        { border-color: #2c2c28; }
[data-theme="dark"] .day-cell.today            { border-color: #1a3350; }
[data-theme="dark"] .day-cell.today .day-num   { color: #1a3350; }

/* Public calendar cells */
.public-day-cell {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 5px 5px;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
  transition: border-color 0.15s;
}
.public-day-cell.other-month { background: var(--bg-alt); opacity: 0.4; }
.public-day-cell.has-shift   { border-color: var(--accent-mid); background: var(--accent-light); }
.public-day-cell.today       { border-color: var(--accent); }
.public-day-cell.today .day-num { color: var(--accent); }

.day-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.day-num { font-size: 15px; font-weight: 700; line-height: 1; margin-bottom: 1px; }

.redday-star {
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 9px;
  color: var(--redday);
  font-weight: 700;
  cursor: default;
}

/* ═══════════════════════════════════════════════════════════════
   SHIFT BUTTONS
═══════════════════════════════════════════════════════════════ */
.shift-btns { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }

.shift-btn {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 4px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg);
  color: var(--text-faint);
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  width: 100%;
  line-height: 1.2;
  position: relative;
}
.shift-btn:hover { border-color: var(--border-strong); color: var(--text-muted); }
/* Read-only slot in the Shift calendar tab. The outline is transparent rather than removed so
   rows keep their size; the dark selector is needed to beat the dark theme's own border color. */
.shift-btn.static,
[data-theme="dark"] .shift-btn.static { cursor: default; pointer-events: none; border-color: transparent; }

.shift-btn.active-day   { background: var(--accent-light);  color: var(--accent);  border-color: var(--accent-mid); }
.shift-btn.active-eve   { background: var(--evening-light); color: var(--evening); border-color: var(--evening); }
.shift-btn.active-night { background: var(--night-light);   color: var(--night);   border-color: var(--night); }

/* Dark mode shift buttons */
[data-theme="dark"] .shift-btn {
  background:   #1a1a17;
  color:        #7a7870;
  border-color: #252522;
}

.shift-btn-wrap { position: relative; }
.shift-btn-wrap.has-ot-menu .shift-btn { padding-right: 22px; }

.manual-ot-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--overtime);
}
.manual-ot-dot.unsaved { background: #d9a441; }

.ot-menu-btn {
  position: absolute;
  top: 50%;
  right: 2px;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  color: inherit;
  opacity: 0.55;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 2;
}
.ot-menu-btn:hover { opacity: 1; background: rgba(0,0,0,0.12); }

.shift-btn.active-day   ~ .ot-menu-btn { color: var(--accent); }
.shift-btn.active-eve   ~ .ot-menu-btn { color: var(--evening); }
.shift-btn.active-night ~ .ot-menu-btn { color: var(--night); }

.ot-popup {
  position: fixed;
  z-index: 1000;
  background: var(--bg-card, var(--bg));
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  width: 180px;
}
.ot-popup-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.ot-popup-row label { font-size: 11px; color: var(--text-faint); }
.ot-popup-row select, .ot-popup-row input {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
}
.ot-popup-actions { display: flex; gap: 6px; }
.ot-popup-btn {
  flex: 1;
  font-size: 11px;
  padding: 5px 4px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.ot-popup-btn.save   { background: var(--overtime); color: #fff; border-color: var(--overtime); }
.ot-popup-btn.remove { color: var(--redday); }
.ot-popup-btn.delete { background: var(--redday); color: #fff; border-color: var(--redday); }
.ot-popup-btn:hover  { border-color: var(--border-strong); }
[data-theme="dark"] .shift-btn:hover {
  color:        #b0aea6;
  border-color: var(--border-strong);
  background:   #222220;
}
/* Active shifts — back to lighter blue */
[data-theme="dark"] .shift-btn.active-day,
[data-theme="dark"] .shift-btn.active-eve,
[data-theme="dark"] .shift-btn.active-night {
  background:   #1a2d42;
  color:        #7aabcf;
  border-color: #2a4a6a;
}
.shift-btn-label { flex: 1; text-align: left; }
.shift-btn-time  { opacity: 0.65; font-weight: 400; white-space: nowrap; font-size: 9px; }

.ot-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--redday);
  flex-shrink: 0;
  display: none;
}
.shift-btn.is-overtime .ot-dot { display: block; }

/* Manual shift indicator dot */
.scraped-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* Public shift pills */
.public-shift-pill {
  border-radius: 4px;
  padding: 3px 5px;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  margin-top: auto;
}
.public-shift-pill.fm { background: var(--accent-light);  color: var(--accent); }
.public-shift-pill.em { background: var(--evening-light); color: var(--evening); }
.public-shift-pill.na { background: var(--night-light);   color: var(--night); }
.public-shift-time    { font-size: 9px; font-weight: 400; opacity: 0.75; display: block; margin-top: 1px; }

/* Plain per-day list on the signed-out page — one line per day worked */
#public-list { display: flex; flex-direction: column; }

.public-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px;
}

.public-list-date {
  min-width: 90px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.public-list-shifts {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.public-list-shift {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.public-list-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   SETTINGS
═══════════════════════════════════════════════════════════════ */
.settings-section { margin-bottom: 2rem; }

.settings-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.settings-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings-desc  { font-size: 13px; color: var(--text-faint); margin-bottom: 16px; margin-top: -4px; }

.field          { display: flex; flex-direction: column; gap: 5px; }
.field label    { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.field .hint    { font-size: 12px; color: var(--text-faint); }

.field input,
.field select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 15px;
  color: var(--text);
  width: 100%;
  transition: border-color 0.15s;
}
.field input:focus,
.field select:focus { outline: none; border-color: var(--accent); }

.toggle-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.toggle-label { font-size: 15px; }
.toggle-sub   { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.toggle       { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }

.slider-track {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.slider-track::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle input:checked + .slider-track              { background: var(--accent); }
.toggle input:checked + .slider-track::before      { transform: translateX(20px); }

.save-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.save-btn:hover { opacity: 0.88; }
.save-btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.save-btn.secondary:hover { background: var(--bg); }

.mingat-status-box {
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.mingat-status-box.ok    { background: var(--overtime-light); color: var(--overtime); }
.mingat-status-box.error { background: var(--redday-light);   color: var(--redday); }

/* ═══════════════════════════════════════════════════════════════
   SEARCH TAB
═══════════════════════════════════════════════════════════════ */
.search-section          { margin-bottom: 2rem; }
.search-section h2       { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.search-section p        { font-size: 14px; color: var(--text-muted); margin-bottom: 1.25rem; }

.search-input-wrap       { max-width: 400px; position: relative; margin-bottom: 1rem; }
.search-input-wrap input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 15px;
  color: var(--text);
  width: 100%;
  transition: border-color 0.15s;
}
.search-input-wrap input:focus       { outline: none; border-color: var(--accent); }
.search-input-wrap input::placeholder { color: var(--text-faint); }

.colleague-results { margin-top: 4px; max-width: 480px; }
.colleague-empty,
.colleague-loading { font-size: 13px; color: var(--text-faint); padding: 12px 0; }

.colleague-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.colleague-name { font-size: 14px; font-weight: 500; color: var(--text); flex: 1; }
.colleague-dept { font-size: 12px; color: var(--text-faint); }

.colleague-view-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
  white-space: nowrap;
}
.colleague-view-btn:hover { background: var(--bg); }

.colleague-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}
.colleague-cal-name { font-size: 15px; font-weight: 600; }
.colleague-cal-nav  { display: flex; align-items: center; gap: 8px; }
.colleague-cal-month { font-size: 14px; font-weight: 500; }

.colleague-back-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  margin-left: 8px;
}

.colleague-shift-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.colleague-shift-date { min-width: 130px; color: var(--text-faint); }

.colleague-tag          { font-size: 11px; padding: 2px 7px; border-radius: 5px; font-weight: 600; }
.colleague-tag.active-day   { background: var(--accent-light);  color: var(--accent); }
.colleague-tag.active-eve   { background: var(--evening-light); color: var(--evening); }
.colleague-tag.active-night { background: var(--night-light);   color: var(--night); }

.shift-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
  display: inline-block;
  margin: 1px 2px 1px 0;
}

/* ═══════════════════════════════════════════════════════════════
   SCHEDULE TEMPLATES
═══════════════════════════════════════════════════════════════ */
.template-group-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.template-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.template-btn:hover  { border-color: var(--border-strong); color: var(--text); }
.template-btn.active { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
.template-btn.none   { font-weight: 400; font-size: 13px; }

.template-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: var(--accent-light);
  border: 1px solid var(--accent-mid);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--accent);
  flex-wrap: wrap;
}
.template-bar strong { font-weight: 700; }
.template-bar-actions { margin-left: auto; display: flex; gap: 6px; }
.template-bar-btn {
  background: none;
  border: 1px solid var(--accent-mid);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.template-bar-btn:hover          { background: var(--accent-mid); }
.template-bar-btn.apply          { background: var(--accent); color: #fff; border-color: var(--accent); }
.template-bar-btn.apply:hover    { opacity: 0.88; }

/* Template overlay pill — dashed outline shown on calendar days */
.template-shift-pill {
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 9px;
  font-weight: 700;
  opacity: 0.75;
  border: 1.5px dashed;
  text-align: center;
  pointer-events: none;
}
.template-shift-pill.day   { border-color: var(--accent);  color: var(--accent);  }
.template-shift-pill.eve   { border-color: var(--evening); color: var(--evening); }
.template-shift-pill.night { border-color: var(--night);   color: var(--night);   }

/* Compact template picker for public calendar */
.pub-template-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
}
.pub-template-bar span { flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════════════ */
.empty-state   { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state p { margin-top: 8px; font-size: 14px; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  .calendar-layout            { flex-direction: column; padding-left: 0; }
  .calendar-layout:has(.wage-panel:not(.collapsed)) { padding-left: 0; }
  .wage-panel                 { width: 100%; position: static; }
  .wage-panel.collapsed       { width: 100%; min-width: unset; }
  .wage-panel-body            { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0.75rem; }
  .wage-stat                  { border-bottom: none; padding: 0; }
  .wage-divider               { display: none; }
  .settings-grid              { grid-template-columns: 1fr; }
  main                        { padding: 1rem; }
  .public-main                { padding: 1rem; }
  header {
    flex-wrap: wrap;
    height: auto;
    min-height: 56px;
    padding: 0.5rem 1rem;
    row-gap: 0.5rem;
  }
  nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  nav::-webkit-scrollbar     { display: none; }
  .header-right               { gap: 6px; }
  #header-username            { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .public-header              { padding: 0 1rem; }
  .week-cells                 { gap: 3px; }
  .day-cell                   { min-height: 90px; padding: 5px 3px 3px; }
  .public-day-cell            { min-height: 75px; padding: 5px 3px 3px; }
  .day-num                    { font-size: 13px; }
  .shift-btn                  { font-size: 9px; }
  .shift-btn-time             { display: none; }
  nav button                  { padding: 6px 10px; font-size: 13px; }
}

/* ═══════════════════════════════════════════════════════════════
   "Floaty" mode — when a background image is set (see .has-bg-image,
   toggled in settings.js/public.js), cards stop being solid opaque
   boxes and become frosted glass instead, so the photo reads as one
   continuous scene rather than a grid of disconnected white/dark
   islands sitting on top of it. Each rule reuses that element's own
   existing background color via color-mix() rather than a flat
   translucent gray, so day-cell states (weekend/red-day/other-month)
   stay visually distinct, just softer.
═══════════════════════════════════════════════════════════════ */
.has-bg-image header,
.has-bg-image .day-cell,
.has-bg-image .public-day-cell,
.has-bg-image .wage-panel,
.has-bg-image .sync-bar,
.has-bg-image .btn-icon,
.has-bg-image .save-changes-btn,
.has-bg-image .settings-section,
.has-bg-image .ot-popup,
.has-bg-image .template-bar,
.has-bg-image .ot-notice {
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  border-color: color-mix(in srgb, var(--border) 60%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: none;
}
.has-bg-image .day-cell.other-month       { background: color-mix(in srgb, var(--bg-alt) 35%, transparent); }
.has-bg-image .day-cell.is-weekend-window { background: color-mix(in srgb, var(--weekend-light) 45%, transparent); }
.has-bg-image .day-cell.is-red-day        { background: color-mix(in srgb, var(--redday-light) 45%, transparent); }
.has-bg-image .ot-notice                  { background: color-mix(in srgb, var(--overtime-light) 55%, transparent); }
.has-bg-image .template-bar               { background: color-mix(in srgb, var(--accent-light) 55%, transparent); }
.has-bg-image nav button.active           { background: color-mix(in srgb, var(--accent-light) 65%, transparent); }

/* ═══════════════════════════════════════════════════════════════
   Sync status in the signed-out header (next to dark-mode / sign-in).
   Placed after the "floaty" rules above so these win their ties.
═══════════════════════════════════════════════════════════════ */
.public-header .sync-bar {
  padding: 0;
  margin: 0;
  gap: 8px;
  min-width: 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.public-header #public-sync-text {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.public-header .sync-btn { margin-left: 0; }

@media (max-width: 760px) {
  /* Logo + buttons on the first row, sync status on a row of its own below */
  .public-header {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    padding: 0.5rem 1rem;
    row-gap: 0.5rem;
  }
  .public-header-right { display: contents; }
  .public-header .logo        { order: 1; }
  .public-header .dark-toggle { order: 2; margin-left: auto; }
  .public-header .login-btn   { order: 3; margin-left: 10px; }
  .public-header .sync-bar    { order: 4; flex-basis: 100%; justify-content: space-between; }
  .public-header #public-sync-text { flex: 1; max-width: none; }
}