/* ═══════════════════════════════════════════════════════════════════════════
   Philtronics Time-to-Complete – Stylesheet
   Industrial / utilitarian aesthetic. Touch-first. High contrast.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Design tokens ─────────────────────────────────────────────────────── */
:root {
  --bg:          #0f1117;
  --bg2:         #171b26;
  --bg3:         #1e2333;
  --border:      #2a2f42;
  --border2:     #3a4158;
  --text:        #e8eaf2;
  --text2:       #9aa0b8;
  --text3:       #5a6078;
  --accent:      #f0b429;    /* amber – shopfloor warning palette */
  --accent2:     #d49a10;
  --green:       #22c55e;
  --green-dim:   #16532d;
  --red:         #ef4444;
  --red-dim:     #5a1515;
  --blue:        #3b82f6;
  --blue-dim:    #1e3a6e;

  --radius:      6px;
  --radius-lg:   10px;
  --shadow:      0 4px 24px rgba(0,0,0,.5);
  --shadow-lg:   0 8px 40px rgba(0,0,0,.7);

  --font-body:   'Barlow', system-ui, sans-serif;
  --font-mono:   'DM Mono', 'Courier New', monospace;

  --topbar-h:    56px;
  --transition:  150ms ease;
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
}
button { cursor: pointer; font-family: inherit; }
input  { font-family: inherit; }
a      { color: var(--accent); }
ul     { list-style: none; }

/* ─── Topbar ────────────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 100;
}
.topbar.hidden { display: none; }

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.brand-mark     { font-size: 22px; color: var(--accent); line-height: 1; }
.brand-name     { font-size: 15px; font-weight: 800; letter-spacing: .12em; color: var(--text); }
.brand-sub      { font-size: 10px; font-weight: 600; letter-spacing: .1em; color: var(--text2);
                  display: none; }
@media(min-width:600px){ .brand-sub { display: block; } }

.topbar-center  { flex: 1; text-align: center; }
.topbar-right   { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.user-label {
  font-size: 13px;
  color: var(--text2);
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Active timer banner in topbar */
.active-banner-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--green-dim);
  border: 1px solid var(--green);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
}
.active-banner-dot {
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 1.2s infinite;
}

/* ─── Nav drawer ────────────────────────────────────────────────────────── */
.nav-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 150;
}
.nav-overlay.hidden { display: none; }

.nav-drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(280px, 88vw);
  height: 100dvh;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  padding-top: var(--topbar-h);
  transform: translateX(100%);
  transition: transform .22s ease;
}
.nav-drawer[data-open] { transform: translateX(0); }

.nav-list  { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-list li button {
  width: 100%;
  text-align: left;
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text2);
  background: none;
  border: none;
  letter-spacing: .04em;
  transition: background var(--transition), color var(--transition);
}
.nav-list li button:hover,
.nav-list li button.active {
  background: var(--bg3);
  color: var(--accent);
}
.nav-footer { padding: 16px 24px; border-top: 1px solid var(--border); }
.nav-logout-btn {
  width: 100%;
  padding: 14px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--red);
  font-weight: 600;
  font-size: 15px;
  transition: background var(--transition);
}
.nav-logout-btn:hover { background: var(--red-dim); }

/* ─── Main / pages ──────────────────────────────────────────────────────── */
main { padding-top: var(--topbar-h); min-height: 100dvh; }
.page { display: block; }
.page[hidden] { display: none; }
.page-content {
  max-width: 840px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

/* ─── Login ─────────────────────────────────────────────────────────────── */
.page-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 60% at 70% 30%, rgba(240,180,41,.07) 0%, transparent 70%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}
.login-logo    { text-align: center; margin-bottom: 32px; }
.brand-mark-large { font-size: 48px; color: var(--accent); display: block; line-height: 1; margin-bottom: 8px; }
.login-title   { font-size: 24px; font-weight: 800; letter-spacing: .14em; }
.login-subtitle { font-size: 13px; color: var(--text2); margin-top: 4px; letter-spacing: .06em; }

/* ─── Forms ─────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.form-group .opt { font-weight: 400; text-transform: none; font-size: 11px; }

input[type="text"],
input[type="password"],
input[type="date"],
textarea {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 17px;
  padding: 14px 16px;
  width: 100%;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}
input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240,180,41,.18);
}
input::placeholder { color: var(--text3); }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .06em;
  padding: 14px 24px;
  transition: background var(--transition), opacity var(--transition), transform .1s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-full  { width: 100%; }
.btn-xl    { font-size: 18px; padding: 18px 28px; letter-spacing: .1em; }

.btn-primary { background: var(--accent); color: #0f1117; }
.btn-primary:hover { background: var(--accent2); }

.btn-start { background: var(--green); color: #0f1117; font-size: 22px; font-weight: 800; border-radius: var(--radius-lg); }
.btn-start:hover { filter: brightness(1.1); }

.btn-stop { background: var(--red); color: #fff; font-size: 22px; font-weight: 800; flex: 1; border-radius: var(--radius-lg); }
.btn-stop:hover { filter: brightness(1.1); }

.btn-cancel-sm {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
  font-size: 14px;
  padding: 14px 20px;
}
.btn-cancel-sm:hover { background: var(--red-dim); color: var(--red); border-color: var(--red); }

.btn-export { background: var(--blue); color: #fff; }
.btn-export:hover { filter: brightness(1.1); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
}
.btn-ghost:hover { background: var(--bg3); color: var(--text); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

.icon-btn {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 20px;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--bg3); color: var(--text); }

/* ─── Timer panels ──────────────────────────────────────────────────────── */
.timer-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.panel-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 20px;
}
.panel-active {
  border-color: var(--green);
  box-shadow: 0 0 0 1px var(--green), 0 0 24px rgba(34,197,94,.12);
}

