/* ============================================================
   ACCUREX FIELD VISIT LOG — DESIGN TOKENS
   Matches the ACCUREX Incident Report Tracker look:
   navy #08183b, teal #26bec5, white.
   ============================================================ */
:root {
  --navy: #08183b;
  --navy-2: #102a5c;
  --navy-3: #1b3a73;
  --teal: #26bec5;
  --teal-ink: #0f7f86;      /* teal dark enough for text on white */
  --teal-soft: #e3f7f8;
  --bg: #f3f6fa;
  --card: #ffffff;
  --white: #ffffff;
  --text: #0e1a2e;
  --muted: #64718a;
  --line: #e2e8f0;
  --line-2: #eef2f7;
  --success: #1d7f57;
  --success-bg: #e5f5ee;
  --pending: #a15c07;
  --pending-bg: #fff4e0;
  --danger: #c4314b;
  --danger-bg: #fdecef;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(8, 24, 59, 0.05), 0 4px 14px rgba(8, 24, 59, 0.05);
  --font: 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; }

a { color: var(--teal-ink); }

button { font-family: var(--font); cursor: pointer; }
button:disabled { cursor: not-allowed; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  background: var(--navy);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(8, 24, 59, 0.25);
}
.topbar-row {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-logo {
  background: var(--white);
  border-radius: 8px;
  padding: 5px 8px;
  display: inline-flex;
  flex-shrink: 0;
}
.topbar-logo img { height: 26px; width: auto; display: block; }
.topbar-title { min-width: 0; }
.topbar-title .brand {
  display: block;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.2;
}
.topbar-title .subtitle {
  display: block;
  font-size: 12px;
  color: #9fb0cf;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-spacer { flex: 1; }
.topbar-meta {
  font-size: 12.5px;
  color: #c9d4e8;
  white-space: nowrap;
}
.topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #dbe4f3;
  white-space: nowrap;
}
.topbar-user .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--navy);
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.topbar-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--white);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
}
.topbar-btn:hover { background: rgba(255, 255, 255, 0.08); }

/* Second row: navigation tabs (admin) */
.topnav {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.topnav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav-inner::-webkit-scrollbar { display: none; }
.nav-tab {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  color: #b9c6dd;
  font-size: 13.5px;
  font-weight: 500;
  padding: 12px 12px 10px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.nav-tab:hover { color: var(--white); }
.nav-tab.active {
  color: var(--white);
  font-weight: 600;
  border-bottom-color: var(--teal);
}
.nav-badge {
  background: var(--danger);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}
.nav-badge:empty { display: none; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-main {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}
.app-main.wide { max-width: 1200px; padding: 26px 24px 60px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.page-head h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 0;
  color: var(--navy);
}
.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  margin-bottom: 18px;
}

.eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px 0;
}
.eyebrow .step-tag { color: var(--teal-ink); }

h1.page-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--navy);
  margin: 0 0 6px 0;
}
p.page-lede {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0 0 22px 0;
  line-height: 1.6;
}

/* ---------- Step progress (employee page) ---------- */
.stepper {
  display: flex;
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  gap: 6px;
}
.stepper li {
  flex: 1;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}
.stepper li::before {
  content: "";
  display: block;
  height: 4px;
  border-radius: 4px;
  background: var(--line);
  margin-bottom: 7px;
}
.stepper li.done::before { background: var(--teal); }
.stepper li.current::before { background: var(--navy); }
.stepper li.current { color: var(--navy); }
.stepper li.done { color: var(--teal-ink); }

/* ============================================================
   FORMS
   ============================================================ */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field select,
.field input[type="time"],
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid #d5dce7;
  font-size: 14.5px;
  font-family: var(--font);
  background: var(--white);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus,
