/* DSG Drone — design tokens + app shell (P1)
   Tokens anchored on product plan §3.4
*/

:root {
  --brand-orange: #ea5c1f;
  --brand-grey: #373a40;

  --orange-50: #fef1ea;
  --orange-100: #fce4d6;
  --orange-200: #f7c4a8;
  --orange-400: #f07a45;
  --orange-500: #ea5c1f;
  --orange-600: #d9521a;
  --orange-700: #c44a16;

  --grey-50: #f5f6f7;
  --grey-100: #eeeef1;
  --grey-200: #dde0e4;
  --grey-300: #c2c6cc;
  --grey-400: #9aa0a8;
  --grey-500: #7a808a;
  --grey-600: #5f656e;
  --grey-700: #4b5058;
  --grey-800: #373a40;
  --grey-900: #2a2d32;
  --grey-950: #1a1c1f;
  --white: #ffffff;

  --success: #2f9b5b;
  --success-bg: #e6f6ec;
  --warning: #c4851a;
  --warning-bg: #fdf3e0;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --info: #3d6f8c;
  --info-bg: #e8f1f5;

  --bg-app: var(--grey-50);
  --bg-card: var(--white);
  --text: var(--grey-800);
  --text-muted: var(--grey-600);
  --border: var(--grey-200);
  --action: var(--orange-500);

  --header-h: 56px;
  --mobile-nav-h: 48px;
  --sidebar-w: 240px;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(26, 28, 31, 0.06);
  --shadow-md: 0 8px 24px rgba(26, 28, 31, 0.08);
  --focus-ring: 0 0 0 3px rgba(234, 92, 31, 0.4);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-app);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--action);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ---- Header (dark chrome) ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
  padding: 0 1rem;
  /* Lighter than logo grey (#373a40) so mark separates from chrome */
  background: #4f545c;
  color: var(--white);
  border-bottom: 1px solid #3d4148;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand:hover {
  text-decoration: none;
  color: var(--white);
}

.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  padding: 2px;
  box-sizing: border-box;
}

.brand-text {
  font-size: 1.05rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-user {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
}

.logout-form {
  margin: 0;
}

/* ---- Mobile nav under header ---- */
.mobile-nav-bar {
  display: none;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  position: sticky;
  top: var(--header-h);
  z-index: 35;
}

.mobile-nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 40px;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.mobile-nav-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.hamburger {
  width: 18px;
  height: 2px;
  background: var(--grey-800);
  position: relative;
  display: inline-block;
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: var(--grey-800);
}

.hamburger::before {
  top: -6px;
}

.hamburger::after {
  top: 6px;
}

/* ---- Layout ---- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--header-h));
}

.sidebar {
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 1rem 0.75rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: block;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  color: var(--grey-600);
  font-weight: 500;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--grey-50);
  color: var(--grey-800);
  text-decoration: none;
}

.nav-item.is-active {
  background: var(--orange-100);
  color: var(--orange-500);
  border-left-color: var(--orange-500);
  font-weight: 600;
}

.content {
  padding: 1.25rem 1.5rem 2.5rem;
  max-width: 1100px;
}

.sidebar-backdrop {
  display: none;
}

/* ---- Page / cards ---- */
.page-header {
  margin-bottom: 1.25rem;
}

.page-title {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  color: var(--grey-800);
}

.page-sub {
  margin: 0;
  color: var(--text-muted);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow-sm);
  padding: 1.15rem 1.25rem;
}

.card-title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.muted {
  color: var(--text-muted);
}

.stub-list {
  margin: 0.75rem 0 0;
  padding-left: 1.2rem;
  color: var(--text-muted);
}

.empty-state {
  text-align: left;
}

/* ---- Forms & buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-primary {
  background: var(--orange-500);
  color: var(--white);
  border-color: var(--orange-500);
}

.btn-primary:hover {
  background: var(--orange-600);
  border-color: var(--orange-600);
  text-decoration: none;
  color: var(--white);
}

.btn-secondary {
  background: var(--white);
  color: var(--grey-800);
  border-color: var(--grey-300);
}

.btn-header {
  background: transparent;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.35);
  min-height: 34px;
  padding: 0.3rem 0.7rem;
  font-size: 0.875rem;
}

.btn-header:hover {
  background: var(--grey-900);
  border-color: var(--orange-500);
}

.btn-block {
  width: 100%;
}

.input {
  width: 100%;
  min-height: 42px;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  font: inherit;
}

.input:focus {
  outline: none;
  border-color: var(--orange-500);
  box-shadow: var(--focus-ring);
}

.form-field {
  margin-bottom: 0.95rem;
}

.form-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.form-field-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-field-inline label {
  margin: 0;
  font-weight: 500;
}

.field-errors {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  color: var(--danger);
  font-size: 0.88rem;
}

.checkbox {
  width: 1rem;
  height: 1rem;
}

/* ---- Flash ---- */
.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.flash {
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--info-bg);
  color: var(--grey-800);
}

