:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: #111a2f;
  --panel-alt: #1a2540;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #2563eb;
  --danger: #b91c1c;
  --border: #23314f;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

.mobile-app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.mobile-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #0f172a;
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0.9rem;
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.mobile-header-logo-link {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  text-decoration: none;
}

.mobile-header-logo-link:hover {
  text-decoration: none;
}

.mobile-header-logo-link:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.mobile-header-logo {
  display: block;
  height: 1.8rem;
  width: auto;
  max-width: min(48vw, 180px);
}
.mobile-main {
  padding: 0.75rem;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.mobile-primary-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  padding: 0.65rem 0.75rem 0;
}

.mobile-nav-link {
  text-decoration: none;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-alt);
  color: var(--text);
  padding: 0.5rem;
  font-size: 0.9rem;
}

.mobile-nav-link.active {
  background: var(--accent);
  border-color: var(--accent);
}

.page {
  display: block;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
}

.login-card {
  max-width: 420px;
  margin: 1.25rem auto;
  display: grid;
  gap: 0.5rem;
}

#page-login {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-block: 0.5rem;
}

#page-login .login-card {
  width: min(420px, 100%);
  margin: 0;
}

.login-panel-title {
  margin: 0.15rem 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.mobile-mfa-qr {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 180px;
  padding: 0.75rem;
  background: #fff;
  border-radius: 10px;
}

.mobile-mfa-qr svg {
  width: min(220px, 100%);
  height: auto;
}

.mobile-mfa-recovery-codes {
  margin: 0;
  padding: 0.65rem 0.75rem;
  background: #0b1328;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
}

.login-logo {
  width: min(90vw, 100%);
  margin: 0.55rem auto 0.2rem;
  display: block;
  opacity: 0.95;
}

label {
  color: var(--muted);
  font-size: 0.86rem;
}

input {
  width: 100%;
  background: #0b1328;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.6rem;
}

select {
  width: 100%;
  background: #0b1328;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.6rem;
}

textarea {
  width: 100%;
  background: #0b1328;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.6rem;
  font-family: inherit;
}

.btn {
  border: 0;
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  color: white;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

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

.btn-danger {
  background: var(--danger);
}

.btn-ghost {
  background: var(--panel-alt);
  border: 1px solid var(--border);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.55rem;
}

.toolbar h2 {
  margin: 0;
  font-size: 1rem;
}

.status {
  margin: 0.35rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.status.error {
  color: #fda4af;
}

.jobs-list,
.list {
  display: grid;
  gap: 0.6rem;
}

.scheduler-jobs-list {
  display: grid;
  gap: 0.65rem;
}

.scheduler-job-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  outline-offset: 2px;
}

.scheduler-job-card-link:focus-visible {
  outline: 2px solid #60a5fa;
}

.scheduler-detail-toolbar-title {
  flex: 1;
  margin: 0;
  font-size: 1rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.scheduler-detail-body {
  display: grid;
  gap: 0.65rem;
}

.scheduler-detail-section {
  display: grid;
  gap: 0.45rem;
}

.scheduler-detail-section-title {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.scheduler-detail-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.scheduler-detail-empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
}

.scheduler-detail-map {
  width: 100%;
  min-height: 240px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-alt);
}

.scheduler-detail-map-status {
  margin: 0;
}

.scheduler-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.scheduler-detail-actions .btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.scheduler-filter-card {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.crew-filter-card {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.crew-list {
  display: grid;
  gap: 0.65rem;
}

.crew-card {
  display: grid;
  gap: 0.45rem;
}

.crew-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.crew-card-name {
  margin: 0;
  font-size: 1rem;
}

.crew-card-district {
  color: var(--muted);
  font-size: 0.78rem;
}

.crew-card-summary {
  color: var(--muted);
  font-size: 0.84rem;
}

.crew-card-members {
  font-size: 0.84rem;
}

.crew-assigned-list,
.crew-available-list {
  display: grid;
  gap: 0.45rem;
}

.crew-assignment-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  background: #0b1328;
}

.crew-assignment-row-meta {
  color: var(--muted);
  font-size: 0.75rem;
}

.crew-assignment-modal {
  display: grid;
  gap: 0.8rem;
}

.crew-assignment-section {
  display: grid;
  gap: 0.4rem;
}

.crew-assignment-section h4 {
  margin: 0;
  font-size: 0.9rem;
}

.crew-assignment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  align-items: end;
}

.crew-assignment-actions {
  grid-template-columns: 1fr;
}

.scheduler-job-card {
  display: grid;
  gap: 0.55rem;
}

.scheduler-job-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.scheduler-job-customer {
  margin: 0;
  font-size: 0.95rem;
}

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

.scheduler-job-field {
  display: grid;
  gap: 0.2rem;
}

.scheduler-job-field-span {
  grid-column: 1 / -1;
}

.scheduler-job-window-wrap {
  display: block;
  width: 100%;
  min-width: 0;
}

.scheduler-job-window-split {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
}

.scheduler-job-window-col {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  flex: 1 1 0;
}

.scheduler-job-window-start {
  text-align: left;
}

.scheduler-job-window-end {
  text-align: right;
}

.scheduler-job-window-end .scheduler-job-label,
.scheduler-job-window-end .scheduler-job-value {
  text-align: right;
}

.scheduler-job-ct-string-value {
  white-space: nowrap;
}

.scheduler-job-label {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.scheduler-job-value {
  font-size: 0.87rem;
}

.scheduler-status-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  white-space: nowrap;
  text-transform: lowercase;
}

.scheduler-status-scheduled {
  border-color: #1d4ed8;
  color: #93c5fd;
}

.scheduler-status-in-progress {
  border-color: #ca8a04;
  color: #fde68a;
}

.scheduler-status-completed {
  border-color: #15803d;
  color: #86efac;
}

.scheduler-status-cancelled {
  border-color: #be123c;
  color: #fda4af;
}

.scheduler-status-draft {
  border-color: var(--border);
  color: var(--muted);
}

.scheduler-readiness {
  display: inline-flex;
  gap: 0.22rem;
}

.scheduler-readiness-cue {
  border-radius: 999px;
  min-width: 1.35rem;
  text-align: center;
  padding: 0.12rem 0.35rem;
  font-size: 0.72rem;
  border: 1px solid var(--border);
}

.scheduler-readiness-ok {
  border-color: #15803d;
  color: #86efac;
}

.scheduler-readiness-missing {
  border-color: #9f1239;
  color: #fda4af;
}

@media (max-width: 420px) {
  .scheduler-job-grid {
    grid-template-columns: 1fr;
  }
}

/* Hidden tabs (share mode, jobs without plugs) leave no empty track. */
.tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

.tab-btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-alt);
  color: var(--text);
  padding: 0.5rem;
}

.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
}

.value-row,
.log-row,
.plug-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem;
  background: var(--panel);
}

