/* ==========================================================================
   Contracts, Submissions, Forms and Manuals
   (modules/features/contracts.js, technician.js, forms.js, manuals.js)
   The filter bar, then one quiet table: grouped rows (contracts by when the
   next service is due), a ⋯ or a button at the end. Contracts also has a
   month calendar. Phones get lists in phone.css.
   ========================================================================== */

.ct-page,
.sb-page,
.fm-page,
.mf-page {
  min-height: 100%;
  background: var(--bg-primary);
}

:is(.ct-page, .sb-page, .fm-page, .mf-page) > .fb {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
}

.sp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

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

.sp-sub {
  margin-top: 3px;
  overflow: hidden;
  font-size: 12.5px;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-ellipsis {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── List / Calendar switch ────────────────────────────────────────────── */

.ct-seg {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
}

.ct-seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  min-height: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.ct-seg button:hover {
  color: var(--text-primary);
}

.ct-seg button[aria-selected="true"] {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 500;
}

/* ── Table ─────────────────────────────────────────────────────────────── */

.sp-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 13.5px;
}

.sp-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 36px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
}

.sp-table th:first-child,
.sp-table td:first-child {
  padding-left: 20px;
}

.sp-table th:last-child,
.sp-table td:last-child {
  padding-right: 16px;
}