.flash-error,
.flash-danger {
  background: var(--danger-bg);
  border-color: #f0c2bd;
  color: var(--danger);
}

.flash-success {
  background: var(--success-bg);
  border-color: #b7e4c7;
  color: var(--success);
}

.flash-warning {
  background: var(--warning-bg);
  border-color: #f0d9a8;
  color: var(--warning);
}

.flash-info {
  background: var(--info-bg);
  border-color: #c5d9e4;
  color: var(--info);
}

/* ---- Auth (login) ---- */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--grey-50);
}

.auth-main {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 1.75rem 1.5rem 1.6rem;
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.auth-logo {
  width: min(220px, 70vw);
  height: auto;
}
.auth-logo-lg {
  width: min(300px, 82vw);
}
.auth-card-simple .auth-brand {
  margin-bottom: 1.35rem;
}
.auth-back {
  margin-top: 1rem;
  text-align: center;
}


.auth-heading {
  margin: 0 0 0.25rem;
  text-align: center;
  font-size: 1.25rem;
}

.auth-sub {
  margin: 0 0 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.auth-flash {
  margin-bottom: 0.85rem;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .mobile-nav-bar {
    display: block;
  }

  .layout {
    grid-template-columns: 1fr;
    min-height: calc(100vh - var(--header-h) - var(--mobile-nav-h));
  }

  .sidebar {
    position: fixed;
    top: calc(var(--header-h) + var(--mobile-nav-h));
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.18s ease;
    box-shadow: var(--shadow-md);
    overflow-y: auto;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    top: calc(var(--header-h) + var(--mobile-nav-h));
    background: rgba(26, 28, 31, 0.35);
    z-index: 45;
  }

  .sidebar-backdrop[hidden] {
    display: none;
  }

  .content {
    padding: 1rem;
  }

  .header-user {
    display: none;
  }
}

/* ---- P2 settings + clients ---- */
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

.toolbar-search {
  flex: 1 1 220px;
  max-width: 420px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}

.form-field-full {
  grid-column: 1 / -1;
}

.input-textarea {
  min-height: 96px;
  resize: vertical;
}

.field-help {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.label-text {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin-bottom: 0.75rem;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
  color: var(--grey-700);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-section {
  margin: 0;
}

.section-subhead {
  margin: 0.75rem 0 0.5rem;
  font-size: 1rem;
  color: var(--grey-700);
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  padding: 0.75rem 0 0.25rem;
  background: linear-gradient(to top, var(--bg-app) 70%, transparent);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

.table-wrap {
  overflow-x: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table th {
  background: var(--grey-100);
  font-weight: 600;
  color: var(--grey-700);
}

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

.data-table a {
  font-weight: 600;
}

.card-stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.list-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.list-card:hover {
  border-color: var(--orange-200);
  text-decoration: none;
}

.list-card-title {
  font-weight: 600;
  color: var(--grey-800);
}

.list-card-meta {
  margin-top: 0.2rem;
  font-size: 0.9rem;
}

.detail-list {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1.25rem;
}

.detail-list dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--grey-500);
  margin-bottom: 0.15rem;
}

.detail-list dd {
  margin: 0;
  color: var(--text);
}

.detail-full {
  grid-column: 1 / -1;
}

.preserve-lines {
  white-space: pre-wrap;
}

.mobile-only {
  display: none;
}

.desktop-only {
  display: block;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--grey-100);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

.settings-form .card + .card {
  /* spacing via parent gap */
}

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

  .detail-list {
    grid-template-columns: 1fr;
  }

  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: block;
  }
}

/* ---- P3 jobs ---- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--grey-700);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.chip:hover {
  border-color: var(--orange-200);
  text-decoration: none;
}

.chip.is-active {
  background: var(--orange-50, #fff4ee);
  border-color: var(--orange);
  color: var(--orange);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--grey-100);
  color: var(--grey-700);
  vertical-align: middle;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-muted { background: var(--grey-100); color: var(--grey-600); }

.totp-secret {
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  word-break: break-all;
}
.totp-qr-wrap {
  margin: 0.75rem 0;
}
.totp-qr {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  padding: 0.5rem;
}
.backup-codes-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.4rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.card-warning {
  border-color: var(--warning);
}
.badge-draft { background: #eef1f4; color: #4b5563; }
.badge-confirmed { background: #e0f2fe; color: #075985; }
.badge-scheduled { background: #fef3c7; color: #92400e; }
.badge-flown { background: #dcfce7; color: #166534; }
.badge-editing { background: #ede9fe; color: #5b21b6; }
.badge-delivered { background: #dbeafe; color: #1e40af; }
.badge-closed { background: #e5e7eb; color: #374151; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

.header-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.inline-form {
  display: inline;
}

.input-select {
  min-width: 10rem;
}

.toolbar-wrap {
  align-items: flex-end;
}

.toolbar-check {
  margin: 0 0.25rem;
  white-space: nowrap;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.timeline li {
  display: grid;
  grid-template-columns: 7rem 1fr auto;
  gap: 0.5rem 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.timeline li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.timeline-type {
  font-weight: 700;
  color: var(--grey-700);
  text-transform: capitalize;
}

.card-danger {
  border-color: #fecaca;
}

.btn-danger {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(1.05);
}

.field-error {
  margin: 0.25rem 0 0;
  color: #b91c1c;
  font-size: 0.85rem;
}

.list-card-title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 700px) {
  .timeline li {
    grid-template-columns: 1fr;
  }
}


/* ---- P4 schedule ---- */
.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.88rem;
  min-height: 34px;
}

.desktop-only-inline {
  display: inline-flex;
}

/* Wider canvas for calendar */
.schedule-page {
  max-width: none;
  width: 100%;
}

.content:has(.schedule-page) {
  max-width: 1480px;
}

.schedule-page .page-header {
  margin-bottom: 0.85rem;
}

.schedule-page .page-title {
  font-size: 1.45rem;
  letter-spacing: -0.01em;
}

/* Unified toolbar card */
.sched-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow-sm);
}

