/*
    Titan Studio shell. The look is build 674's (legacy/index.html): the same colour tokens, Barlow / Barlow Condensed,
    square green buttons, plain outlined second buttons, surface cards, pill tabs and the 56px top bar.
    Bootstrap is still the grid and component base; its variables are pointed at the planner's tokens here.
*/
:root {
    --bg: #e8edef;
    --surface: #f6f8f9;
    --ink: #1d282e;
    --mute: #58666d;
    --line: #c3cdd2;
    --acc: #00644c;
    --acc-rgb: 0, 100, 76;
    --accfg: #fff;
    --band: #dbe3e7;
    --red: #c0392b;
    --amber: #b26b00;
    --ts-logo: #0B8A55;
    --ts-acc: var(--acc);
    --ts-cond: "Barlow Condensed", "Arial Narrow", sans-serif;
}

[data-bs-theme=dark] {
    --bg: #161d21;
    --surface: #1e272c;
    --ink: #e6ecef;
    --mute: #98a7ae;
    --line: #34434a;
    --acc: #3fb58f;
    --acc-rgb: 63, 181, 143;
    --accfg: #06140f;
    --band: #26323a;
    --red: #ff7b6e;
    color-scheme: dark;
}

:root, [data-bs-theme=dark], [data-bs-theme=light] {
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--ink);
    --bs-emphasis-color: var(--ink);
    --bs-heading-color: var(--ink);
    --bs-secondary-color: var(--mute);
    --bs-tertiary-color: var(--mute);
    --bs-secondary-bg: var(--band);
    --bs-tertiary-bg: var(--band);
    --bs-border-color: var(--line);
    --bs-border-color-translucent: var(--line);
    --bs-primary: var(--acc);
    --bs-primary-rgb: var(--acc-rgb);
    --bs-link-color: var(--acc);
    --bs-link-color-rgb: var(--acc-rgb);
    --bs-link-hover-color: var(--acc);
    --bs-link-hover-color-rgb: var(--acc-rgb);
    --bs-body-font-family: Barlow, system-ui, -apple-system, "Segoe UI", sans-serif;
    --bs-body-font-size: 16px;
    --bs-body-line-height: 1.45;
    --bs-border-radius: 4px;
    --bs-border-radius-sm: 4px;
    --bs-border-radius-lg: 10px;
    --bs-card-bg: var(--surface);
}

html, body {
    font-family: Barlow, system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
}

h1, h2, h3, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--ts-cond);
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);
}

h1, .h4 { font-size: 1.7rem; }
h1 a { color: var(--acc); }
h1 small { font: 400 .95rem Barlow, system-ui, sans-serif; color: var(--mute); }
h2, .h5 { font-size: 1.3rem; }
.h6, h3 { font-size: 1.15rem; margin-bottom: 8px; }
.small, small { font-size: .85rem; }
a { text-underline-offset: 2px; }

/* Buttons: one green button per area, the rest plain (V644), delete red */
.btn {
    --bs-btn-border-radius: 4px;
    --bs-btn-padding-x: 12px;
    --bs-btn-padding-y: 6px;
    --bs-btn-font-size: .95rem;
    --bs-btn-font-weight: 400;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-sm, .btn-group-sm > .btn {
    --bs-btn-padding-x: 10px;
    --bs-btn-padding-y: 3px;
    --bs-btn-font-size: .85rem;
    --bs-btn-border-radius: 4px;
    min-height: 32px;
}

.btn.py-0 { min-height: 28px; }

.btn-primary, .btn-success {
    --bs-btn-color: var(--accfg);
    --bs-btn-bg: var(--acc);
    --bs-btn-border-color: var(--acc);
    --bs-btn-hover-color: var(--accfg);
    --bs-btn-hover-bg: var(--acc);
    --bs-btn-hover-border-color: var(--acc);
    --bs-btn-active-color: var(--accfg);
    --bs-btn-active-bg: var(--acc);
    --bs-btn-active-border-color: var(--acc);
    --bs-btn-disabled-color: var(--accfg);
    --bs-btn-disabled-bg: var(--acc);
    --bs-btn-disabled-border-color: var(--acc);
    font-weight: 600;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .15);
}

