/* =========================================================
   Staff Portal - Apple-style interface
   One stylesheet for login, worker and Superadmin pages
   ========================================================= */

:root {
  /* Colours */
  --accent: #223983;          /* LIM BEST corporate blue */
  --accent-press: #1A2C66;
  --accent-tint: #E8ECF6;
  --red: #D52B30;             /* LIM BEST red: log out, delete */
  --green: #248A3D;
  --green-tint: #E6F4EA;
  --amber-tint: #FFF4DB;
  --amber-text: #8A5300;
  --whatsapp: #25D366;

  --bg: #F5F5F7;              /* page background */
  --card: #FFFFFF;
  --fill: #F2F2F7;            /* input / segmented control background */
  --text: #1D1D1F;
  --text-2: #6E6E73;          /* secondary text */
  --separator: rgba(60, 60, 67, 0.14);

  /* Shape */
  --r-card: 18px;
  --r-control: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.05);

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto,
          "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}

img {
  max-width: 100%;
}

h1, h2, h3, p {
  margin: 0;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

:focus-visible {
  outline: 3px solid rgba(34, 57, 131, 0.35);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}


/* =========================================================
   Buttons
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: var(--accent-press);
}

/* Secondary: tinted, no outline (Apple "gray" button) */
.btn-outline {
  background: var(--accent-tint);
  color: var(--accent);
}

.btn-outline:hover {
  background: #DCE2F1;
}

.btn-small {
  min-height: 36px;
  padding: 0 14px;
  font-size: 14px;
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: #FFFFFF;
}

/* Text buttons in headers and tables */
.link-btn {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--red);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.link-btn-blue {
  color: var(--accent);
}

.link-btn:hover {
  opacity: 0.7;
}


/* =========================================================
   Form fields
   ========================================================= */

input[type="text"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="month"],
input[type="number"],
input[type="datetime-local"],
input[type="time"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1.5px solid transparent;
  border-radius: var(--r-control);
  background: var(--fill);
  color: var(--text);
  font-size: 16px;   /* 16px stops iPhone zooming in */
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

textarea {
  padding: 12px 14px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #FFFFFF;
}

label {
  display: block;
  margin: 0 0 6px 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
}

.form-error {
  padding: 12px 14px;
  border-radius: var(--r-control);
  background: #FDECEC;
  color: #B3261E;
  font-size: 14px;
}

/* PIN field with Show / Hide (button added by auth.js) */
.pin-field {
  position: relative;
  display: block;
}

.pin-field input {
  padding-right: 84px;
}

.show-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  height: 36px;
  min-width: 68px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}


/* =========================================================
   Segmented control (language, reports, admin tabs)
   ========================================================= */

.segmented,
.lang-switch,
.seg-group,
.admin-tabs {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: rgba(118, 118, 128, 0.12);
}

.lang-switch button,
.seg,
.tab {
  min-height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.lang-switch button.is-active,
.seg.is-active,
.tab.is-active {
  background: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04);
}


/* =========================================================
   Malaysian licence plate (black, white letters)
   ========================================================= */

.plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  background: #111111;
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: inset 0 0 0 2px #111111, inset 0 0 0 3px rgba(255, 255, 255, 0.35);
  font-variant-numeric: tabular-nums;
}


/* =========================================================
   Header (worker + admin): frosted, sticky
   ========================================================= */

.app-header,
.w-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--separator);
}

.app-header,
.w-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
}

.app-logo,
.w-logo {
  flex: 0 1 auto;
  min-width: 0;
  height: 32px;
  width: auto;
  max-width: 45vw;
  object-fit: contain;
  object-position: left center;
}

.app-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  line-height: 1.25;
}

/* Worker header: name + two round icon buttons in one row */
.w-user {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.w-user > span {
  margin-right: 4px;
  white-space: nowrap;
}

.icon-round {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  cursor: pointer;
}

.icon-round svg {
  width: 20px;
  height: 20px;
}

.icon-round-red {
  background: #FDECEC;
  color: var(--red);
}

.icon-round:active {
  transform: scale(0.94);
}

.app-user > span,
.w-user > span {
  font-size: 15px;
  font-weight: 600;
}

.app-user-actions,
.w-user-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0 16px;
}

.app-user-actions .link-btn,
.w-user-actions .link-btn {
  font-size: 14px;
}


/* =========================================================
   Dialogs (bottom sheet on phones, centred on desktop)
   ========================================================= */

dialog {
  width: calc(100% - 32px);
  max-width: 420px;
  max-height: 90vh;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.pin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
}

.pin-form h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.pin-form label {
  margin-bottom: -8px;
}

.dialog-sub {
  margin-top: -8px;
  color: var(--text-2);
  font-size: 15px;
}

.pin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

.pin-actions .btn {
  min-height: 50px;
}

@media (max-width: 600px) {
  dialog {
    width: 100%;
    max-width: none;
    margin: auto 0 0;
    border-radius: 20px 20px 0 0;
  }
}


/* =========================================================
   Login page
   ========================================================= */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-card .lang-switch {
  margin-bottom: 36px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-logo {
  height: 56px;
  width: auto;
}

.login-sub {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow);
}

#login-form label {
  margin-bottom: -10px;
}

#login-btn {
  min-height: 52px;
  margin-top: 4px;
  font-size: 17px;
}

.login-help {
  margin-top: 20px;
  text-align: center;
  color: var(--text-2);
  font-size: 14px;
}


/* =========================================================
   Worker page
   ========================================================= */

.w-wrap {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.w-toolbar {
  display: flex;
  justify-content: center;
  padding-top: 16px;
}

.w-toolbar .lang-switch {
  width: 100%;
  max-width: 320px;
}

/* Large title */
.w-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 4px 16px;
}