.sched-toolbar-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
  justify-content: space-between;
}

.sched-seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--grey-100);
  border: 1px solid var(--border);
  gap: 2px;
}

.sched-seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0.28rem 0.95rem;
  border-radius: 999px;
  color: var(--grey-600);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}

.sched-seg-btn:hover {
  color: var(--grey-800);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.65);
}

.sched-seg-btn.is-active {
  background: var(--white);
  color: var(--orange-600);
  border-color: var(--orange-200);
  box-shadow: var(--shadow-sm);
}

.sched-period {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}

.sched-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--grey-300);
  background: var(--white);
  color: var(--grey-800);
  font-size: 1.35rem;
  line-height: 1;
  text-decoration: none;
  font-weight: 500;
}

.sched-icon-btn:hover {
  border-color: var(--orange-300);
  background: var(--orange-50);
  color: var(--orange-700);
  text-decoration: none;
}

.sched-period-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  padding: 0 0.15rem;
}

.sched-period-title {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--grey-800);
  white-space: nowrap;
}

.sched-period-today-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: var(--orange-100);
  color: var(--orange-700);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sched-today-btn {
  margin-left: 0.15rem;
}

.sched-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 auto;
}

@media (min-width: 901px) and (max-width: 1280px) {
  .sched-toolbar-top {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "seg actions"
      "period period";
    row-gap: 0.65rem;
    column-gap: 0.75rem;
    align-items: center;
  }
  .sched-seg { grid-area: seg; }
  .sched-period {
    grid-area: period;
    justify-content: flex-start;
  }
  .sched-toolbar-actions { grid-area: actions; }
}


.sched-wx-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
  margin: 0;
}

.sched-wx-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--grey-700);
  white-space: nowrap;
}

.sched-wx-select {
  min-width: min(18rem, 100%);
  max-width: 100%;
  flex: 1 1 14rem;
}

/* Legend */
.sched-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  align-items: center;
  margin: 0 0 0.75rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  font-size: 0.8rem;
  color: var(--grey-600);
}

.sched-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sched-legend-swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--grey-200);
  flex: 0 0 auto;
}

.sched-legend-swatch.is-scheduled {
  background: #fef3c7;
  border-color: #f59e0b;
  box-shadow: inset 3px 0 0 #d97706;
}

.sched-legend-swatch.is-confirmed {
  background: #e0f2fe;
  border-color: #38bdf8;
  box-shadow: inset 3px 0 0 #0284c7;
}

.sched-legend-swatch.is-flown {
  background: #dcfce7;
  border-color: #4ade80;
  box-shadow: inset 3px 0 0 #16a34a;
}

.sched-legend-swatch.is-chain {
  background: #dbeafe;
  border-left: 3px solid #2563eb;
}

