/* ─── Brand font ─── */
@font-face {
  font-family: "Bw Modelica";
  src: url("fonts/BwModelica-Regular.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Bw Modelica";
  src: url("fonts/BwModelica-Medium.woff") format("woff");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Bw Modelica";
  src: url("fonts/BwModelica-Bold.woff") format("woff");
  font-weight: 600 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Bw Modelica";
  src: url("fonts/BwModelica-ExtraBold.woff") format("woff");
  font-weight: 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Bw Modelica";
  src: url("fonts/BwModelica-Black.woff") format("woff");
  font-weight: 900; font-style: normal; font-display: swap;
}

/* ─── Design tokens ─── */
:root {
  --green:      #22a06b;
  --green-dark: #1b8557;
  --red:        #e03956;
  --red-dark:   #bd2544;
  --ink:        #1a1d23;
  --ink-2:      #5b6270;
  --ink-3:      #8a909b;
  --line:       #ececf0;
  --bg-soft:    #f7f7f9;
  --white:      #ffffff;
  --shadow-sm:  0 1px 2px rgba(20,25,35,.05);
  --shadow-md:  0 6px 20px rgba(20,25,35,.08);
  --shadow-lg:  0 20px 50px rgba(20,25,35,.18);
  --r-sm:  10px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-pill:999px;
  --font: "Bw Modelica", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ════════════════════════════════════════════
   DISPLAY PAGE  (index.html — 55" TV)
   ════════════════════════════════════════════ */

body.display-page {
  overflow: hidden;
  font-family: var(--font);
  background: var(--ink);
  color: var(--white);
  user-select: none;
}

.d-app { display: flex; flex-direction: column; height: 100vh; width: 100vw; }

/* Header */
.d-header {
  display: flex;
  align-items: center;
  padding: 18px 32px;
  background: var(--ink);
  border-bottom: 1px solid rgba(255,255,255,.06);
  gap: 16px;
  flex-shrink: 0;
}
.d-header-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: .7;
}
.d-header-clock {
  margin-left: auto;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.d-header-date {
  font-size: 1rem;
  font-weight: 500;
  opacity: .6;
  text-transform: capitalize;
}

/* Main split */
.d-main {
  display: grid;
  grid-template-columns: 58% 42%;
  flex: 1;
  min-height: 0;
}

/* ─── Today panel (left) ─── */
.d-today {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 56px;
  background: var(--green);
  color: #fff;
  transition: background .5s ease;
  overflow: hidden;
}
.d-today--empty { background: rgba(255,255,255,.04); }
.d-today--empty .d-today-photo { opacity: .18; }

/* Decorative blob */
.d-today::before {
  content: "";
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  top: -120px; right: -160px;
  pointer-events: none;
}

.d-today-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  align-self: flex-start;
}
.d-today-badge {
  padding: 6px 18px;
  background: rgba(0,0,0,.22);
  border-radius: var(--r-pill);
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}
.d-today-datestr {
  font-size: 1rem;
  font-weight: 600;
  opacity: .85;
  text-transform: capitalize;
}

.d-today-photo {
  width: 340px;
  height: 340px;
  border-radius: 50%;
  object-fit: cover;
  border: 6px solid rgba(255,255,255,.28);
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
  flex-shrink: 0;
  margin-bottom: 36px;
}
.d-today-initials {
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: rgba(0,0,0,.22);
  border: 6px solid rgba(255,255,255,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7rem;
  font-weight: 900;
  letter-spacing: -4px;
  flex-shrink: 0;
  margin-bottom: 36px;
  color: rgba(255,255,255,.9);
}
.d-today-name {
  font-size: 4.5rem;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: .95;
  text-align: center;
  margin-bottom: 12px;
}
.d-today-sub {
  font-size: 1.2rem;
  font-weight: 500;
  opacity: .75;
  letter-spacing: .5px;
  text-transform: uppercase;
  text-align: center;
}
.d-today-empty-msg {
  font-size: 2rem;
  font-weight: 700;
  opacity: .35;
  text-align: center;
}

/* ─── Week panel (right) ─── */
.d-week {
  background: var(--white);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  overflow: hidden;
}
.d-week-header {
  padding: 20px 28px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.d-week-header-label {
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-3);
}
.d-week-header-sub {
  font-size: .85rem;
  color: var(--ink-2);
  font-weight: 500;
  text-transform: capitalize;
}
.d-week-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.d-day-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line);
  background: var(--white);
  transition: border-color .15s;
}
.d-day-card--today {
  border-color: var(--green);
  background: #f0faf5;
}
.d-day-card--weekend { opacity: .45; }

.d-day-label {
  min-width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.d-day-dow {
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-3);
}
.d-day-card--today .d-day-dow { color: var(--green-dark); }
.d-day-num {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--ink);
  line-height: 1;
}
.d-day-card--today .d-day-num { color: var(--green); }

