/* jobs screen styles (tokens from app.css only).
   Fences out list (panels gauge, map, job groups), the job page and the add / edit form.
   Map pictures, job pins, corner dots and the map's own cards are styled by map.css. */

/* ---------- List layout ---------- */

.jobs-stack,
.jobs-layout,
.jobs-layout__top,
.jobs-layout__map,
.jobs-layout__list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.jobs-layout__list {
  gap: 20px;
}

/* Desktop: panels and the job list on the left, the map stays in view on the right */
@media (min-width: 900px) {
  .jobs-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "top map"
      "list map";
    gap: 20px 24px;
    align-items: start;
  }

  .jobs-layout__top {
    grid-area: top;
  }

  .jobs-layout__list {
    grid-area: list;
  }

  .jobs-layout__map {
    grid-area: map;
    position: sticky;
    top: 0;
  }
}

/* ---------- Panels gauge (the one bold place on the list) ---------- */

.jobs-gauge,
.jobs-owned {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px 16px 20px;
}

.jobs-gauge::before,
.jobs-owned::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: var(--accent);
}

.jobs-gauge.is-over::before {
  background: var(--bad);
}

.jobs-gauge__change {
  position: absolute;
  top: 8px;
  right: 6px;
  color: var(--accent-ink);
}

.jobs-gauge .meter {
  gap: 10px;
}

.jobs-gauge .meter__head {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-right: 84px;
}

.jobs-gauge .meter__label {
  font: 600 12px/1.3 var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.jobs-gauge .meter__value {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  white-space: normal;
  font: 600 22px/1.1 var(--font-display);
  color: var(--ink-2);
}

.jobs-gauge__num {
  font: 700 56px/0.9 var(--font-display);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.jobs-gauge.is-over .jobs-gauge__num {
  color: var(--bad);
}

.jobs-gauge .meter__track {
  height: 14px;
}

/* Booked panels: blue stripes after the orange "out" part of the bar */
.jobs-gauge__booked,
.jobs-swatch {
  background: repeating-linear-gradient(-45deg, var(--info) 0 3px, var(--info-bg) 3px 6px);
}

.jobs-gauge__booked {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 0 999px 999px 0;
}

.jobs-gauge .meter__sub {
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.jobs-swatch {
  display: inline-block;
  width: 16px;
  height: 10px;
  margin: 0 6px 0 1px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px var(--info);
  vertical-align: 0;
}

.jobs-gauge__warn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--warn);
}

.jobs-gauge__warn .icon {
  margin-top: 1px;
}

/* "How many panels do you own?" (before the gauge can work) */
.jobs-owned {
  gap: 14px;
  padding-top: 18px;
}

.jobs-owned__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.jobs-owned__icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-card);
  background: var(--accent-bg);
  color: var(--accent-ink);
}

.jobs-owned__title {
  font: 600 24px/1.15 var(--font-display);
  letter-spacing: 0.01em;
}

.jobs-owned__text {
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-2);
}

.jobs-owned__form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.jobs-owned__row {
  display: flex;
  gap: 8px;
}

.jobs-owned__row > .input-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.jobs-owned__row > .btn {
  flex: none;
}

/* ---------- Map block ---------- */

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

.jobs-map {
  height: 248px;
}

.jobs-map--off {
  height: 172px;
}

@media (min-width: 900px) {
  .jobs-map {
    height: min(calc(100vh - 210px), 600px);
    min-height: 360px;
  }

  .jobs-map--off {
    height: 220px;
    min-height: 0;
  }
}

.jobs-mapbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 16px;
  margin-top: 4px;
}

.jobs-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

.jobs-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.jobs-legend__dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line-strong);
}

.jobs-legend__dot--out {
  background: var(--ok);
}

.jobs-legend__dot--booked {
  background: var(--info);
}

.jobs-legend__dot--done {
  background: var(--ink-2);
}

.jobs-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.jobs-toggle input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
}

/* The job whose pin was tapped, under the map (phones; on desktop the list is beside the map) */
.jobs-picked {
  margin-top: 4px;
}