.sched-legend-swatch.is-block {
  background: #e5e7eb;
  border-style: dashed;
}

/* Week grid */
.week-grid-wrap {
  overflow-x: auto;
  margin-bottom: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}

.week-grid {
  display: grid;
  grid-template-columns: 3.5rem repeat(7, minmax(8.25rem, 1fr));
  min-width: 860px;
  min-height: 560px;
}

.week-hours {
  display: grid;
  grid-template-rows: 4rem repeat(var(--slot-count), minmax(3.1rem, 1fr));
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, var(--grey-50), #fafbfc);
  position: sticky;
  left: 0;
  z-index: 3;
  overflow: visible;
}

.week-hours-corner {
  min-height: 4rem;
  border-bottom: 1px solid var(--border);
  background: var(--grey-50);
  position: sticky;
  top: 0;
  z-index: 4;
}

.week-hour-label {
  position: relative;
  font-size: 0.72rem;
  color: var(--grey-500);
  border-top: 1px solid var(--grey-100);
  font-variant-numeric: tabular-nums;
  overflow: visible;
}

.week-hour-label span {
  position: absolute;
  top: 0.2rem;
  right: 0.35rem;
  left: 0.15rem;
  text-align: right;
  line-height: 1;
  white-space: nowrap;
  z-index: 1;
}

.week-day {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-height: 0;
  min-width: 0;
}

.week-day:last-child {
  border-right: none;
}

.week-day-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: 4rem;
  padding: 0.4rem 0.25rem 0.35rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  font-weight: 600;
  background: var(--grey-50);
  position: sticky;
  top: 0;
  z-index: 2;
}

.week-day-head:hover {
  text-decoration: none;
  background: var(--orange-50);
}

.week-day.is-today .week-day-head {
  background: linear-gradient(180deg, var(--orange-50), #fff8f3);
  box-shadow: inset 0 -2px 0 var(--orange-500);
}

.week-day-name {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--grey-500);
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-day.is-today .week-day-name {
  color: var(--orange-700);
}

.week-day-num {
  font-size: 1.15rem;
  line-height: 1.15;
  color: var(--grey-800);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.week-day-num.is-today-num-legacy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  background: var(--orange-500);
  color: var(--white);
  box-shadow: 0 2px 6px rgba(234, 92, 31, 0.35);
}

.week-day-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 1.15rem;
  margin-top: 0.05rem;
}

.week-day-wx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  line-height: 1;
}

.week-day-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--grey-800);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}

.week-day.is-today .week-day-count {
  background: var(--orange-600);
}

.week-day-body {
  position: relative;
  flex: 1;
  min-height: calc(var(--slot-count, 10) * 3.1rem);
  background: var(--white);
}

.week-day.is-off .week-day-body {
  background: repeating-linear-gradient(
    -45deg,
    #f8f9fa,
    #f8f9fa 8px,
    #eef0f3 8px,
    #eef0f3 16px
  );
}

.week-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--grey-100);
  pointer-events: none;
  z-index: 0;
}

.week-work-shade {
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(234, 92, 31, 0.04);
  border-top: 1px dashed rgba(234, 92, 31, 0.22);
  border-bottom: 1px dashed rgba(234, 92, 31, 0.22);
  pointer-events: none;
  z-index: 0;
}