.active-header {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 700;
  letter-spacing: .12em; color: var(--green);
  margin-bottom: 12px;
  text-transform: uppercase;
}
.active-dot {
  width: 10px; height: 10px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(1.3); }
}

.active-item {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 16px;
  letter-spacing: .06em;
}
.stopwatch {
  font-family: var(--font-mono);
  font-size: clamp(48px, 12vw, 72px);
  font-weight: 400;
  color: var(--text);
  letter-spacing: .04em;
  line-height: 1;
  margin-bottom: 12px;
  user-select: none;
}
.active-meta { font-size: 13px; color: var(--text2); margin-bottom: 20px; }
.active-actions { display: flex; gap: 12px; }

/* ─── Recent entries / lists ────────────────────────────────────────────── */
.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 12px;
}
.entry-list { display: flex; flex-direction: column; gap: 8px; }

.entry-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 16px;
  align-items: start;
  transition: border-color var(--transition);
}
.entry-card:hover { border-color: var(--border2); }

.entry-item {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
}
.entry-operator { font-size: 13px; color: var(--text2); }
.entry-time     { font-size: 13px; color: var(--text2); }
.entry-duration {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-align: right;
}
.entry-status { grid-column: 1/-1; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
}
.badge-completed { background: var(--green-dim); color: var(--green); border: 1px solid var(--green); }
.badge-active    { background: rgba(34,197,94,.1); color: var(--green); border: 1px solid var(--green); }
.badge-cancelled { background: var(--red-dim); color: var(--red); border: 1px solid var(--red); }

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text3);
  font-size: 14px;
}

/* ─── Filter bar ────────────────────────────────────────────────────────── */
.filter-bar {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.filter-row:last-child { margin-bottom: 0; }
.filter-group { flex: 1; min-width: 140px; margin-bottom: 0; }
.filter-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ─── Page headings ─────────────────────────────────────────────────────── */
.page-heading {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .06em;
  margin-bottom: 20px;
}
.page-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-heading-row .page-heading { margin-bottom: 0; }

/* ─── Stat cards ────────────────────────────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
}
.stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  color: var(--accent);
}

/* ─── Dashboard table ───────────────────────────────────────────────────── */
.dash-table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
}
tbody td:first-child {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 13px;
}
tbody tr:hover td { background: var(--bg3); }