.btn-primary:hover, .btn-success:hover { filter: brightness(1.08); }

.btn-outline-secondary, .btn-outline-primary, .btn-secondary, .btn-light, .btn-outline-dark {
    --bs-btn-color: var(--ink);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: var(--line);
    --bs-btn-hover-color: var(--acc);
    --bs-btn-hover-bg: transparent;
    --bs-btn-hover-border-color: var(--acc);
    --bs-btn-active-color: var(--accfg);
    --bs-btn-active-bg: var(--acc);
    --bs-btn-active-border-color: var(--acc);
    --bs-btn-disabled-color: var(--mute);
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: var(--line);
}

.btn-outline-primary { --bs-btn-border-color: var(--acc); --bs-btn-color: var(--acc); }

.btn-outline-danger, .btn-danger {
    --bs-btn-color: var(--red);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: var(--red);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #c0392b;
    --bs-btn-hover-border-color: #c0392b;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #c0392b;
    --bs-btn-active-border-color: #c0392b;
}

.btn.active, .btn-check:checked + .btn {
    background: var(--acc);
    color: var(--accfg);
    border-color: var(--acc);
    font-weight: 600;
}

.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus {
    outline: 2px solid var(--acc);
    outline-offset: 1px;
    box-shadow: none;
    border-color: var(--line);
}

/* Fields */
.form-control, .form-select, .input-group-text {
    color: var(--ink);
    background-color: var(--bg);
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: .95rem;
    min-height: 38px;
    padding: 6px;
}

.form-control:focus, .form-select:focus { background-color: var(--bg); color: var(--ink); }
.form-control::placeholder { color: var(--mute); opacity: .8; }
.form-control:disabled, .form-select:disabled { background-color: var(--band); opacity: .75; }
.form-select { padding-right: 28px; background-position: right 8px center; }
.form-control-sm, .form-select-sm { min-height: 34px; font-size: .9rem; padding: 4px 6px; }
.form-select-sm { padding-right: 26px; }
textarea.form-control { min-height: 80px; }
.form-label, label.form-label { font-size: .8rem; color: var(--mute); margin-bottom: 3px; }
.form-check-input { width: 20px; height: 20px; margin-top: .1em; background-color: var(--bg); border-color: var(--line); }
.form-check-input:checked { background-color: var(--acc); border-color: var(--acc); }
.form-check { padding-left: 1.9em; }
.form-check .form-check-input { margin-left: -1.9em; }
.input-group-text { background: var(--band); color: var(--mute); }

/* Cards (.hcard): surface, thin line, 10px corners, condensed heading */
.card {
    --bs-card-bg: var(--surface);
    --bs-card-border-color: var(--line);
    --bs-card-border-radius: 10px;
    --bs-card-inner-border-radius: 9px;
    --bs-card-cap-bg: var(--band);
    --bs-card-spacer-x: 14px;
    --bs-card-spacer-y: 12px;
    color: var(--ink);
}

.card-header, .card-footer { border-color: var(--line); }

/* Tables */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--ink);
    --bs-table-border-color: var(--line);
    --bs-table-hover-bg: var(--band);
    --bs-table-hover-color: var(--ink);
    --bs-table-striped-bg: var(--band);
    font-size: .92rem;
}

.table > thead > tr > th {
    background: var(--band);
    color: var(--ink);
    font-weight: 600;
    border-bottom: 0;
    white-space: nowrap;
}

.table > :not(caption) > * > * { padding: 7px 10px; }
.table-sm > :not(caption) > * > * { padding: 4px 6px; }
.table a { font-weight: 600; text-decoration: none; }