.week-event {
  position: absolute;
  left: 3px;
  right: 3px;
  z-index: 1;
  border-radius: 7px;
  padding: 0.28rem 0.4rem 0.3rem;
  overflow: hidden;
  font-size: 0.74rem;
  line-height: 1.25;
  box-shadow: 0 1px 2px rgba(26, 28, 31, 0.08);
  border: 1px solid transparent;
  background: #fff7ed;
  color: var(--grey-800);
  min-height: 1.5rem;
  transition: filter 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

a.week-event {
  color: inherit;
  text-decoration: none;
}

a.week-event:hover {
  filter: brightness(0.98);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(26, 28, 31, 0.12);
  z-index: 2;
  transform: translateY(-1px);
}

/* Status-colored job events */
.week-event-job.status-draft,
.week-event-job.status-confirmed {
  background: linear-gradient(180deg, #f0f9ff, #e0f2fe);
  border-color: #7dd3fc;
  box-shadow: inset 3px 0 0 #0284c7, 0 1px 2px rgba(26, 28, 31, 0.06);
}

.week-event-job.status-scheduled {
  background: linear-gradient(180deg, #fffbeb, #fef3c7);
  border-color: #fcd34d;
  box-shadow: inset 3px 0 0 #d97706, 0 1px 2px rgba(26, 28, 31, 0.06);
}

.week-event-job.status-flown,
.week-event-job.status-editing,
.week-event-job.status-delivered,
.week-event-job.status-closed {
  background: linear-gradient(180deg, #f0fdf4, #dcfce7);
  border-color: #86efac;
  box-shadow: inset 3px 0 0 #16a34a, 0 1px 2px rgba(26, 28, 31, 0.06);
}

.week-event-job.status-cancelled {
  background: linear-gradient(180deg, #fef2f2, #fee2e2);
  border-color: #fca5a5;
  box-shadow: inset 3px 0 0 #dc2626, 0 1px 2px rgba(26, 28, 31, 0.06);
  opacity: 0.85;
}

.week-event-block {
  background: repeating-linear-gradient(
    -45deg,
    #f3f4f6,
    #f3f4f6 5px,
    #e5e7eb 5px,
    #e5e7eb 10px
  );
  border-color: #9ca3af;
  color: #374151;
  border-style: dashed;
}

.week-event.is-overlap {
  border-color: var(--warning) !important;
  border-width: 2px;
  border-style: solid !important;
  box-shadow: inset 4px 0 0 var(--warning), 0 0 0 1px rgba(196, 133, 26, 0.2) !important;
}

.week-event.chain-stop {
  border-top: 2px solid #2563eb;
}
.week-event.chain-seq-1 { border-top-color: #2563eb; }
.week-event.chain-seq-2 { border-top-color: #7c3aed; }
.week-event.chain-seq-3 { border-top-color: #db2777; }
.week-event.chain-seq-4 { border-top-color: #ea580c; }
.week-event.chain-seq-5 { border-top-color: #059669; }
.week-event.chain-seq-0 { border-top-color: #0891b2; }

.week-event.wx-no_go {
  outline: 2px solid #dc2626;
  outline-offset: -2px;
}
.week-event.wx-marginal {
  outline: 1px dashed #d97706;
  outline-offset: -1px;
}

.week-event-time {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 700;
  color: var(--grey-700);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
}

.week-event-title {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  margin-top: 0.05rem;
}

.week-event-sub {
  display: block;
  font-size: 0.7rem;
  line-height: 1.15;
  opacity: 0.88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--grey-600);
  margin-top: 0.05rem;
}

.week-overlap-mark {
  color: #b91c1c;
  font-weight: 800;
}

/* City weather day tints */
.day-wx-go .week-day-head,
.day-wx.day-wx-go {
  background: linear-gradient(180deg, #ecfdf5 0%, var(--grey-50) 100%);
}
.day-wx-marginal .week-day-head,
.day-wx.day-wx-marginal {
  background: linear-gradient(180deg, #fffbeb 0%, var(--grey-50) 100%);
}
.day-wx-no_go .week-day-head,
.day-wx.day-wx-no_go {
  background: linear-gradient(180deg, #fef2f2 0%, var(--grey-50) 100%);
}
.day-wx-go .week-day-body {
  box-shadow: inset 0 0 0 9999px rgba(22, 163, 74, 0.03);
}
.day-wx-marginal .week-day-body {
  box-shadow: inset 0 0 0 9999px rgba(217, 119, 6, 0.04);
}
.day-wx-no_go .week-day-body {
  box-shadow: inset 0 0 0 9999px rgba(220, 38, 38, 0.05);
}

/* Mobile week list */
.week-list {
  display: none;
}

.week-list-day.is-today {
  border-color: var(--orange-200);
  box-shadow: 0 0 0 1px rgba(234, 92, 31, 0.12), var(--shadow-sm);
}

.week-list-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.week-list-item {
  display: grid !important;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.5rem 0.75rem;
  align-items: start;
  padding: 0.65rem 0.55rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--grey-50);
  margin: 0;
}

.week-list-item + .week-list-item {
  margin-top: 0.45rem;
}

.week-list-item.is-job.status-scheduled {
  background: #fffbeb;
  border-color: #fcd34d;
}
.week-list-item.is-job.status-confirmed,
.week-list-item.is-job.status-draft {
  background: #f0f9ff;
  border-color: #7dd3fc;
}
.week-list-item.is-job.status-flown,
.week-list-item.is-job.status-editing,
.week-list-item.is-job.status-delivered {
  background: #f0fdf4;
  border-color: #86efac;
}
.week-list-item.is-block {
  background: #f3f4f6;
  border-style: dashed;
}
.week-list-item.is-overlap {
  border-color: var(--warning);
  box-shadow: inset 3px 0 0 var(--warning);
}

.week-list-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--grey-700);
  font-size: 0.9rem;
}

.week-list-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.week-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.5rem;
  align-items: center;
}

/* Day view */
.day-blocks-card,
.day-jobs-card,
.sched-unscheduled {
  margin-bottom: 1rem;
}

.day-event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.day-event-list > li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
}

.day-block-row {
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fafc;
  border-style: dashed;
}

.day-block-row.is-overlap {
  border-color: var(--warning);
  border-style: solid;
  box-shadow: inset 4px 0 0 var(--warning);
  background: var(--warning-bg);
}

.day-block-main {
  min-width: 0;
  flex: 1 1 12rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.day-block-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.15rem;
}

.day-block-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}

.day-block-notes {
  margin-top: 0.25rem;
  font-size: 0.9rem;
}

.day-job-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.day-job-card {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 0.95rem 1.05rem;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  border-left-width: 4px;
  border-left-color: var(--grey-300);
}

.day-job-card.status-draft,
.day-job-card.status-confirmed {
  border-left-color: #0284c7;
  background: linear-gradient(90deg, #f0f9ff 0%, var(--white) 5.5rem);
}

.day-job-card.status-scheduled {
  border-left-color: #d97706;
  background: linear-gradient(90deg, #fffbeb 0%, var(--white) 5.5rem);
}

.day-job-card.status-flown,
.day-job-card.status-editing,
.day-job-card.status-delivered,
.day-job-card.status-closed {
  border-left-color: #16a34a;
  background: linear-gradient(90deg, #f0fdf4 0%, var(--white) 5.5rem);
}

.day-job-card.status-cancelled {
  border-left-color: #dc2626;
  opacity: 0.92;
}

.day-job-card.is-overlap {
  border-color: var(--warning);
  box-shadow: inset 0 0 0 1px rgba(196, 133, 26, 0.25), var(--shadow-sm);
}

.day-job-card.is-chain.chain-seq-1 { border-left-color: #2563eb; }
.day-job-card.is-chain.chain-seq-2 { border-left-color: #7c3aed; }
.day-job-card.is-chain.chain-seq-3 { border-left-color: #db2777; }
.day-job-card.is-chain.chain-seq-4 { border-left-color: #ea580c; }
.day-job-card.is-chain.chain-seq-5 { border-left-color: #059669; }
.day-job-card.is-chain.chain-seq-0 { border-left-color: #0891b2; }

.day-job-card.is-pinned {
  box-shadow: inset 0 0 0 1px #f59e0b, var(--shadow-sm);
}

.day-job-time-col {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-top: 0.1rem;
  font-variant-numeric: tabular-nums;
  border-right: 1px solid var(--border);
  padding-right: 0.85rem;
  min-width: 0;
}

.day-flight-time {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--grey-800);
  line-height: 1.2;
}

.day-flight-end {
  font-size: 0.85rem;
  font-weight: 600;
}

.day-busy-hint {
  font-size: 0.75rem;
  margin-top: 0.35rem;
  line-height: 1.3;
}

.day-job-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.day-job-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
}

.day-job-head-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
}

.day-job-number code {
  font-size: 0.95em;
  font-weight: 700;
}

.day-job-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.day-job-client {
  font-size: 1.02rem;
}

.day-job-address {
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--grey-700);
  font-size: 0.95rem;
}

.day-job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  margin-top: 0.15rem;
  font-size: 0.88rem;
  align-items: center;
}

.day-job-meta-text {
  line-height: 1.35;
}

.drive-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--grey-100);
  color: var(--grey-700);
  font-weight: 600;
  font-size: 0.8rem;
}

.day-phone {
  font-size: 1.02rem;
  font-weight: 600;
}

.day-gate {
  font-size: 0.9rem;
  padding: 0.4rem 0.55rem;
  background: var(--grey-50);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.day-wx-summary {
  font-size: 0.85rem;
}

.day-job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.15rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.day-empty {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.5rem 0 0.25rem;
}

.day-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Unscheduled */
.sched-unscheduled-hint {
  margin: -0.15rem 0 0.85rem;
  font-size: 0.9rem;
}

.sched-unscheduled-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.sched-unscheduled-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--grey-50);
}

.sched-unscheduled-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1 1 14rem;
}

.sched-unscheduled-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
}

.sched-unscheduled-client {
  font-weight: 700;
  color: var(--grey-800);
}

.sched-unscheduled-meta {
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.35rem;
}

.badge-block {
  background: #e5e7eb;
  color: #374151;
}

.badge-overlap {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(196, 133, 26, 0.35);
}

.badge-chain {
  background: #dbeafe;
  color: #1e40af;
}

.badge-pref {
  background: #ede9fe;
  color: #5b21b6;
}

.badge-warn {
  background: #fef3c7;
  color: #92400e;
}

.callout-warning {
  background: var(--warning-bg);
  border-color: rgba(196, 133, 26, 0.45);
}

.conflict-list {
  margin-top: 0.5rem;
}

/* Weather icons */
.wx-icon {
  font-style: normal;
  line-height: 1;
  display: inline-block;
}
.wx-icon-sm {
  font-size: 0.85em;
}
.badge-weather-go .wx-icon,
.badge-weather-marginal .wx-icon,
.badge-weather-no_go .wx-icon,
.badge-weather-unknown .wx-icon {
  margin-right: 0.15rem;
}

/* Legacy class kept for other templates */
.sched-nav {
  display: none;
}

@media (max-width: 900px) {
  .week-grid-wrap {
    display: none;
  }

  .week-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
  }

  .desktop-only-inline {
    display: none;
  }

  .sched-toolbar-top {
    flex-direction: column;
    align-items: stretch;
  }

  .sched-period {
    justify-content: space-between;
  }

  .sched-period-title {
    font-size: 0.92rem;
    white-space: normal;
  }

  .sched-toolbar-actions {
    justify-content: stretch;
  }

  .sched-toolbar-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .sched-legend {
    display: none;
  }

  .day-job-card {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .day-job-time-col {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.65rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 0.55rem;
  }

  .day-busy-hint {
    width: 100%;
    margin-top: 0.1rem;
  }

  .day-job-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }

  .day-job-actions .btn,
  .day-job-actions form,
  .day-job-actions button {
    width: 100%;
    min-height: 44px;
  }

  .sched-unscheduled-item {
    align-items: stretch;
    flex-direction: column;
  }

  .sched-unscheduled-item .btn {
    width: 100%;
    min-height: 44px;
  }
}

@media (max-width: 700px) {
  .content:has(.schedule-page) {
    max-width: none;
  }
}



/* Day weather strip */
.weather-strip {
  margin-bottom: 1rem;
}
.weather-strip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.55rem;
}
.weather-strip-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--grey-50);
  max-width: 100%;
}
.weather-strip-item.badge-weather-go {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: inherit;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  font-size: inherit;
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
}
.weather-strip-item.badge-weather-marginal {
  background: #fffbeb;
  border-color: #fde68a;
  color: inherit;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  font-size: inherit;
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
}
.weather-strip-item.badge-weather-no_go {
  background: #fef2f2;
  border-color: #fecaca;
  color: inherit;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  font-size: inherit;
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
}
.weather-strip-item.badge-weather-unknown {
  background: var(--grey-50);
  color: inherit;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  font-size: inherit;
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
}
.weather-strip-status {
  font-weight: 700;
  font-size: 0.9rem;
}
.weather-strip-hint {
  font-size: 0.85rem;
}
.weather-strip-city {
  font-size: 0.88rem;
}
.weather-strip-summary {
  font-size: 0.85rem;
  flex: 1 1 100%;
}
.weather-strip-job {
  font-weight: 700;
}

/* —— P5 invoices —— */
.badge-inv-draft {
  background: var(--grey-100);
  color: var(--grey-700);
}
.badge-inv-sent {
  background: var(--info-bg);
  color: var(--info);
}
.badge-inv-paid {
  background: var(--success-bg);
  color: var(--success);
}
.badge-inv-void {
  background: var(--grey-200);
  color: var(--grey-600);
  text-decoration: line-through;
}
.badge-overdue {
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 700;
}
.invoice-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.paid-form .field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.paid-form .field {
  flex: 1 1 8rem;
}
.callout {
  background: var(--grey-50);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0.5rem 0 1rem;
}
.warning-text {
  color: var(--warning);
  margin: 0.5rem 0 0;
}
.plain-list {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}
.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}
.field-row .field {
  flex: 1 1 10rem;
}
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.95rem;
}


/* —— P6 dashboard + polish —— */
.dash-header .quick-actions {
  flex-wrap: wrap;
}
.card-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
.card-title-row .card-title {
  margin: 0;
}
.dash-job-list,
.dash-block-list,
.attention-items,
.busy-days {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dash-block-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.dash-job-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.dash-job-row:last-child,
.dash-block-item:last-child {
  border-bottom: none;
}
.dash-job-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  flex: 1 1 14rem;
  color: inherit;
  min-width: 0;
}
.dash-job-main:hover .dash-job-title {
  color: var(--action);
}
.dash-job-time {
  font-weight: 700;
  min-width: 4.5rem;
  color: var(--grey-700);
}
.dash-job-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.dash-job-side {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.attention-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
}
.attention-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  background: var(--grey-50);
}
.attention-card.attention-inv_overdue {
  border-color: #f0b4ae;
  background: var(--danger-bg);
}
.attention-head {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.55rem;
}
.attention-count {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--brand-orange);
  min-width: 1.75rem;
}
.attention-title {
  margin: 0;
  font-size: 0.98rem;
}
.attention-link {
  font-size: 0.85rem;
}
.attention-items li {
  padding: 0.25rem 0;
  font-size: 0.92rem;
}
.week-summary {
  margin: 0 0 0.75rem;
}
.busy-days {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.busy-days a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius);
  color: inherit;
  background: var(--grey-50);
  border: 1px solid var(--border);
}
.busy-days a:hover {
  border-color: var(--orange-200);
  background: var(--orange-50);
}
.busy-count {
  font-weight: 600;
  color: var(--grey-700);
}
.empty-state {
  margin: 0.25rem 0 0;
}
/* Larger tap targets on day-of mobile */
@media (max-width: 700px) {
  .dash-header {
    flex-direction: column;
    align-items: stretch;
  }
  .dash-header .header-btn-row {
    width: 100%;
  }
  .dash-header .header-btn-row .btn {
    flex: 1 1 calc(50% - 0.35rem);
    text-align: center;
    min-height: 44px;
  }
  .dash-job-row {
    flex-direction: column;
    align-items: stretch;
  }
  .dash-job-side .btn,
  .day-job-actions .btn,
  .day-job-actions button {
    min-height: 44px;
  }
  .day-job-actions {
    width: 100%;
  }
  .day-job-actions .btn,
  .day-job-actions form {
    flex: 1 1 auto;
  }
}