.w-label {
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
}

.w-date-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.w-refresh {
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.worker-page .form-error {
  margin-bottom: 16px;
}

/* Vehicle block */
.w-crew {
  margin-bottom: 28px;
}

.w-crew-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin-bottom: 12px;
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow);
}

.w-crew-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.w-crew-role {
  font-size: 17px;
  font-weight: 600;
}

.w-crew-partner {
  color: var(--text-2);
  font-size: 14px;
}

.w-progress {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.w-progress-bar {
  width: 64px;
  height: 6px;
  border-radius: 3px;
  background: var(--fill);
  overflow: hidden;
}

.w-progress-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--green);
  transition: width 0.3s ease;
}

.w-crew-empty {
  padding: 20px;
  border-radius: var(--r-card);
  background: var(--card);
  color: var(--text-2);
  text-align: center;
}

/* Task card */
.w-task {
  margin-bottom: 12px;
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.w-task-main {
  display: flex;
  gap: 14px;
  padding: 18px 16px 14px;
}

/* Suggested order: a round number badge */
.w-num {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
}

.w-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.w-order-label {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.w-title {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* Boss's special reminder */
.w-remark {
  margin: 0 16px 12px;
  padding: 12px 14px;
  border-radius: var(--r-control);
  background: var(--amber-tint);
  color: var(--amber-text);
  font-size: 15px;
}

.w-remark strong {
  font-weight: 700;
}

/* iOS-style list rows: address and contact */
.w-rows {
  margin: 0 16px;
  border-top: 1px solid var(--separator);
}

.w-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 0;
  border-bottom: 1px solid var(--separator);
  color: var(--text);
  text-decoration: none;
}

.w-row:last-child {
  border-bottom: 0;
}

.w-row-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--fill);
  color: var(--accent);
}

.w-row-icon svg {
  width: 18px;
  height: 18px;
}

.w-row-text {
  flex: 1;
  min-width: 0;
  font-size: 16px;
}

.w-row-sub {
  display: block;
  color: var(--text-2);
  font-size: 13px;
}

.w-chevron {
  flex: none;
  color: #C7C7CC;
}

/* Address is read on the spot: large, dark, wraps fully, can be copied */
.w-row-address {
  align-items: flex-start;
  padding: 12px 0;
}

.w-row-address .w-row-icon {
  margin-top: 2px;
}

.w-address-text {
  display: block;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  user-select: text;
  -webkit-user-select: text;
}

.w-row-address .w-round {
  margin-top: 2px;
}

/* A done task keeps its address readable */
.w-task-done .w-address-text {
  color: var(--text-2);
  font-weight: 500;
}

/* Round call / WhatsApp buttons on the contact row */
.w-round {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  text-decoration: none;
}

.w-round svg {
  width: 20px;
  height: 20px;
}

.w-round-call {
  background: var(--accent-tint);
  color: var(--accent);
}

.w-round-wa {
  background: var(--whatsapp);
  color: #FFFFFF;
}

/* Complete button */
.w-actions {
  padding: 12px 16px 16px;
}

.btn-complete {
  width: 100%;
  min-height: 54px;
  font-size: 17px;
}

/* Completed task: quiet, with a green tick */
.w-task-done {
  box-shadow: none;
  background: rgba(255, 255, 255, 0.6);
}

.w-task-done .w-num {
  background: var(--green-tint);
  color: var(--green);
}

.w-task-done .w-title,
.w-task-done .w-row-text {
  color: var(--text-2);
}

.w-done-badge {
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
}

.w-task-done .w-actions {
  display: none;
}

.w-task-done .w-rows {
  margin-bottom: 4px;
}

/* Empty day */
.w-empty {
  padding: 48px 24px;
  border-radius: var(--r-card);
  background: var(--card);
  text-align: center;
}

.w-empty-title {
  margin-bottom: 6px;
  font-size: 20px;
  font-weight: 700;
}

.w-empty p {
  color: var(--text-2);
}


/* =========================================================
   Superadmin page
   ========================================================= */

/* Logo | tabs | user, all in one frosted sticky bar */
.admin-page .app-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 16px;
  row-gap: 8px;
}

.admin-page .app-logo {
  justify-self: start;
}

.admin-page .app-user {
  justify-self: end;
}

.admin-tabs {
  display: flex;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.admin-tabs::-webkit-scrollbar {
  display: none;
}

/* Narrow screens: tabs drop to their own row inside the bar */
@media (max-width: 900px) {
  .admin-page .app-header {
    display: flex;
    flex-wrap: wrap;
  }

  .admin-tabs {
    order: 3;
    margin: 0 auto;
  }
}

.admin-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: var(--r-control);
  background: var(--green-tint);
  color: var(--green);
  font-weight: 500;
}

.notice-error {
  background: #FDECEC;
  color: #B3261E;
}

/* Date bar */
.date-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.date-bar .date-input {
  width: auto;
  min-height: 36px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.date-label {
  margin-left: 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.warnings {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: var(--r-control);
  background: var(--amber-tint);
  color: var(--amber-text);
  font-size: 15px;
}

.warnings ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

/* Vehicle cards */
.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
  align-items: start;
}

.vcard {
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.vcard:not(.vcard-active) {
  background: rgba(255, 255, 255, 0.6);
  box-shadow: none;
  border: 1px dashed rgba(60, 60, 67, 0.2);
}

.vcard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
}

.vcard-progress {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
}

.vcard-crew {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
  padding: 8px 16px 16px;
}

.vcard-crew .btn {
  grid-column: 1 / -1;
  justify-self: start;
}

.vcard-crew label {
  margin: 0;
  font-size: 13px;
}

.crew-select {
  margin-top: 4px;
  min-height: 40px;
  padding: 0 10px;
  font-size: 15px;
}

.vcard-hint {
  padding: 0 16px 16px;
  color: var(--text-2);
  font-size: 14px;
}

.vtask-list {
  margin: 0 16px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--separator);
}