.sp-table tbody td {
  height: 56px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-table tbody tr.is-openable {
  cursor: pointer;
}

.sp-table tbody tr:not(.sp-group):hover td,
.sp-table tbody tr.is-menu-open td {
  background: var(--row-hover, var(--bg-hover));
}

/* Group headings inside the table */
.sp-table tr.sp-group th {
  height: 40px;
  padding: 14px 20px 6px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
}

.sp-group-count {
  margin-left: 8px;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* An extra fact after the count ("10m talk time") */
.sp-group-note {
  margin-left: 8px;
  font-weight: 400;
  color: var(--text-muted);
}

.sp-group-note::before {
  content: '·';
  margin-right: 8px;
}

.sp-more {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  vertical-align: middle;
  cursor: pointer;
  opacity: 0;
}

.sp-table tbody tr:hover .sp-more,
.sp-table tbody tr.is-menu-open .sp-more,
.sp-more:focus-visible {
  opacity: 1;
}

.sp-more:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

@media (hover: none) {
  .sp-more {
    opacity: 1;
  }
}

/* ── Contracts ─────────────────────────────────────────────────────────── */

.ct-col-company { width: 26%; }
.ct-col-service { width: 14%; }
.ct-col-schedule { width: 13%; }
.ct-col-next { width: 17%; }
.ct-col-location { width: auto; }
.ct-col-actions { width: 140px; text-align: right; }

.ct-company {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ct-date {
  font-variant-numeric: tabular-nums;
}

.ct-rel {
  margin-left: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.ct-rel.is-soon {
  color: var(--text-primary);
  font-weight: 500;
}

.ct-col-location {
  color: var(--text-secondary, var(--text-muted));
}

.ct-start {
  height: 28px;
  min-height: 0;
  padding: 0 10px;
  font-size: 12.5px;
}

/* Calendar */
.ct-cal {
  padding: 16px 20px 32px;
}

.ct-cal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ct-cal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.ct-cal-total {
  font-size: 12.5px;
  color: var(--text-muted);
}

.ct-cal-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.ct-cal-btn {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  min-height: 0;
  padding: 0 8px;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  background: var(--bg-primary);
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}

.ct-cal-btn:hover {
  background: var(--bg-hover);
}

.ct-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
}

.ct-cal-wd {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.ct-cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  min-height: 108px;
  padding: 6px 6px 8px;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.ct-cal-cell:nth-child(7n) {
  border-right: 0;
}

.ct-cal-grid > .ct-cal-cell:nth-last-child(-n + 7) {
  border-bottom: 0;
}

.ct-cal-cell.is-out {
  background: var(--bg-primary);
}

.ct-cal-cell.has-events {
  cursor: pointer;
}

.ct-cal-cell.is-selected {
  background: var(--bg-hover);
}

.ct-cal-day {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-bottom: 2px;
  border-radius: 50%;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.ct-cal-cell.is-today .ct-cal-day {
  background: var(--text-primary);
  color: var(--bg-primary);
  font-weight: 600;
}

.ct-cal-event {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 3px 6px;
  border: 0;
  border-radius: 5px;
  background: var(--bg-tertiary);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.ct-cal-event:hover {
  background: var(--border-color);
}

.ct-cal-more {
  min-height: 0;
  padding: 1px 6px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
}

.ct-cal-more:hover {
  color: var(--text-primary);
}

/* Phones show dots in place of names */
.ct-cal-dots {
  display: none;
}

/* The day's services, under the calendar */
.ct-day {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
}

.ct-day[hidden] {
  display: none;
}

.ct-day-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 600;
}

.ct-day-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}

.ct-day-row + .ct-day-row {
  border-top: 1px solid var(--border-color);
}

.ct-day-main {
  flex: 1;
  min-width: 0;
}

.ct-day-empty {
  padding: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Submissions ───────────────────────────────────────────────────────── */

/* Status tabs above the table */
.sb-tabs {
  display: flex;
  gap: 2px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-color);
}

.sb-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  min-height: 0;
  padding: 0 8px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13.5px;
  color: var(--text-muted);
  cursor: pointer;
}

.sb-tab:hover {
  color: var(--text-primary);
}

.sb-tab[aria-selected="true"] {
  color: var(--text-primary);
  font-weight: 500;
}

.sb-tab[aria-selected="true"]::after {
  content: '';
  position: absolute;
  right: 8px;
  bottom: -1px;
  left: 8px;
  height: 2px;
  border-radius: 2px;
  background: var(--text-primary);
}

.sb-tab-count {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bg-tertiary);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 18px;
  color: var(--text-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sb-col-form { width: 22%; }
.sb-col-site { width: auto; }
.sb-col-tech { width: 16%; }
.sb-col-date { width: 14%; }
.sb-col-status { width: 12%; }
.sb-col-actions { width: 196px; text-align: right; }

.sb-form {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
}

/* A quiet status: a dot and a word */
.sb-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
}

.sb-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

.sb-status.is-pending::before { background: #d97706; }
.sb-status.is-approved::before { background: #16a34a; }
.sb-status.is-denied::before { background: #dc2626; }

.sb-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.sb-act {
  height: 28px;
  min-height: 0;
  padding: 0 10px;
  font-size: 12.5px;
}

/* Approve / Deny come forward on the row you're on */
@media (hover: hover) {
  .sp-table tbody tr .sb-act {
    opacity: 0;
  }

  .sp-table tbody tr:hover .sb-act,
  .sp-table tbody tr:focus-within .sb-act {
    opacity: 1;
  }
}

/* Deny dialog */
.sb-deny-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  margin-top: 6px;
}

.sb-deny-sections label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  cursor: pointer;
}

.sb-deny-field + .sb-deny-field {
  margin-top: 16px;
}

.sb-deny-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.sb-deny-hint {
  margin: 0 0 16px;
  font-size: 13.5px;
  color: var(--text-muted);
}

/* ── An opened submission ──────────────────────────────────────────────── */

.sb-page.is-detail > .fb,
.sb-page.is-detail > .sb-tabs {
  display: none;
}

.sb-page.is-detail #ups-reports-container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 24px 48px;
}

.sb-page .ups-report-detail {
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.sb-detail-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.sb-page .sb-detail-head {
  padding: 0 0 18px;
}

.sb-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 0;
  margin: 0 0 10px -4px;
  padding: 2px 6px 2px 2px;
  border: 0;
  border-radius: 6px;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.sb-back:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sb-detail-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.sb-detail-titles {
  min-width: 0;
}

.sb-detail-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.sb-detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.sb-detail-meta .sb-status {
  color: var(--text-primary);
}

.sb-detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sb-pdf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sb-page .ups-report-detail-body {
  padding: 20px 0 0;
}

/* The technician joins the site line on phones only */
.sb-m-tech {
  display: none;
}


/* ── Forms ─────────────────────────────────────────────────────────────── */

.fm-col-name { width: auto; }
.fm-col-shape { width: 16%; }
.fm-col-subs { width: 12%; }
.fm-col-last { width: 13%; }
.fm-col-active { width: 160px; }
.fm-col-more { width: 56px; text-align: right; }

.fm-name {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* Name over description, the icon centred against both */
.fm-name-lines {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.fm-name-text {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
}

.fm-name-lines .fm-desc {
  margin: 0;
  padding: 0;
}

.fm-icon {
  display: inline-grid;
  flex-shrink: 0;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  background: var(--bg-secondary);
  color: var(--text-muted);
}


.fm-col-active {
  white-space: nowrap;
}

.fm-switch-label {
  margin-left: 8px;
  font-size: 13px;
  color: var(--text-muted);
  vertical-align: middle;
}

/* A small on/off switch, ink when on */
.fm-switch {
  position: relative;
  width: 30px;
  height: 18px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: var(--border-color);
  vertical-align: middle;
  cursor: pointer;
  transition: background 0.15s;
}

.fm-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
}

.fm-switch[aria-checked="true"] {
  background: var(--text-primary);
}

.fm-switch[aria-checked="true"] .fm-switch-knob {
  transform: translateX(12px);
  background: var(--bg-primary);
}

/* Builder: a bar that stays on top, then the form as a document */
.fbx {
  min-height: 100%;
  background: var(--bg-primary);
}

.fbx-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.fbx-bar .sb-back {
  margin: 0;
}

.fbx-bar-title {
  font-size: 13px;
  color: var(--text-muted);
}

.fbx-bar-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.fbx-body {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px 96px;
}

.fbx-title,
.fbx-desc {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  box-shadow: none;
  font: inherit;
  color: var(--text-primary);
  resize: none;
}

.fbx-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.fbx-desc {
  min-height: 0;
  margin-top: 6px;
  overflow: hidden;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-secondary, var(--text-muted));
}

:is(.fbx-title, .fbx-desc)::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

#fb-sections-container {
  margin-top: 28px;
}

.fbx-page {
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-secondary);
}

.fbx-page-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--border-color);
}