.d-day-photo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line);
  flex-shrink: 0;
}
.d-day-initials {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink-2);
  flex-shrink: 0;
}
.d-day-card--today .d-day-initials { background: #d6f0e4; border-color: #9dd9be; color: var(--green-dark); }

.d-day-info { flex: 1; min-width: 0; }
.d-day-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.d-day-card--today .d-day-name { color: var(--green-dark); }
.d-day-empty {
  font-size: .9rem;
  color: var(--ink-3);
  font-weight: 500;
}

/* ════════════════════════════════════════════
   ADMIN PAGE  (admin.html)
   ════════════════════════════════════════════ */

body.admin-page {
  font-family: var(--font);
  background: var(--bg-soft);
  color: var(--ink);
  min-height: 100vh;
}

.a-app { display: flex; flex-direction: column; min-height: 100vh; }

/* Header */
.a-header {
  display: flex;
  align-items: center;
  padding: 14px 28px;
  background: var(--ink);
  color: var(--white);
  gap: 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: sticky;
  top: 0;
  z-index: 50;
}
.a-header-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.2px;
}
.a-header-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255,255,255,.1);
  border-radius: var(--r-pill);
  font-size: .88rem;
  font-weight: 600;
  color: #fff;
  transition: background .15s;
  margin-left: auto;
}
.a-header-link:hover { background: rgba(255,255,255,.18); }

/* Main two-col layout */
.a-main {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  padding: 24px;
  align-items: start;
  flex: 1;
}

/* Cards / panels */
.a-card {
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  overflow: hidden;
}
.a-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.a-card-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.1px;
}
.a-card-sub {
  font-size: .8rem;
  color: var(--ink-3);
  font-weight: 500;
  margin-top: 2px;
}
.a-card-body { padding: 18px 22px; }