/* ─── User list ─────────────────────────────────────────────────────────── */
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.user-card.disabled { opacity: .5; }
.user-avatar {
  width: 40px; height: 40px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: var(--accent);
  flex-shrink: 0;
}
.user-info  { flex: 1; min-width: 0; }
.user-name  { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta  { font-size: 13px; color: var(--text2); display: flex; gap: 8px; flex-wrap: wrap; }
.user-actions { display: flex; gap: 8px; }

.role-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 3px;
}
.role-operator     { background: rgba(59,130,246,.15); color: var(--blue); }
.role-supervisor   { background: rgba(240,180,41,.15); color: var(--accent); }
.role-manager      { background: rgba(168,85,247,.15); color: #c084fc; }
.role-administrator{ background: rgba(239,68,68,.15); color: var(--red); }

/* ─── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 300;
  padding: 16px;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg);
  max-height: 90dvh;
  display: flex; flex-direction: column;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-body  { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  flex-shrink: 0;
}

/* ─── Toast ─────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 24px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: toastIn .2s ease forwards;
  max-width: min(380px, 92vw);
  text-align: center;
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red);   color: var(--red);   }
.toast.fade-out { animation: toastOut .3s ease forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(8px); } }

/* ─── Error / misc ──────────────────────────────────────────────────────── */
.error-msg {
  color: var(--red);
  font-size: 14px;
  font-weight: 500;
  min-height: 20px;
  margin-bottom: 8px;
}
.error-msg:empty { margin-bottom: 0; }

/* ─── Autocomplete suggestions ──────────────────────────────────────────── */
.autocomplete-wrap { position: relative; }
.suggestions {
  position: absolute;
  top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.suggestions li {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.suggestions li:last-child { border-bottom: none; }
.suggestions li:hover, .suggestions li[aria-selected="true"] {
  background: var(--bg2);
  color: var(--accent);
}
.suggestions li .sug-desc {
  font-size: 12px;
  color: var(--text3);
  display: block;
  margin-top: 2px;
}


/* ─── QR / Barcode Scanner ──────────────────────────────────────────────── */
.input-with-action {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.input-with-action input {
  flex: 1;
  min-width: 0;
}
.btn-scan {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition);
  cursor: pointer;
  flex-shrink: 0;
}
.btn-scan svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
}
.btn-scan:hover { background: var(--bg2); border-color: var(--accent); }
.btn-scan:active { transform: scale(.97); }

/* Scanner overlay */
.scanner-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.scanner-overlay[hidden] { display: none; }

.scanner-box {
  width: 100%;
  max-width: 480px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.scanner-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text2);
}
.scanner-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  overflow: hidden;
}
#scannerVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Reticle (aiming guide) */
.scanner-reticle {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.reticle-corner {
  position: absolute;
  width: 28px; height: 28px;
  border-color: var(--accent);
  border-style: solid;
  border-width: 0;
}
.reticle-corner.tl { top: 20%; left: 15%; border-top-width: 3px; border-left-width: 3px; border-radius: 2px 0 0 0; }
.reticle-corner.tr { top: 20%; right: 15%; border-top-width: 3px; border-right-width: 3px; border-radius: 0 2px 0 0; }
.reticle-corner.bl { bottom: 20%; left: 15%; border-bottom-width: 3px; border-left-width: 3px; border-radius: 0 0 0 2px; }
.reticle-corner.br { bottom: 20%; right: 15%; border-bottom-width: 3px; border-right-width: 3px; border-radius: 0 0 2px 0; }

.reticle-line {
  position: absolute;
  left: 16%; right: 16%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: scanLine 2s ease-in-out infinite;
}
@keyframes scanLine {
  0%   { top: 22%; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 78%; opacity: 0; }
}

.scanner-status {
  text-align: center;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text2);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scanner-status.success { color: var(--green); font-weight: 600; }
.scanner-status.error   { color: var(--red); }

.scanner-actions {
  padding: 0 16px 14px;
  display: flex;
  justify-content: center;
}

::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ─── Utility ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

/* ─── Responsive tweaks ─────────────────────────────────────────────────── */
@media (min-width: 600px) {
  .active-item { font-size: 32px; }
  .stopwatch   { font-size: 80px; }
  .login-card  { padding: 48px 40px; }
}
@media (min-width: 900px) {
  .page-content { padding: 32px 24px 80px; }
  .timer-panel  { padding: 32px; }
}

/* ─── Delete timer button (admin only, shown on entry cards) ─────────────── */
.btn-delete-timer {
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text3);
  font-size: 15px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  margin-top: 6px;
  margin-left: auto;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.btn-delete-timer:hover {
  background: var(--red-dim);
  border-color: var(--red);
  color: var(--red);
}

/* ─── Wall Board ─────────────────────────────────────────────────────────── */
.page-content-wide {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.wallboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.wallboard-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.wallboard-subhead {
  font-size: 15px;
  color: var(--text2);
  font-weight: 500;
}
.wallboard-updated {
  font-size: 12px;
  color: var(--text3);
}

/* Tile grid — responsive, 1 col on mobile up to 4 on wide screens */
.wallboard-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.wallboard-tile {
  background: var(--bg2);
  border: 1px solid var(--app-green, var(--green));
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 0 16px rgba(34,197,94,.08);
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

/* Pulsing green top bar to show it's live */
.wallboard-tile::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}

/* Amber — over 2 hours */
.wallboard-tile.tile-warning {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(240,180,41,.12);
}
.wallboard-tile.tile-warning::before { background: var(--accent); }

/* Red — over 4 hours */
.wallboard-tile.tile-overdue {
  border-color: var(--red);
  box-shadow: 0 0 16px rgba(239,68,68,.15);
}
.wallboard-tile.tile-overdue::before { background: var(--red); }

.wb-item {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: .04em;
  line-height: 1.2;
}
.wb-operator {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.wb-elapsed {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: .04em;
  margin: 8px 0 4px;
  line-height: 1;
}
.wallboard-tile.tile-warning .wb-elapsed { color: var(--accent); }
.wallboard-tile.tile-overdue .wb-elapsed { color: var(--red); }

.wb-started {
  font-size: 12px;
  color: var(--text3);
}
.wb-notes {
  font-size: 12px;
  color: var(--text2);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Empty state */
.wallboard-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text3);
}
.wallboard-empty-icon {
  font-size: 56px;
  color: var(--green);
  margin-bottom: 16px;
  line-height: 1;
}
.wallboard-empty-text {
  font-size: 18px;
  font-weight: 500;
}

/* ─── Work Time branding ────────────────────────────────────────────────── */
.brand-logo-img {
  height: 28px;
  width:  auto;
  object-fit: contain;
  flex-shrink: 0;
  /* Invert black background to transparent on dark topbar */
  mix-blend-mode: screen;
  filter: brightness(1.1);
}

.login-logo-img {
  height: 72px;
  width:  auto;
  object-fit: contain;
  display: block;
  margin: 0 auto 12px;
  mix-blend-mode: screen;
  filter: brightness(1.1);
}

/* Remove old hex mark styles when logo image is used */
.brand-mark,
.brand-mark-large { display: none; }

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.app-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text3);
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 10;
  letter-spacing: .04em;
}
.app-footer strong { color: var(--text2); font-weight: 600; }
.footer-dot        { color: var(--border2); }

