/* Employee portal. Most staff open this on a phone, so it is laid out
   narrow-first and the calendar collapses to a list on small screens. */

/* Light theme. The accent and the muted grey are darker than they would be on
   a dark ground: both sit on white here, and the pale versions would not be
   readable. */
:root {
  color-scheme: light; /* so the month dropdown and scrollbars come up light too */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --sunk: #f0f3f7; /* days outside the month */
  --weekend: #f7f9fb;
  --line: #d3dce5;
  --text: #16232e;
  --muted: #5b7185;
  --accent: #1668ab;
  --accent-ink: #ffffff;
  --err: #c0262b;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", "Sarabun", system-ui, sans-serif;
}

/* ------------------------------------------------------------------ chrome */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 700; color: var(--accent); }
.account { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who { color: var(--muted); font-size: 13px; }

main { padding: 16px; max-width: 1100px; margin: 0 auto; }

.muted { color: var(--muted); }
.foot { font-size: 12px; margin-top: 16px; }
.loading { padding: 24px; }

/* ------------------------------------------------------------------ inputs */

.btn {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.btn:hover:not([disabled]) { background: #e2e8f0; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not([disabled]) { filter: brightness(1.1); }
.btn.block { width: 100%; padding: 10px; }

input, select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.error {
  padding: 9px 12px;
  border-radius: 6px;
  background: rgba(192, 38, 43, .09);
  border-left: 3px solid var(--err);
  color: var(--err);
  font-size: 13px;
}

.title { font-size: 19px; margin: 0 0 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

/* ------------------------------------------------------------------- login */

.login-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }

.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}

.login-brand { font-weight: 700; font-size: 17px; color: var(--accent); margin-bottom: 22px; }
.login-card input { width: 100%; margin-bottom: 16px; }
.login-card .error { margin-bottom: 16px; }

/* ---------------------------------------------------------------- calendar */

.monthbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
#month-summary { font-size: 13px; }

/* The grid keeps its shape on every screen so staff see the same calendar on
   a phone as on a desktop. Narrow screens scroll this container sideways
   rather than the page itself. */
.calendar-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  /* Below this the day columns are too narrow to read a time in. */
  min-width: 620px;
}

.calendar .loading, .calendar .error { grid-column: 1 / -1; }

.dow {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 8px 4px;
}

.cell {
  background: var(--surface);
  min-height: 92px;
  padding: 6px;
}
.cell.is-empty { background: var(--sunk); }
.cell.is-weekend { background: var(--weekend); }
.cell.is-today { outline: 2px solid var(--accent); outline-offset: -2px; }

.daynum { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.cell.has-data .daynum { color: var(--text); font-weight: 600; }

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

.time {
  background: var(--surface-2);
  border-left: 2px solid var(--accent);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Only the page padding tightens on a phone. The calendar itself is left
   alone, so there is one layout to learn and one to explain. */
@media (max-width: 640px) {
  main { padding: 12px; }
  .topbar { padding: 10px 12px; }
  .account { gap: 6px; }
}

/* ------------------------------------------------------------------ dialog */

dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  width: min(340px, 92vw);
}
dialog::backdrop { background: rgba(22, 35, 46, .35); }
dialog input { width: 100%; margin-bottom: 14px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }

/* ------------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 16px;
  max-width: 90vw;
}
.toast.is-error { border-left-color: var(--err); }