.fbx-page-num {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.fbx-page-name {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.fbx-page-name:hover,
.fbx-page-name:focus {
  background: var(--bg-hover);
}

.fbx-fields {
  padding: 4px 0;
}

.fbx-field {
  padding: 10px 12px 10px 8px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.fbx-field:last-child {
  border-bottom: 0;
}

.fbx-field.fb-dragging {
  opacity: 0.5;
}

.fbx-field.fb-drag-over {
  box-shadow: inset 0 2px 0 var(--text-primary);
}

.fbx-field-main {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 150px 96px 28px;
  align-items: center;
  gap: 8px;
}

.fbx-sub .fbx-field-main {
  grid-template-columns: minmax(0, 1fr) 140px 96px 28px;
}

.fbx-grip {
  display: grid;
  place-items: center;
  color: var(--text-muted);
  opacity: 0.5;
  cursor: grab;
}

.fbx-field:hover .fbx-grip {
  opacity: 1;
}

.fbx-input {
  width: 100%;
  height: 34px;
  min-height: 0;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  outline: none;
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-size: 14px;
  color: var(--text-primary);
}

.fbx-input:hover {
  border-color: var(--border-color);
}

.fbx-input:focus {
  border-color: var(--text-muted);
  background: var(--bg-primary);
}

.fbx-label {
  font-weight: 500;
}

.fbx-hint {
  height: 30px;
  font-size: 13px;
  color: var(--text-muted);
}

.fbx-type .crm-dd-trigger {
  height: 34px;
  min-height: 0;
}

.fbx-req {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
}

.fbx-req input[type="checkbox"] {
  -webkit-appearance: checkbox !important;
  appearance: auto !important;
  width: 15px !important;
  height: 15px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  accent-color: var(--text-primary);
}

.fbx-icon-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.fbx-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--color-danger, #dc2626);
}

.fbx-field-extra {
  margin: 4px 36px 0 28px;
}

.fbx-sub .fbx-field-extra {
  margin: 4px 36px 0 0;
}

.fbx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 6px 10px;
}

.fbx-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 26px;
  padding: 0 4px 0 10px;
  border: 1px solid var(--border-color);
  border-radius: 13px;
  background: var(--bg-primary);
  font-size: 12.5px;
}

