/* LP Schedule Hub. Styled to match the main Launchpad system: Plus Jakarta Sans, the same colour tokens
   (shadcn-style HSL tokens read from the site's compiled CSS), 0.5rem radius, rounded-full badges. */

@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('/assets/fonts/plus-jakarta-sans-var.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;

  /* hsl(215 83% 50%) primary, hsl(222 47% 11%) text, hsl(215 16% 47%) muted, hsl(214 32% 91%) border */
  --primary: #166ee9;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e1e7ef;
  --input-border: #cbd5e1; /* a touch stronger than the site's #e1e7ef so form fields stay visible (3:1) */
  --border-strong: var(--input-border);
  --text: #0f1729;
  --text-2: #1e293b;
  --muted: #65758b;
  --link: #166ee9;
  --nav-active-bg: rgba(22, 110, 233, 0.1);
  --nav-active-text: #166ee9;
  --btn: #166ee9;
  --btn-hover: #2d7deb; /* primary at 90% */
  --btn-text: #f8fafc;
  --focus: #166ee9;
  --danger: #dc2626;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --overlay: rgba(2, 6, 23, 0.5);
  --shadow: 0 10px 30px rgba(2, 6, 23, 0.16);
  --shadow-card: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --mix-to: #000000;
  --mix-pct: 72%;

  --st-requested-bg: #fef3c7;
  --st-requested-text: #92400e;
  --st-scheduled-bg: #dbeafe;
  --st-scheduled-text: #1e40af;
  --st-completed-bg: #dcfce7;
  --st-completed-text: #166534;
  --st-cancelled-bg: #f3f4f6;
  --st-cancelled-text: #4b5563;

  --t-installation: #166ee9;
  --t-delivery: #16a34a;
  --t-ocular: #ea8a0c;
  --t-meeting: #8b5cf6;
  --t-collection: #0d9488;
  --t-invoice: #db2777;
  --t-errand: #ca8a04;
  --t-rework: #64748b;

  --sidebar-w: 232px;
  --radius: 0.5rem;
}

:root[data-theme='dark'] {
  --primary: #4790f5;
  --bg: #080e1c;
  --surface: #0d1526;
  --surface-2: #161e31;
  --border: #1c263b;
  --input-border: #2b3a55;
  --text: #f1f5f9;
  --text-2: #e2e8f0;
  --muted: #8596ad;
  --link: #4790f5;
  --nav-active-bg: rgba(71, 144, 245, 0.1);
  --nav-active-text: #4790f5;
  --btn: #4790f5;
  --btn-hover: #5a9bf6;
  --btn-text: #080e1c;
  --focus: #4790f5;
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --overlay: rgba(0, 0, 0, 0.65);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  --mix-to: #ffffff;
  --mix-pct: 68%;

  --st-requested-bg: rgba(245, 158, 11, 0.16);
  --st-requested-text: #fcd34d;
  --st-scheduled-bg: rgba(71, 144, 245, 0.18);
  --st-scheduled-text: #93c5fd;
  --st-completed-bg: rgba(34, 197, 94, 0.16);
  --st-completed-text: #86efac;
  --st-cancelled-bg: rgba(148, 163, 184, 0.14);
  --st-cancelled-text: #cbd5e1;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}
html[data-theme='dark'] {
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  color: var(--text);
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--link);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}
.skip-link:focus {
  top: 8px;
}

.noscript {
  padding: 24px;
}