.value-row .name {
  font-size: 0.9rem;
}

.value-row .value {
  margin-top: 0.2rem;
  font-weight: 600;
}

/* Expandable Job Log row: shown for coiled tubing and snubbing jobs so mobile
 * users can tap a comment to reveal the same channel values (Depth, Weight,
 * pressures, etc.) the web Job Log table displays in its columns. */
.log-row.is-expandable {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.log-row.is-expandable:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.log-row.is-expanded {
  background: #172445;
  border-color: rgba(96, 165, 250, 0.4);
}

.log-row-head {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.log-row-head-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}

.log-row-caret {
  color: var(--text-disabled);
  font-size: 0.95rem;
  line-height: 1;
  transition: transform 0.15s ease;
  margin-top: 0.1rem;
}

.log-row.is-expanded .log-row-caret {
  transform: rotate(90deg);
}

.log-row-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.8rem;
  padding-top: 0.55rem;
  margin-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.log-value-cell {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.log-value-label {
  font-size: 0.55rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.log-value-num {
  font-size: 0.85rem;
  color: var(--text-soft);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-value-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.68rem 0.72rem;
  background: #0f172a;
  display: grid;
  gap: 0.35rem;
}

.overview-value-card .name {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.overview-value-card .value {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.overview-value-num {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #f8fafc;
}

.overview-value-unit {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: #94a3b8;
}

.overview-value-spark {
  height: 20px;
}

.overview-value-spark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.overview-channel-controls {
  margin-bottom: 0.65rem;
}

.overview-channel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.overview-channel-header h3 {
  margin: 0;
  font-size: 0.9rem;
}

.overview-channel-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.overview-channel-actions {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

.overview-channel-toggle-btn {
  min-width: 5.5rem;
}

.overview-channel-controls.collapsed .overview-channel-body {
  display: none;
}

.overview-channel-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem 0.55rem;
}

.overview-channel-picker label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.28rem 0.38rem;
  background: #0b1328;
  color: var(--text);
  font-size: 0.8rem;
}

.overview-channel-picker input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.small {
  color: var(--muted);
  font-size: 0.8rem;
}

.inline-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.user-chip {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

.mobile-account-menu {
  position: relative;
}

.mobile-account-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 10rem;
  z-index: 250;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.35rem;
  display: grid;
  gap: 0.35rem;
}

.mobile-account-menu-list[hidden] {
  display: none;
}

.mobile-account-menu-list .btn {
  text-align: left;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(2, 6, 23, 0.72);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal-content {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
}

.modal-content h3 {
  margin: 0 0 0.4rem;
}

.modal-content p {
  margin: 0;
  color: var(--muted);
}

.placeholder-card {
  display: grid;
  gap: 0.35rem;
}

.placeholder-card h3 {
  margin: 0;
  font-size: 0.95rem;
}

.mobile-change-password-modal {
  display: grid;
  gap: 0.45rem;
}

.mobile-change-password-modal .inline-actions {
  margin-top: 0.35rem;
}

.overview-share-wrap {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.overview-share-btn {
  width: 100%;
}

.job-log-jdr-wrap .btn {
  width: 100%;
}
.jdr-day-modal {
  display: grid;
  gap: 0.55rem;
  width: min(460px, 100%);
}
.jdr-day-modal-body {
  display: grid;
  gap: 0.45rem;
}
.jdr-day-modal-body .btn {
  width: 100%;
}

.job-log-add-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* Grow the action buttons to fill the row instead of left-justifying with a
   trailing gap. Works for whatever subset is visible (Running Footage is
   role-gated), and still wraps on very narrow screens. */
.job-log-add-actions .btn {
  flex: 1 1 auto;
}

.job-info-modal {
  display: grid;
  gap: 0.55rem;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}

.job-info-body,
.job-info-groups {
  display: grid;
  gap: 0.55rem;
}

.job-info-group {
  display: grid;
  gap: 0.5rem;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
}

.job-info-item {
  display: grid;
  gap: 0.15rem;
}

.job-info-label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.job-info-value {
  font-size: 0.9rem;
  color: var(--text);
  word-break: break-word;
  min-height: 1.1em;
}

.job-info-mods-list {
  margin: 0.1rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--text);
}

.job-info-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.running-footage-modal {
  display: grid;
  gap: 0.45rem;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}

.running-footage-filter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.running-footage-filter input {
  flex: 1 1 6rem;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-alt);
  color: var(--text);
}

.running-footage-body {
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 60vh;
  overflow: auto;
  background: var(--panel-alt);
}

.running-footage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.running-footage-table th,
.running-footage-table td {
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.running-footage-table th {
  position: sticky;
  top: 0;
  background: var(--panel);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
}

.running-footage-table td.footage-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.running-footage-empty {
  padding: 0.75rem 0.65rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.share-link-modal {
  display: grid;
  gap: 0.45rem;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}

.share-link-modal .toolbar {
  margin-bottom: 0.25rem;
}

.share-link-modal .toolbar h3 {
  margin: 0;
}

.share-link-modal input[type="text"],
.share-link-modal select {
  width: 100%;
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.55rem;
  font: inherit;
}

.share-link-modal .share-link-generate-btn {
  margin-top: 0.3rem;
}

.share-link-result {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.35rem;
}

.share-link-result input[type="text"] {
  flex: 1;
  min-width: 0;
}

.share-link-section-heading {
  margin: 0.65rem 0 0.25rem;
  font-size: 0.92rem;
  color: var(--text);
}

.share-links-list {
  display: grid;
  gap: 0.35rem;
  max-height: 36vh;
  overflow-y: auto;
}

.share-link-row {
  display: grid;
  gap: 0.2rem;
  padding: 0.5rem 0.6rem;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.share-link-row-label {
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.share-link-row-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.share-link-row-status {
  text-transform: capitalize;
}

.share-link-row-status.is-active {
  color: #4ade80;
}

.share-link-row-status.is-revoked,
.share-link-row-status.is-expired {
  color: var(--muted);
}

.share-link-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.3rem;
}

.share-link-row-actions .btn {
  padding: 0.35rem 0.55rem;
  font-size: 0.82rem;
}

/* ---------- Mobile redesign: shared tokens & primitives ---------- */

:root {
  --data-mill: #fb923c;
  --data-p2p-t: #22d3ee;
  --data-p2p-d: #a78bfa;
  --outlier: #ef4444;
  --outlier-text: #fca5a5;
  --ok: #22c55e;
  --ok-soft: #86efac;
  --warn: #f59e0b;
  --warn-soft: #fcd34d;
  --text-strong: #f1f5f9;
  --text-soft: #cbd5e1;
  --text-faint: #64748b;
  --text-disabled: #475569;
  --accent-secondary: #93c5fd;
}

@keyframes mobilePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.mono {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.status-soft {
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* Filter chip strip — shared between Plugs and Live Jobs */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

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

.chip-count {
  background: rgba(255, 255, 255, 0.06);
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  min-width: 1rem;
  text-align: center;
}

.chip.is-active .chip-count {
  background: rgba(255, 255, 255, 0.22);
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex: 0 0 6px;
}

.chip-dot.is-outlier {
  background: var(--outlier);
}

/* ---------- Mobile Plugs redesign ---------- */

.plugs-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  background: linear-gradient(180deg, #131e3a 0%, #0f172e 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.7rem;
  margin-bottom: 0.5rem;
}

.plugs-hero-stat {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.plugs-hero-label {
  font-size: 0.55rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.plugs-hero-value {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  display: inline-block;
}

.plugs-hero-value.is-mill { color: var(--data-mill); }
.plugs-hero-value.is-p2p-t { color: var(--data-p2p-t); }
.plugs-hero-value.is-p2p-d { color: var(--data-p2p-d); }

.plugs-hero-unit {
  font-size: 0.6rem;
  color: var(--muted);
  margin-left: 0.18rem;
}

/* Chips scroll under a frac toggle pinned to the right of the same row. */
.plugs-filter-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.plugs-filters {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.1rem;
  flex: 1 1 auto;
  min-width: 0;
}

.plugs-frac-toggle {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.plugs-frac-toggle.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.plug-num.is-frac {
  display: inline-flex;
  align-items: baseline;
  gap: 0.22rem;
}

.plug-num-tag {
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.plug-card.is-mia .plug-num-tag { color: var(--text-faint); }

/* Scoped to .modal-content so these beat the generic `.modal-content p` rule. */
.modal-content .plugs-total-help {
  color: var(--text-soft);
  font-size: 0.78rem;
  line-height: 1.45;
  margin: 0 0 0.75rem;
}

.modal-content .plugs-total-error {
  color: var(--outlier);
  font-size: 0.72rem;
  min-height: 1rem;
  margin: 0.35rem 0 0;
}

.plugs-search-wrap {
  margin-bottom: 0.45rem;
}

.plugs-search {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  font-family: inherit;
}

.plugs-search:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 1px;
}

.plug-actions {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.6rem;
  margin-bottom: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.plug-actions-target {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.62rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.plug-actions-target-value {
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.plug-actions-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.plug-action-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  padding: 0.65rem 0.4rem;
  min-height: 44px;
  color: #fff;
  cursor: pointer;
}

.plug-action-btn.is-tag { background: #2563eb; }
.plug-action-btn.is-through { background: #ea7a1c; }
.plug-action-btn.is-mia { background: #b91c1c; }

.plug-action-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.plug-action-btn:not(:disabled):active {
  transform: translateY(1px);
  filter: brightness(0.92);
}

.plug-action-btn:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.plugs-legend {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.62rem;
  color: var(--text-faint);
  margin-bottom: 0.55rem;
}

.plugs-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
}

.plugs-legend-swatch {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 2px;
}

.plugs-legend-swatch.is-mill { background: var(--data-mill); }
.plugs-legend-swatch.is-p2p-t { background: var(--data-p2p-t); }
.plugs-legend-swatch.is-p2p-d { background: var(--data-p2p-d); }

.plugs-legend-tick {
  display: inline-block;
  width: 1px;
  height: 9px;
  background: rgba(255, 255, 255, 0.6);
}

.plugs-legend-outlier {
  display: inline-block;
  width: 7px;
  height: 7px;
  border: 1px solid var(--outlier);
  border-radius: 2px;
}

.plugs-legend-sep { color: var(--text-disabled); }

.plug-list {
  display: grid;
  gap: 0.32rem;
}

.plug-card {
  width: 100%;
  text-align: left;
  background: #0f172e;
  border: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  display: grid;
  gap: 0.35rem;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.plug-card:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.plug-card.is-expanded {
  background: #172445;
  border-color: rgba(96, 165, 250, 0.4);
  border-left-color: rgba(96, 165, 250, 0.4);
}

.plug-card.is-outlier {
  border-left: 3px solid var(--outlier);
  padding-left: calc(0.6rem - 2px);
}

.plug-card.is-mia {
  opacity: 0.5;
}

.plug-card-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.plug-num {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-strong);
  min-width: 2rem;
}

.plug-card.is-mia .plug-num { color: var(--text-faint); }

.plug-status-pill {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  font-family: inherit;
  white-space: nowrap;
}

.plug-status-pill.is-done {
  color: var(--ok-soft);
  background: rgba(34, 197, 94, 0.10);
  border-color: rgba(34, 197, 94, 0.25);
}

.plug-status-pill.is-mia {
  color: var(--text-faint);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
}

.plug-card-spacer { flex: 1; }

.plug-mini-stat {
  display: grid;
  gap: 0.05rem;
  text-align: right;
  min-width: 2.5rem;
}

.plug-mini-stat-label {
  font-size: 0.5rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.plug-mini-stat-value {
  font-size: 0.78rem;
  color: var(--text-soft);
  font-weight: 600;
}

.plug-mini-stat-value.is-mill { color: var(--data-mill); }
.plug-mini-stat-value.is-outlier { color: var(--outlier-text); }

.plug-mini-stat-unit {
  font-size: 0.55rem;
  color: var(--text-faint);
  margin-left: 0.18rem;
}

.plug-card-caret {
  color: var(--text-disabled);
  font-size: 0.95rem;
  line-height: 1;
  transition: transform 0.15s ease;
}

.plug-card.is-expanded .plug-card-caret {
  transform: rotate(90deg);
}

.plug-card-body {
  display: grid;
  gap: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 0.05rem;
}

.plug-bar-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.6rem;
}

.plug-bar-row-label {
  font-weight: 700;
}

.plug-bar-row-label.is-mill { color: var(--data-mill); }
.plug-bar-row-label.is-p2p-t { color: var(--data-p2p-t); }
.plug-bar-row-label.is-p2p-d { color: var(--data-p2p-d); }

.plug-bar-track {
  position: relative;
  height: 8px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  border: 1px solid transparent;
}

.plug-bar-track.is-outlier {
  border-color: rgba(239, 68, 68, 0.6);
}

.plug-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 2px;
}

.plug-bar-track.is-mill .plug-bar-fill { background: var(--data-mill); }
.plug-bar-track.is-p2p-t .plug-bar-fill { background: var(--data-p2p-t); }
.plug-bar-track.is-p2p-d .plug-bar-fill { background: var(--data-p2p-d); }

.plug-bar-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.35);
}

.plug-bar-label {
  font-size: 0.6rem;
  color: var(--text-strong);
  text-align: right;
  min-width: 3rem;
}

.plug-row-cumlat {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.plug-row-cum,
.plug-row-lateral {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.plug-row-lateral { margin-left: auto; }

.plug-row-cum-label {
  font-size: 0.55rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.plug-row-cum-value {
  font-size: 0.7rem;
  color: var(--text-soft);
  font-weight: 600;
}

.plug-lateral-track {
  position: relative;
  width: 80px;
  height: 10px;
}

.plug-lateral-track::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 4px;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 1px;
}

.plug-lateral-dot {
  position: absolute;
  top: 0;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--data-p2p-d);
  box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.2);
  margin-left: -5px;
}

.plug-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  padding: 0.4rem 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
}

.plug-time-cell {
  display: grid;
  gap: 0.1rem;
}

.plug-time-label {
  font-size: 0.55rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.plug-time-value {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}

.plug-time-clock {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-strong);
}

.plug-time-date {
  font-size: 0.6rem;
  color: var(--text-faint);
}

.plug-time-empty {
  font-size: 0.7rem;
  color: var(--text-disabled);
}

.plug-detail-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.plug-detail-cell {
  display: grid;
  gap: 0.1rem;
}

.plug-detail-label {
  font-size: 0.55rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.plug-detail-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-strong);
  display: inline-flex;
  align-items: baseline;
  gap: 0.18rem;
}

.plug-detail-value.is-outlier {
  color: var(--outlier-text);
}

.plug-detail-unit {
  font-size: 0.55rem;
  color: var(--muted);
  font-weight: 500;
}

.plug-detail-med {
  font-size: 0.55rem;
  color: var(--text-faint);
}

.plug-empty {
  margin: 0.6rem 0;
}

/* ---------- Mobile Live Jobs redesign ---------- */

.jobs-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0 0.55rem;
}

.jobs-hero-text {
  min-width: 0;
}

.jobs-hero-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-strong);
}

.jobs-hero-meta {
  margin: 0.18rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.jobs-hero-meta:empty {
  display: none;
}

.jobs-hero-online {
  color: var(--ok-soft);
  font-weight: 600;
}

.jobs-hero-strong {
  color: var(--text-soft);
  font-weight: 600;
}

.jobs-hero-sep {
  color: var(--text-disabled);
  margin: 0 0.18rem;
}

.jobs-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  flex-shrink: 0;
  color: var(--text-soft);
}

/* Live Jobs filter chips share the .chip primitives. */
.jobs-filters {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0.5rem;
  padding-bottom: 0.1rem;
}

.jobs-filters .chip-dot.is-online { background: var(--ok); }
.jobs-filters .chip-dot.is-standby { background: var(--warn); }

/* Status pill — shared between Live Jobs cohorts and Plugs. */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-pill.is-active {
  color: var(--ok-soft);
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
}

.status-pill.is-standby {
  color: var(--warn-soft);
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
}

.status-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.status-pill.is-active[data-online="1"] .status-pill-dot {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
  animation: mobilePulse 2s infinite;
}

.status-pill.is-standby[data-online="1"] .status-pill-dot {
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

/* Cohort cards */
.cohort-card {
  position: relative;
  background: linear-gradient(180deg, #131e3a 0%, #0f172e 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  font-family: inherit;
  color: var(--text);
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}

.cohort-card.is-single {
  cursor: pointer;
  padding: 0.7rem 0.75rem;
  display: grid;
  gap: 0.5rem;
}

.cohort-card.is-multi {
  padding-top: 0.7rem;
}

.cohort-card:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.cohort-rail {
  position: absolute;
  left: 0;
  top: 0.7rem;
  bottom: 0.7rem;
  width: 3px;
  border-radius: 0 2px 2px 0;
}

.cohort-rail.is-online { background: var(--ok); }
.cohort-rail.is-offline { background: var(--warn); opacity: 0.55; }

.cohort-card.is-single .cohort-head {
  padding: 0;
}

.cohort-card.is-multi .cohort-head {
  padding: 0 0.75rem;
}

.cohort-eyebrow-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
}

.cohort-operator {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.cohort-badge {
  background: rgba(96, 165, 250, 0.14);
  color: var(--accent-secondary);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 4px;
  padding: 0 0.3rem;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.cohort-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem;
  margin-top: 0.18rem;
}

.cohort-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.25;
  min-width: 0;
  flex: 1;
}

.cohort-single-panel {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.cohort-device-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent-secondary);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 6px;
  padding: 0.12rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.cohort-row-sep {
  font-size: 0.7rem;
  color: var(--text-faint);
}

.cohort-row-time {
  font-size: 0.7rem;
  color: var(--muted);
  flex-shrink: 0;
  margin-left: auto;
}

.cohort-row-chevron {
  color: var(--text-disabled);
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.cohort-rows {
  display: flex;
  flex-direction: column;
  margin-top: 0.55rem;
}

.cohort-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.85rem 0.55rem 1.15rem;
  border: 0;
  background: transparent;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  color: var(--text);
  text-align: left;
  font-family: inherit;
  font-size: inherit;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
}

.cohort-row:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: -2px;
}

.cohort-row.is-last {
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
}

.cohort-row-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--warn);
  flex-shrink: 0;
}

.cohort-row-dot.is-online {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.cohort-row-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* Job-detail breadcrumb header */
.job-breadcrumb {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.job-back-btn {
  flex-shrink: 0;
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
}

.job-breadcrumb-text {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 0.1rem;
}

.job-breadcrumb-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-breadcrumb-meta {
  margin: 0;
  font-size: 0.7rem;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Mobile redesign: motion + small-viewport polish ---------- */

@media (prefers-reduced-motion: reduce) {
  .status-pill.is-active[data-online="1"] .status-pill-dot {
    animation: none;
  }
  .plug-card-caret {
    transition: none;
  }
}

@media (max-width: 360px) {
  .jobs-hero-title { font-size: 1.2rem; }
  .plugs-hero { padding: 0.55rem 0.6rem; gap: 0.45rem; }
  .plugs-hero-value { font-size: 0.95rem; }
  .plug-card { padding: 0.42rem 0.5rem; }
  .plug-card.is-outlier { padding-left: calc(0.5rem - 2px); }
  .cohort-card.is-single { padding: 0.6rem 0.65rem; }
  .cohort-row { padding: 0.5rem 0.7rem 0.5rem 1rem; }
  .cohort-title { font-size: 0.85rem; }
}

/* ===== Mobile scheduler lanes ===== */
/* Read-only resource-lanes view for #/scheduler (see mobile-scheduler-lanes.js).
   Ported from the approved lanes mockup. All classes are msl-prefixed so nothing
   collides with the shared mobile global stylesheet; the buttons reuse the existing
   .btn family. mobile.css mixes CSS vars + raw hex, so this section does too. */

/* --- view toggle + density segmented controls --- */
.msl-seg {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.msl-seg button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  min-height: 38px;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.msl-seg button.on {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.msl-seg button:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}
.msl-viewtoggle { margin-bottom: 0.55rem; }
.msl-seg-small { flex: 0 0 auto; padding: 2px; }
.msl-seg-small button { flex: 0 0 auto; min-height: 28px; padding: 0 9px; font-size: 0.68rem; }
/* Density segmented control rides the Filters/Today row, pushed flush right. */
.msl-density { margin-left: auto; align-self: center; }
.msl-dshort { display: none; }

/* --- lanes toolbar --- */
.msl-toolbar { margin-bottom: 0.55rem; }
.msl-tb-row1 { display: flex; gap: 8px; align-items: stretch; }
.msl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 40px;
  font-size: 0.78rem;
}
.msl-cbadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
}
/* Narrow phones (<=370px): compact density labels to 3d/5d/7d so the single
   toolbar row never overflows (Filters + Today + 3 short buttons + gaps < ~300px). */
@media (max-width: 370px) {
  .msl-density .msl-dfull { display: none; }
  .msl-density .msl-dshort { display: inline; }
}

/* --- horizontally pannable, day-snapped track --- */
.msl-timeline {
  --dayw: calc(var(--vp, 360px) / var(--dpv, 3));
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.msl-timeline::-webkit-scrollbar { display: none; }
.msl-timeline.nosnap { scroll-snap-type: none; }
.msl-track { position: relative; width: calc(var(--dayw) * var(--ndays, 14)); }
.msl-dayhead {
  display: flex;
  height: 38px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.msl-dayseg {
  position: relative;
  flex: 0 0 auto;
  width: var(--dayw);
  border-left: 1px solid rgba(96, 131, 199, 0.30);
  padding: 5px 0 0 9px;
  scroll-snap-align: start;
}
.msl-d-lbl { font-size: 0.7rem; font-weight: 600; color: var(--text-soft); }
.msl-dayseg.today .msl-d-lbl { color: var(--accent-secondary); }
.msl-dayseg.today::after {
  content: "";
  position: absolute;
  left: 9px;
  bottom: 0;
  width: 34px;
  height: 2px;
  background: var(--accent);
}
.msl-tick {
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  font-style: normal;
  font-size: 0.55rem;
  color: var(--text-faint);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  display: none;
}
.msl-timeline.d3 .msl-tick { display: block; }

/* --- lanes + labels --- */
.msl-lanes { padding-bottom: 8px; }
.msl-lane { padding-top: 6px; }
.msl-lane-label {
  position: sticky;
  left: 0;
  z-index: 6;
  width: var(--vp, 360px);
  display: flex;
  align-items: center;
  gap: 7px;
  height: 22px;
  padding: 0 2px;
  background: var(--bg);
}
.msl-ln-name { font-size: 0.75rem; font-weight: 700; color: var(--text-strong); white-space: nowrap; }
.msl-ln-meta {
  font-size: 0.62rem;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msl-chip-cap {
  flex: 0 0 auto;
  font-size: 0.58rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  color: var(--accent-secondary);
  background: #0b1328;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}
.msl-lane.tbd .msl-ln-name {
  color: var(--muted);
  font-weight: 600;
  border: 1px dashed var(--text-faint);
  border-radius: 6px;
  padding: 1px 7px;
}
.msl-lane-track {
  position: relative;
  height: 52px;
  background-color: rgba(15, 23, 42, 0.55);
  user-select: none;
  -webkit-user-select: none;
  background-image: repeating-linear-gradient(to right, rgba(96, 131, 199, 0.30) 0 1px, transparent 1px var(--dayw));
}
.msl-timeline.d3 .msl-lane-track {
  background-image:
    repeating-linear-gradient(to right, rgba(96, 131, 199, 0.30) 0 1px, transparent 1px var(--dayw)),
    repeating-linear-gradient(to right, rgba(148, 163, 184, 0.10) 0 1px, transparent 1px calc(var(--dayw) / 2));
}
.msl-lane.tbd .msl-lane-track {
  background-color: rgba(51, 65, 85, 0.18);
  box-shadow: inset 0 1px 0 rgba(100, 116, 139, 0.25), inset 0 -1px 0 rgba(100, 116, 139, 0.25);
}

/* --- now line --- */
.msl-nowline {
  position: absolute;
  top: 38px;
  bottom: 8px;
  width: 2px;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(to bottom, var(--warn), var(--outlier));
}
.msl-nowline::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 7px rgba(245, 158, 11, 0.8);
}

/* --- bars --- */
.msl-bar {
  position: absolute;
  top: 4px;
  height: 44px;
  min-width: 24px;
  z-index: 2;
  border: 0;
  border-radius: 8px;
  padding: 5px 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.msl-bar:focus-visible { outline: 2px solid #60a5fa; outline-offset: 1px; }
.msl-b-top { display: flex; align-items: center; gap: 5px; min-width: 0; white-space: nowrap; font-size: 0.72rem; line-height: 1.15; }
.msl-b-cust { font-weight: 700; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.msl-b-well { opacity: 0.8; font-size: 0.66rem; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 4 auto; }
.msl-mbadge, .msl-wbadge { flex: 0 0 auto; font-size: 0.72rem; line-height: 1; }
.msl-wbadge { color: #fdba74; }
.msl-live { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 3px; font-size: 0.55rem; font-weight: 700; letter-spacing: 0.06em; color: var(--ok-soft); }
.msl-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: mslPulse 1.4s ease-in-out infinite; }
@keyframes mslPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.msl-dots { display: flex; gap: 3px; }
.msl-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
}
.msl-dot.ok { background: var(--ok); color: #052e16; }
.msl-dot.miss { background: var(--outlier); color: #fff; }

.msl-bar.st-scheduled { background: #1d4ed8; color: #dbeafe; }
.msl-bar.st-in_progress { background: #ca8a04; color: #fef9c3; }
.msl-bar.st-completed { background: #15803d; color: #dcfce7; }
.msl-bar.st-cancelled { background: #be123c; color: #ffe4e6; }
.msl-bar.st-draft { background: #334155; color: #cbd5e1; border: 1.5px dashed #64748b; }
.msl-bar.conflict { z-index: 3; border: 2px solid #f97316; }
.msl-blk { justify-content: center; }
.msl-blk .msl-b-cust { font-weight: 600; font-size: 0.68rem; }
.msl-bar.blk-transit { background: #6d28d9; color: #ede9fe; }
.msl-bar.blk-downtime { background: repeating-linear-gradient(135deg, #7f1d1d 0 8px, #9f1239 8px 16px); color: #fecdd3; }

/* narrow-bar degradation (5/7-day density and short jobs) */
.msl-bar.narrow .msl-b-well,
.msl-bar.narrow .msl-dots,
.msl-bar.narrow .msl-mbadge,
.msl-bar.narrow .msl-wbadge,
.msl-bar.narrow .msl-live { display: none; }
.msl-bar.micro .msl-b-top,
.msl-bar.micro .msl-dots { display: none; }
.msl-bar.micro { padding: 0; }

/* --- status / empty / error / skeleton --- */
.msl-statusline {
  padding: 9px 2px 4px;
  color: var(--text-faint);
  font-size: 0.68rem;
}
.msl-empty {
  padding: 1.2rem 0.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}
.msl-error {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.9rem 0.8rem;
  color: #fda4af;
  font-size: 0.82rem;
}
.msl-skel-lane .msl-skel-name {
  display: inline-block;
  width: 120px;
  height: 10px;
  border-radius: 999px;
  background: var(--panel-alt);
  animation: mslShimmer 1.2s ease-in-out infinite;
}
.msl-skel-bar {
  position: absolute;
  top: 4px;
  height: 44px;
  border-radius: 8px;
  background: var(--panel-alt);
  animation: mslShimmer 1.2s ease-in-out infinite;
}
@keyframes mslShimmer { 0%, 100% { opacity: 0.55; } 50% { opacity: 0.9; } }

/* --- warning banners (M2/M3 write feedback) --- */
.msl-warnings { display: grid; gap: 6px; margin-bottom: 8px; }
.msl-warn-banner {
  padding: 8px 11px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--warn-soft);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--warn);
  border-left-width: 4px;
  border-radius: 8px;
}

/* --- overlays: scrim + bottom sheets --- */
.msl-scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(2, 6, 23, 0.72);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.msl-scrim.on { opacity: 1; pointer-events: auto; }
.msl-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 91;
  max-height: 82%;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(105%);
  visibility: hidden;
  transition: transform 0.18s ease, visibility 0s linear 0.18s;
}
.msl-sheet.open { transform: translateY(0); visibility: visible; transition: transform 0.18s ease; }
.msl-handle { width: 36px; height: 4px; border-radius: 999px; background: var(--border); margin: 2px auto 10px; }
.msl-sh-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 9px; }
.msl-sh-head h2 { margin: 0; font-size: 0.95rem; line-height: 1.3; color: var(--text-strong); }
.msl-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.msl-pill.st-scheduled { background: #1d4ed8; color: #dbeafe; }
.msl-pill.st-in_progress { background: #ca8a04; color: #fef9c3; }
.msl-pill.st-completed { background: #15803d; color: #dcfce7; }
.msl-pill.st-cancelled { background: #be123c; color: #ffe4e6; }
.msl-pill.st-draft { border: 1.5px dashed #64748b; color: #cbd5e1; }
.msl-pill.blk-transit { background: #6d28d9; color: #ede9fe; }
.msl-pill.blk-downtime { background: #9f1239; color: #fecdd3; }
.msl-sh-time {
  font-size: 0.8rem;
  color: var(--text-soft);
  background: #0b1328;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  margin-bottom: 8px;
}
.msl-krow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(35, 49, 79, 0.55);
  font-size: 0.8rem;
}
.msl-k { flex: 0 0 auto; text-transform: uppercase; font-size: 0.62rem; letter-spacing: 0.05em; color: var(--muted); }
.msl-v { min-width: 0; text-align: right; color: var(--text); }
.msl-vready { display: inline-flex; align-items: center; gap: 7px; }
.msl-miss { font-style: normal; font-size: 0.72rem; color: var(--outlier); }
.msl-okt { font-style: normal; font-size: 0.72rem; color: var(--ok-soft); }
.msl-conflict-row {
  margin: 10px 0 2px;
  padding: 9px 11px;
  font-size: 0.75rem;
  line-height: 1.45;
  color: #fdba74;
  border: 1px solid #f97316;
  border-left-width: 4px;
  border-radius: 8px;
  background: rgba(249, 115, 22, 0.10);
}
.msl-advisory {
  margin: 10px 0 2px;
  padding: 9px 11px;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--warn-soft);
  border: 1px solid var(--warn);
  border-left-width: 4px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.10);
}
.msl-maplink { color: var(--accent-secondary); text-decoration: underline; white-space: nowrap; }
.msl-actions:empty { display: none; }
.msl-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.msl-sh-links { display: flex; gap: 8px; margin-top: 13px; }
.msl-link { flex: 1; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

/* --- filter sheet controls --- */
.msl-f-lbl {
  display: block;
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 13px 2px 6px;
}
.msl-input {
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  font-size: 0.85rem;
  font-family: inherit;
  background: #0b1328;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
.msl-fchecks { display: grid; gap: 2px; }
.msl-fcheck { display: flex; align-items: center; gap: 11px; min-height: 38px; font-size: 0.82rem; color: var(--text-soft); }
.msl-fcheck input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.msl-fchips { display: flex; flex-wrap: wrap; gap: 8px; }
.msl-fchip {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text-soft);
  font-family: "SF Mono", Menlo, Consolas, monospace;
}
.msl-fchip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.msl-fchip:disabled { opacity: 0.4; cursor: not-allowed; }
.msl-frow-toggle { display: flex; justify-content: space-between; align-items: center; min-height: 44px; font-size: 0.82rem; color: var(--text-soft); margin-top: 4px; }
.msl-switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: 0 0 auto; }
.msl-switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.msl-switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--panel-alt); border: 1px solid var(--border); pointer-events: none; transition: background 0.15s; }
.msl-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform 0.15s; }
.msl-switch input:checked + i { background: var(--accent); border-color: var(--accent); }
.msl-switch input:checked + i::after { transform: translateX(18px); background: #fff; }
.msl-f-apply { width: 100%; margin-top: 15px; min-height: 44px; }

/* --- M2: drag (lift / armed / pending / drop target), hint pill, tooltip --- */
/* Job bars capture touch only for write roles so read-only panning is unchanged. */
.msl-writable .msl-bar:not(.msl-blk) {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.msl-bar.msl-lifted { z-index: 15; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.65); cursor: grabbing; }
.msl-bar.msl-pending {
  z-index: 12;
  outline: 2px dashed var(--accent-secondary);
  outline-offset: 1px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}
.msl-bar.msl-armed {
  z-index: 12;
  outline: 2px dashed var(--accent-secondary);
  outline-offset: 1px;
  animation: mslArmPulse 1.1s ease-in-out infinite;
}
@keyframes mslArmPulse {
  0%, 100% { outline-color: var(--accent-secondary); }
  50% { outline-color: var(--accent); }
}
.msl-lane-track.msl-drop { box-shadow: inset 0 0 0 2px var(--accent); background-color: rgba(37, 99, 235, 0.14); }
.msl-hintpill {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 60px);
  z-index: 96;
  transform: translate(-50%, -6px);
  background: #0b1328;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent-secondary);
  font-size: 0.68rem;
  padding: 8px 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.msl-hintpill.on { opacity: 1; transform: translate(-50%, 0); }
.msl-dragtip {
  position: fixed;
  z-index: 98;
  transform: translateX(-50%);
  background: #0b1328;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-strong);
  font-size: 0.68rem;
  padding: 4px 9px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}
.msl-dragtip.on { opacity: 1; }

/* --- M2: confirm bar (docked above the viewport bottom, safe-area padded) --- */
.msl-confirmbar {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 93;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 13px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  transform: translateY(150%);
  visibility: hidden;
  transition: transform 0.18s ease, visibility 0s linear 0.18s;
}
.msl-confirmbar.on { transform: none; visibility: visible; transition: transform 0.18s ease; }
.msl-confirmbar.saved { border-color: var(--ok); }
.msl-cb-text { font-size: 0.74rem; color: var(--text-strong); }
.msl-confirmbar.saved .msl-cb-text { color: var(--ok-soft); }
.msl-cb-actions { display: flex; gap: 8px; }
.msl-cb-actions .btn { flex: 1; min-height: 44px; }

/* --- M2: toast (transient + ±1h undo) --- */
.msl-toast {
  position: fixed;
  left: 50%;
  bottom: calc(70px + env(safe-area-inset-bottom));
  z-index: 95;
  max-width: 92%;
  transform: translate(-50%, 8px);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #0b1328;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.72rem;
  padding: 9px 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.msl-toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.msl-undo {
  border: 0;
  background: transparent;
  color: var(--accent-secondary);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 2px;
  min-height: 32px;
}

/* --- M2: sheet quick actions (status pills, ±1h / Move, Edit / Delete) --- */
.msl-actions .btn { min-height: 44px; text-align: center; }
.msl-actions-full { grid-column: 1 / -1; }
.msl-status-row { display: flex; flex-wrap: wrap; gap: 6px; }
.msl-stbtn {
  flex: 1 1 auto;
  min-height: 40px;
  padding: 0 8px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text-soft);
  opacity: 0.72;
}
.msl-stbtn.on { opacity: 1; border-color: var(--accent-secondary); box-shadow: inset 0 0 0 1px var(--accent-secondary); }
.msl-stbtn.st-scheduled.on { background: #1d4ed8; color: #dbeafe; }
.msl-stbtn.st-in_progress.on { background: #ca8a04; color: #fef9c3; }
.msl-stbtn.st-completed.on { background: #15803d; color: #dcfce7; }
.msl-stbtn.st-cancelled.on { background: #be123c; color: #ffe4e6; }
.msl-stbtn.st-draft.on { background: #334155; color: #cbd5e1; }

/* --- M2: red error banner for write failures (reuses the warnings container) --- */
.msl-err-banner { color: #fecaca; background: rgba(185, 28, 28, 0.15); border-color: var(--danger); }

/* --- M2: create FAB --- */
.msl-fab {
  position: fixed;
  right: 14px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 88;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  font-size: 1.9rem;
  line-height: 1;
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 3px;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45), 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.msl-fab[hidden] { display: none; }
.msl-fab.msl-fab-gone { opacity: 0; pointer-events: none; transform: scale(0.8); }

@media (prefers-reduced-motion: reduce) {
  .msl-scrim, .msl-sheet, .msl-switch i, .msl-switch i::after { transition: none; }
  .msl-live i, .msl-skel-bar, .msl-skel-lane .msl-skel-name { animation: none; }
  .msl-timeline { scroll-behavior: auto; }
  .msl-hintpill, .msl-dragtip, .msl-confirmbar, .msl-toast, .msl-fab { transition: none; }
  .msl-bar.msl-armed { animation: none; }
}

/* ===== Mobile scheduler editor ===== */
/* Write-flow sheets for the /m lanes view (mobile-scheduler-editor.js). Matches the
   msl- bottom-sheet design language; all classes are mse-prefixed. The four tokens the
   mockup uses but the shared :root does not define (--input-bg, --hero) fall back inline. */

.mse-host { display: contents; }

.mse-scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(2, 6, 23, 0.72);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.mse-scrim.on { opacity: 1; pointer-events: auto; }

.mse-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 91;
  max-height: 94dvh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  transform: translateY(105%);
  visibility: hidden;
  transition: transform 0.18s ease, visibility 0s linear 0.18s;
}
.mse-sheet.open { transform: translateY(0); visibility: visible; transition: transform 0.18s ease; }

.mse-handle { flex: none; width: 36px; height: 4px; border-radius: 999px; background: var(--border); margin: 8px auto 6px; }

.mse-head { flex: none; padding: 0 16px 9px; border-bottom: 1px solid var(--border); }
.mse-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.mse-head-main { min-width: 0; }
.mse-title { font-size: 0.95rem; font-weight: 700; line-height: 1.3; color: var(--text-strong); }
.mse-sub { font-size: 0.66rem; color: var(--muted); margin-top: 2px; }
.mse-x {
  flex: none;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text-soft);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.mse-jobline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.mse-jobcx { font-size: 0.82rem; color: var(--text-soft); min-width: 0; }

.mse-pill {
  flex: none;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.mse-pill.st-scheduled { background: #1d4ed8; color: #dbeafe; }
.mse-pill.st-in_progress { background: #ca8a04; color: #fef9c3; }
.mse-pill.st-completed { background: #15803d; color: #dcfce7; }
.mse-pill.st-cancelled { background: #be123c; color: #ffe4e6; }
.mse-pill.st-draft { border: 1.5px dashed #64748b; color: #cbd5e1; }

/* Create-flow step header */
.mse-steps { display: flex; align-items: center; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.mse-steps::-webkit-scrollbar { display: none; }
.mse-step-item { display: flex; align-items: center; gap: 6px; flex: none; }
.mse-step-num {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.66rem;
  font-weight: 700;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--muted);
}
.mse-step-name { font-size: 0.66rem; color: var(--muted); white-space: nowrap; }
.mse-step-item.current .mse-step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.mse-step-item.current .mse-step-name { color: var(--text-strong); font-weight: 600; }
.mse-arrow { color: var(--text-faint); font-size: 0.7rem; flex: none; }

.mse-banners { flex: none; padding: 10px 16px 0; }
.mse-banner {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.78rem;
  line-height: 1.45;
}
.mse-banner.warn { background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.45); color: var(--warn-soft); }
.mse-banner.err { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.5); color: #fecaca; }
.mse-banner code { display: block; margin-top: 6px; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 0.6rem; color: var(--text-faint); }
.mse-banner-actions { margin-top: 8px; }

.mse-body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 13px 16px 18px; }
.mse-loading { padding: 24px 4px; color: var(--muted); font-size: 0.85rem; text-align: center; }

.mse-footer {
  flex: none;
  display: flex;
  gap: 10px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.mse-fbtn { flex: 1; min-height: 44px; }

/* Form primitives */
.mse-field { margin-bottom: 14px; }
.mse-field:last-child { margin-bottom: 0; }
.mse-label {
  display: block;
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 5px;
}
.mse-input {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--input-bg, #0b1328);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
.mse-textarea { min-height: 0; resize: vertical; line-height: 1.4; }
.mse-readonly {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  font-size: 0.82rem;
  color: var(--text-soft);
  background: var(--input-bg, #0b1328);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.mse-note { font-size: 0.66rem; color: var(--text-faint); margin: 5px 0 0; }

/* datetime + steppers */
.mse-dtrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mse-dtrow .mse-input { flex: 1 1 168px; min-width: 0; }
.mse-steppers { display: flex; gap: 5px; flex: none; }
.mse-step {
  min-width: 44px;
  min-height: 44px;
  padding: 0 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text-soft);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.7rem;
  cursor: pointer;
}
.mse-step:active { background: var(--accent); border-color: var(--accent); color: #fff; }
.mse-duration {
  display: inline-block;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--accent-secondary);
}
.mse-duration.warn { color: var(--warn-soft); }

/* equipment chips + picker */
.mse-chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.mse-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
}
.mse-chip-x { color: var(--muted); font-size: 0.95rem; line-height: 1; }
.mse-chip-add { border-style: dashed; color: var(--accent-secondary); background: transparent; }
.mse-addwell { width: 100%; min-height: 44px; margin-top: 2px; }

.mse-picker-wrap { position: fixed; inset: 0; z-index: 92; display: none; }
.mse-picker-wrap.open { display: block; }
.mse-picker-wrap .mse-scrim { z-index: 1; opacity: 1; pointer-events: auto; }
.mse-picker {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  max-height: 68dvh;
  display: flex;
  flex-direction: column;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
}
.mse-picker .mse-head-row { padding: 0 16px 9px; border-bottom: 1px solid var(--border); }
.mse-picker-search {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.mse-picker-search .mse-label { margin-bottom: 5px; }
.mse-picker-search-input { width: 100%; min-height: 44px; }
.mse-picker-list { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 12px calc(12px + env(safe-area-inset-bottom)); }
.mse-picker-group {
  text-transform: uppercase;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 10px 2px 5px;
}
.mse-picker-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 52px;
  padding: 9px 12px;
  margin-bottom: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.mse-u-name { font-size: 0.84rem; font-weight: 600; }
.mse-u-meta { font-size: 0.64rem; color: var(--muted); }
.mse-picker-empty { font-size: 0.75rem; color: var(--muted); padding: 14px 12px; }

/* location row */
.mse-locrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mse-loccoords {
  flex: 1 1 140px;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--text-soft);
  background: var(--input-bg, #0b1328);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.mse-locbtn { flex: none; min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; font-size: 0.78rem; }

/* typeahead */
.mse-ta { position: relative; }
.mse-ta-drop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 5;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.mse-ta-opt {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 0.84rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.mse-ta-opt:last-child { border-bottom: 0; }
.mse-ta-opt mark { background: transparent; color: var(--accent-secondary); font-weight: 700; }

/* wells + duplicate-well card */
.mse-wellrow-wrap { margin-bottom: 9px; }
.mse-wellrow { display: flex; gap: 8px; }
.mse-wellrow .mse-input { flex: 1 1 auto; min-width: 0; }
.mse-wellrm { flex: none; min-height: 44px; min-width: 44px; }
.mse-dupcard {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 10px;
  padding: 11px 12px;
  margin-top: 8px;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--warn-soft);
}
.mse-dup-actions { display: flex; gap: 8px; margin-top: 9px; }
.mse-dup-actions .btn { flex: 1; min-height: 44px; font-size: 0.74rem; }
.mse-dup-confirm { color: var(--ok-soft); }

/* create-flow inline link + block-type segmented */
.mse-linkbtn {
  display: inline-block;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-secondary);
  font-size: 0.78rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.mse-seg { display: flex; gap: 8px; }
.mse-seg-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg, #0b1328);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.mse-seg-btn.active { background: var(--panel-alt); border-color: var(--accent); color: var(--text-strong); }
.mse-swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.mse-sw-down { background: repeating-linear-gradient(135deg, #7f1d1d 0 4px, #9f1239 4px 8px); }
.mse-sw-transit { background: #6d28d9; }

@media (prefers-reduced-motion: reduce) {
  .mse-scrim, .mse-sheet { transition: none; }
}

/* ---------- Mobile Map tab ---------- */

.map-canvas-wrap {
  position: relative;
}

.map-canvas {
  width: 100%;
  height: 45vh;
  min-height: 220px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-alt);
  transition: height 160ms ease;
}

#page-map.is-map-expanded .map-canvas {
  height: 78vh;
}

.map-canvas-notice {
  position: absolute;
  inset-inline: 0.5rem;
  top: 0.5rem;
  margin: 0;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  background: rgba(11, 16, 32, 0.86);
  text-align: center;
}

.map-canvas-controls {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  display: flex;
  gap: 0.4rem;
}

.map-canvas-controls .btn {
  min-height: 36px;
  padding: 0.35rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-soft);
  font-family: inherit;
  background: rgba(11, 16, 32, 0.88);
}

.map-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.chip.is-static {
  cursor: default;
}

.chip.is-static.is-warn {
  border-color: var(--warn);
  color: var(--warn-soft);
}

.map-job-list {
  display: grid;
  gap: 0.6rem;
}

.map-job-card {
  display: grid;
  gap: 0.5rem;
  border-left: 3px solid transparent;
}

.map-job-card.is-focused {
  border-left-color: var(--accent);
  border-color: var(--accent);
}

.map-job-card.is-unmapped {
  opacity: 0.75;
}

.map-job-main {
  display: grid;
  gap: 0.15rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}

.map-job-main.is-static {
  cursor: default;
}

.map-job-main:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 3px;
  border-radius: 6px;
}

.map-job-customer {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.map-job-well {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-strong);
}

.map-job-where {
  font-size: 0.78rem;
  color: var(--text-soft);
}

.map-job-equipment {
  font-size: 0.72rem;
  color: var(--text-faint);
}

.map-job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.map-job-actions .btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
}

.map-job-actions .map-job-nav {
  color: #fff;
}

.map-unmapped {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  background: var(--panel);
}

.map-unmapped-summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-soft);
}

.map-unmapped-hint {
  margin: 0.4rem 0 0.6rem;
  font-size: 0.75rem;
  color: var(--text-faint);
}

.map-unmapped .map-job-card {
  margin-top: 0.5rem;
}

.map-popup {
  padding: 0.5rem 0.6rem;
  font-family: inherit;
  color: #0b1020;
}

.map-popup-customer {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.7;
}

.map-popup-well {
  font-size: 0.9rem;
  font-weight: 700;
}

.map-popup-where,
.map-popup-equipment {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Four primary tabs need a tighter label at narrow widths. */
@media (max-width: 380px) {
  .mobile-nav-link {
    font-size: 0.8rem;
    padding: 0.5rem 0.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-canvas {
    transition: none;
  }
}