/* Worker list */
.worker-list { display: flex; flex-direction: column; gap: 8px; }
.worker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line);
  background: var(--white);
  transition: border-color .15s;
}
.worker-item:hover { border-color: var(--ink-3); }
.worker-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line);
  flex-shrink: 0;
}
.worker-initials-sm {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  font-weight: 800;
  color: var(--ink-2);
  flex-shrink: 0;
}
.worker-info { flex: 1; min-width: 0; }
.worker-name {
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.worker-email {
  font-size: .78rem;
  color: var(--ink-3);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.worker-del-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.worker-del-btn:hover { background: #fde8eb; color: var(--red); }

.workers-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--ink-3);
  font-size: .92rem;
}

/* Add worker form */
.add-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 22px;
  border-top: 1px solid var(--line);
}
.add-form-title {
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 2px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.form-input {
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font-size: .95rem;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
  background: var(--white);
}
.form-input:focus { border-color: var(--green); }

/* Photo upload area */
.photo-upload {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: var(--r-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.photo-upload:hover { border-color: var(--green); background: #f7fdf9; }
.photo-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-upload-icon { font-size: 1.8rem; margin-bottom: 6px; }
.photo-upload-text {
  font-size: .82rem;
  color: var(--ink-2);
  font-weight: 500;
}
.photo-upload-preview {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 6px;
  border: 3px solid var(--green);
}

/* ─── Calendar ─── */
.cal-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}
.cal-title {
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: -.2px;
}
.cal-nav-btn {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.cal-nav-btn:hover { background: var(--line); }

.cal-grid-wrap { padding: 16px 20px 20px; }
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}
.cal-weekdays span {
  text-align: center;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 4px 0;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-cell {
  min-height: 68px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-cell:hover:not(.cal-cell--other):not(.cal-cell--past) { border-color: var(--green); background: #f7fdf9; }
.cal-cell--today { border-color: var(--green); background: #f0faf5; }
.cal-cell--other { opacity: .3; pointer-events: none; }
.cal-cell--past  { opacity: .5; cursor: default; }
.cal-cell--weekend { background: var(--bg-soft); cursor: default; }
.cal-cell--weekend:hover { border-color: var(--line); background: var(--bg-soft); }

.cal-cell-num {
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink-2);
}
.cal-cell--today .cal-cell-num { color: var(--green-dark); }

.cal-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--green);
  color: #fff;
  border-radius: var(--r-pill);
  padding: 3px 8px 3px 3px;
  font-size: .72rem;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
}
.cal-chip--today { background: var(--green-dark); }
.cal-chip-photo {
  width: 20px; height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.cal-chip-initials {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .6rem;
  font-weight: 800;
  flex-shrink: 0;
}
.cal-chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Generate modal */
.gen-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,25,35,.5);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gen-modal-overlay[hidden] { display: none; }

/* ─── Shared modal panel ─── */
.modal-panel {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 28px 26px 22px;
  width: min(460px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.3px;
  margin-bottom: 6px;
}
.modal-sub {
  font-size: .9rem;
  color: var(--ink-2);
  margin-bottom: 20px;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
}

/* Worker picker grid */
.picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 2px;
  margin-bottom: 4px;
}
.picker-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--white);
  transition: all .15s;
  cursor: pointer;
}
.picker-btn:hover { border-color: var(--green); background: #f7fdf9; }
.picker-btn--selected { border-color: var(--green); background: #e8f7f0; }
.picker-btn--clear   { border-style: dashed; color: var(--ink-3); grid-column: 1 / -1; flex-direction: row; justify-content: center; }
.picker-btn--clear:hover { border-color: var(--red); color: var(--red); background: #fff5f6; }

.picker-photo {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line);
}
.picker-initials {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink-2);
}
.picker-name {
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  line-height: 1.2;
}
.picker-btn--selected .picker-initials { background: #d6f0e4; border-color: #9dd9be; color: var(--green-dark); }

/* Generate rotation form */
.gen-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.gen-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-2);
}
.gen-input {
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font-size: .98rem;
  color: var(--ink);
  outline: none;
  background: var(--white);
  transition: border-color .15s;
}
.gen-input:focus { border-color: var(--green); }
.gen-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .92rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}
.gen-checkbox-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; }

/* ─── Buttons ─── */
.btn {
  padding: 12px 22px;
  border-radius: var(--r-sm);
  font-size: .95rem;
  font-weight: 700;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary   { background: var(--green);   color: #fff; }
.btn-primary:hover   { background: var(--green-dark); }
.btn-primary:disabled { background: #aaa; cursor: not-allowed; }
.btn-secondary { background: var(--bg-soft); color: var(--ink); border: 1.5px solid var(--line); }
.btn-secondary:hover { background: var(--line); }
.btn-danger    { background: var(--red);  color: #fff; }
.btn-danger:hover    { background: var(--red-dark); }
.btn-ghost     { background: transparent; color: var(--ink-2); }
.btn-ghost:hover     { background: var(--bg-soft); }
.btn-sm { padding: 8px 14px; font-size: .85rem; }
.btn-icon { padding: 10px; border-radius: var(--r-sm); }

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 13px 22px;
  border-radius: var(--r-pill);
  font-size: .95rem;
  font-weight: 600;
  z-index: 300;
  box-shadow: var(--shadow-lg);
  animation: toast-in .22s ease;
  white-space: nowrap;
}
.toast[hidden] { display: none; }
.toast--ok  { background: var(--green); }
.toast--err { background: var(--red); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }
