/*
 * Tech Schedule — mobile field view.
 *
 * Standalone: no theme CSS loads on this page, so this is the whole
 * stylesheet. Shares the BBE/BBS dispatch palette so the two tools feel
 * related, but the layout is built for one thumb on a phone: nothing below
 * 44px tall is tappable, the day header sticks, and the primary actions
 * (call, directions) are full-width buttons rather than links in a sentence.
 */

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

html, body { margin: 0; padding: 0; }

body.bbs-sched-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    color: #242424;
    background: #f5f4ef;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul { list-style: none; }
button { font: inherit; color: inherit; }

/* ---------------------------------------------------------- password gate */

.bbs-sched-lock { max-width: 24rem; margin: 3rem auto; padding: 0 1.25rem; }
.bbs-sched-lock h1 { font-size: 1.3rem; color: #003407; margin-bottom: 0.4rem; }
.bbs-sched-lock p { color: #5c5c5c; font-size: 0.9rem; margin-bottom: 1rem; }

.bbs-sched-lock input[type="password"] {
    width: 100%;
    padding: 0.7rem 0.6rem;
    border: 1px solid #d8d4cc;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 0.6rem;
}

.bbs-sched-lock input[type="submit"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #b2400e;
    color: #fff;
    border: 0;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
}

.bbs-sched-lock label { display: block; }

/* ----------------------------------------------------------------- header */

.bbs-sched-head {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #003407;
    color: #fff;
    padding: 0.75rem 1rem calc(0.6rem + env(safe-area-inset-top, 0px));
    padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
}

.bbs-sched-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.bbs-sched-head h1 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }

.bbs-sched-filter-btn {
    min-height: 40px;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.bbs-sched-filter-btn[aria-expanded="true"] { background: #fff; color: #003407; }

.bbs-sched-summary {
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: #b9d2bf;
}

/* ---------------------------------------------------------------- filters */

.bbs-sched-filters {
    background: #fff;
    border-bottom: 1px solid #e6e4e4;
    padding: 0.9rem 1rem 1rem;
}

.bbs-sched-filters h2 {
    font-size: 0.7rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #5c5c5c;
    font-weight: 700;
    margin-bottom: 0.45rem;
}

.bbs-sched-filters h2:not(:first-child) { margin-top: 1rem; }

.bbs-sched-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.bbs-sched-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 40px;
    padding: 0.4rem 0.8rem;
    border: 1px solid #d8d4cc;
    border-radius: 999px;
    background: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.bbs-sched-chip[aria-pressed="true"] { border-color: #003407; background: #e8f3ea; }
.bbs-sched-chip[aria-pressed="false"] { opacity: 0.45; }

.bbs-sched-swatch { width: 20px; height: 20px; border-radius: 3px; display: inline-block; border: 1px solid #5c5c5c; }
.bbs-sched-swatch.round { border-radius: 50%; }
.bbs-sched-chip-count { font-weight: 400; color: #5c5c5c; font-variant-numeric: tabular-nums; }

.bbs-sched-filter-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }

.bbs-sched-btn {
    flex: 1 1 auto;
    min-height: 46px;
    padding: 0.6rem 1rem;
    border: 0;
    border-radius: 8px;
    background: #b2400e;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}

.bbs-sched-btn-ghost { background: #fff; color: #44403c; border: 1px solid #d8d4cc; }

.bbs-sched-hint { margin-top: 0.6rem; font-size: 0.75rem; color: #7a756c; line-height: 1.4; }

.bbs-sched-banner {
    background: #fdf1e7;
    border-bottom: 1px solid #f0c9a8;
    color: #6b2f08;
    font-size: 0.82rem;
    padding: 0.6rem 1rem;
}

/* ------------------------------------------------------------------- list */

.bbs-sched-list { padding: 0 0 3rem; }

.bbs-sched-day-head {
    position: sticky;
    top: 74px;
    z-index: 10;
    background: #ece9e1;
    border-top: 1px solid #ddd8cd;
    border-bottom: 1px solid #ddd8cd;
    padding: 0.4rem 1rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #3d3a34;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.bbs-sched-day-head .count { font-weight: 400; color: #6d675e; }

.bbs-sched-card {
    display: block;
    width: 100%;
    text-align: left;
    background: #fff;
    border: 0;
    border-bottom: 1px solid #ece9e1;
    padding: 0;
    cursor: pointer;
}

/*
 * The collapsed job line carries the truck colour as a wash. Only this row —
 * the expanded detail stays neutral, or a long detail would turn into a block
 * of colour and the wash would stop meaning "this is the job line".
 *
 * A tint rather than the truck colour at full strength: several of the trucks
 * are dark enough that black text on them fails contrast, and the stripe down
 * the left already shows the colour at full saturation.
 */
.bbs-sched-card-main {
    display: grid;
    grid-template-columns: 6px 68px 1fr auto;
    gap: 0.7rem;
    align-items: center;
    padding: 0.75rem 1rem 0.75rem 0;
    min-height: 66px;
    background: var(--truck-tint, #fff);
}

.bbs-sched-card[aria-expanded="true"] .bbs-sched-card-main {
    box-shadow: inset 0 -2px 0 var(--truck, #9ca3af);
}

.bbs-sched-stripe { align-self: stretch; background: var(--truck, #9ca3af); }

.bbs-sched-time {
    font-size: 0.95rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.bbs-sched-dur { display: block; font-size: 0.75rem; font-weight: 500; color: #5c5c5c; }

.bbs-sched-who { min-width: 0; }
.bbs-sched-name { display: block; font-weight: 700; font-size: 0.95rem; line-height: 1.25; }

.bbs-sched-sub {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: #44403c;
    min-width: 0;
}

.bbs-sched-city { overflow-wrap: anywhere; }

/*
 * Tech initials in their own colour, matching the letter colours the map and
 * the Techs filter already use, so a tech can spot their own jobs by colour
 * without reading. A pill rather than a strict circle because "St" is two
 * characters — single letters still come out round.
 */
.bbs-sched-techs { display: inline-flex; gap: 3px; flex: 0 0 auto; }

.bbs-sched-tech {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--tech, #78716c);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.bbs-sched-tech.is-none {
    background: #fff;
    color: #9a3412;
    border: 1px dashed #d9a066;
    box-shadow: none;
}

.bbs-sched-tag {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: #1c1917;
    color: #fff;
    white-space: nowrap;
}

.bbs-sched-tag.is-short { background: #e7e5e4; color: #44403c; }

.bbs-sched-chev { color: #b5afa4; font-size: 1.1rem; padding-right: 0.15rem; }

/* ---------------------------------------------------------------- details */

.bbs-sched-detail {
    padding: 0.2rem 1rem 1rem 1rem;
    background: #fbfaf7;
    border-top: 1px dashed #e0dbd1;
}

.bbs-sched-detail dl { display: grid; grid-template-columns: 78px 1fr; gap: 0.35rem 0.6rem; margin: 0.7rem 0 0; }
.bbs-sched-detail dt { font-size: 0.75rem; color: #7a756c; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.bbs-sched-detail dd { margin: 0; font-size: 0.88rem; }

.bbs-sched-note { color: #9a3412; font-size: 0.8rem; margin-top: 0.5rem; }

.bbs-sched-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.9rem; }

.bbs-sched-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 48px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid transparent;
}

.bbs-sched-action.call { background: #fff; color: #003407; border-color: #b9dcc1; }
.bbs-sched-action.nav { background: #b2400e; color: #fff; }
.bbs-sched-action.is-off { opacity: 0.4; pointer-events: none; }

/* ------------------------------------------------------------ empty state */

.bbs-sched-empty {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: #6d675e;
    font-size: 0.92rem;
}

.bbs-sched-empty strong { display: block; font-size: 1.05rem; color: #242424; margin-bottom: 0.3rem; }

/* Anything wider than a phone: keep the column readable rather than stretched. */
@media (min-width: 640px) {
    .bbs-sched-head, .bbs-sched-filters, .bbs-sched-list, .bbs-sched-banner {
        max-width: 1120px;
        margin-left: auto;
        margin-right: auto;
    }
    .bbs-sched-head { border-radius: 0 0 10px 10px; }
}

/* ------------------------------------------------------------ view toggle */

.bbs-sched-views {
    display: flex;
    gap: 2px;
    margin-top: 0.6rem;
    padding: 2px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
}

.bbs-sched-view {
    flex: 1 1 0;
    min-height: 38px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}

.bbs-sched-view[aria-selected="true"] { background: #fff; color: #003407; }

/* ------------------------------------------------------------ month view */

.bbs-sched-monthbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: #fff;
    border-bottom: 1px solid #e6e4e4;
}

.bbs-sched-monthbar h2 { font-size: 1rem; font-weight: 700; }

.bbs-sched-nav {
    min-width: 44px;
    min-height: 44px;
    border: 1px solid #d8d4cc;
    border-radius: 8px;
    background: #fff;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.bbs-sched-nav[disabled] { opacity: 0.3; cursor: default; }

.bbs-sched-dow {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    background: #fff;
    padding: 0 0.35rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #7a756c;
    text-align: center;
    text-transform: uppercase;
}

.bbs-sched-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    padding: 0 0.35rem 0.5rem;
    background: #fff;
    border-bottom: 1px solid #e6e4e4;
}

.bbs-sched-cell {
    position: relative;
    min-width: 0;
    min-height: 96px;
    padding: 4px 2px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: #f8f7f4;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    font: inherit;
}

.bbs-sched-cell .num {
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

/* Days we never asked HighLevel about: hatched, so an empty cell is never
   mistaken for "nothing booked". */
.bbs-sched-cell.is-out {
    background: repeating-linear-gradient(45deg, #f3f1ec, #f3f1ec 4px, #ebe8e1 4px, #ebe8e1 8px);
    color: #b5afa4;
    cursor: default;
}

.bbs-sched-cell.is-empty { color: #5c5c5c; }
.bbs-sched-cell.is-today { border-color: #003407; }
.bbs-sched-cell.is-today .num { color: #003407; }

.bbs-sched-cell.is-selected {
    background: #003407;
    border-color: #003407;
}

.bbs-sched-cell.is-selected .num { color: #fff; }

.bbs-sched-dots {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 100%;
    line-height: 1.2;
}

.bbs-sched-month-job { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 3px; }
.bbs-sched-month-initials { color: #242424; font-size: 0.875rem; font-weight: 800; overflow-wrap: anywhere; min-width: 0; }
.bbs-sched-cell.is-selected .bbs-sched-month-initials { color: #fff; }
.bbs-sched-month-off { padding: 2px 0; font-size: 0.75rem; font-weight: 700; color: #704226; line-height: 1.2; }
.bbs-sched-cell.is-selected .bbs-sched-month-off { color: #fff; }
.bbs-sched-empty-day { padding: 12px 16px; font-size: 1rem; color: #5c5c5c; background: #fff; }

.bbs-sched-dot {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: 800;
    border-radius: 50%;
    background: var(--truck, #9ca3af);
}

/* Heat treatments read as squares, matching the map's rectangle/circle rule. */
.bbs-sched-dot.is-full { border-radius: 2px; }

.bbs-sched-cell.is-selected .bbs-sched-dot { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85); }

.bbs-sched-more { font-size: 0.75rem; font-weight: 700; color: #5c5c5c; line-height: 1; }
.bbs-sched-cell.is-selected .bbs-sched-more { color: #cfe0d3; }

.bbs-sched-daypick {
    padding: 0.55rem 1rem;
    background: #ece9e1;
    border-bottom: 1px solid #ddd8cd;
    font-size: 0.82rem;
    font-weight: 700;
    color: #3d3a34;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.bbs-sched-daypick .count { font-weight: 400; color: #6d675e; }