/* ---------- shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}
html[data-sidebar='collapsed'] .shell {
  --sidebar-w: 68px;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 30;
}

.sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: none;
  height: 56px;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar__logo {
  display: flex;
  align-items: center;
  min-width: 0;
}
.logo {
  display: block;
  height: auto;
}
.logo--full {
  height: 28px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left;
}
.logo--mark,
.logo--dark {
  display: none;
}
:root[data-theme='dark'] .logo--light {
  display: none;
}
:root[data-theme='dark'] .logo--dark {
  display: block;
}
html[data-sidebar='collapsed'] .sidebar__head {
  flex-direction: column;
  height: auto;
  padding: 12px 0;
  gap: 12px;
}
html[data-sidebar='collapsed'] .logo--full {
  display: none !important;
}
html[data-sidebar='collapsed'] .logo--mark {
  display: block;
  width: 22px;
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 16px;
}
.nav__group {
  margin: 20px 8px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav__group:first-child {
  margin-top: 8px;
}
.nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 2px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 400;
  transition: background-color 0.15s, color 0.15s;
}
.nav__item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav__item[aria-current='page'] {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  font-weight: 500;
}
.nav__icon {
  display: inline-flex;
  flex: none;
}
html[data-sidebar='collapsed'] .nav__label,
html[data-sidebar='collapsed'] .nav__group,
html[data-sidebar='collapsed'] .sidebar__who {
  display: none;
}
html[data-sidebar='collapsed'] .nav__item {
  justify-content: center;
}

.sidebar__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  font-size: 12px;
  font-weight: 700;
}
.sidebar__who {
  flex: 1;
  min-width: 0;
}
.sidebar__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__role {
  font-size: 12px;
  color: var(--muted);
}
html[data-sidebar='collapsed'] .sidebar__foot {
  justify-content: center;
  padding: 14px 0;
}
html[data-sidebar='collapsed'] #logout {
  display: none;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .topbar__menu {
  display: none;
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}
.crumbs strong {
  color: var(--text);
  font-weight: 600;
}
.crumbs__sep {
  display: inline-flex;
  opacity: 0.7;
}
.topbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.role-pill {
  padding: 5px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
}

.content {
  padding: 24px;
  max-width: 1480px;
  width: 100%;
  outline: none;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: var(--overlay);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.btn--primary {
  background: var(--btn);
  color: var(--btn-text);
  box-shadow: var(--shadow-card);
}
.btn--primary:hover {
  background: var(--btn-hover);
}
.btn--secondary {
  background: var(--surface);
  border-color: var(--input-border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.btn--secondary:hover {
  background: var(--surface-2);
}
.btn--danger {
  background: var(--surface);
  border-color: var(--danger);
  color: var(--danger);
  box-shadow: var(--shadow-sm);
}
.btn--danger:hover {
  background: var(--danger-bg);
}
.btn--ghost {
  background: transparent;
  color: var(--link);
  padding-inline: 8px;
}
.btn--ghost:hover {
  background: var(--surface-2);
}
.btn--sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:hover {
  background: var(--surface-2);
}
.icon-btn--bordered {
  border-color: var(--border-strong);
}

.icon {
  display: block;
  flex: none;
}

/* ---------- page header, filters, table ---------- */

.page-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 20px;
}
.page-head h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.count {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.page-head__actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.page-sub {
  flex-basis: 100%;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.search {
  position: relative;
  flex: 1 1 260px;
  min-width: 200px;
}
.search .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.input,
.select,
.textarea {
  width: 100%;
  height: 36px;
  padding: 4px 12px;
  background: var(--surface);
  border: 1px solid var(--input-border);
  border-radius: calc(var(--radius) - 2px);
  color: var(--text);
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search .input {
  padding-left: 38px;
}
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 1px var(--focus);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--muted);
  opacity: 0.8;
}
.select {
  width: auto;
  min-width: 140px;
}
.textarea {
  height: auto;
  padding: 8px 12px;
  min-height: 72px;
  resize: vertical;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}
.table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.table td {
  padding: 14px 16px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table tbody tr[data-id] {
  cursor: pointer;
}
.table tbody tr[data-id]:hover td {
  background: var(--surface-2);
}
.table .nowrap {
  white-space: nowrap;
}
.cell-main {
  font-weight: 600;
  color: var(--text);
}
.cell-sub {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
}
.cell-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 320px;
}
.row-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.row-title:hover {
  text-decoration: underline;
}
.rush-flag {
  display: inline-flex;
  color: #d97706;
}
.muted {
  color: var(--muted);
}

.jo-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}
.jo {
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

/* ---------- pills ---------- */

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.pill--status-requested {
  background: var(--st-requested-bg);
  color: var(--st-requested-text);
}
.pill--status-scheduled {
  background: var(--st-scheduled-bg);
  color: var(--st-scheduled-text);
}
.pill--status-completed {
  background: var(--st-completed-bg);
  color: var(--st-completed-text);
}
.pill--status-cancelled {
  background: var(--st-cancelled-bg);
  color: var(--st-cancelled-text);
}
.pill--type {
  background: color-mix(in srgb, var(--c) 14%, transparent);
  color: color-mix(in srgb, var(--c) var(--mix-pct), var(--mix-to));
}
.type-installation { --c: var(--t-installation); }
.type-delivery { --c: var(--t-delivery); }
.type-ocular { --c: var(--t-ocular); }
.type-meeting { --c: var(--t-meeting); }
.type-collection { --c: var(--t-collection); }
.type-invoice { --c: var(--t-invoice); }
.type-errand { --c: var(--t-errand); }
.type-rework { --c: var(--t-rework); }

/* ---------- empty / error states ---------- */

.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 56px 24px;
  text-align: center;
}
.empty img {
  width: 44px;
  height: auto;
  margin-bottom: 8px;
}
.empty h2 {
  font-size: 16px;
}
.empty p {
  max-width: 44ch;
  color: var(--muted);
}
.empty .btn {
  margin-top: 8px;
}