.vtask {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--separator);
}

.vtask-empty {
  padding: 16px 0;
  color: var(--text-2);
  font-size: 14px;
}

.vtask-order {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.vtask-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.vtask-done .vtask-num {
  background: var(--green-tint);
  color: var(--green);
}

.icon-btn {
  width: 28px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--fill);
  color: var(--text-2);
  font-size: 9px;
  cursor: pointer;
}

.icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.vtask-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 14px;
}

.vtask-title {
  font-size: 16px;
  font-weight: 600;
}

.vtask-remark {
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 8px;
  background: var(--amber-tint);
  color: var(--amber-text);
}

.vtask-address {
  color: var(--accent);
  text-decoration: none;
}

.vtask-address:hover {
  text-decoration: underline;
}

.vtask-contact {
  color: var(--text-2);
}

.vtask-status-done {
  color: var(--green);
  font-weight: 600;
}

.vtask-done .vtask-title {
  color: var(--text-2);
}

.vtask-actions {
  display: flex;
  gap: 18px;
  margin-top: 4px;
}

.vtask-actions .link-btn {
  font-size: 14px;
}

.vcard-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 16px;
}

/* Staff & Vehicles */
.panel-title {
  margin: 8px 4px 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-note {
  margin: 0 4px 12px;
  color: var(--text-2);
  font-size: 14px;
}

.table-wrap {
  margin-bottom: 32px;
  overflow-x: auto;
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--separator);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table th {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.row-inactive td {
  color: var(--text-2);
}

.row-actions {
  display: flex;
  gap: 18px;
}

.table-empty {
  color: var(--text-2);
  text-align: center;
}

.inline-form {
  display: flex;
  gap: 10px;
  max-width: 420px;
  margin: 0 0 14px;
}

.inline-form input {
  min-height: 44px;
  background: var(--card);
  box-shadow: var(--shadow);
}

/* Task dialog: longer form */
.task-dialog {
  max-width: 520px;
}

.task-dialog .pin-form {
  gap: 12px;
}

/* Reports */
.report-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.report-bar .date-input {
  width: auto;
  min-height: 36px;
  background: var(--card);
  box-shadow: var(--shadow);
}

#rep-export {
  margin-left: auto;
}

.report-heading {
  margin-bottom: 16px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px;
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow);
}

.stat-label {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
}

.stat-value {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-note {
  color: var(--green);
  font-size: 14px;
  font-weight: 600;
}

.hour-bars {
  padding: 12px 16px;
}

.hour-row {
  display: grid;
  grid-template-columns: 130px 1fr 40px;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
  font-size: 14px;
}

.hour-track {
  height: 10px;
  border-radius: 5px;
  background: var(--fill);
  overflow: hidden;
}

.hour-bar {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: var(--accent);
}

.hour-count {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.empty-state {
  padding: 48px 24px;
  border-radius: var(--r-card);
  background: var(--card);
  text-align: center;
}

.empty-title {
  margin-bottom: 6px;
  font-size: 20px;
  font-weight: 700;
}


/* =========================================================
   Smaller screens
   ========================================================= */

@media (max-width: 900px) {
  .stat-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .app-header,
  .w-header-inner {
    padding: 10px 16px;
  }

  .admin-main {
    padding: 20px 16px 48px;
  }

  .vehicle-grid {
    grid-template-columns: 1fr;
  }

  .vcard-crew .btn {
    justify-self: stretch;
  }

  .date-label,
  .report-heading {
    width: 100%;
    margin-left: 0;
    font-size: 24px;
  }

  #rep-export {
    margin-left: 0;
  }

  .hour-row {
    grid-template-columns: 100px 1fr 32px;
  }

  .w-date-value {
    font-size: 28px;
  }
}


/* =========================================================
   Designed confirm / message sheet (replaces browser pop-ups)
   ========================================================= */

.btn-danger {
  background: var(--red);
  color: #FFFFFF;
}

.btn-danger:hover {
  background: #B32227;
}

.confirm-sheet {
  max-width: 380px;
}

.confirm-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 24px 24px;
  text-align: center;
}

.confirm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
}

.confirm-icon svg {
  width: 28px;
  height: 28px;
}

.is-danger .confirm-icon {
  background: #FDECEC;
  color: var(--red);
}

.confirm-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.confirm-message {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 15px;
}

.confirm-message:empty {
  display: none;
}

/* Task name + address in a soft panel */
.confirm-details {
  width: 100%;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--r-control);
  background: var(--fill);
  text-align: left;
}

.confirm-detail-main {
  font-size: 17px;
  font-weight: 600;
}

.confirm-detail {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.4;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  margin-top: 22px;
}

.confirm-actions.is-single {
  grid-template-columns: 1fr;
}

.confirm-actions .btn {
  min-height: 52px;
  font-size: 17px;
}

/* Gentle entrance when the sheet opens */
.confirm-sheet[open] {
  animation: sheet-in 0.22s ease-out;
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

@media (max-width: 600px) {
  .confirm-sheet {
    max-width: none;
  }

  .confirm-box {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .confirm-sheet[open] { animation: none; }
}

/* Plate inputs show capitals while typing (saved in capitals too) */
#plate-input,
#vehicle-plate {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#plate-input::placeholder,
#vehicle-plate::placeholder {
  text-transform: none;
  letter-spacing: normal;
}

/* Section title with a button on the right */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 4px 6px;
}