/* Nudge page content up so footer doesn't overlap */
main { padding-bottom: 28px; }

/* ─── Time Check toggle ──────────────────────────────────────────────────── */
.time-check-group  { margin-bottom: 8px; }

.time-check-label {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  padding: 14px 16px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), background var(--transition);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.time-check-label:hover { border-color: var(--border2); }

/* Hide native checkbox */
.time-check-input { position: absolute; opacity: 0; width: 0; height: 0; }

/* Custom checkbox box */
.time-check-box {
  width: 26px; height: 26px;
  border: 2px solid var(--border2);
  border-radius: 6px;
  background: var(--bg2);
  flex-shrink: 0;
  margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), border-color var(--transition);
  position: relative;
}
.time-check-box::after {
  content: '';
  width: 14px; height: 8px;
  border-left: 3px solid #fff;
  border-bottom: 3px solid #fff;
  transform: rotate(-45deg) translateY(-2px);
  opacity: 0;
  transition: opacity .15s;
}
.time-check-input:checked ~ .time-check-box {
  background: var(--accent);
  border-color: var(--accent);
}
.time-check-input:checked ~ .time-check-box::after { opacity: 1; }

/* Highlight the whole row when checked */
.time-check-input:checked ~ .time-check-box,
.time-check-label:has(.time-check-input:checked) {
  border-color: var(--accent);
  background: rgba(240,180,41,.08);
}

.time-check-text  { flex: 1; }
.time-check-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.time-check-desc {
  display: block;
  font-size: 12px;
  color: var(--text3);
  line-height: 1.4;
}

.badge-timecheck {
  background: rgba(59,130,246,.15);
  color: var(--blue);
  border: 1px solid var(--blue);
  font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 3px;
  display: inline-block; margin-top: 4px;
}
.entry-meta-tag {
  font-size: 12px;
  color: var(--text2);
  margin-top: 2px;
}

/* ─── User Manual nav link ───────────────────────────────────────────────── */
.nav-manual-btn {
  display: block;
  width: 100%;
  padding: 13px 16px;
  margin-bottom: 10px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  text-align: center;
  text-decoration: none;
  letter-spacing: .04em;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.nav-manual-btn:hover {
  background: var(--bg2);
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

/* ─── Topbar brand as home button ───────────────────────────────────────── */
button.topbar-brand {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button.topbar-brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ─── Login client branding ──────────────────────────────────────────────── */
.login-client-brand {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.login-client-brand-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
}
.login-client-logo {
  width: 180px;
  height: auto;
  object-fit: contain;
  opacity: .85;
  filter: brightness(1.1);
}

/* ─── Target Times ───────────────────────────────────────────────────────── */
.target-times-section {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 2px solid var(--border);
}
.section-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.section-desc {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 16px;
}
.btn-sm {
  font-size: 13px;
  padding: 8px 14px;
}

.target-times-list { display: flex; flex-direction: column; gap: 8px; }

.target-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.target-row-info  { display: flex; align-items: center; gap: 16px; }
.target-row-actions { display: flex; gap: 6px; }
.target-item-number {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
}
.target-time-display {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 5px;
  padding: 3px 10px;
}

/* Time input row in modal */
.time-input-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

/* Entry card target */
.entry-target {
  font-size: 12px;
  color: var(--text2);
  margin-top: 3px;
}

/* Wallboard target progress bar */
.wb-target-wrap {
  margin-top: 8px;
}
.wb-target-label {
  font-size: 10px;
  color: var(--text2);
  margin-bottom: 4px;
  font-weight: 500;
  letter-spacing: .03em;
}
.wb-target-bar {
  height: 5px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}
.wb-target-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width .5s ease;
  min-width: 2px;
}
.wb-target-fill.over { background: var(--red); }
.wallboard-tile.tile-warning .wb-target-fill:not(.over) { background: var(--accent); }

/* ─── TOTP / 2FA ─────────────────────────────────────────────────────────── */
.totp-step-header {
  text-align: center;
  margin-bottom: 20px;
}
.totp-step-icon {
  font-size: 40px;
  margin-bottom: 8px;
  line-height: 1;
}
.totp-step-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.totp-step-desc {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
}

.totp-code-input {
  font-family: var(--font-mono);
  font-size: 28px !important;
  letter-spacing: .3em;
  text-align: center;
  padding: 14px !important;
  width: 100%;
}

/* ─── Target label overdue state ─────────────────────────────────────────── */
.wb-target-label.overdue {
  color: var(--red);
  font-weight: 700;
}
.wallboard-tile.tile-warning .wb-target-label:not(.overdue) {
  color: var(--accent);
}

/* ─── Active panel target time display ───────────────────────────────────── */
.active-target-wrap {
  margin: 12px 0 4px;
  padding: 12px 16px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}
.active-target-wrap:has(.active-target-fill.warn) {
  border-color: var(--accent);
}
.active-target-wrap:has(.active-target-fill.over) {
  border-color: var(--red);
  background: rgba(239,68,68,.04);
}

.active-target-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.active-target-bar {
  flex: 1;
  height: 8px;
  background: var(--bg2);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border2);
}
.active-target-fill {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  transition: width .8s ease, background .3s;
  min-width: 2px;
}
.active-target-fill.warn { background: var(--accent); }
.active-target-fill.over { background: var(--red); }

.active-target-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  min-width: 38px;
  text-align: right;
  flex-shrink: 0;
}