.fbx-chip button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

.fbx-chip button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.fbx-chip svg {
  width: 11px;
  height: 11px;
}

.fbx-option-add {
  display: flex;
  gap: 6px;
  align-items: center;
}

.fbx-option-add .fbx-input {
  height: 30px;
  font-size: 13px;
}

.fbx-group {
  margin-top: 6px;
  padding: 8px 10px 10px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-primary);
}

.fbx-group-label {
  margin: 0 0 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.fbx-sub {
  padding: 6px 0;
}

.fbx-sub + .fbx-sub {
  border-top: 1px solid var(--border-color);
}

.fbx-empty {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.fbx-add-field,
.fbx-add-page {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13.5px;
  color: var(--text-muted);
  cursor: pointer;
}

.fbx-add-field {
  width: 100%;
  height: 40px;
  padding: 0 16px;
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 12px 12px;
}

.fbx-add-field.is-small {
  width: auto;
  height: 30px;
  margin-top: 4px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
}

.fbx-add-page {
  height: 36px;
  padding: 0 12px;
  border: 1px dashed var(--border-color);
  border-radius: 9px;
}

:is(.fbx-add-field, .fbx-add-page):hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}


/* ── Manuals ───────────────────────────────────────────────────────────── */

.mf-page {
  position: relative;
}

.mf-crumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13.5px;
}

.mf-back-btn,
.mf-breadcrumb-btn {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  font: inherit;
  color: var(--text-muted);
  cursor: pointer;
}

.mf-back-btn {
  width: 28px;
  justify-content: center;
  padding: 0;
  margin-right: 4px;
}

:is(.mf-back-btn, .mf-breadcrumb-btn):hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mf-breadcrumb-current {
  padding: 0 6px;
  font-weight: 600;
  color: var(--text-primary);
}

.mf-crumb-sep {
  color: var(--text-muted);
  opacity: 0.6;
}

.mf-col-name { width: auto; }
.mf-col-kind { width: 15%; }
.mf-col-size { width: 12%; }
.mf-col-added { width: 15%; }
.mf-col-more { width: 56px; text-align: right; }

.mf-item {
  cursor: pointer;
}

.mf-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 500;
}

.mf-folder .mf-name {
  font-weight: 600;
}

.mf-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.mf-ico {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

.mf-folder .mf-ico {
  color: var(--text-primary);
}

.mf-col-kind,
.mf-col-size,
.mf-col-added {
  color: var(--text-secondary, var(--text-muted));
  font-size: 13px;
}

.mf-item:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: -2px;
}

.mf-rename-input {
  height: 30px;
  border-color: var(--text-muted) !important;
}

.mf-upload-btn input[hidden] {
  display: none;
}

/* Dragging files over the page */
.mf-drop-hint {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--text-muted);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  pointer-events: none;
}

.mf-page.is-dropping .mf-drop-hint {
  display: flex;
}

/* ── Visits (modules/features/team-dashboard.js) ──────────────────────────
   Same page as Contracts: the filter bar across the top, then one table of
   visits grouped by day, or the map. Each row opens the visit panel. */