.jobs-picked:empty {
  display: none;
}

.jobs-picked__card {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-1);
}

@media (min-width: 900px) {
  .jobs-picked {
    display: none;
  }
}

/* No job on the map: a smaller designed card in the map's place */
.jobs-map-empty {
  padding: 20px 16px;
}

.jobs-map-empty .empty__art {
  width: 88px;
  height: 88px;
  margin-bottom: 2px;
}

.jobs-map-empty .empty__title {
  font-size: 22px;
}

/* ---------- Job groups and rows ---------- */

.jobs-group__meta {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.jobs-row__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-width: 0;
}

.jobs-row__head > .list-row__title {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}

.jobs-row__chips {
  flex: none;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.jobs-row__head + .list-row__sub {
  margin-top: 4px;
}

.jobs-row__meta {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.jobs-row__note {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--accent-ink);
}

/* Desktop: the row of the tapped pin is marked (phones show the picked card under the map) */
@media (min-width: 900px) {
  .jobs-row.is-picked {
    background: var(--accent-bg);
  }

  .jobs-row.is-picked::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
    background: var(--accent);
  }
}

.jobs-none {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.45;
}

/* "Months 1–3 billed outside this app" on the job page */
.jobs-outside {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-2);
}

.jobs-outside .icon {
  color: var(--ok);
}

.jobs-more-btn {
  align-self: center;
  color: var(--accent-ink);
}

/* ---------- Job page ---------- */

.jobs-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 16px 16px 20px;
}

.jobs-hero::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: var(--ok);
}

.jobs-hero--booked::before {
  background: var(--info);
}

.jobs-hero--done::before {
  background: var(--line-strong);
}

.jobs-hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.jobs-hero__title {
  font: 700 32px/1.05 var(--font-display);
  letter-spacing: 0.01em;
}

.jobs-hero__sub {
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-2);
}

.jobs-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.jobs-stat {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 2px;
  min-width: 0;
}

.jobs-stat__num {
  margin: 0;
  font: 700 26px/1.05 var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.jobs-stat__label {
  font-size: 13px;
  line-height: 1.3;
  color: var(--ink-2);
}

.jobs-detail-map {
  height: 220px;
}

@media (min-width: 900px) {
  .jobs-detail-map {
    height: 300px;
  }
}

.jobs-lines {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.jobs-tel {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: -11px 0;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.jobs-notes {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.jobs-notes__label {
  font-size: 15px;
  color: var(--ink-2);
}

.jobs-notes__text {
  margin-top: 4px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.jobs-more {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.jobs-more > .btn {
  flex: 1 1 160px;
}

/* Status sheet ("Fence is up", "Picked up", "Put back out") */
.jobs-sheet {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.jobs-sheet-text {
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-2);
}

/* ---------- Add / edit form ---------- */

.jobs-form-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.jobs-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.jobs-grid-2--one {
  grid-template-columns: minmax(0, 1fr);
}

.jobs-grid-2--wide {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

@media (min-width: 560px) {
  .jobs-grid-2--wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

.jobs input[type="date"] {
  min-width: 0;
}

.jobs input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}

.jobs-draw {
  height: 300px;
}

.jobs-draw--off {
  height: 176px;
}

@media (min-width: 900px) {
  .jobs-draw {
    height: 360px;
  }

  .jobs-draw--off {
    height: 200px;
  }
}

.jobs-draw__readout.is-hint {
  padding: 8px 12px;
  font: 600 14px/1.2 var(--font-body);
}

.jobs-draw__below {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: -6px;
}

.jobs-draw__help {
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-2);
}

.jobs-prices__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.jobs-prices__summary {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.jobs-prices__line {
  font-size: 15px;
  line-height: 1.45;
}

.jobs-prices__rent {
  font-size: 15px;
  line-height: 1.3;
  color: var(--ink-2);
}

.jobs-prices__rent strong {
  font: 700 24px/1 var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.jobs-prices__toggle {
  flex: none;
  margin: -8px -8px 0 0;
  color: var(--accent-ink);
}

.jobs-prices__fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.jobs-prices__note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-2);
}