.fullpage {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.fullpage__card {
  width: min(460px, 100%);
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: grid;
  gap: 12px;
}
.fullpage__card img {
  height: 32px;
  width: auto;
  margin-bottom: 8px;
}
.fullpage__card h1 {
  font-size: 20px;
}
.fullpage__card .code {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

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

.datenav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.datenav .input {
  width: auto;
}
.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--btn);
}
.board-table {
  min-width: 1080px;
}
.board-table th,
.board-table td {
  padding: 12px;
}
.board-table .col-time {
  min-width: 150px;
}
.board-table .cell-clamp {
  -webkit-line-clamp: 4;
}
.nowrap {
  white-space: nowrap;
}

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

.cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.cal__dow {
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.cal__day {
  min-height: 118px;
  padding: 6px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.cal__day:nth-child(7n) {
  border-right: 0;
}
.cal__day--other {
  background: var(--surface-2);
}
.cal__day--other .cal__num {
  color: var(--muted);
}
.cal__num {
  align-self: flex-start;
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border: 0;
  border-radius: 13px;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.cal__num:hover {
  background: var(--surface-2);
}
.cal__day--today .cal__num {
  background: var(--btn);
  color: var(--btn-text);
}
.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 3px 6px;
  border: 0;
  border-left: 3px solid var(--c);
  border-radius: 5px;
  background: color-mix(in srgb, var(--c) 13%, transparent);
  color: var(--text);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.chip:hover {
  background: color-mix(in srgb, var(--c) 24%, transparent);
}
.chip--cancelled {
  opacity: 0.55;
  text-decoration: line-through;
}
.chip__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip__time {
  flex: none;
  font-weight: 600;
  color: var(--muted);
}
.cal__more {
  align-self: flex-start;
  padding: 1px 6px;
  border: 0;
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--link);
  cursor: pointer;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--muted);
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--c);
}

/* ---------- dialogs and drawer ---------- */

dialog {
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: var(--overlay);
}
.modal {
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  margin: auto;
  border-radius: 14px;
}
.modal {
  overflow: hidden;
}
.modal[open] {
  display: flex;
  flex-direction: column;
}
/* The form wraps head, body and footer: let the body scroll while the footer stays in view. */
.modal > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.dlg__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.dlg__head h2 {
  font-size: 17px;
}
.dlg__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: grid;
  gap: 16px;
  align-content: start;
}
.dlg__foot {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.drawer {
  width: min(540px, 100vw);
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  border-width: 0 0 0 1px;
  border-radius: 0;
}
.drawer[open] {
  display: flex;
  flex-direction: column;
  animation: drawer-in 0.18s ease-out;
}
@keyframes drawer-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .drawer[open] {
    animation: none;
  }
}
.drawer__title {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.drawer__title h2 {
  font-size: 19px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.detail {
  display: grid;
  gap: 16px;
}
.detail dt {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 2px;
}
.detail dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.detail__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.detail a {
  font-weight: 600;
}
.crew-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.crew-chip {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}
.drawer__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.drawer__actions .spacer {
  flex: 1;
}
.meta {
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- forms ---------- */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 0;
}
.field--wide {
  grid-column: 1 / -1;
}
.field > label,
.field > legend,
.field > .label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  padding: 0;
}
.field > legend {
  margin-bottom: 6px;
  float: left;
  width: 100%;
}
.field > legend + * {
  clear: both;
}
.field .hint {
  font-size: 12.5px;
  color: var(--muted);
}
.field__error {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--danger);
}
.field__error:empty {
  display: none;
}
.input[aria-invalid='true'],
.select[aria-invalid='true'],
.textarea[aria-invalid='true'] {
  border-color: var(--danger);
}
.form-error {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 500;
}
.seg {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-2);
  width: fit-content;
}
.seg label {
  position: relative;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 500;
}
.seg input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.seg label:has(input:checked) {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.seg label:has(input:focus-visible) {
  outline: 2px solid var(--focus);
}
.tf-rows {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}
.tf-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tf-row .input {
  width: 140px;
}
.crew-pick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}
.crew-pick label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
}
.crew-pick label:has(input:checked) {
  border-color: var(--btn);
  background: var(--nav-active-bg);
}
.crew-pick input {
  accent-color: var(--btn);
}
.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.inline-form .input {
  flex: 1 1 200px;
  width: auto;
}
details.more > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--link);
  padding: 4px 0;
}
details.more[open] > summary {
  margin-bottom: 12px;
}