.active-target-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  text-align: center;
}
.active-target-label.warn   { color: var(--accent); font-weight: 600; }
.active-target-label.overdue { color: var(--red);    font-weight: 700; }

/* ─── Dashboard table delta column ──────────────────────────────────────── */
.dash-over       { color: var(--red);    font-weight: 600; }
.dash-under      { color: var(--green);  font-weight: 600; }
.dash-no-target  { color: var(--text3);  }

/* ─── Operator message notification ──────────────────────────────────────── */
.msg-notification {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 32px));
  background: var(--bg2);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,.35), 0 0 0 1px rgba(240,180,41,.2);
  z-index: 9999;
  padding: 16px 18px;
  animation: msg-slide-in .25s ease;
}
@keyframes msg-slide-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.msg-notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.msg-notif-from {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .03em;
}
.msg-notif-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color var(--transition);
}
.msg-notif-close:hover { color: var(--text); }
.msg-notif-body {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-notif-time {
  font-size: 11px;
  color: var(--text3);
}

/* ─── Wallboard message button ───────────────────────────────────────────── */
.wb-msg-btn {
  margin-top: 10px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 5px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  padding: 7px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  letter-spacing: .04em;
}
.wb-msg-btn:hover {
  background: rgba(240,180,41,.1);
  color: var(--accent);
  border-color: var(--accent);
}

/* ─── Wall Board Compact ──────────────────────────────────────────────────── */
.wbc-grid {
  display: grid;
  /* Smaller minimum than the full wallboard — fits ~8 across on a 1920px TV */
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.wbc-tile {
  background: var(--bg2);
  border: 2px solid var(--app-green, var(--green));
  border-radius: var(--radius);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: 0 0 12px rgba(34,197,94,.07);
}

/* Colour bar across top */
.wbc-tile::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--green);
}

/* Amber — approaching or over 80% of target */
.wbc-tile.tile-warning {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(240,180,41,.12);
}
.wbc-tile.tile-warning::before { background: var(--accent); }

/* Red — over target or over 4h */
.wbc-tile.tile-overdue {
  border-color: var(--red);
  box-shadow: 0 0 16px rgba(239,68,68,.15);
}
.wbc-tile.tile-overdue::before { background: var(--red); }

.wbc-operator {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.wbc-item {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.wbc-elapsed {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: .04em;
  line-height: 1;
  margin-top: 4px;
}

.wbc-tile.tile-warning .wbc-elapsed { color: var(--accent); }
.wbc-tile.tile-overdue .wbc-elapsed { color: var(--red); }

/* On very large screens, allow even smaller tiles */
@media (min-width: 1600px) {
  .wbc-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .wbc-elapsed { font-size: 24px; }
}

/* ─── Home Page ───────────────────────────────────────────────────────────── */
.home-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

/* Greeting */
.home-greeting {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.home-greeting-text {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.01em;
}
.home-greeting-date {
  font-size: 13px;
  color: var(--text3);
}

/* Card grid */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.home-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.home-card-full { grid-column: 1 / -1; }
.home-card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 14px 16px 0;
}
.home-card-body { padding: 12px 16px 16px; }

/* Active jobs list */
.home-active-grid { display: flex; flex-direction: column; gap: 6px; }
.home-active-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--bg3);
  border-radius: var(--radius);
  border-left: 3px solid var(--green);
  transition: border-color var(--transition);
}
.home-active-row.warn { border-left-color: var(--accent); }
.home-active-row.over { border-left-color: var(--red); background: rgba(239,68,68,.03); }

.home-active-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-green { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,.5); }
.dot-amber { background: var(--accent); box-shadow: 0 0 6px rgba(240,180,41,.5); }
.dot-red   { background: var(--red);    box-shadow: 0 0 6px rgba(239,68,68,.5); }