.panel-head .panel-title {
  margin: 0;
}

.field-hint {
  margin: 6px 4px 0;
  color: var(--text-2);
  font-size: 13px;
}

.pin-form [hidden] {
  display: none;
}

/* Labels wrapped in a group keep normal spacing above their field */
.pin-form > div > label {
  margin-bottom: 6px;
}


/* =========================================================
   PHASE 2: job pool, dispatch board, import, review, worker qty
   ========================================================= */

:root {
  --deliver: #0B7A75;
  --deliver-tint: #E0F2F1;
  --bomba: #6B3FA0;
  --bomba-tint: #F1EAF9;
  --other: #5B6578;
  --other-tint: #EEF0F3;
  --amber: #B25E00;
  --amber-fill: #F5A524;
}

/* ---------- Tabs: pending counter ---------- */

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--amber-fill);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
}

.tab-count[hidden] {
  display: none;
}

/* ---------- Page heading ---------- */

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 16px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-collect { background: var(--accent-tint); color: var(--accent); }
.badge-deliver { background: var(--deliver-tint); color: var(--deliver); }
.badge-bomba   { background: var(--bomba-tint); color: var(--bomba); }
.badge-other   { background: var(--other-tint); color: var(--other); }

.badge-status-open      { background: var(--other-tint); color: var(--other); }
.badge-status-assigned  { background: var(--accent-tint); color: var(--accent); }
.badge-status-pending   { background: var(--amber-tint); color: var(--amber); }
.badge-status-done      { background: var(--green-tint); color: var(--green); }
.badge-status-cancelled { background: var(--fill); color: var(--text-2); text-decoration: line-through; }

.badge-ok   { background: var(--green-tint); color: var(--green); }
.badge-warn { background: var(--amber-tint); color: var(--amber); margin: 0 4px 4px 0; white-space: normal; height: auto; padding: 3px 8px; }

/* ---------- Filters ---------- */

.status-seg {
  display: flex;
  flex-wrap: wrap;
  width: max-content;
  max-width: 100%;
  margin-bottom: 14px;
}

.seg-count {
  margin-left: 4px;
  color: var(--text-2);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.seg-pending.is-active {
  color: var(--amber);
}

.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.filter-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-range label {
  margin: 0;
  font-size: 13px;
}

.filter-bar .date-input,
.filter-select,
.filter-search,
.bulk-bar .date-input {
  width: auto;
  min-height: 36px;
  padding: 0 10px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 14px;
}

.filter-search {
  flex: 1;
  min-width: 200px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--separator);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.chip.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #FFFFFF;
}

.chip-count {
  font-weight: 500;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.chip-row-small .chip {
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
}

/* ---------- Bulk bar ---------- */

.bulk-bar {
  position: sticky;
  top: calc(var(--header-h, 64px) + 10px);
  z-index: 12;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: var(--r-control);
  background: var(--accent);
  color: #FFFFFF;
  box-shadow: var(--shadow);
}

.bulk-count {
  font-weight: 700;
  margin-right: 6px;
}

.bulk-label {
  font-size: 14px;
  opacity: 0.85;
}

.bulk-bar .btn-outline {
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
}

.bulk-bar .btn-primary {
  background: #FFFFFF;
  color: var(--accent);
}

.bulk-bar .link-btn {
  color: #FFD5D6;
  margin-left: auto;
}

/* ---------- Job table ---------- */

.job-table td {
  vertical-align: top;
}

.job-row {
  cursor: pointer;
}

.job-row:hover td {
  background: #FAFAFC;
}

.job-row-cancelled td {
  color: var(--text-2);
}

.col-check {
  width: 36px;
}

.col-check input {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--accent);
}

.col-date {
  white-space: nowrap;
}

.col-customer {
  min-width: 240px;
  max-width: 420px;
}

.cell-main {
  display: block;
  font-weight: 600;
}

.cell-sub {
  display: block;
  margin-top: 2px;
  color: var(--text-2);
  font-size: 13px;
}

.cell-detail {
  font-size: 12px;
}

.col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table th.col-num {
  text-align: right;
}

.qty-diff {
  color: var(--amber);
  font-weight: 700;
}

/* Special column so BOMBA certificate jobs stand out */
.col-bomba {
  text-align: center;
}

.bomba-flag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bomba);
  color: #FFFFFF;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* ---------- Dispatch board ---------- */

.copy-crews {
  margin-left: auto;
}

.board {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}

.board-pool {
  position: sticky;
  top: calc(var(--header-h, 64px) + 16px);
  max-height: calc(100vh - var(--header-h, 64px) - 32px);
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow);
}

.pool-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.pool-title {
  font-size: 18px;
  font-weight: 700;
}

.pool-count {
  color: var(--text-2);
  font-weight: 600;
}

.pool-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  cursor: pointer;
}

.pool-hint {
  margin-bottom: 10px;
  color: var(--text-2);
  font-size: 12.5px;
}

.pool-list {
  flex: 1;
  overflow-y: auto;
  min-height: 80px;
}

.dnd-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dnd-list:empty::before {
  content: attr(data-empty);
  display: block;
  padding: 18px 12px;
  border: 1.5px dashed rgba(60, 60, 67, 0.25);
  border-radius: var(--r-control);
  color: var(--text-2);
  font-size: 13px;
  text-align: center;
}

.dnd-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
  padding: 10px 12px 10px 14px;
  border: 1px solid var(--separator);
  border-radius: var(--r-control);
  background: var(--card);
  cursor: grab;
  font-size: 13.5px;
}