/* R5 weather badges */
.badge-weather-go { background: #dcfce7; color: #166534; }
.badge-weather-marginal { background: #fef3c7; color: #92400e; }
.badge-weather-no_go { background: #fee2e2; color: #991b1b; }
.badge-weather-unknown { background: #e5e7eb; color: #4b5563; }

/* R6 auto-plan */
.auto-plan-candidates { list-style: none; padding: 0; margin: 0 0 1rem; }
.auto-plan-candidates li { padding: 0.35rem 0; border-bottom: 1px solid var(--border, #e5e7eb); }
.check-row { display: flex; gap: 0.5rem; align-items: flex-start; cursor: pointer; }
.auto-plan-stops { margin: 0.75rem 0 1rem; padding-left: 1.25rem; }
.auto-plan-stop { margin-bottom: 0.75rem; }
.auto-plan-stop-head { margin-bottom: 0.15rem; }
.row-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.badge-warn { background: #fef3c7; color: #92400e; }

/* —— UI polish: overflow, inputs —— */
.text-ellipsis {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.table-wrap,
.data-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}
table.data-table td,
table.data-table th,
.jobs-table td,
.jobs-table th {
  overflow-wrap: anywhere;
}
.input-phone {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.input-date,
.input-time {
  font-variant-numeric: tabular-nums;
  max-width: 12rem;
}
.page-title {
  overflow-wrap: anywhere;
}
.page-sub {
  overflow-wrap: anywhere;
}
.dash-job-title,
.dash-job-body {
  min-width: 0;
}
.dash-job-title {
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-title {
  overflow-wrap: anywhere;
}


/* UX weather metrics */
.wx-metrics {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.wx-metrics-sm { font-size: 0.75rem; gap: 0.25rem 0.4rem; }
.wx-metric { white-space: nowrap; }
.wx-metric.tone-good { color: #166534; }
.wx-metric.tone-warn { color: #92400e; }
.wx-metric.tone-bad { color: #991b1b; }
.wx-metric.tone-muted { color: var(--muted, #6b7280); }

.week-event-wx {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.15;
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.week-event-job .week-event-time {
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.week-event-job .week-event-sub {
  font-size: 0.68rem;
  opacity: 0.9;
}

/* Today date number same size as other days */
.week-day-num.is-today-num,
.week-day.is-today .week-day-num {
  font-size: inherit;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  display: inline;
  place-items: unset;
  padding: 0;
  line-height: inherit;
}
.week-day.is-today .week-day-num {
  color: var(--brand, #ea5c1f);
  font-weight: 700;
}

.dash-job-body .wx-metrics {
  margin-top: 0.2rem;
}
.weather-strip-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  align-items: center;
}