.home-active-info  { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.home-active-name  { font-size: 13px; font-weight: 600; color: var(--text); }
.home-active-item  { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.home-active-ws    { font-size: 11px; color: var(--text3); }

.home-active-time  { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.home-active-elapsed {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.home-active-target { font-size: 11px; color: var(--text3); white-space: nowrap; }
.text-red   { color: var(--red)    !important; }
.text-amber { color: var(--accent) !important; }
.text-green { color: var(--green)  !important; }

.home-msg-btn { padding: 4px 8px; font-size: 14px; flex-shrink: 0; }

/* Today's stats */
.home-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.home-stat-item {
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 3px;
}
.home-stat-icon   { font-size: 20px; }
.home-stat-value  { font-family: var(--font-mono); font-size: 28px; font-weight: 500; color: var(--text); line-height: 1; }
.home-stat-label  { font-size: 11px; color: var(--text3); letter-spacing: .04em; }
.stat-active .home-stat-value { color: var(--green); }
.stat-done   .home-stat-value { color: var(--accent); }

/* Performance table */
.home-perf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.home-perf-table th {
  text-align: left;
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
}
.home-perf-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
}
.home-perf-table tr:last-child td { border-bottom: none; }
.perf-item { font-family: var(--font-mono); color: var(--accent) !important; }

/* User summary */
.home-user-summary {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.home-user-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.home-user-stat-val { font-family: var(--font-mono); font-size: 28px; font-weight: 500; color: var(--text); line-height: 1; }
.home-user-stat-lbl { font-size: 11px; color: var(--text3); }
.home-2fa-warn {
  font-size: 12px;
  color: var(--red);
  background: rgba(239,68,68,.06);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--radius);
  padding: 8px 12px;
}

/* Quick actions */
.home-action-btn {
  display: block;
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  padding: 11px 14px;
  text-align: left;
  cursor: pointer;
  margin-bottom: 7px;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  letter-spacing: .02em;
}
.home-action-btn:last-child { margin-bottom: 0; }
.home-action-btn:hover {
  background: var(--bg2);
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 640px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-card-full { grid-column: 1; }
}

/* ─── Pause / Resume ─────────────────────────────────────────────────────── */

/* Pause banner on active timer panel */
.pause-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(59,130,246,.12);
  border: 1px solid #3b82f6;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
  animation: pause-pulse 2s ease-in-out infinite;
}
.pause-banner-icon { font-size: 20px; }
#pauseBannerText {
  font-size: 13px;
  font-weight: 600;
  color: #60a5fa;
  letter-spacing: .04em;
}
@keyframes pause-pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: .6; }
}

/* Paused stopwatch */
.stopwatch-paused {
  color: #60a5fa !important;
  opacity: .75;
}