/* Colour strip on the left shows the job type */
.dnd-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.dnd-deliver::before { background: var(--deliver); }
.dnd-bomba::before   { background: var(--bomba); }
.dnd-other::before   { background: var(--other); }

.dnd-item:hover {
  border-color: rgba(34, 57, 131, 0.35);
}

.dnd-item.is-locked {
  cursor: pointer;
  background: var(--fill);
}

.dnd-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.dnd-top .badge {
  height: 20px;
  font-size: 11.5px;
}

.dnd-area {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-2);
}

.dnd-qty {
  margin-left: auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dnd-late {
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
}

.dnd-name {
  font-weight: 600;
  line-height: 1.3;
}

.dnd-address {
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.35;
}

.dnd-remark {
  align-self: flex-start;
  margin-top: 2px;
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--amber-tint);
  color: var(--amber-text);
  font-size: 12px;
}

.dnd-status {
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 600;
}

.dnd-done    { color: var(--green); }
.dnd-pending { color: var(--amber); }

.dnd-ghost {
  opacity: 0.35;
}

.dnd-chosen {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.vehicle-list {
  min-height: 60px;
  padding: 0 16px;
}

.vcard-load {
  display: flex;
  gap: 8px;
  padding: 0 16px 6px;
}

.load-stat {
  display: flex;
  flex-direction: column;
  min-width: 64px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--accent-tint);
  color: var(--accent);
  line-height: 1.15;
}

.load-deliver { background: var(--deliver-tint); color: var(--deliver); }
.load-bomba   { background: var(--bomba-tint); color: var(--bomba); }
.load-other   { background: var(--other-tint); color: var(--other); }

.load-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.load-label {
  font-size: 12px;
  font-weight: 600;
}

.vcard-warn {
  margin: 0 16px 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--amber-tint);
  color: var(--amber-text);
  font-size: 13px;
}

.board .vehicle-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* ---------- Import ---------- */

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 0 20px;
  padding: 36px 20px;
  border: 2px dashed rgba(34, 57, 131, 0.3);
  border-radius: var(--r-card);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  text-align: center;
}