/* Tabs (.dtabs): underline in the accent */
.nav-tabs {
    --bs-nav-tabs-border-color: var(--line);
    --bs-nav-link-color: var(--mute);
    --bs-nav-link-hover-color: var(--ink);
    --bs-nav-tabs-link-active-color: var(--ink);
    --bs-nav-tabs-link-active-bg: transparent;
    gap: 4px;
}

.nav-tabs .nav-link {
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 8px 14px;
    background: none;
}

.nav-tabs .nav-link.active { border-bottom-color: var(--acc); font-weight: 700; }

/* Notes and warnings (.warn, .secw, .p6hold) */
.alert {
    --bs-alert-bg: var(--surface);
    --bs-alert-color: var(--ink);
    --bs-alert-border-color: transparent;
    --bs-alert-padding-x: 12px;
    --bs-alert-padding-y: 8px;
    --bs-alert-border-radius: 0;
    --bs-alert-link-color: var(--acc);
    border: 0;
    border-left: 4px solid var(--acc);
    font-size: .92rem;
}

.alert-warning { border-left-color: var(--amber); }
.alert-danger { border-left-color: #c0392b; }
.text-danger { color: var(--red) !important; }
.text-warning-emphasis { color: var(--amber) !important; }
[data-bs-theme=dark] .text-warning-emphasis { color: #e8a33d !important; }
.text-success { color: var(--acc) !important; }

/* Status pills (.cst) */
.badge {
    --bs-badge-border-radius: 10px;
    --bs-badge-font-size: .75rem;
    --bs-badge-font-weight: 700;
    --bs-badge-padding-x: 9px;
    --bs-badge-padding-y: 3px;
}

.badge.text-bg-secondary { background: #58666d !important; color: #fff !important; }
.badge.text-bg-danger { background: #c0392b !important; color: #fff !important; }
.badge.text-bg-warning { background: #d68910 !important; color: #fff !important; }
.badge.text-bg-success, .badge.text-bg-primary { background: #1e8449 !important; color: #fff !important; }
.badge.text-bg-info { background: #2471a3 !important; color: #fff !important; }

.ts-cst {
    display: inline-flex;
    justify-content: center;
    min-width: 84px;
    font-size: .75rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 2px 9px;
    white-space: nowrap;
    border: 1px solid var(--acc);
    color: var(--acc);
}

.ts-cst.st-Quote { border-color: var(--mute); color: var(--mute); }
.ts-cst.st-Contract { background: #d68910; border-color: #d68910; color: #fff; }
.ts-cst.st-Signed, .ts-cst.st-Production, .ts-cst.st-Delivered { background: #1e8449; border-color: #1e8449; color: #fff; }
.ts-cst.st-Processing { background: #2471a3; border-color: #2471a3; color: #fff; }
.ts-cst.st-Cancelled { border-color: var(--mute); color: var(--mute); text-decoration: line-through; }

details > summary { cursor: pointer; font-weight: 600; }
dl dt { font-weight: 400; color: var(--mute); }
hr { border-color: var(--line); opacity: 1; }
.list-group { --bs-list-group-bg: var(--bg); --bs-list-group-color: var(--ink); --bs-list-group-border-color: var(--line); }
.modal-content, .dropdown-menu { background: var(--surface); color: var(--ink); border-color: var(--line); }

/* Shell */
.ts-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top bar (#topbar): 56px, surface, logo, name and level, then the tabs */
.ts-top {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 0 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 40;
    flex-wrap: wrap;
}

.ts-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
}

/* The T badge (.tsb, V669: white box, dark edge, green ring) */
.ts-brand .tsb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 9px;
    width: 36px;
    height: 36px;
    box-shadow: inset 0 0 0 3px #111, inset 0 0 0 5px #0B8A55, 0 0 0 1px #3a4448;
    flex: 0 0 auto;
}

.ts-brand .tsb svg { width: 22px; height: 22px; }

.ts-brand .tsw {
    font: 300 22px/1 Barlow, "Segoe UI", Arial, sans-serif;
    letter-spacing: -.5px;
    white-space: nowrap;
}

.ts-brand .tsw b { font-weight: 800; }
.ts-brand .tsw i { font-style: normal; font-weight: 300; color: var(--acc); }

/* Name and level (#tbwho) */
.ts-who {
    display: flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
    font-size: .9rem;
    padding: 4px 10px;
    border: 1px solid transparent;
    border-left-color: var(--line);
    border-radius: 0 8px 8px 0;
    margin-left: 4px;
    color: var(--ink);
    text-decoration: none;
}

.ts-who:hover { border-color: var(--line); background: var(--band); border-radius: 8px; }
.ts-who b { font-weight: 600; }
.ts-who .car { font-size: .7rem; color: var(--mute); }
.ts-who .lv { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .72rem; font-weight: 700; color: #fff; background: #58666d; }
.ts-who .lv.Admin { background: #1d282e; border: 1px solid #3a4448; }
.ts-who .lv.HeadOffice, .ts-who .lv.Processing { background: #00644c; }
.ts-who .lv.Distributor { background: #b26b00; }

/* Tabs (#hotabs) */
.ts-tabs {
    display: flex;
    gap: 4px;
    align-items: center;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.ts-tabs::-webkit-scrollbar { display: none; }

.ts-tab {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid transparent;
    text-decoration: none;
    color: var(--ink);
    font-size: .88rem;
    white-space: nowrap;
}

.ts-tab:hover { border-color: var(--line); color: var(--ink); }

.ts-tab.active {
    background: var(--acc);
    color: var(--accfg);
    font-weight: 600;
}

.ts-me {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ts-me .btn { min-height: 34px; }

.ts-main {
    flex: 1;
    padding: 14px 14px 30px;
    min-width: 0;
}

.ts-foot {
    padding: 14px 16px 12px;
    text-align: center;
    font: 400 10px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
    color: #9aa0a6;
    opacity: .75;
    letter-spacing: .02em;
}

/* Home (V642–V647): search, one green button, Your day, the four counts, two columns of cards */
.ts-q {
    width: 100%;
    min-height: 40px;
    margin-bottom: 12px;
}

.nfact { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.nfact .btn { min-height: 40px; }
.nfact .btn-primary { padding: 6px 22px; min-height: 48px; font-size: 1.05rem; }

.hcard {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
}

.hcard h3 { font: 700 1.15rem/1.2 var(--ts-cond); margin: 0 0 8px; }
.hcard h3 .nt { font: 400 .78rem Barlow, system-ui, sans-serif; color: var(--mute); margin-left: 8px; }
.hcard .sph { font: 600 .8rem Barlow, system-ui, sans-serif; color: var(--mute); margin: 8px 0 2px; }
.hcard p { margin: 4px 0; }

.ydr {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-top: 6px;
    background: var(--bg);
}

.ydr .t { flex: 1; min-width: 0; }
.ydr .t b { font-weight: 600; }
.ydr .t span { display: block; font-size: .82rem; color: var(--mute); }
.ydr.red { border-color: #c0392b; }
.ydr.red .t b { color: var(--red); }

.hcts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.hct { background: var(--band); border-radius: 10px; padding: 10px 14px; text-decoration: none; color: var(--ink); }
.hct span { display: block; font-size: .8rem; color: var(--mute); }
.hct b { font-size: 1.3rem; font-weight: 600; }
.hct.red b { color: var(--red); }

.hgr { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.hgr > div { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hgl { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 6px; }
.hgl div { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.hgl span { display: block; font-size: .75rem; color: var(--mute); }
.hgl b { font-size: 1.15rem; font-weight: 600; }

@media (max-width: 1100px) {
    .hgr { grid-template-columns: minmax(0, 1fr); }
    .hcts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Job rows (#cbar .cdi): job number, a grey line of detail, when, then the status pill */
.clist { display: flex; flex-direction: column; gap: 4px; }

.cdi {
    display: flex;
    align-items: center;
    gap: 4px 10px;
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 5px 10px;
    min-height: 40px;
    text-decoration: none;
}

.cdi:hover { border-color: var(--acc); color: var(--ink); }
.cdi b { white-space: nowrap; font-weight: 700; }
.cdi > span:not(.ts-cst) { color: var(--mute); font-size: .85rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cdi em { font-style: normal; font-size: .75rem; color: var(--mute); white-space: nowrap; padding-right: 8px; }

.ts-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.ts-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 16px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 10px;
    text-decoration: none;
    color: var(--ink);
    min-height: 74px;
}

.ts-tile:hover { border-color: var(--acc); color: var(--ink); }
.ts-tile b { font-size: 1.05rem; font-weight: 600; }
.ts-tile span { font-size: .85rem; color: var(--mute); }

/* Page heading row: name on the left, the buttons on the right */
.ts-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ts-head h1 { margin: 0 auto 0 0; }
.ts-head .sub { flex-basis: 100%; color: var(--mute); font-size: .85rem; margin: -4px 0 0; }

/* Touch-friendly controls for iPad (B6). */
@media (pointer: coarse) {
    .btn, .form-control, .form-select {
        min-height: 44px;
    }
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Something went wrong on this part of the page.";
}


.ts-totals div {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.ts-parts select {
    min-width: 7rem;
}

.ts-plan svg {
    max-height: 340px;
}

/* Legacy drawing blocks (build 674 elevation html: h2 + svg + notes) */
.ts-plan h2 { font-size: 1rem; font-weight: 600; }
.ts-plan .nt, .ts-plan .ds { font-size: .8rem; color: var(--bs-secondary-color); }
.ts-plan svg { max-width: 100%; height: auto; }

/* Plan editing (build 674 drag.js / galaxy.js): the plan takes pointer gestures; the drag label follows the pointer */
.ts-plan-host { touch-action: none; user-select: none; }
.ts-plan-host svg { max-height: 460px; width: 100%; }
.ts-plan-ghost { position: fixed; z-index: 1090; pointer-events: none; padding: 4px 10px; border-radius: 14px; background: #0B8A55; color: #fff; font-size: .8rem; opacity: .9; }

/* Flashing library (build 674 V608 rows, V162 drawing pad) */
.ts-fl-grid { display: flex; flex-direction: column; gap: 8px; }
.ts-fl-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; gap: 12px; align-items: center; border: 1px solid var(--bs-border-color); border-radius: 10px; padding: 8px 10px; }
.ts-fl-name { display: flex; flex-direction: column; gap: 3px; }
.ts-fl-thumb { display: flex; align-items: center; justify-content: center; min-width: 90px; min-height: 60px; border: 1px solid var(--bs-border-color); border-radius: 10px; background: #fff; color: #111; padding: 4px 6px; }
.ts-fl-thumb.empty { background: var(--bs-tertiary-bg); border-style: dashed; }
.ts-flpad-host.ts-flpad-note svg, .ts-flpad-note .ts-flpad-svg { cursor: crosshair; }
.ts-flpad-folds td, .ts-flpad-folds th { white-space: nowrap; }
@media (max-width: 900px) { .ts-fl-row { grid-template-columns: 1fr; } }

/* To do's Go: the section it opened flashes (build 674 .lvflash) */
.ts-flash { outline: 3px solid #2a6fdb; outline-offset: 3px; border-radius: 6px; transition: outline-color .3s; }

[hidden] { display: none !important; }

/* Job screen (build 674 V32 to V35, V645, V648): job strip, stage bar, steps, form, drawings, price box */
.ts-main:has(> .ts-editor) { padding: 0; }
.ts-shell:has(.ts-editor) .ts-foot { display: none; }
.ts-editor { display: flex; flex-direction: column; }
.ts-editor .ts-stagebar { margin: 0; border-top: 0; }

.ts-jtabbar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    min-height: 40px;
    padding: 0 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.ts-jtabbar .sp { flex: 1; }
.ts-jtabbar .btn { align-self: center; min-height: 34px; margin: 3px 0; }
.ts-jtabbar .ts-save { flex-direction: column; gap: 0; line-height: 1.1; min-width: 110px; padding: 2px 16px; }
.ts-jtabbar .ts-save small { font-size: .68rem; font-weight: 400; opacity: .9; }

.jtab {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 320px;
    min-width: 120px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: var(--bg);
    color: var(--mute);
    font-size: .85rem;
    white-space: nowrap;
    overflow: hidden;
    text-decoration: none;
}

.jtab.on { background: var(--acc); color: var(--accfg); border-color: var(--acc); }
.jtab:hover { color: var(--accfg); }
.jtab .jtr { font-weight: 700; display: flex; align-items: center; gap: 5px; }
.jtab .jtn { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.jtab .jtd { width: 8px; height: 8px; border-radius: 4px; background: #E8A33D; display: inline-block; }

.ts-work { display: block; padding-bottom: 96px; }

.ts-rail {
    display: flex;
    flex-direction: row;
    gap: 2px;
    padding: 4px;
    background: #14211D;
    overflow-x: auto;
    scrollbar-width: none;
}

.ts-rail button {
    position: relative;
    flex: 0 0 auto;
    min-width: 62px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #C9D6D1;
    font-size: .72rem;
    line-height: 1.15;
    text-align: center;
}

.ts-rail button:hover { background: #22332D; }
.ts-rail button.on { background: var(--acc); color: var(--accfg); font-weight: 600; }
.ts-rail .rgdot { position: absolute; top: 7px; right: 14px; width: 8px; height: 8px; border-radius: 4px; background: #E8A33D; }

.ts-lpane { padding: 14px; min-width: 0; }
.ts-rpane { min-width: 0; display: flex; flex-direction: column; }

/* Form sections (build 674 fieldset / legend): green rule on top, condensed heading with an arrow */
.ts-fs {
    border-top: 3px solid var(--acc);
    background: var(--surface);
    margin: 0 0 8px;
    padding: 8px 10px;
}

.ts-fs > summary, .ts-fs-h {
    font: 700 1.05rem var(--ts-cond);
    list-style: none;
    cursor: pointer;
    user-select: none;
    padding: 0 0 2px;
}

.ts-fs > summary::-webkit-details-marker { display: none; }
.ts-fs > summary .lt::before { content: "\25B8  "; color: var(--acc); }
.ts-fs[open] > summary .lt::before, .ts-fs-h .lt::before { content: "\25BE  "; color: var(--acc); }
.ts-fs[open] > summary, .ts-fs-h { border-bottom: 1px solid var(--line); margin-bottom: 10px; padding-bottom: 6px; }
.ts-fs-h { cursor: default; }
.ts-fs .form-label { font-size: .8rem; }
.ts-lpane .card { border-radius: 0; border: 0; border-top: 3px solid var(--acc); }

/* Drawing tabs (#subtabs): pills */
.ts-subtabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 14px 6px; }

.ts-subtabs button {
    flex: 0 0 auto;
    min-height: 38px;
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 4px 14px;
    font-size: .85rem;
}

.ts-subtabs button.on { background: var(--band); border-color: var(--acc); font-weight: 600; }

/* The drawing side is always light (body.dk #dwrap): plans read as paper */
.ts-dwrap {
    --bg: #eef2f1;
    --surface: #ffffff;
    --ink: #1d282e;
    --mute: #58666d;
    --line: #c3cdd2;
    --band: #dbe3e7;
    --acc: #00664D;
    --acc-rgb: 0, 102, 77;
    --accfg: #ffffff;
    --red: #c0392b;
    --bs-body-bg: #fff;
    --bs-body-color: #1d282e;
    --bs-secondary-color: #58666d;
    --bs-border-color: #c3cdd2;
    --bs-secondary-bg: #dbe3e7;
    --bs-tertiary-bg: #dbe3e7;
    --bs-card-bg: #fff;
    --bs-link-color-rgb: 0, 102, 77;
    color-scheme: light;
    flex: 1;
    min-height: 0;
    background: #fff;
    color: #1d282e;
    padding: 10px 14px 12px;
    overflow: auto;
}

.ts-dwrap .card { --bs-card-bg: #fff; --bs-card-border-color: #c3cdd2; color: #1d282e; }
.ts-dwrap .text-warning-emphasis { color: #b26b00 !important; }

/* Symbols down the side of the plan (#palette .palit) and the Accessories list beside them (#acclist) */
.ts-palette { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }

.palit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 72px;
    padding: 6px 2px;
    border-radius: 8px;
    background: #fff;
    color: #1d282e;
    border: 1px solid #D5DDDA;
    font-size: .66rem;
    line-height: 1.1;
    text-align: center;
    user-select: none;
}

.palit:hover { border-color: var(--acc); }
.palit.armed { background: #00664D; color: #fff; border-color: #00664D; }
.palit.dis { opacity: .38; cursor: not-allowed; }
.palit.wait { border-color: #E8A33D; min-height: 34px; justify-content: center; }
#palbin { color: #A93226; border-color: #E6B0AA; }
#palbin.armed { background: #C0392B; color: #fff; border-color: #C0392B; }

.ts-palette .alg, .ts-acclist .alg {
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #58666d;
    padding: 5px 6px 1px;
}

.ts-acclist { background: #F7F9F8; border: 1px solid #D5DDDA; padding: 4px 0 8px; margin-bottom: 8px; font-size: .7rem; line-height: 1.2; color: #1d282e; }
.ts-acclist .alh { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 2px 6px; }
.ts-acclist .alh b { font-size: .78rem; }
.ts-acclist .altodo { font-size: .7rem; font-weight: 700; color: #fff; background: #C0392B; border-radius: 9px; padding: 1px 7px; }
.ts-acclist .alr { display: flex; flex-direction: column; padding: 2px 6px; border-left: 3px solid transparent; cursor: pointer; user-select: none; }
.ts-acclist .alr:hover { background: #E3F1EC; border-left-color: #00664D; }
.ts-acclist .aln { font-weight: 600; }
.ts-acclist .alw { font-size: .62rem; color: #58666d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-acclist .alr.todo, .ts-acclist .alr.need { background: #FDECEA; border-left-color: #C0392B; }
.ts-acclist .alr.todo .alw, .ts-acclist .alr.need .alw { color: #A93226; }
.ts-acclist .alempty { padding: 2px 6px; color: #58666d; margin: 0; }

/* Price box, bottom left (#pbox) */
.ts-pbox {
    display: flex;
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 75;
    align-items: stretch;
    background: #26323a;
    color: #fff;
    border-radius: 0 12px 0 0;
    box-shadow: 0 -2px 14px rgba(0, 0, 0, .25);
    overflow: hidden;
}

.ts-pbox.noprice { background: #c0392b; }
.ts-pbox button { border: 0; border-radius: 0; background: transparent; color: #fff; }
.ts-pbox button:hover { background: rgba(0, 0, 0, .12); }
.ts-pbox .pbwarn { display: flex; align-items: center; gap: 4px; padding: 0 14px; font-weight: 700; }
.ts-pbox .pbwarn.bad { background: #c0392b; }
.ts-pbox .pbwarn.orng { background: #d9822b; }
.ts-pbox .pbprice { display: flex; flex-direction: column; align-items: flex-start; padding: 8px 18px 8px 22px; min-width: 220px; line-height: 1.1; }
.ts-pbox .pbl { font-size: .75rem; opacity: .9; }
.ts-pbox .pbv { font-size: 1.9rem; font-weight: 800; }
.ts-pbox .pbs { font-size: .72rem; opacity: .9; }

@media (min-width: 1000px) {
    .ts-editor { height: calc(100vh - 57px); }
    .ts-work { flex: 1; min-height: 0; display: grid; grid-template-columns: 88px 400px minmax(0, 1fr); padding: 0; }
    .ts-rail { flex-direction: column; gap: 4px; padding: 10px 6px 96px; overflow-y: auto; }
    .ts-rail button { min-width: 0; padding: 10px 2px; }
    .ts-lpane { overflow: auto; padding: 14px 14px 110px; border-right: 10px solid var(--line); }
    .ts-rpane { overflow: hidden; }

    .ts-plan-editor { display: grid; grid-template-columns: auto auto minmax(0, 1fr); column-gap: 10px; align-items: start; }
    .ts-plan-editor > * { grid-column: 3; }
    .ts-plan-editor > .ts-palette { grid-column: 1; grid-row: 1 / span 12; flex-direction: column; flex-wrap: nowrap; width: 84px; margin: -10px 0 -12px -14px; padding: 10px 6px; background: #F1F4F3; border-right: 1px solid #D5DDDA; align-self: stretch; }
    .ts-plan-editor > .ts-acclist { grid-column: 2; grid-row: 1 / span 12; width: 138px; margin: -10px 0 -12px -10px; border: 0; border-right: 1px solid #D5DDDA; align-self: stretch; }
    .ts-plan-host svg { max-height: calc(100vh - 250px); }
    .ts-dwrap > svg, .ts-dwrap .ts-plan-host svg { display: block; margin: 0 auto; }
}

@media print {
    .ts-top, .ts-rail, .ts-jtabbar, .ts-stagebar, .ts-pbox, .ts-foot { display: none !important; }
}

/* Customer file (build 674 V69 / V74 / V644): tiles, activity, the Buildings card beside the overview */
.dovg { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.ts-dtiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; }
.ts-dtiles div { background: var(--surface); border-radius: 10px; padding: 12px 14px; min-height: 96px; }
.ts-dtiles span { font-size: .85rem; }
.ts-dtiles b { display: block; font-size: 1.15rem; font-weight: 700; }
.ts-dtiles i { display: block; font-style: normal; color: var(--acc); margin-top: 4px; }
.ts-act { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.ts-act:last-child { border-bottom: 0; }
.ts-act em { font-style: normal; font-size: .82rem; color: var(--mute); }
.ts-bld { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-top: 8px; background: var(--surface); }
.ts-bld .r { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ts-bld .r span { color: var(--mute); }
.ts-bld .r em { font-style: normal; font-size: .82rem; color: var(--mute); }
.ts-bld .amt { color: var(--acc); font-weight: 600; }
.ts-bld .b { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ts-count { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 9px; background: var(--band); color: var(--mute); font-size: .72rem; font-weight: 600; text-align: center; }
.ts-form { max-width: 720px; }

@media (max-width: 1100px) {
    .dovg { grid-template-columns: minmax(0, 1fr); }
    .ts-dtiles { grid-template-columns: minmax(0, 1fr); }
}
.cdi > .ts-cst { flex: 0 0 104px; }
.btn-link { white-space: normal; min-height: 0; color: var(--acc); }

/* James's own screens (still used by reps and distributors until the Studio page opens to them) */
/* Stage bar (STG-01/02) */
.ts-stagebar {
    display: flex;
    gap: 2px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.ts-stage {
    flex: 1;
    min-width: 90px;
    text-align: center;
    padding: 6px 4px;
    background: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
    font-size: .85rem;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
}

.ts-stage.done {
    background: #cfe9dc;
    color: #0B8A55;
}

.ts-stage.now {
    background: var(--ts-logo);
    color: #fff;
    font-weight: 600;
}