/* Paused panel */
.panel-paused .active-header { color: #60a5fa; }
.panel-paused .active-dot    { background: #60a5fa !important; }

/* Pause/Resume button */
.btn-pause-sm {
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  padding: 12px 14px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
}
.btn-pause-sm:hover { border-color: #3b82f6; color: #60a5fa; }

.btn-resume-sm {
  background: rgba(59,130,246,.1);
  border: 1px solid #3b82f6;
  border-radius: var(--radius);
  color: #60a5fa;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-body);
  padding: 12px 14px;
  cursor: pointer;
  animation: pause-pulse 1.5s ease-in-out infinite;
}

/* Paused wallboard tiles — blue border, pulsing */
.wallboard-tile.tile-paused {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 1px #3b82f6, 0 0 14px rgba(59,130,246,.15) !important;
  animation: wb-pause-pulse 2s ease-in-out infinite;
}
.wallboard-tile.tile-paused::before { background: #3b82f6 !important; }

.wbc-tile.tile-paused {
  border-color: #3b82f6 !important;
  animation: wb-pause-pulse 2s ease-in-out infinite;
}
.wbc-tile.tile-paused::before { background: #3b82f6 !important; }

@keyframes wb-pause-pulse {
  0%,100% { opacity: 1;   box-shadow: 0 0 0 1px #3b82f6, 0 0 14px rgba(59,130,246,.15); }
  50%      { opacity: .75; box-shadow: 0 0 0 1px #3b82f6, 0 0 24px rgba(59,130,246,.35); }
}

/* Paused tag on wallboard tiles */
.wb-paused-tag {
  font-size: 11px;
  font-weight: 700;
  color: #60a5fa;
  letter-spacing: .08em;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.wbc-paused-tag {
  font-size: 14px;
  color: #60a5fa;
  margin-top: 2px;
  display: block;
}

/* Context menu */
.wb-context-menu {
  position: fixed;
  z-index: 9999;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  min-width: 180px;
  overflow: hidden;
}
.wb-context-info {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  padding: 8px 14px 6px;
  border-bottom: 1px solid var(--border);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.wb-context-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  padding: 11px 14px;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}
.wb-context-item:last-child { border-bottom: none; }
.wb-context-item:hover { background: var(--bg3); }

/* ─── Wallboard tile pause/resume button ─────────────────────────────────── */
.wb-btn-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.wb-pause-btn {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-body);
  padding: 8px 10px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  letter-spacing: .03em;
}
.wb-pause-btn:hover {
  background: rgba(59,130,246,.1);
  border-color: #3b82f6;
  color: #60a5fa;
}
.wb-pause-btn.is-paused {
  background: rgba(59,130,246,.08);
  border-color: #3b82f6;
  color: #60a5fa;
  font-weight: 800;
}
.wb-pause-btn.is-paused:hover {
  background: rgba(59,130,246,.18);
}
.wb-pause-btn:disabled { opacity: .5; cursor: not-allowed; }

.wb-msg-btn {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  padding: 8px 10px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.wb-msg-btn:hover {
  background: var(--bg2);
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Presence dot ───────────────────────────────────────────────────────────── */
.wb-operator-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.presence-dot.online {
  background: var(--green);
  box-shadow: 0 0 5px rgba(34,197,94,.6);
}
.presence-dot.offline {
  background: var(--red);
  box-shadow: 0 0 5px rgba(239,68,68,.4);
}

/* ─── Message reply UI ───────────────────────────────────────────────────────── */

/* Reply-type notification gets a blue left border to distinguish from outbound */
.msg-notification.msg-reply {
  border-left: 3px solid #3b82f6;
}

/* Original message context block shown on supervisor reply popup */
.msg-notif-context {
  background: var(--bg3);
  border-left: 3px solid var(--border2);
  border-radius: 4px;
  padding: 6px 10px;
  margin: 6px 0 2px;
  font-size: 12px;
  color: var(--text3);
  line-height: 1.4;
}
.msg-notif-context-label {
  font-weight: 700;
  color: var(--text2);
}

/* Reply input area inside operator notification popup */
.msg-notif-reply-wrap {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.msg-notif-reply-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-body);
  padding: 8px 10px;
  resize: none;
  line-height: 1.4;
  transition: border-color var(--transition);
}
.msg-notif-reply-input:focus {
  outline: none;
  border-color: var(--accent);
}
.msg-notif-reply-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}
.msg-notif-char {
  font-size: 10px;
  color: var(--text3);
}
.msg-notif-send {
  background: var(--accent);
  color: #0f1117;
  border: none;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-body);
  padding: 6px 14px;
  cursor: pointer;
  transition: opacity var(--transition);
}
.msg-notif-send:hover   { opacity: .88; }
.msg-notif-send:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Chat Drawer ────────────────────────────────────────────────────────────── */
.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1100;
}

.chat-drawer {
  position: fixed;
  bottom: 0;
  right: 0;
  width: min(420px, 100vw);
  height: min(560px, 90vh);
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,.22);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow .2s;
}
/* Ensure hidden attribute isn't overridden by display:flex */
.chat-drawer[hidden] { display: none !important; }
.chat-drawer.chat-pulse {
  box-shadow: 0 -8px 40px rgba(240,180,41,.35);
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-header-icon {
  font-size: 22px;
  line-height: 1;
}
.chat-header-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.chat-header-sub {
  font-size: 11px;
  color: var(--text3);
  margin-top: 1px;
}
.chat-close-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 14px;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.chat-close-btn:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* Message list */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

/* Bubbles */
.chat-bubble-wrap {
  display: flex;
}
.chat-bubble-wrap.mine   { justify-content: flex-end; }
.chat-bubble-wrap.theirs { justify-content: flex-start; }

.chat-bubble {
  max-width: 78%;
  border-radius: 14px;
  padding: 9px 13px 6px;
  position: relative;
}
.chat-bubble.mine {
  background: var(--accent);
  color: #0f1117;
  border-bottom-right-radius: 4px;
}
.chat-bubble.theirs {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-bubble-text {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}
.chat-bubble.mine .chat-bubble-text { color: #0f1117; }
.chat-bubble-time {
  font-size: 10px;
  margin-top: 4px;
  text-align: right;
  opacity: .65;
}
.chat-bubble.mine   .chat-bubble-time { color: #0f1117; }
.chat-bubble.theirs .chat-bubble-time { color: var(--text3); }

/* System message (conversation closed) */
.chat-system-msg {
  text-align: center;
  font-size: 12px;
  color: var(--text3);
  padding: 6px 12px;
  background: var(--bg3);
  border-radius: 20px;
  margin: 4px auto;
  border: 1px solid var(--border);
}

/* Input area */
.chat-input-wrap {
  border-top: 1px solid var(--border);
  padding: 10px 12px 12px;
  background: var(--bg);
  flex-shrink: 0;
}
.chat-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  padding: 9px 12px;
  resize: none;
  line-height: 1.4;
  transition: border-color var(--transition);
}
.chat-input:focus { outline: none; border-color: var(--accent); }
.chat-input:disabled { opacity: .5; cursor: not-allowed; }

.chat-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
}
.chat-char-count {
  font-size: 10px;
  color: var(--text3);
}
.chat-send-btn {
  background: var(--accent);
  color: #0f1117;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-body);
  padding: 8px 20px;
  cursor: pointer;
  transition: opacity var(--transition);
}
.chat-send-btn:hover    { opacity: .88; }
.chat-send-btn:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 480px) {
  .chat-drawer { width: 100vw; border-radius: 16px 16px 0 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   REPORTS PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.report-section {
  margin-bottom: 36px;
}
.report-section .section-heading {
  font-size: 15px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.report-overdue-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 700px) {
  .report-overdue-grid { grid-template-columns: 1fr; }
}
.report-overdue-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.report-overdue-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.report-chart-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 8px;
  position: relative;
  height: 320px;
}
.report-chart-wrap canvas {
  display: block;
}

.report-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.report-section-header .section-heading {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}
.report-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px;
}
.report-tab {
  background: none;
  border: none;
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font-body, 'Barlow', sans-serif);
}
.report-tab:hover { color: var(--text); background: var(--bg3); }
.report-tab.active { background: var(--accent); color: #0f1117; }

/* ═══════════════════════════════════════════════════════════════════════════
   RAISE HAND
   ═══════════════════════════════════════════════════════════════════════════ */

/* Operator timer page buttons */
.btn-hand-sm {
  background: rgba(139,92,246,.12);
  border: 1px solid #7c3aed;
  border-radius: 6px;
  color: #a78bfa;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
  font-family: var(--font-body, 'Barlow', sans-serif);
  transition: all .15s;
}
.btn-hand-sm:hover { background: rgba(139,92,246,.2); }

.btn-hand-raised-sm {
  background: rgba(245,158,11,.15);
  border: 1px solid var(--accent, #f0b429);
  border-radius: 6px;
  color: var(--accent, #f0b429);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
  font-family: var(--font-body, 'Barlow', sans-serif);
  animation: hand-pulse 1.8s ease-in-out infinite;
}
@keyframes hand-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240,180,41,0); }
  50%       { box-shadow: 0 0 0 6px rgba(240,180,41,.2); }
}

/* Wallboard tile — hand raised state */
.wallboard-tile.tile-hand-raised,
.wbc-tile.tile-hand-raised {
  border-color: #a78bfa !important;
  animation: hand-tile-pulse 1.8s ease-in-out infinite;
}
@keyframes hand-tile-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139,92,246,0); }
  50%       { box-shadow: 0 0 0 6px rgba(139,92,246,.25); }
}

/* wb-hand-tag moved to corner layout */

.wbc-hand-tag {
  font-size: 16px;
  margin-top: 2px;
}

/* wb-lower-hand-btn replaced by wb-hand-lower-btn */

/* Home page hand raised row highlight */
.home-active-row.hand-raised {
  border-left: 2px solid #a78bfa;
  background: rgba(139,92,246,.06);
}

/* Home page raised hands tile */
.home-hand-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all .2s;
}
.home-hand-tile.active {
  background: rgba(139,92,246,.08);
  border-color: #7c3aed;
  animation: hand-tile-pulse 1.8s ease-in-out infinite;
}
.home-hand-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.home-hand-icon {
  font-size: 28px;
  line-height: 1;
}
.home-hand-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  font-family: var(--font-mono);
}
.home-hand-tile.active .home-hand-value {
  color: #a78bfa;
}
.home-hand-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: 2px;
}
.home-lower-all-btn {
  white-space: nowrap;
  border-color: #7c3aed !important;
  color: #a78bfa !important;
}
.home-lower-all-btn:hover {
  background: rgba(139,92,246,.12) !important;
}