/* ---------- admin ---------- */

.stack {
  display: grid;
  gap: 24px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}
.admin-add {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.admin-add .input,
.admin-add .select {
  flex: 1 1 180px;
  width: auto;
}
.crew-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.crew-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.crew-list li:last-child {
  border-bottom: 0;
}
.crew-list .name {
  flex: 1;
  font-weight: 600;
  color: var(--text);
}
.crew-list .off {
  color: var(--muted);
  font-weight: 500;
}

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 200;
  display: grid;
  gap: 8px;
  width: min(440px, calc(100vw - 24px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow);
  font-weight: 500;
  pointer-events: auto;
}
.toast--error {
  background: var(--danger);
  color: #fff;
}
:root[data-theme='dark'] .toast--error {
  color: #0f1218;
}
.skeleton {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
}

/* ---------- small screens ---------- */

@media (max-width: 899px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(85vw, 300px);
    transform: translateX(-100%);
    transition: transform 0.18s ease-out;
    box-shadow: var(--shadow);
  }
  html[data-nav='open'] .sidebar {
    transform: none;
  }
  #sidebar-toggle {
    display: none;
  }
  html[data-sidebar='collapsed'] .nav__label,
  html[data-sidebar='collapsed'] .nav__group,
  html[data-sidebar='collapsed'] .sidebar__who {
    display: revert;
  }
  html[data-sidebar='collapsed'] .logo--full.logo--light {
    display: block !important;
  }
  :root[data-theme='dark'][data-sidebar='collapsed'] .logo--full.logo--light {
    display: none !important;
  }
  :root[data-theme='dark'][data-sidebar='collapsed'] .logo--full.logo--dark {
    display: block !important;
  }
  html[data-sidebar='collapsed'] .logo--mark {
    display: none;
  }
  html[data-sidebar='collapsed'] .sidebar__head {
    flex-direction: row;
    height: 56px;
    padding: 0 8px 0 16px;
  }
  html[data-sidebar='collapsed'] .nav__item {
    justify-content: flex-start;
  }
  html[data-sidebar='collapsed'] #logout {
    display: grid;
  }
  .topbar .topbar__menu {
    display: inline-grid;
  }
  .topbar {
    padding: 0 12px;
  }
  .content {
    padding: 16px 12px;
  }
  .form-grid,
  .detail__grid {
    grid-template-columns: 1fr;
  }
  .cal__day {
    min-height: 84px;
    padding: 4px;
  }
  .chip__text,
  .chip__time {
    display: none;
  }
  .chip {
    width: 10px;
    height: 10px;
    padding: 0;
    border-radius: 50%;
    border-left-width: 0;
    background: var(--c);
  }
  .cal__day {
    flex-direction: row;
    flex-wrap: wrap;
    align-content: flex-start;
  }
  .cal__num {
    flex-basis: 100%;
  }
}

@media print {
  .sidebar,
  .topbar,
  .toolbar,
  .page-head__actions,
  .toasts {
    display: none !important;
  }
  .shell {
    display: block;
  }
  .table-wrap {
    overflow: visible;
  }
  body {
    background: #fff;
  }
}

/* ---------- small helpers ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.table--auto {
  min-width: 0;
}
.modal--sm {
  width: min(440px, calc(100vw - 24px));
}

/* ---------- tables become stacked cards on phones ---------- */