.drop-zone.is-over {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.drop-sub {
  color: var(--text-2);
  font-size: 14px;
}

.import-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-warn .stat-value {
  color: var(--amber);
}

.import-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.import-actions .pool-toggle {
  margin-right: auto;
}

.import-table td {
  vertical-align: top;
}

.import-table .date-input,
.import-table .filter-select {
  min-height: 34px;
  box-shadow: none;
  background: var(--fill);
}

.import-table .qty-input {
  width: 76px;
  min-height: 34px;
  padding: 0 8px;
  text-align: right;
}

.import-table td:nth-child(5) .cell-main {
  white-space: nowrap;
}

.row-issue td:last-child {
  min-width: 160px;
}

.area-code-cell {
  font-weight: 700;
}

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

.job-dialog {
  max-width: 600px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.type-seg {
  display: grid;
  grid-auto-flow: column;
  width: 100%;
}

.type-seg .seg {
  padding: 0 8px;
}

.review-box {
  padding: 14px 16px;
  border-radius: var(--r-control);
  background: var(--amber-tint);
  color: var(--text);
}

.review-done {
  background: var(--green-tint);
}

.review-done strong {
  color: var(--green);
}

.review-title {
  display: block;
  margin-bottom: 8px;
  color: var(--amber);
  font-size: 16px;
}

.review-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin: 0 0 12px;
  font-size: 14px;
}

.review-facts dt {
  color: var(--text-2);
}

.review-facts dd {
  margin: 0;
  font-weight: 600;
}

.review-action {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.review-action .date-input {
  width: auto;
  min-height: 36px;
  background: var(--card);
}

.review-main {
  padding: 12px;
  border-radius: 12px;
  background: var(--card);
}

.review-line {
  font-size: 15px;
  font-weight: 600;
}

.review-main .date-input {
  background: var(--fill);
}

.review-hint {
  margin: 8px 2px 0;
  color: var(--text-2);
  font-size: 13px;
}

.review-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 20px;
  margin-top: 10px;
}

.review-links .link-btn {
  font-size: 14px;
}

.review-inline {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.job-history summary {
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.job-history ol {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13.5px;
}

.job-history li {
  margin-bottom: 4px;
}

.hist-when {
  display: block;
  color: var(--text-2);
  font-size: 12px;
}

.job-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.job-actions-spacer {
  flex: 1;
}

.ask-text input {
  margin-top: 16px;
}

/* ---------- Responsive: admin ---------- */

@media (max-width: 1000px) {
  .board {
    grid-template-columns: 1fr;
  }

  .board-pool {
    position: static;
    max-height: none;
  }

  .pool-list {
    max-height: 50vh;
  }
}

@media (max-width: 700px) {
  .import-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .copy-crews {
    margin-left: 0;
  }
}


/* =========================================================
   Worker page: job types, quantity stepper, pending
   ========================================================= */

.w-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.w-type {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 700;
}

.w-type-tag-collect { background: var(--accent-tint); color: var(--accent); }
.w-type-tag-deliver { background: var(--deliver-tint); color: var(--deliver); }
.w-type-tag-bomba   { background: var(--bomba); color: #FFFFFF; }
.w-type-tag-other   { background: var(--other-tint); color: var(--other); }

.w-area {
  height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--fill);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  line-height: 26px;
}

/* A BOMBA certificate job gets a purple edge */
.w-type-bomba {
  box-shadow: inset 4px 0 0 var(--bomba), var(--shadow);
}

.w-pending-badge {
  color: var(--amber);
  font-size: 13px;
  font-weight: 700;
}

.w-num-pending {
  background: var(--amber-tint);
  color: var(--amber);
  font-weight: 800;
}

.w-task-pending {
  background: rgba(255, 255, 255, 0.7);
  box-shadow: none;
}

.w-task-pending .w-title {
  color: var(--text-2);
}

.w-details {
  margin: -4px 16px 12px 70px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.4;
}

/* Planned vs actual */
.w-qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 16px 0;
  padding: 12px 14px;
  border-radius: var(--r-control);
  background: var(--fill);
}

.w-qty-plan,
.w-qty-actual {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.w-qty-actual {
  align-items: flex-end;
}

.w-qty-label {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.w-qty-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #FFFFFF;
  color: var(--accent);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.stepper input {
  width: 72px;
  min-height: 44px;
  padding: 0 6px;
  border: 2px solid transparent;
  background: #FFFFFF;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.stepper input.is-diff {
  border-color: var(--amber-fill);
  color: var(--amber);
}

.stepper-large {
  justify-content: center;
  margin-top: 4px;
}

.stepper-large .step-btn,
.stepper-large input {
  height: 52px;
}

.stepper-large .step-btn {
  width: 52px;
  background: var(--fill);
}

.stepper-large input {
  width: 96px;
  background: var(--fill);
}

.w-qty-hint {
  margin: 8px 16px 0;
  color: var(--amber);
  font-size: 14px;
  font-weight: 600;
}

.w-qty-hint[hidden] {
  display: none;
}

/* Pending + Complete side by side */
.w-actions-two {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 10px;
}

.btn-pending {
  background: var(--amber-tint);
  color: var(--amber);
}

.btn-pending:hover {
  background: #FDE9C2;
}

.btn-complete:disabled {
  background: #E5E5EA;
  color: #8E8E93;
  opacity: 1;
  cursor: not-allowed;
}

/* Pending sheet */
.reason-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reason {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 14px;
  border: 1.5px solid var(--separator);
  border-radius: var(--r-control);
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.reason[hidden] {
  display: none;
}

.reason-dot {
  flex: none;
  width: 22px;
  height: 22px;
  border: 2px solid #C7C7CC;
  border-radius: 50%;
}

.reason.is-active {
  border-color: var(--amber-fill);
  background: var(--amber-tint);
  font-weight: 700;
}

.reason.is-active .reason-dot {
  border: 7px solid var(--amber-fill);
}

.reason-extra[hidden] {
  display: none;
}

.pending-dialog .pin-actions .btn-pending {
  background: var(--amber-fill);
  color: #FFFFFF;
}

/* Anything marked hidden stays hidden, whatever display rule it has */
[hidden] {
  display: none !important;
}

/* Table headings never break inside a word */
.data-table th {
  white-space: nowrap;
  overflow-wrap: normal;
}

/* Labels inside two-column rows of a dialog keep normal spacing */
.pin-form .form-row label {
  margin-bottom: 6px;
}

/* ---------- Import: repeated companies and missing areas ---------- */

.badge-issue {
  margin: 0 4px 4px 0;
  height: auto;
  padding: 3px 8px;
  white-space: normal;
}

.badge-dup  { background: #FDECEC; color: #B3261E; }
.badge-area { background: var(--amber-tint); color: var(--amber); }
.badge-info { background: var(--fill); color: var(--text-2); }

.dup-banner {
  margin-bottom: 12px;
  padding: 12px 16px;
  border-left: 4px solid #D52B30;
  border-radius: var(--r-control);
  background: #FDECEC;
  color: #7A1C17;
  font-size: 14px;
}

/* Rows of the same company on the same date are grouped with a red edge */
.row-dup td:first-child {
  box-shadow: inset 4px 0 0 #D52B30;
}

.row-dup-first td {
  border-top: 2px solid rgba(213, 43, 48, 0.35);
}

.dup-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.stat-dup .stat-value {
  color: #B3261E;
}

.stat-note-quiet {
  color: var(--text-2);
  font-weight: 500;
}

.filter-select.is-missing {
  background: var(--amber-tint);
  color: var(--amber);
  font-weight: 600;
}

.chip-warn:not(.is-active) {
  border-color: var(--amber-fill);
  background: var(--amber-tint);
  color: var(--amber);
}

.dup-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
}

.dup-toggle {
  margin-left: auto;
  background: #FFFFFF;
  color: #B3261E;
}

/* ---------- Import preview filters ---------- */

.import-show {
  margin-bottom: 10px;
}

.import-filters .filter-select {
  max-width: 100%;
}

.import-count {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-2);
}

.import-count strong {
  color: var(--text);
}

.import-empty td {
  padding: 28px 12px;
  text-align: center;
  color: var(--text-2);
}

.existing-note {
  max-width: 260px;
  margin-top: 4px;
  line-height: 1.35;
}

/* Quick-date buttons scroll sideways on small phones instead of widening the page */
.filter-bar .seg-group {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-bar .seg-group::-webkit-scrollbar {
  display: none;
}

/* ---------- Worker: pick a new day and time (big buttons) ---------- */

.pick-label {
  display: block;
  margin: 4px 0 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.pick-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.pick-days {
  grid-template-columns: repeat(4, 1fr);
}

.pick-slots {
  grid-template-columns: repeat(2, 1fr);
}

.pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 52px;
  padding: 8px 4px;
  border: 1.5px solid var(--separator);
  border-radius: var(--r-control);
  background: var(--card);
  color: var(--text);
  font: inherit;
  text-align: center;
  cursor: pointer;
}

.pick-day {
  min-height: 72px;
}

.pick-big {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.pick-main {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.pick-sub {
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.2;
}

.pick.is-active {
  border-color: var(--amber-fill);
  background: var(--amber-tint);
}

.pick.is-active .pick-big,
.pick.is-active .pick-main {
  color: var(--amber);
}

.pick-native {
  margin: -4px 0 12px;
}

.pick-native[hidden] {
  display: none;
}

/* =========================================================
   Print job sheets (Dispatch)
   ========================================================= */

.print-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.pin-form .print-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--fill);
  color: var(--text);
  cursor: pointer;
}

.print-row input {
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
}

.plate-small {
  min-width: 52px;
  height: 28px;
  padding: 0 8px;
  font-size: 14px;
}

.print-who {
  display: flex;
  flex-direction: column;
}

.print-tip {
  margin: 12px 0 0;
  color: var(--text-2);
  font-size: 13px;
}

.print-area {
  display: none;
}

@page {
  size: A4;
  margin: 10mm;
}

@media print {
  body.admin-page {
    background: #FFFFFF;
  }

  body.admin-page > *:not(.print-area) {
    display: none !important;
  }

  .print-area {
    display: block;
  }
}

/* Sheet layout (also used off-screen to measure the height before printing) */
.print-area {
  color: #000000;
  font-size: 9.5pt;
  line-height: 1.3;
}

.print-area.is-measuring {
  display: block;
  position: absolute;
  top: 0;
  left: -10000px;
  width: 190mm;
  background: #FFFFFF;
}

.sheet {
  break-after: page;
}

.sheet:last-child {
  break-after: auto;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 3mm;
  border-bottom: 2px solid #223983;
}

.sheet-logo {
  height: 11mm;
  width: auto;
}

.sheet-title {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.sheet-title strong {
  font-size: 15pt;
  color: #223983;
}

.sheet-title span {
  font-size: 11pt;
  font-weight: 600;
}

.sheet-crew {
  display: flex;
  align-items: center;
  gap: 6mm;
  margin: 3mm 0;
}

.sheet-plate {
  padding: 1.5mm 3mm;
  border: 1.5px solid #000000;
  border-radius: 2mm;
  font-size: 15pt;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.sheet-people {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.5mm 3mm;
  margin: 0;
}

.sheet-people dt {
  color: #555555;
}

.sheet-people dd {
  margin: 0;
  font-weight: 700;
}

.sheet-load {
  display: flex;
  gap: 3mm;
  margin-left: auto;
}

.sheet-load-item {
  padding: 1mm 2.5mm;
  border: 1px solid #BBBBBB;
  border-radius: 1.5mm;
}

.sheet-load-item b {
  font-size: 11pt;
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.sheet-table th {
  padding: 1.5mm;
  border-bottom: 1.5px solid #000000;
  font-size: 8.5pt;
  text-align: left;
}

.sheet-table td {
  padding: 1.8mm 1.5mm;
  border-bottom: 1px solid #CCCCCC;
  vertical-align: top;
}

.sheet-table tr {
  break-inside: avoid;
}

.sheet-table .c-no { width: 8mm; font-weight: 700; white-space: nowrap; }
.sheet-table .c-cust { width: auto; }
.sheet-table .c-contact { width: 30mm; }
.sheet-table .c-type { width: 16mm; }
.sheet-table .c-qty { width: 10mm; text-align: right; font-weight: 700; }
.sheet-table .c-actual { width: 16mm; border-left: 1px solid #CCCCCC; }
.sheet-table .c-sign { width: 26mm; border-left: 1px solid #CCCCCC; }

.sheet-company {
  font-weight: 700;
}

.sheet-area {
  display: inline-block;
  margin-right: 1.5mm;
  padding: 0 1mm;
  border: 1px solid #000000;
  border-radius: 1mm;
  font-size: 8pt;
}

.sheet-address {
  margin-top: 0.5mm;
}

.sheet-note {
  margin-top: 0.5mm;
  color: #555555;
  font-size: 8pt;
}

.sheet-remark {
  margin-top: 0.5mm;
  font-weight: 700;
}

.sheet-phone {
  font-weight: 600;
  white-space: nowrap;
}

.sheet-bomba .c-type,
.sheet-deliver .c-type {
  font-weight: 700;
}

.sheet-done,
.sheet-pending {
  font-size: 8pt;
  font-weight: 700;
}

.sheet-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 4mm 12mm;
  margin-top: 8mm;
}

.sheet-printed {
  margin-left: auto;
  color: #777777;
  font-size: 8pt;
}

/* ---------- Release time (Settings + Dispatch hint) ---------- */

.release-card {
  margin-bottom: 28px;
  padding: 16px;
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow);
}

.release-card > label {
  display: block;
  margin: 0 0 8px;
  font-weight: 600;
}

.release-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.release-row input[type="time"] {
  width: auto;
  min-height: 40px;
  font-size: 17px;
  font-weight: 600;
}

.release-tz {
  color: var(--text-2);
  font-size: 14px;
}

.release-card .panel-note {
  margin: 10px 0 0;
}

.release-hint {
  margin: -8px 0 16px;
  color: var(--text-2);
  font-size: 14px;
}

.w-wait .w-empty-title {
  color: var(--accent);
}

/* ---------- Busy overlay ---------- */

.busy {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(245, 245, 247, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.busy[hidden] {
  display: none;
}

.busy-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(360px, 100%);
  padding: 28px 24px;
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
  text-align: center;
}

.busy-spinner {
  width: 36px;
  height: 36px;
  margin-bottom: 6px;
  border: 3.5px solid rgba(34, 57, 131, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: busy-spin 0.8s linear infinite;
}

@keyframes busy-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .busy-spinner {
    animation-duration: 2.4s;
  }
}

.busy-title {
  font-size: 17px;
}

.busy-sub {
  color: var(--text-2);
  font-size: 14px;
}

.busy-bar {
  width: 100%;
  height: 6px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--fill);
}

.busy-bar[hidden] {
  display: none;
}

.busy-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}

/* ---------- Admin (office) role: Jobs and Scan tabs only ---------- */

.role-admin [data-super],
.role-admin #tab-jobs .col-check {
  display: none !important;
}

/* ---------- Unassigned list: own date range ---------- */

.pool-range {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-2);
}

.pool-range .date-input {
  flex: 1;
  min-width: 0;
  min-height: 34px;
  padding: 0 8px;
  background: var(--fill);
  box-shadow: none;
  font-size: 13px;
}

.pool-quick {
  margin-bottom: 10px;
}


/* =========================================================
   Scan: job QR (worker), scanner import and Bomba cert list (office)
   ========================================================= */

/* ---------- Worker: "Scan QR" button and QR sheet ---------- */

.w-scan-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: calc(100% - 32px);
  min-height: 52px;
  margin: 12px 16px 0;
  font-size: 17px;
  font-weight: 600;
}

/* Done / pending cards end with this button */
.w-scan-btn:last-child {
  margin-bottom: 16px;
}

.w-scan-icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
}

.w-scan-icon svg {
  width: 100%;
  height: 100%;
}

.qr-dialog {
  max-width: 400px;
}

.qr-box {
  align-items: center;
  text-align: center;
}

.qr-canvas {
  width: 100%;
  max-width: 320px;
  height: auto;
  aspect-ratio: 1 / 1;
  margin: 4px auto;
  border-radius: 12px;
  background: #FFFFFF;
  image-rendering: pixelated;
}

.qr-ref {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.qr-box .btn {
  width: 100%;
}

/* ---------- Office: import ---------- */

.scan-import {
  margin-bottom: 16px;
  padding: 14px;
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow);
}

.scan-import textarea {
  min-height: 150px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
}

.scan-import-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 12px;
}

.scan-file-btn {
  margin-right: auto;
  cursor: pointer;
}

.scan-result {
  margin-bottom: 32px;
}

.scan-summary {
  margin: 0 4px 12px;
  font-weight: 600;
}

.scan-problems {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--r-card);
  background: #FDECEC;
}

.scan-problems-title {
  margin-bottom: 8px;
  color: #B3261E;
  font-weight: 600;
}

.scan-problem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(179, 38, 30, 0.15);
}