/* Wallboard tile — raised hand full-width banner */
.wb-hand-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(139,92,246,.18);
  border: 1px solid rgba(139,92,246,.4);
  border-radius: 6px;
  padding: 5px 8px 5px 10px;
  margin-bottom: 8px;
  gap: 8px;
}
.wb-hand-banner-text {
  font-size: 11px;
  font-weight: 700;
  color: #c4b5fd;
  letter-spacing: .03em;
  white-space: nowrap;
}
.wb-hand-lower-btn {
  background: rgba(139,92,246,.25);
  border: 1px solid #7c3aed;
  border-radius: 4px;
  color: #c4b5fd;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  cursor: pointer;
  font-family: var(--font-body, 'Barlow', sans-serif);
  white-space: nowrap;
  transition: background .15s;
  flex-shrink: 0;
}
.wb-hand-lower-btn:hover { background: rgba(139,92,246,.4); }
.wb-hand-lower-btn:disabled { opacity: .5; cursor: default; }

/* ═══════════════════════════════════════════════════════════════════════════
   HAND RAISED POPUP (supervisor notification)
   ═══════════════════════════════════════════════════════════════════════════ */
.hand-raised-popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  background: var(--bg2);
  border: 2px solid #7c3aed;
  border-radius: 14px;
  padding: 16px 16px 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  max-width: 340px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4), 0 0 0 1px rgba(139,92,246,.3);
  animation: hrp-slide-in .3s cubic-bezier(.16,1,.3,1);
}
@keyframes hrp-slide-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.hrp-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
  animation: hand-pulse 1.8s ease-in-out infinite;
}
.hrp-body {
  flex: 1;
  min-width: 0;
}
.hrp-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #a78bfa;
  margin-bottom: 4px;
}
.hrp-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hrp-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 4px;
}
.hrp-time {
  font-size: 11px;
  color: var(--text3);
}
.hrp-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text3);
  font-size: 14px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .15s;
}
.hrp-close:hover {
  background: var(--bg3);
  border-color: #7c3aed;
  color: #a78bfa;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DEPARTMENT BADGES
   ═══════════════════════════════════════════════════════════════════════════ */
.dept-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 20px;
  margin-top: 4px;
}
.dept-prod      { background: rgba(66,153,225,.15); color: #60a5fa; border: 1px solid rgba(66,153,225,.3); }
.dept-stores    { background: rgba(56,161,105,.15); color: #4ade80; border: 1px solid rgba(56,161,105,.3); }
.dept-testinsp  { background: rgba(159,122,234,.15); color: #c084fc; border: 1px solid rgba(159,122,234,.3); }
.dept-pcb       { background: rgba(236,110,36,.15);  color: #fb923c; border: 1px solid rgba(236,110,36,.3); }