@media (max-width: 700px) {
  .table,
  .board-table {
    min-width: 0;
  }
  .table,
  .table tbody,
  .table td {
    display: block;
  }
  .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  .table tbody tr {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }
  .table tbody tr:last-child {
    border-bottom: 0;
  }
  .table td,
  .board-table td {
    padding: 2px 0;
    border: 0;
  }
  .table tbody tr[data-id]:hover td {
    background: none;
  }
  .table td[data-label]:not(:empty)::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 96px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    vertical-align: top;
  }
  .table td.cell-title {
    order: -1;
    padding-bottom: 6px;
    font-size: 15px;
  }
  .table td[data-label="Details"] .jo-list,
  .table td[data-label="Details"] .cell-clamp {
    display: inline-flex;
  }
  .table td[data-label="Status"] {
    order: 5;
    padding-top: 6px;
  }
  .cell-sub,
  .table .cell-clamp {
    max-width: none;
  }
}

/* ---------- sign-in, account and password screens ---------- */

.fullpage__card form {
  display: grid;
  gap: 14px;
  margin-top: 4px;
}
.fullpage__card .btn {
  width: 100%;
}
.fullpage__card .hint {
  font-size: 12.5px;
  color: var(--muted);
}
.notice {
  padding: 10px 12px;
  border-radius: calc(var(--radius) - 2px);
  background: var(--nav-active-bg);
  color: var(--text);
  font-weight: 500;
}
button.avatar {
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}
button.avatar:hover {
  box-shadow: 0 0 0 2px var(--nav-active-text);
}
.secret {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.secret span {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.secret strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  color: var(--text);
  word-break: break-all;
  user-select: all;
}
.pw-row {
  display: flex;
  gap: 8px;
  flex: 1 1 260px;
}
.pw-row .input {
  flex: 1;
  width: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.admin-add .form-error,
.admin-add .field__error {
  flex-basis: 100%;
}
.actions-cell {
  white-space: nowrap;
}
.dlg__body h3.section-title {
  margin: 4px 0 8px;
  font-size: 15px;
}

/* ---------- this week's board: days, trips, stops ---------- */

.day {
  overflow: visible;
}
.day--today {
  border-color: var(--nav-active-text);
  box-shadow: 0 0 0 1px var(--nav-active-text), var(--shadow-card);
}
.day__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.day__head h2 {
  font-size: 16px;
}
.day__add {
  margin-left: auto;
}
.day__body {
  display: grid;
  gap: 0;
}
.day__empty {
  padding: 18px 16px;
}
.trip {
  border-bottom: 1px solid var(--border);
}
.trip:last-child {
  border-bottom: 0;
}
.trip__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px 6px;
  background: var(--surface-2);
}
.trip--plain .trip__head {
  background: transparent;
}
.trip__title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--text);
}
.trip__meta {
  color: var(--muted);
  font-size: 13px;
}
.trip__note {
  padding: 6px 16px 10px;
  background: var(--surface-2);
  color: var(--text);
  white-space: pre-wrap;
}
.trip__return {
  padding: 10px 16px 14px;
  font-weight: 600;
  color: var(--muted);
}
.warn-text {
  color: var(--st-requested-text);
  font-weight: 600;
}
.pill--group {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--muted);
}
.stop-letter {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  font-weight: 700;
}
.stop-letter:empty {
  display: none;
}
.col-stop {
  width: 48px;
}
.col-move {
  white-space: nowrap;
  width: 76px;
}
.icon-btn--sm {
  width: 28px;
  height: 28px;
}
.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.row--cancelled td {
  opacity: 0.55;
}
.row--cancelled .row-title {
  text-decoration: line-through;
}
.board-table .col-time {
  min-width: 150px;
}

/* ---------- scheduling dialog and the crew message ---------- */

.trip-fields {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.trip-fields > legend {
  float: none;
  width: auto;
  padding: 0 6px;
  font-weight: 600;
  color: var(--text);
}
.modal--wide {
  width: min(760px, calc(100vw - 24px));
}
.summary-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}
.field-inline .input {
  width: auto;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  min-height: 280px;
}
.warn {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--st-requested-bg);
  color: var(--st-requested-text);
}
.warn ul {
  margin: 6px 0 0;
  padding-left: 18px;
}
.group-members {
  display: block;
  margin-top: 2px;
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
}