.scan-problem-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.scan-problem-line {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.scan-problem-reason {
  color: #B3261E;
  font-size: 14px;
}

.scan-problem .btn {
  flex-shrink: 0;
  background: var(--card);
}

/* ---------- Office: one job (import preview and Bomba cert list) ---------- */

.scan-group {
  margin-bottom: 8px;
}

.scan-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin: 0 4px 10px;
}

.scan-group-head .btn {
  margin-left: auto;
}

.scan-ref {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--fill);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.scan-table th,
.scan-table td {
  vertical-align: middle;
  white-space: nowrap;
  overflow-wrap: normal;
}

.scan-table .col-address {
  min-width: 240px;
  white-space: normal;
  overflow-wrap: break-word;
}

.col-serial {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.col-copy {
  white-space: nowrap;
}

.col-copy .cell-sub {
  display: inline-block;
  max-width: 240px;
  margin-right: 8px;
  white-space: normal;
  vertical-align: middle;
}

.col-applied {
  text-align: center;
}

.col-applied input {
  width: 22px;
  height: 22px;
  accent-color: var(--green);
  cursor: pointer;
}

.row-applied td {
  color: var(--text-2);
}

/* Copy: red until copied, then grey */
.copy-btn {
  min-width: 74px;
  min-height: 34px;
  margin-left: 8px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  vertical-align: middle;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.copy-btn:active {
  transform: scale(0.96);
}

.copy-btn.is-new {
  background: var(--red);
  color: #FFFFFF;
}

.copy-btn.is-copied {
  background: var(--fill);
  color: var(--text-2);
}

.copy-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Extinguisher life: red = over, orange = within 12 months */
.life-text {
  font-variant-numeric: tabular-nums;
}

.life-over {
  padding: 2px 8px;
  border-radius: 6px;
  background: #FDECEC;
  color: #B3261E;
  font-weight: 600;
}

.life-soon {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--amber-tint);
  color: var(--amber-text);
  font-weight: 600;
}

/* Settings: extinguisher types form */
.type-form {
  max-width: 620px;
}

.type-form #type-code {
  max-width: 150px;
}

.type-form #type-life {
  max-width: 110px;
}

@media (max-width: 600px) {
  .scan-problem {
    flex-direction: column;
    align-items: flex-start;
  }

  .scan-group-head .btn {
    margin-left: 0;
  }

  .type-form {
    flex-wrap: wrap;
  }
}

/* ---------- Office: scanner "Data upload" barcode ---------- */

.scan-upload {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 10px;
}

.scan-upload-code {
  flex-shrink: 0;
  width: 280px;
  height: auto;
  padding: 10px 14px;
  border-radius: 10px;
  background: #FFFFFF;
  box-shadow: inset 0 0 0 1px var(--separator);
}

.scan-upload-steps {
  margin: 0;
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.6;
}

.scan-upload-note {
  margin-bottom: 12px;
  color: var(--text-2);
  font-size: 13.5px;
}

@media (max-width: 600px) {
  .scan-upload {
    flex-direction: column;
    align-items: flex-start;
  }
}