.toolbar input:focus, .toolbar select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(38, 190, 197, 0.18);
}
.field select { appearance: auto; }
.field textarea { resize: vertical; min-height: 90px; }
.field input:disabled, .field select:disabled {
  background: var(--line-2);
  color: var(--muted);
}
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.hint a { font-weight: 600; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  transition: background 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { opacity: 0.88; }
.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--navy-2); }
.btn-primary:disabled { background: #b8c0cd; }
.btn-accent { background: var(--teal); color: var(--navy); font-weight: 700; }
.btn-accent:hover:not(:disabled) { background: #3ccbd1; }
.btn-accent:disabled { background: #b9e5e7; color: #5b7a8a; }
.btn-secondary { background: var(--white); color: var(--navy); border: 1px solid #cdd5e1; }
.btn-secondary:hover:not(:disabled) { border-color: var(--navy); }
.btn-danger-outline { background: var(--white); color: var(--danger); border: 1px solid var(--danger); }
.btn-ghost {
  background: transparent;
  border: 0;
  color: var(--navy);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 4px;
  width: auto;
}
.btn-ghost:hover { color: var(--teal-ink); text-decoration: underline; }
.card .btn-ghost { display: block; margin-left: auto; margin-right: auto; }
.btn-link {
  background: transparent;
  border: 0;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--teal-ink);
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { width: auto; flex: 1; }

/* ============================================================
   LOCATION / VISIT SUMMARY (employee page)
   ============================================================ */
.location-status {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border: 1px solid var(--line);
}
.location-status.pending { background: var(--pending-bg); color: var(--pending); border-color: #f6dfb4; }
.location-status.ok { background: var(--teal-soft); color: var(--teal-ink); border-color: #bfe9ec; }
.location-status.error { background: var(--danger-bg); color: var(--danger); border-color: #f5c8d0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.dot.live { animation: pulse 1.4s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(38, 190, 197, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(38, 190, 197, 0); }
  100% { box-shadow: 0 0 0 0 rgba(38, 190, 197, 0); }
}

.log-entry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 10px;
}
.log-entry-row .label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}
.log-entry-time {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.log-entry-meta { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }

.locked-note {
  font-size: 12px;
  color: var(--muted);
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  line-height: 1.6;
}

/* ============================================================
   TO-DO LIST (employee Step 3)
   ============================================================ */
h1.page-title.greeting { font-size: 22px; }
.todo-section { margin-top: 18px; }
.todo-section:first-child { margin-top: 0; }
.todo-section-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--navy); margin-bottom: 8px;
}
.todo-section-note { font-size: 12px; color: var(--muted); margin: -2px 0 8px; line-height: 1.5; }
.todo-count {
  background: var(--line-2); color: var(--navy); border-radius: 999px;
  font-size: 11.5px; padding: 2px 9px; letter-spacing: 0;
}
.todo-count.carried { background: #fbe9ec; color: #b4495c; }
.todo-count.done { background: var(--success-bg); color: var(--success); }

.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.todo-item {
  display: flex; align-items: flex-start; gap: 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 12px 11px; background: var(--white);
}
.todo-item.carried {
  background: #fdf5f6; border-color: #f3d3d9;
  box-shadow: inset 3px 0 0 #e0899a;
}
.todo-item.carried .todo-text { color: #b4495c; }
.todo-item.done .todo-text { color: var(--muted); text-decoration: line-through; text-decoration-color: #aab4c4; }
.todo-item.carried.done .todo-text { color: #c9858f; }
.todo-main { flex: 1; min-width: 0; }
.todo-text { font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.45; word-wrap: break-word; }
.todo-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.todo-item.carried .todo-meta { color: #c27583; }
.todo-tag {
  display: inline-block; font-size: 10.5px; font-weight: 600; border-radius: 999px;
  padding: 1px 8px; margin-left: 2px; white-space: nowrap; vertical-align: 1px;
}
.todo-tag.carried { background: #fbe4e8; color: #b4495c; }
.todo-tag.edited { background: var(--pending-bg); color: var(--pending); }
.todo-tag.unsynced { background: var(--line-2); color: var(--muted); }
.todo-item-actions { display: flex; gap: 2px; flex-shrink: 0; }
.btn-link.muted { color: var(--muted); }

/* custom checkbox */
.todo-check { position: relative; flex-shrink: 0; width: 22px; height: 22px; margin-top: 0; cursor: pointer; }
.todo-check input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.todo-check .box {
  display: block; width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid #b9c3d3; background: var(--white); transition: all 0.15s ease;
}
.todo-item.carried .todo-check .box { border-color: #e0a3ae; }
.todo-check input:checked + .box { background: var(--teal); border-color: var(--teal); }
.todo-check input:checked + .box::after {
  content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px;
  border: solid var(--navy); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.todo-check input:focus-visible + .box { outline: 2px solid var(--teal); outline-offset: 2px; }
.todo-check.disabled { cursor: default; }
.todo-check.disabled .box { background: var(--line-2); border-style: dashed; }
.todo-check.disabled input { cursor: default; }

.todo-icon {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.todo-icon.ok { background: var(--success-bg); color: var(--success); }
.todo-icon.pending { background: #fbe4e8; color: #b4495c; font-size: 18px; line-height: 1; }
.todo-list.summary .todo-item.done .todo-text { text-decoration: none; color: var(--text); }

.todo-edit { display: flex; gap: 6px; align-items: center; }
.todo-edit-input {
  flex: 1; min-width: 0; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--teal);
  font-size: 14px; font-family: var(--font); box-shadow: 0 0 0 3px rgba(38, 190, 197, 0.18);
}
.todo-edit-input:focus { outline: none; }

.todo-empty {
  font-size: 13px; color: var(--muted); text-align: center; padding: 18px 12px;
  border: 1px dashed #d5dce7; border-radius: var(--radius-sm);
}
.todo-add { display: flex; gap: 8px; margin-top: 10px; }
.todo-add input {
  flex: 1; min-width: 0; padding: 11px 13px; border-radius: var(--radius-sm); border: 1px solid #d5dce7;
  font-size: 14px; font-family: var(--font);
}
.todo-add input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(38, 190, 197, 0.18); }
.todo-add .btn { width: auto; padding: 10px 18px; }

.todo-progress { margin: 0 0 18px; }
.todo-progress-row { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: var(--navy); margin-bottom: 7px; }
.todo-progress-pct { color: var(--teal-ink); }
.todo-bar { height: 8px; border-radius: 8px; background: var(--line-2); overflow: hidden; }
.todo-bar span { display: block; height: 100%; background: var(--teal); border-radius: 8px; transition: width 0.3s ease; }

.todo-actions { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.btn-end-day { background: var(--white); color: var(--navy); border: 1.5px solid var(--navy); }
.btn-end-day:hover:not(:disabled) { background: var(--line-2); }
.btn-end-day.confirming { background: var(--danger); border-color: var(--danger); color: var(--white); }
.btn-end-day.confirming:hover:not(:disabled) { background: #a8263d; }
.end-day-confirm {
  background: var(--danger-bg); border: 1px solid #f5c8d0; color: var(--danger);
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; line-height: 1.55; margin-bottom: 10px;
}
.end-day-confirm strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.departure-block { margin-top: 14px; }
.departure-hint { text-align: center; margin-top: 8px; }
.btn-accent:disabled + .departure-hint { color: var(--muted); }

.todo-recap { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 18px; }
.recap-pill { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 4px 11px; }
.recap-pill.done { background: var(--success-bg); color: var(--success); }
.recap-pill.pending { background: #fbe4e8; color: #b4495c; }

/* Employee history: visits / to-do lists */
.segmented.full { display: flex; width: 100%; margin: 0 0 16px; box-shadow: none; }
.segmented.full .seg { flex: 1; justify-content: center; padding: 9px 12px; }
.my-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.my-filters input[type="text"] { grid-column: 1 / -1; }
.my-filters input, .my-filters select {
  width: 100%; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid #d5dce7;
  font-size: 13.5px; font-family: var(--font); background: var(--white); color: var(--text); min-width: 0;
}
.my-filters input:focus, .my-filters select:focus { outline: none; border-color: var(--teal); }
.my-filter-dates { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.my-filter-dates label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.my-filters .btn-link { grid-column: 1 / -1; justify-self: end; padding: 2px 0; }
.my-filters select { grid-column: 1 / -1; }
.my-todo-count { font-size: 12.5px; font-weight: 600; color: var(--navy); margin: 4px 0 10px; }
.my-todo-day { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; background: #fbfcfe; }
.my-todo-day-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.my-todo-day-head b { display: block; font-size: 13.5px; color: var(--navy); }
.my-todo-day-head span { font-size: 12px; color: var(--muted); }
.my-todo-day-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.my-todo-day-right .my-todo-done { font-size: 12px; font-weight: 600; color: var(--navy); }
.my-todo-day .todo-item { padding: 10px; }

/* ============================================================
   BANNERS / NOTES
   ============================================================ */
.banner {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.banner.info { background: #eef3fb; color: var(--navy-2); border-color: #d6e1f2; }
.banner.error { background: var(--danger-bg); color: var(--danger); border-color: #f5c8d0; }
.banner.success { background: var(--success-bg); color: var(--success); border-color: #bfe5d3; }

.sync-note {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
  line-height: 1.6;
}
.page-footer {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 36px;
  line-height: 1.6;
}
.page-footer a { color: var(--navy); font-weight: 700; text-decoration: none; }

/* ============================================================
   ADMIN: KPI TILES
   ============================================================ */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  text-align: left;
  font-family: var(--font);
}
button.kpi { cursor: pointer; }
button.kpi:hover { border-color: var(--teal); }
.kpi-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.kpi-value.teal { color: var(--teal-ink); }
.kpi-value.red { color: var(--danger); }
.kpi-label { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

/* ============================================================
   ADMIN: TOOLBAR / PANELS / TABLES
   ============================================================ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 14px;
}
.toolbar input[type="text"],
.toolbar input[type="date"],
.toolbar input[type="email"] {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #d5dce7;
  font-size: 13.5px;
  font-family: var(--font);
  background: var(--white);
  color: var(--text);
  min-width: 0;
}
.toolbar input.grow { flex: 1 1 220px; }
.toolbar label.inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.toolbar .btn, .page-actions .btn { width: auto; padding: 9px 14px; font-size: 13px; }
.toolbar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  margin-right: 4px;
}

.table-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 2px 10px;
}
.table-meta .count { font-size: 13px; color: var(--text); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i {
  width: 12px; height: 12px; border-radius: 3px; display: inline-block;
}
.legend i.today { background: #c9eef0; box-shadow: inset 3px 0 0 var(--teal); }
.legend i.flag { background: #f8d2d9; box-shadow: inset 3px 0 0 var(--danger); }

.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
table.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 820px;
}
table.log-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-weight: 600;
  color: var(--white);
  background: var(--navy);
  padding: 13px 16px;
  white-space: nowrap;
}
table.log-table td {
  padding: 13px 16px;
  border-top: 1px solid var(--line-2);
  vertical-align: top;
}
table.log-table tbody tr:first-child td { border-top: 0; }
table.log-table td:first-child { font-weight: 600; color: var(--navy); }
table.log-table tr:hover td { background: #f7f9fc; }
table.log-table.numbered td:first-child { font-weight: 500; color: var(--muted); width: 56px; }
table.log-table.numbered td:nth-child(2) { font-weight: 600; color: var(--navy); }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pill.complete { background: var(--success-bg); color: var(--success); }
.pill.open { background: var(--teal-soft); color: var(--teal-ink); }
.pill.flag { background: var(--danger-bg); color: var(--danger); margin-top: 5px; }
.map-link { font-size: 12px; color: var(--teal-ink); font-weight: 600; text-decoration: none; white-space: nowrap; }
.map-link:hover { text-decoration: underline; }

table.log-table tr.row-flagged td {
  background: #fff6f7;
}
table.log-table tr.row-flagged td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
table.log-table tr.row-flagged:hover td { background: #fdecef; }

/* Today's visits get a teal tint; a flag (departure far from arrival)
   wins over it, since that's the more important signal. */
table.log-table tr.row-today:not(.row-flagged) td { background: #f2fbfb; }
table.log-table tr.row-today:not(.row-flagged) td:first-child { box-shadow: inset 4px 0 0 var(--teal); }
table.log-table tr.row-today:not(.row-flagged):hover td { background: var(--teal-soft); }

.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--muted);
  font-size: 14px;
  background: var(--card);
  border: 1px dashed #d5dce7;
  border-radius: var(--radius);
}

.panel-note { font-size: 12.5px; color: var(--muted); margin: 0 2px 14px; line-height: 1.6; }

/* ============================================================
   ADMIN: NEW TABS (to-do lists, statuses, audit, settings)
   ============================================================ */
.topbar-user .who { display: inline-flex; flex-direction: column; line-height: 1.2; }
.topbar-user .who small { font-size: 11px; color: #8fa0c0; }
.topbar-user .who small:empty { display: none; }

.kpis.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-value.green { color: var(--success); }
.kpi-value.amber { color: var(--pending); }

.toolbar select {
  padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid #d5dce7;
  font-size: 13.5px; font-family: var(--font); background: var(--white); color: var(--text);
}

/* segmented control */
.segmented { display: inline-flex; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; box-shadow: var(--shadow); }
.segmented .seg {
  border: 0; background: transparent; font-size: 13px; font-weight: 600; color: var(--muted);
  padding: 7px 13px; border-radius: 7px; display: inline-flex; align-items: center; gap: 7px;
}
.segmented .seg:hover { color: var(--navy); }
.segmented .seg.active { background: var(--navy); color: var(--white); }
.seg-count { font-size: 11px; background: var(--line-2); color: var(--navy); border-radius: 999px; padding: 1px 7px; }
.seg.active .seg-count { background: rgba(255,255,255,0.18); color: var(--white); }
.segmented.big { margin-bottom: 14px; }
.segmented.big .seg { padding: 9px 18px; font-size: 13.5px; }

/* status pills */
.pill.status-active { background: var(--success-bg); color: var(--success); }
.pill.status-deactivated { background: var(--pending-bg); color: var(--pending); }
.pill.status-archived { background: var(--line-2); color: var(--muted); }
.pill.planning { background: #eef3fb; color: var(--navy-2); }
.pill.pending-red { background: #fbe4e8; color: #b4495c; }
.pill.role { background: #eef3fb; color: var(--navy-2); }
.pill.role.super { background: var(--navy); color: var(--white); }
.pill.action.navy { background: #eef3fb; color: var(--navy-2); }
.pill.action.green { background: var(--success-bg); color: var(--success); }
.pill.action.amber { background: var(--pending-bg); color: var(--pending); }
.pill.action.red { background: var(--danger-bg); color: var(--danger); }
.btn-link.warn { color: var(--pending); }
.hint.tight { margin-top: 3px; font-size: 11.5px; }
td.row-actions { white-space: nowrap; text-align: right; }
td.nowrap, .nowrap { white-space: nowrap; }
.you-tag { font-size: 10.5px; font-weight: 700; color: var(--teal-ink); background: var(--teal-soft); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }

/* Visits: to-do cell */
.todo-cell { display: inline-flex; flex-direction: column; gap: 5px; text-decoration: none; color: var(--navy); font-size: 12.5px; font-weight: 600; min-width: 84px; }
.todo-cell:hover span:first-child { text-decoration: underline; color: var(--teal-ink); }
.mini-bar { display: block; height: 5px; border-radius: 5px; background: var(--line-2); overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--teal); }

/* To-do lists tab */
.legend i.carried { background: #fbe4e8; box-shadow: inset 3px 0 0 #e0899a; }
.legend i.edited { background: var(--pending-bg); box-shadow: inset 3px 0 0 var(--pending); }
.todo-date-head {
  font-size: 12px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase;
  color: var(--muted); margin: 22px 2px 10px;
}
.todo-date-head:first-child { margin-top: 4px; }
.todo-day {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden;
}
.todo-day-head {
  display: grid; grid-template-columns: minmax(200px, 1.2fr) 2fr minmax(170px, 1fr);
  gap: 18px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.todo-day-who { display: flex; align-items: center; gap: 11px; }
.avatar.sm {
  width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: var(--white);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.todo-day-name { font-weight: 700; color: var(--navy); font-size: 14.5px; }
.todo-day-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.todo-day-times { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--text); }
.todo-day-times b { font-weight: 600; color: var(--muted); margin-right: 3px; }
.todo-day-progress-row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.todo-day .table-wrap, .todo-day table { border: 0; box-shadow: none; border-radius: 0; }
table.log-table.todo-table { min-width: 760px; table-layout: fixed; }
table.log-table.todo-table th:nth-child(1) { width: 44px; }
table.log-table.todo-table th:nth-child(3) { width: 120px; }
table.log-table.todo-table th:nth-child(4) { width: 195px; }
table.log-table.todo-table th:nth-child(5) { width: 110px; }
table.log-table.todo-table th:nth-child(6) { width: 230px; }
table.log-table.todo-table th { background: var(--line-2); color: var(--muted); padding: 9px 16px; }
table.log-table.todo-table td { padding: 11px 16px; }
table.log-table.todo-table td:first-child { font-weight: 500; color: var(--muted); width: 44px; }
table.log-table.todo-table td.task-text { font-weight: 500; color: var(--text); max-width: 420px; }
table.log-table tr.row-carried td { background: #fdf5f6; }
table.log-table tr.row-carried td:first-child { box-shadow: inset 4px 0 0 #e0899a; }
table.log-table tr.row-carried td.task-text { color: #b4495c; }
table.log-table tr.history-row td { background: #fffaf0; border-top: 0; padding-top: 0; }
td.notes { white-space: normal; }
.note { display: inline-block; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 9px; margin: 1px 2px 1px 0; border: 0; font-family: var(--font); }
.note.carried { background: #fbe4e8; color: #b4495c; }
.note.edited { background: var(--pending-bg); color: var(--pending); cursor: pointer; }
.note.edited:hover { text-decoration: underline; }
.note.muted { background: var(--line-2); color: var(--muted); }
.history-box { border-left: 3px solid #f0c98a; padding: 6px 0 4px 12px; display: flex; flex-direction: column; gap: 6px; }
.history-item { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 12.5px; }
.history-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--pending); min-width: 62px; }
.history-item.current .history-label { color: var(--success); }
.history-text { color: var(--text); }
.history-item:not(.current) .history-text { text-decoration: line-through; text-decoration-color: #d9b27a; color: #6b5a40; }
.history-when { color: var(--muted); font-size: 11.5px; }

/* Audit */
table.log-table.audit td.details { color: var(--text); max-width: 520px; }
table.log-table.audit td:first-child { font-weight: 500; color: var(--muted); }

/* Settings */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.settings-grid > .settings-card:last-child { max-width: 640px; }
table.log-table.compact td:first-child { white-space: nowrap; }
.settings-card { padding: 22px 24px; }
.settings-head h3 { margin: 0; font-size: 16px; color: var(--navy); }
.settings-head p { margin: 4px 0 16px; font-size: 13px; color: var(--muted); line-height: 1.55; }
.form-row { display: grid; grid-template-columns: 1fr 1.2fr 0.6fr auto; gap: 10px; align-items: end; max-width: 980px; }
.form-row .field select { height: 40px; }
.form-row .field { margin-bottom: 0; }
.form-row .field input, .form-row .field select { padding: 9px 11px; font-size: 13.5px; }
.form-row .btn { width: auto; padding: 10px 16px; font-size: 13px; white-space: nowrap; }
.table-wrap.flat { box-shadow: none; margin-top: 14px; }
table.log-table.compact { min-width: 640px; font-size: 13px; }
table.log-table.compact th { padding: 10px 12px; }
table.log-table.compact td { padding: 11px 12px; }
table.log-table.compact td:first-child { font-weight: 500; color: var(--text); }
.role-note { margin-top: 12px; }
.radius-row { display: flex; flex-direction: column; gap: 12px; }
.radius-row .field { margin-bottom: 0; }
.input-suffix { display: flex; align-items: center; border: 1px solid #d5dce7; border-radius: var(--radius-sm); overflow: hidden; background: var(--white); max-width: 220px; }
.input-suffix input { border: 0; padding: 11px 13px; font-size: 20px; font-weight: 700; color: var(--navy); flex: 1; min-width: 0; font-family: var(--font); }
.input-suffix input:focus { outline: none; }
.input-suffix span { padding: 0 14px; color: var(--muted); font-size: 13px; background: var(--line-2); align-self: stretch; display: flex; align-items: center; }
input[type="range"] { width: 100%; accent-color: var(--teal); -webkit-appearance: none; appearance: none; height: 6px; border-radius: 6px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--teal); border: 3px solid var(--white); box-shadow: 0 1px 4px rgba(8,24,59,0.3); cursor: pointer; }
.radius-presets { display: flex; gap: 8px; margin: 12px 0 4px; flex-wrap: wrap; }
.chip { border: 1px solid #cdd5e1; background: var(--white); color: var(--navy); font-size: 12.5px; font-weight: 600; border-radius: 999px; padding: 5px 12px; }
.chip:hover { border-color: var(--teal); color: var(--teal-ink); }
.settings-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.settings-foot .btn { width: auto; padding: 10px 18px; font-size: 13px; }
.settings-foot .hint { margin: 0; }

@media (max-width: 1000px) {
  .settings-grid { grid-template-columns: 1fr; }
  .kpis.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .todo-day-head { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 700px) {
  .form-row { grid-template-columns: 1fr; }
  .kpis.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================
   SIGN-IN SCREENS (employee Step 1, forgot password, admin lock)
   Dark navy page with a centered white card — same as the
   Incident Report Tracker login.
   ============================================================ */
.auth-brand, .auth-footer { display: none; }

body.is-auth {
  background: var(--navy);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(38, 190, 197, 0.16), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(27, 58, 115, 0.9), transparent 60%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}
body.is-auth::before,
body.is-auth::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
}
body.is-auth::before {
  /* large faint "A" triangle, bottom right */
  width: 760px; height: 660px;
  right: -180px; bottom: -220px;
  background: linear-gradient(160deg, rgba(38, 190, 197, 0.20), rgba(38, 190, 197, 0.02));
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
body.is-auth::after {
  width: 300px; height: 260px;
  left: -60px; top: 12%;
  background: linear-gradient(200deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0));
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
body.is-auth .topbar,
body.is-auth .stepper,
body.is-auth .sync-note,
body.is-auth .page-footer { display: none; }
body.is-auth .app-main {
  position: relative;
  z-index: 1;
  max-width: 420px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 18px;
}
body.is-auth .card {
  border: 0;
  border-radius: 16px;
  padding: 30px 30px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
body.is-auth .card .eyebrow { display: none; }
body.is-auth .auth-brand {
  display: block;
  text-align: center;
  margin-bottom: 22px;
}
.auth-brand img { height: 46px; width: auto; display: block; margin: 0 auto 14px; }
.auth-brand .auth-title { font-size: 20px; font-weight: 700; color: var(--navy); letter-spacing: -0.2px; }
.auth-brand .auth-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
body.is-auth h1.page-title { font-size: 15px; text-align: center; }
body.is-auth p.page-lede { text-align: center; font-size: 13px; margin-bottom: 20px; }
body.is-auth .auth-footer {
  display: block;
  text-align: center;
  color: #8fa0c0;
  font-size: 12px;
  margin-top: 18px;
}
.auth-footer a { color: var(--teal); font-weight: 700; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }
body.is-auth .banner { margin-bottom: 14px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .topbar-row { padding: 10px 14px; gap: 10px; }
  .topbar-title .subtitle, .topbar-meta { display: none; }
  .topbar-logo img { height: 22px; }
  .topbar-user .who { display: none; }
  .app-main, .app-main.wide { padding: 20px 14px 50px; }
  .card { padding: 22px 18px; }
  .page-head h2 { font-size: 21px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 26px; }
  .toolbar input.grow { flex-basis: 100%; }
}