.visits-hub {
  gap: 0;
  max-width: none;
  min-height: 100%;
  margin: 0;
  background: var(--bg-primary);
  animation: none;
}

.visits-hub > .visits-command-bar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
}

.visits-hub > .visits-map-view.active {
  padding: 20px;
}

.visits-hub #visits-list-pg .pagination-container {
  padding: 12px 20px;
}

.vs-col-company { width: auto; }
.vs-col-rep { width: 12%; }
.vs-col-type { width: 13%; }
.vs-col-distance { width: 9%; }
.vs-col-score { width: 8%; }
.vs-col-fare { width: 15%; }
.vs-col-time { width: 8%; }
.vs-col-actions { width: 92px; text-align: right; }

.vs-table :is(.vs-col-distance, .vs-col-score, .vs-col-time) {
  font-variant-numeric: tabular-nums;
}

.vs-table .vs-col-time {
  color: var(--text-secondary, var(--text-primary));
}

.vs-company {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vs-dot {
  margin: 0 6px;
}

.sp-rep {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  vertical-align: middle;
}

.sp-avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 8.5px;
  font-weight: 600;
  line-height: 1;
  color: #fff;
}

.vs-fare {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
}

.vs-fare i {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.vs-fare.is-requested i { background: var(--color-warning, #d97706); }
.vs-fare.is-approved i { background: var(--color-success, #16a34a); }
.vs-fare.is-rejected i { background: var(--color-danger, #dc2626); }

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

.vs-fare.is-requested .vs-fare-word {
  color: var(--color-warning, #d97706);
}

/* Review shows on the row you're on (always on touch screens) */
.vs-review {
  opacity: 0;
}

.vs-row:hover .vs-review,
.vs-row:focus-within .vs-review,
.vs-review:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .vs-review {
    opacity: 1;
  }
}

.vs-row:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.ct-seg .vs-view-btn svg {
  flex-shrink: 0;
}

/* ── Calls (modules/features/call-logs.js) ────────────────────────────────
   The same table: upcoming calls first, then history grouped by day. */

.calls-page {
  min-height: 100%;
  background: var(--bg-primary);
}

.calls-page > .calls-toolbar {
  padding: 12px 20px;
}

.cl-col-contact { width: 20%; }
.cl-col-notes { width: auto; }
.cl-col-rep { width: 11%; }
.cl-col-outcome { width: 11%; }
.cl-col-duration { width: 7%; }
.cl-col-time { width: 15%; }
.cl-col-actions { width: 84px; text-align: right; }
.cl-table:has(.cl-row .btn) .cl-col-actions { width: 132px; }

.cl-table :is(.cl-col-duration, .cl-col-time) {
  font-variant-numeric: tabular-nums;
}

.cl-table .cl-col-time {
  color: var(--text-secondary, var(--text-primary));
}

.cl-table .cl-col-notes {
  color: var(--text-secondary, var(--text-primary));
}

.cl-contact {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 500;
}

.cl-dir {
  display: inline-grid;
  flex-shrink: 0;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.cl-dir svg {
  width: 16px;
  height: 16px;
}

.cl-contact + .sp-sub {
  padding-left: 24px;
}

/* The outcome reads like the visit's fare: a dot and a word, no box */
.cl-table .calls-outcome {
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
  font-weight: 400;
  color: var(--text-primary);
}

.cl-row.is-overdue .calls-outcome {
  color: var(--color-danger);
}

.cl-col-actions {
  white-space: nowrap;
}

.cl-col-actions > * {
  vertical-align: middle;
}

.cl-col-actions .calls-icon-btn {
  display: inline-grid;
}

/* Edit and delete show on the row you're on (always on touch screens) */
.cl-hover {
  opacity: 0;
}

.cl-row:hover .cl-hover,
.cl-row:focus-within .cl-hover,
.cl-hover:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .cl-hover {
    opacity: 1;
  }
}

.cl-row:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.calls-page .calls-more {
  display: block;
  margin: 16px auto;
}
