.pwa-install-button{border:1px solid #2d5356;border-radius:8px;background:#123335;color:#78d9cd;padding:8px 11px;min-height:36px;font-size:11px;line-height:1.4;font-weight:600}
.pwa-install-button:hover{border-color:#3c857f;background:#17423f;color:#b9fff1}
.pwa-install-button[hidden],#pwa-native-install[hidden],.pwa-install-status[hidden]{display:none}
.pwa-install-dialog:not([open]){display:none}
.pwa-install-dialog .dialog-header{position:sticky;top:0;background:#10262c;z-index:1;border-bottom:1px solid #25424a;margin-bottom:20px}
.pwa-install-copy{font-size:13px;line-height:1.7;color:#a0bcc4}
.pwa-install-copy>p{margin:0 0 17px}
.pwa-device-hint{color:#d3eae5}
.pwa-install-copy .primary-button{margin:0 0 17px;min-height:44px}
.pwa-browser-link{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:10px 16px;border:1px solid #20c4b3;border-radius:8px;background:#00b4a4;color:#06272b;font-weight:600;text-decoration:none;box-sizing:border-box}
.pwa-browser-link:hover{background:#20c4b3}
.pwa-browser-link:focus-visible{outline:2px solid #f6c845;outline-offset:3px}
.pwa-install-copy .pwa-install-status{border-left:3px solid #48b3a3;padding:9px 12px;background:#163b39;color:#c5e8df;border-radius:0 6px 6px 0}
.pwa-install-steps{padding:16px 18px;border:1px solid #2b4850;border-radius:10px;margin:0 0 13px;background:#142c32}
.pwa-install-steps h3{font-size:14px;color:#e1f0ef;font-weight:600;margin:0 0 9px}
.pwa-install-steps ol{margin:0;padding-left:19px}
.pwa-install-steps li+li{margin-top:8px}
.pwa-install-fallback{font-size:12px}
.pwa-app-address{padding:13px 0 16px;border-bottom:1px solid #25424a;margin-bottom:15px}
.pwa-app-address span{display:block;color:#89aab1;font-size:11px;margin-bottom:5px}
.pwa-app-address a{color:#50d8c2;text-underline-offset:3px;overflow-wrap:anywhere}
.pwa-install-copy .pwa-install-note{font-size:11px;color:#8caab2;margin:0}
@media (max-width: 700px), (orientation: landscape) and (pointer: coarse) and (max-height: 500px) and (max-width: 960px) {.pwa-install-button{max-width:112px;padding:7px 9px;min-height:40px;font-size:10px}.pwa-install-dialog .dialog-header{padding:18px 20px 14px}.pwa-install-steps{padding:14px}.pwa-install-copy{font-size:12px}}
@media(max-width:360px){.topbar-actions:has(.pwa-install-button:not([hidden])){gap:5px}.pwa-install-button{max-width:93px;padding:6px;font-size:10px}}

/* Mobile chrome, shared with each role-specific view. */
@media (max-width: 700px), (orientation: landscape) and (pointer: coarse) and (max-height: 500px) and (max-width: 960px) {
  :root {
    --gta-ink: #220b25;
    --gta-panel: #32112f;
    --gta-cream: #fff2da;
    --gta-muted: #d6b9cb;
    --gta-pink: #ff4195;
    --gta-coral: #ff806c;
    --gta-cyan: #37f3e6;
    --gta-stroke: #834569;
    --gta-display: "Garage Display", Impact, "Arial Black", system-ui, sans-serif;
    --gta-gutter: clamp(12px, 3.8vw, 24px);
    background: #19091d;
    color: var(--gta-cream);
    color-scheme: dark;
  }

  .workspace {
    background: linear-gradient(164deg, #350d35, #230d26 315px, #19091d 650px);
  }
  .topbar, #main {
    width: 100%;
    max-width: 610px;
    margin-inline: auto;
    padding-inline: max(var(--gta-gutter), env(safe-area-inset-left)) max(var(--gta-gutter), env(safe-area-inset-right));
  }
  .topbar {
    height: auto;
    min-height: 55px;
    gap: 8px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: 7px;
  }
  #main { padding-top: 2px; padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .mobile-brand { flex: 1 1 auto; min-width: 0; gap: 5px; }
  .mobile-brand .brand-mark { width: 13px; }
  .mobile-brand strong { color: var(--gta-cream); font-size: 12px; letter-spacing: .035em; }
  .mobile-brand small { font-size: 9px; color: var(--gta-muted); }
  .gta-wordmark {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    order: -1;
    flex-direction: column;
    align-items: flex-start;
    width: max-content;
    margin: 0 auto 1px 1px;
    color: #fff8e9;
    font: 900 22px/.75 var(--gta-display);
    letter-spacing: -.052em;
    text-transform: uppercase;
    transform: skewX(-9deg);
    text-shadow: 1px 2px #0e0610, 2px 3px #0e0610;
  }
  .gta-wordmark > b { position: relative; font-weight: 900; }
  .gta-wordmark::after {
    content: "";
    align-self: stretch;
    height: 3px;
    margin-top: 4px;
    background: var(--gta-pink);
    transform: rotate(-2deg);
    clip-path: polygon(0 22%, 99% 0, 91% 62%, 100% 74%, 2% 100%);
  }
  .topbar-actions { gap: 5px; }
  .topbar .help-button, .topbar .report-warning-button {
    width: 34px; height: 34px;
    color: var(--gta-cream);
    background: #361635;
    border: 1px solid var(--gta-stroke);
  }
  .topbar .report-warning-button { color: #ffbe87; border-color: #be6d58; }
  .topbar .pwa-install-button {
    padding: 5px 8px;
    min-height: 34px;
    border: 1px solid var(--gta-stroke);
    background: #351334;
    color: var(--gta-cyan);
  }

  #main .page-heading {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
    margin-bottom: 14px;
  }
  .page-heading > div:first-child {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    min-height: clamp(134px, 36vw, 196px);
    padding: 17px 15px 15px;
    color: var(--gta-cream);
    border: 1px solid #a14f7c;
    border-radius: 9px;
    background-color: #491b40;
    background-image: linear-gradient(90deg, #1f0929e8, #230b2b76 57%, #2a0e3524),
                      linear-gradient(0deg, #210b27c7, transparent 73%),
                      url("/gta-garage-mobile.webp");
    background-position: center, center, center 60%;
    background-size: cover;
  }
  #page-eyebrow {
    color: #ffd1d6;
    font-size: 9px;
    letter-spacing: .14em;
    font-weight: 700;
    margin: 0 0 6px;
  }
  #page-title {
    max-width: 100%;
    margin: 0;
    font: 900 clamp(29px, 8vw, 44px)/1 var(--gta-display);
    letter-spacing: -.025em;
    text-wrap: balance;
    text-shadow: 1px 2px #210a24;
  }
  #page-description {
    max-width: 42ch;
    color: #ffe2e5;
    font-size: 12px;
    line-height: 1.4;
    margin: 7px 0 0;
  }
  /* The earnings card already illustrates these reports. Keep the selected
     period and employee in sight above its live amount. */
  #main:has(.earnings-card, .team-overview) .page-heading > div:first-child {
    min-height: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
  }
  #main:has(.earnings-card, .team-overview) .page-heading #page-eyebrow { display: none; }
  #main:has(.earnings-card, .team-overview) #page-title { font-size: 22px; }
  #main:has(.earnings-card, .team-overview) #page-description { margin-top: 3px; font-size: 11px; color: var(--gta-muted); }
  /* The brand above already identifies the ordinary earnings dashboard.
     Keep its heading in the accessibility tree and the month in normal flow. */
  #main:not(.manager-payroll-view):has(#view-content > .overview-grid, #view-content > .team-overview) .page-heading {
    gap: 0;
    margin-bottom: 0;
  }
  #main:not(.manager-payroll-view):has(#view-content > .overview-grid, #view-content > .team-overview) .page-heading > div:first-child {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .earnings-report-controls .month-switcher {
    width: auto;
    margin: 0;
    padding: 0 3px;
    border-radius: 8px;
    border: 1px solid #b34b82;
    background: linear-gradient(125deg, #34112f, #240c25);
    box-shadow: inset 0 1px #ff7eac19;
  }
  .month-switcher .icon-button { color: var(--gta-cyan); min-height: 40px; width: 42px; }
  .month-switcher select {
    max-width: none;
    min-width: 0;
    min-height: 40px;
    flex: 1;
    color: var(--gta-cream);
    background: transparent;
    font-size: 14px;
  }
  .month-switcher select option { background: var(--gta-panel); color: var(--gta-cream); }

  .period-panel {
    margin: 0 0 13px;
    padding: 12px;
    background: linear-gradient(125deg, #361432, #29112c);
    border: 1px solid var(--gta-stroke);
    border-radius: 9px;
  }
  .period-panel-heading h2 { font: 800 18px/1.1 var(--gta-display); color: var(--gta-cream); }
  .period-panel-heading p, .period-controls label { color: var(--gta-muted); }
  .period-controls input {
    min-width: 0;
    min-height: 40px;
    border: 1px solid var(--gta-stroke);
    border-radius: 6px;
    color: var(--gta-cream);
    background: #220e27;
  }
  .period-controls .primary-button {
    border: 1px solid #60fff0;
    border-radius: 6px;
    background: var(--gta-cyan);
    color: #12232a;
    font-weight: 750;
  }
  .period-presets { gap: 6px; margin-top: 10px; }
  .period-presets .filter-button {
    min-width: 0;
    min-height: 38px;
    padding: 5px;
    font-size: 11px;
    border: 1px solid var(--gta-stroke);
    border-radius: 6px;
    background: #270f2b;
    color: var(--gta-cream);
  }
  .period-presets .filter-button:is(.active, [aria-pressed="true"]) {
    border-color: var(--gta-cyan);
    background: #12373b;
    color: #83fff5;
  }
  .period-error { color: #ffae9d; }
  #period-form:has(#mobile-period-toggle) { padding-block: 0; }
  #period-form:has(#mobile-period-toggle) .period-panel-heading {
    position: relative;
    display: flex;
    align-items: center;
    column-gap: 10px;
    margin: 0;
    min-height: 45px;
  }
  #period-form:has(#mobile-period-toggle) .period-panel-heading h2 { display: none; }
  #mobile-period-toggle {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-start;
    min-height: 44px;
    border: 0;
    padding: 0;
    color: var(--gta-cream);
    background: none;
    font-size: 12px;
    font-weight: 700;
    text-align: start;
    touch-action: manipulation;
  }
  /* Let the date portion open the same control. Its text stays selectable
     to assistive technology, and the button retains its accessible name. */
  #mobile-period-toggle::before { content: ""; position: absolute; inset: 0; }
  #mobile-period-toggle::after {
    content: "";
    position: absolute;
    right: 1px;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--gta-cyan);
    border-bottom: 2px solid var(--gta-cyan);
    transform: translateY(-2px) rotate(45deg);
  }
  #mobile-period-toggle[aria-expanded="true"]::after { transform: translateY(2px) rotate(225deg); }
  #period-form:has(#mobile-period-toggle) #period-active {
    flex: 1;
    margin: 0 19px 0 auto;
    color: var(--gta-muted);
    font-size: 11px;
    line-height: 1.3;
    text-align: right;
  }
  #period-form:has(#mobile-period-toggle[aria-expanded="false"]) #period-fields { display: none; }
  #period-form:has(#mobile-period-toggle[aria-expanded="true"]) #period-fields { display: block; padding: 2px 0 12px; }

  .person-context { gap: 8px; margin: 10px 0 14px; }
  .person-label { gap: 9px; }
  .person-label .avatar {
    width: 34px; height: 34px;
    font: 800 15px/1 var(--gta-display);
    background: linear-gradient(145deg, #804161, #371632 72%);
    color: var(--gta-cream); border-color: #98547c;
  }
  .person-label strong { color: var(--gta-cream); }
  .person-label small, .person-select-wrap label { color: var(--gta-muted); }
  .person-select-wrap { margin-top: 1px; }
  .person-select {
    min-width: 0; min-height: 39px;
    color: var(--gta-cream);
    background-color: #2f1230;
    border: 1px solid var(--gta-stroke);
  }
  .role-chip { padding: 5px 7px; border-color: #755369; color: #ffbfd5; background: #32142f; font-size: 9px; }
  .page-footer { color: var(--gta-muted); border-color: #603755; }
  .demo-banner { margin-bottom: 10px; }

  .mobile-nav {
    min-height: 58px;
    gap: 3px;
    padding: 3px max(6px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    background: #220d25fa;
    border-top: 1px solid #91476f;
    box-shadow: 0 -6px 22px #13081766;
  }
  .mobile-nav .nav-item {
    max-width: 150px;
    gap: 4px;
    min-height: 48px;
    padding: 5px 2px 7px;
    color: #e4d0de;
    font-size: 11px;
    line-height: 1.15;
    text-align: center;
  }
  .mobile-nav .nav-item .icon { width: 21px; height: 21px; }
  .mobile-nav .nav-item.active, .mobile-nav .nav-item.active .icon { color: var(--gta-cyan); }
  .mobile-nav .nav-item.active::before { height: 3px; width: 28px; left: calc(50% - 14px); background: var(--gta-cyan); }
  :where(button, input, a, select, summary):focus-visible { outline-color: var(--gta-cyan); }
}

@media (max-width: 390px) {
  .topbar:has(.pwa-install-button:not([hidden])) .mobile-brand .brand-mark,
  .topbar:has(.pwa-install-button:not([hidden])) .mobile-brand > span:not(.gta-wordmark) { display: none; }
}

@media (max-width: 700px), (orientation: landscape) and (pointer: coarse) and (max-height: 500px) and (max-width: 960px) {
  :root {
    --gta-card: linear-gradient(120deg, #351234, #260c28 77%);
    --gta-deep: #200b24;
    --gta-line: #744163;
    --gta-divider: #5f3355;
    --gta-warn: #ffd58e;
    --gta-error: #ffb3a9;
  }

  /* Use the real payroll total as the hero, followed by the original detail metrics. */
  .earnings-card, .team-stat:first-child {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    position: relative;
    overflow: hidden;
    padding: 18px 16px 0;
    color: var(--gta-cream);
    border: 1px solid #a04578;
    border-radius: 16px;
    background: #2a0b2e;
    box-shadow: 0 7px 20px #1004165c;
  }
  .earnings-card .card-chevron { display: none; }
  .earnings-label, .team-stat:first-child .stat-label {
    margin: 0 0 4px;
    color: var(--gta-cream);
    font-weight: 800;
    font-size: clamp(16px, 4.6vw, 23px);
    line-height: 1.24;
    letter-spacing: -.025em;
  }
  .earnings-card .earnings-value, .team-stat:first-child strong {
    width: fit-content;
    max-width: 100%;
    min-height: 0;
    position: relative;
    margin: 2px 0 10px;
    padding-bottom: .16em;
    font-family: var(--gta-display, Impact, "Arial Black", sans-serif);
    font-size: clamp(46px, 16.5vw, 85px);
    font-weight: 1000;
    line-height: 1.08;
    letter-spacing: -.025em;
    overflow-wrap: anywhere;
    color: #fff2d7;
    -webkit-text-stroke: 2.8px #160819;
    paint-order: stroke fill;
    text-shadow: 0 3px 0 #100412, 1px 4px 0 #100412;
  }
  .earnings-card[data-gta-long] .earnings-value,
  .earnings-card .earnings-value[data-gta-long],
  .team-stat:first-child[data-gta-long] strong,
  .team-stat:first-child strong[data-gta-long] {
    font-size: clamp(30px, 10.5vw, 60px);
  }
  .earnings-card .earnings-value.missing { font-size: clamp(32px, 8vw, 50px); }
  .earnings-card .earnings-value .currency { font-size: .76em; font-weight: inherit; }
  .earnings-card .earnings-value::after, .team-stat:first-child strong::after {
    content: "";
    position: absolute;
    left: 1%;
    right: 4%;
    bottom: 1px;
    height: clamp(4px, 1.35vw, 7px);
    background: var(--gta-pink);
    clip-path: polygon(2% 58%, 49% 4%, 100% 18%, 93% 64%, 35% 87%, 0 100%);
    transform: rotate(-1deg);
    pointer-events: none;
  }
  .earnings-card .earnings-caption {
    max-width: 100%;
    margin: 0;
    font-size: 12px;
    line-height: 1.48;
    color: #edd5e4;
  }
  .earnings-card::after, .team-stat:first-child::after {
    content: "";
    display: block;
    order: 1;
    height: clamp(144px, 43vw, 244px);
    margin: 2px -16px 0;
    background: linear-gradient(180deg, #2a0b2e, transparent 19%, transparent 91%, #290d2b91),
                url("/gta-garage-mobile.webp") center 66% / cover no-repeat;
    pointer-events: none;
  }
  .earnings-card .earnings-card-rule {
    order: 2;
    margin: 0 -16px;
    background: var(--gta-line);
  }
  .earnings-card .earnings-bottom {
    order: 3;
    margin: 0 -16px;
    padding: 12px 16px 15px;
    background: var(--gta-card);
  }
  .earnings-bottom > div + div { border-left-color: var(--gta-line); padding-left: 14px; }
  .metric-label, .support-card-header, .quantity-row, .stat-label { color: var(--gta-muted); }
  .metric-value, .quantity-row strong, .hours-value, .team-stat strong, .payroll-component-amount {
    font-weight: 800;
    color: var(--gta-cream);
    letter-spacing: -.035em;
  }
  .metric-value, .hours-value, .team-stat strong, .quantity-row strong { overflow-wrap: anywhere; }
  .overview-grid { gap: 10px; }
  .support-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding: 0;
    gap: 0 10px;
    background: transparent;
    border: 0;
  }
  .support-card-header, .hours-value, .quantity-row {
    padding-inline: 11px;
    background: var(--gta-card);
    border: 1px solid var(--gta-line);
    border-left: 4px solid var(--gta-cyan);
  }
  .support-card-header {
    grid-column: 1; grid-row: 1;
    padding-top: 10px; padding-bottom: 1px;
    border-radius: 11px 11px 0 0; border-bottom: 0;
    font-size: 12px; line-height: 1.25;
  }
  .hours-value {
    grid-column: 1; grid-row: 2; margin: 0;
    padding-top: 2px; padding-bottom: 10px;
    border-radius: 0 0 11px 11px; border-top: 0;
    font-size: clamp(23px, 6vw, 36px);
  }
  .hours-value span { color: var(--gta-muted); }
  .quantity-row {
    grid-column: 2; grid-row: 1 / 3;
    justify-content: flex-start;
    gap: 3px; padding-block: 10px;
    border-left-color: var(--gta-coral); border-radius: 11px;
    font-size: 12px; line-height: 1.25;
  }
  .quantity-row strong { font-size: clamp(23px, 6vw, 36px); }

  .earnings-trend {
    --plot-height: clamp(114px, 32vw, 174px);
    padding: 14px 12px 8px;
    border-color: #a15290;
    background: linear-gradient(115deg, #361232, #250a28);
    color: var(--gta-cream);
  }
  .section-title-row h2, .earnings-trend h2, .dialog-header h2, .booking-day-heading h2 {
    color: var(--gta-cream);
    font-size: clamp(19px, 5.15vw, 27px);
    font-weight: 850;
    letter-spacing: -.035em;
  }
  .earnings-trend p { color: var(--gta-muted); }
  .trend-axis, .trend-column span { color: #f0dbe9; }
  .trend-grid i, .trend-details th, .trend-details td { border-color: var(--gta-line); }
  .trend-grid .trend-zero { border-color: #d8b9d0; }
  .trend-column svg { fill: var(--gta-pink); }
  .trend-column:nth-child(odd) svg { fill: var(--gta-coral); }
  .trend-details summary, .text-button, .refresh-button { color: var(--gta-cyan); }
  .trend-details summary { padding-block: 10px; }
  .primary-button {
    border-color: var(--gta-cyan); background: var(--gta-cyan); color: #141322;
    font-weight: 750;
  }
  .secondary-button, .filter-button {
    border-color: var(--gta-line); background: var(--gta-deep); color: var(--gta-cream);
  }
  .filter-button.active, .activity-controls .filter-button.active {
    border-color: var(--gta-cyan); background: #124347; color: #bafff5;
  }
  .sync-status, .works-count, .period-label, .group-date, .works-filter-note { color: var(--gta-muted); }
  .sync-status .icon { color: var(--gta-cyan); }
  .sync-status.stale, .sync-status.stale .icon { color: var(--gta-warn); }
  .search-field, .pagination .icon-button {
    color: var(--gta-cream); border-color: var(--gta-line); background: var(--gta-deep);
  }
  .search-field input { color: var(--gta-cream); }
  .search-field input::placeholder { color: var(--gta-muted); }
  .search-field .icon { color: var(--gta-muted); }
  .search-field:focus-within { border-color: var(--gta-cyan); }
  .pagination { color: var(--gta-muted); }

  /* The complete order summary stays one native disclosure, including both totals. */
  .order-card, .booking-card, .team-table tr, .payroll-component {
    color: var(--gta-cream);
    border: 1px solid var(--gta-line);
    border-radius: 13px;
    background: var(--gta-card);
  }
  .order-card, .payroll-component { border-left: 4px solid var(--gta-cyan); }
  .order-card:nth-child(even), .payroll-component:nth-child(even) { border-left-color: var(--gta-coral); }
  .order-card[open], .booking-card[open] { border-top-color: var(--gta-pink); border-right-color: var(--gta-pink); }
  .order-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 13px 14px 9px;
    gap: 10px 0;
  }
  .order-description { grid-column: 1 / -1; grid-row: 1; }
  .order-number { color: var(--gta-cream); font-size: clamp(15px, 4.4vw, 21px); font-weight: 850; }
  .order-date { font-size: 11px; color: var(--gta-muted); }
  .order-vehicle { font-size: 13px; color: #f0dce8; }
  .order-stats { display: contents; }
  .order-earnings, .order-stats > span:first-child {
    align-self: stretch; min-width: 0; max-width: none; text-align: left;
  }
  .order-earnings { grid-column: 1; grid-row: 2; padding-right: 8px; }
  .order-stats > span:first-child {
    grid-column: 2; grid-row: 2; border-left: 1px solid var(--gta-line); padding-left: 12px;
  }
  .order-stat-label, .order-amount-label { margin: 0; color: var(--gta-muted); font-size: 11px; }
  .order-earnings strong, .order-stats strong {
    margin: 4px 0 0; font-size: clamp(18px, 5.1vw, 28px); line-height: 1.14;
    font-weight: 850; letter-spacing: -.025em; color: var(--gta-cream);
  }
  .order-earnings.missing strong { font-size: 15px; color: var(--gta-warn); }
  .order-count, .order-toggle {
    grid-row: 3; align-self: stretch; align-content: center;
    padding: 8px 0 0; min-height: 29px; border: 0; border-top: 1px solid var(--gta-line);
    border-radius: 0; background: transparent; line-height: 1.3; font-size: 11px;
  }
  .order-count { grid-column: 1; color: var(--gta-muted); white-space: normal; }
  .order-toggle { grid-column: 2; color: var(--gta-cyan); }
  .order-works, .booking-details { background: var(--gta-deep); border-top-color: var(--gta-line); }
  .work-item { background: var(--gta-card); border-color: var(--gta-line); }
  .order-works .work-item { background: transparent; }
  .order-works .work-item + .work-item, .booking-card-foot, .booking-works li { border-color: var(--gta-divider); }
  .work-name, .work-amount, .order-works .work-name, .order-works .work-amount { color: var(--gta-cream); }
  .work-icon, .order-works .work-icon, .booking-car-icon {
    color: var(--gta-cyan); background: #0d4146;
  }
  .work-meta, .work-subamount, .order-works-caption, .work-item > .icon { color: var(--gta-muted); }
  .work-amount.missing, .order-works .work-amount.missing, .order-rate-warning, .rate-missing { color: var(--gta-warn); }

  /* Team overview, manager payroll and owner activity. */
  .team-stat, .activity-summary section {
    min-width: 0; border-color: var(--gta-line); border-left: 4px solid var(--gta-cyan);
    background: var(--gta-card); color: var(--gta-cream);
  }
  .team-stat:last-child, .activity-summary section:nth-child(2) { border-left-color: var(--gta-coral); }
  .team-stat:first-child { border: 1px solid #a04578; background: #2a0b2e; }
  .team-table tr { border-left: 4px solid var(--gta-cyan); }
  .team-table tbody tr:nth-child(even) { border-left-color: var(--gta-coral); }
  .team-table tfoot tr { border-color: var(--gta-line); background: #381839; }
  .team-table tfoot td { background: transparent; color: var(--gta-cream); }
  .employee-name, .activity-person strong, .payroll-component h3 { color: var(--gta-cream); }
  .employee-button .avatar, .activity-person .avatar { background: #482042; color: var(--gta-cream); }
  .employee-note, .team-mobile-label, .payroll-component p { color: var(--gta-muted); }
  .team-table td:last-child, .team-table tfoot td:last-child, .activity-count { color: var(--gta-cyan); }
  .payroll-rate { background: #15373d; border-color: #317572; color: var(--gta-cyan); }
  .activity-summary { gap: 6px; }
  .activity-summary section { padding-inline: 8px; }
  .activity-summary section:first-child { background: #40203f; border-color: var(--gta-line); border-left-color: var(--gta-pink); }
  .activity-summary span, .activity-access, .activity-muted, .activity-table td::before,
  .activity-collection, .activity-sections span { color: var(--gta-muted); }
  .activity-summary strong, .activity-sections strong { color: var(--gta-cream); }
  .activity-table tr { background: var(--gta-card); border-color: var(--gta-line); }
  .activity-table tbody th { border-color: var(--gta-divider); }
  .activity-table tbody, .activity-table { background: transparent; }

  /* Booking statuses and controls. */
  .booking-controls, .work-calendar-panel {
    background: var(--gta-card); border-color: var(--gta-line);
  }
  .booking-datebox, .booking-arrow, .booking-today, .booking-owner-filter select,
  .timesheet-month, .timesheet-month select {
    border-color: var(--gta-line); background-color: var(--gta-deep); color: var(--gta-cream);
  }
  .booking-datebox input, .booking-car-name, .booking-time, .booking-meta dd, .booking-plate { color: var(--gta-cream); }
  .booking-arrow, .booking-datebox > .icon, .booking-today, .booking-expand, .booking-source .icon { color: var(--gta-cyan); }
  .booking-week { background: #240d28; border-color: var(--gta-divider); }
  .booking-day { color: var(--gta-muted); }
  .booking-day strong { color: var(--gta-cream); }
  .booking-day[aria-pressed=true] {
    background: #5a2049; border-color: var(--gta-pink); color: var(--gta-cream);
  }
  .booking-day[aria-pressed=true] strong { color: var(--gta-cream); }
  .booking-day-dot.has-bookings { background: var(--gta-cyan); }
  .booking-summary { border-left-color: var(--gta-cyan); }
  .booking-unassigned > .booking-summary { border-left-color: var(--gta-warn); }
  .booking-duration, .booking-field-label, .booking-day-heading > span, .booking-owner-filter,
  .booking-timezone, .booking-muted, .booking-request, .booking-source, .booking-details h3,
  .booking-works small, .booking-meta { color: var(--gta-muted); }
  .booking-concern-text, .booking-comment { color: #f3e0ed; }
  .booking-comment { border-left-color: var(--gta-pink); }
  .booking-assignee { color: var(--gta-warn); }

  /* Keep hours, leave, sick days, unassigned and late marks semantically distinct. */
  .timesheet-scroll, .timesheet-directory-list, .timesheet-bulk-preview {
    background: var(--gta-deep); border-color: var(--gta-line);
    scrollbar-color: #99597f var(--gta-deep);
  }
  .timesheet-table th, .timesheet-table td, .timesheet-bulk-preview th, .timesheet-bulk-preview td {
    border-color: var(--gta-divider);
  }
  .timesheet-table thead th, .timesheet-bulk-preview thead th {
    background: #44213e; color: var(--gta-cream);
  }
  .timesheet-table .timesheet-person { background: #351633; box-shadow: 2px 0 0 var(--gta-line); }
  .timesheet-table thead .timesheet-weekend { background: #513040; color: var(--gta-warn); }
  .timesheet-day.timesheet-weekend { background: #382034; }
  .timesheet-table .timesheet-group th, .timesheet-table .timesheet-summary th,
  .timesheet-table .timesheet-summary td, .timesheet-table .timesheet-total {
    background: #40213f; color: var(--gta-cream);
  }
  .timesheet-person button, .timesheet-person button:hover { color: var(--gta-cream); }
  .timesheet-day-heading small, .timesheet-table .timesheet-summary-note, .timesheet-hint,
  .timesheet-source, .timesheet-field, .timesheet-preserved-marks, .timesheet-selection-weekday,
  .work-calendar-note, .work-calendar-person span, .work-calendar-grid th,
  .work-calendar-totals dt { color: var(--gta-muted); }
  .work-calendar-person strong, .work-calendar-totals dd { color: var(--gta-cream); }
  .work-calendar-grid .is-blank { background: #371936; color: #e5c8db; }
  .work-calendar-grid .is-blank .work-calendar-mark { color: #bc96af; }
  .work-calendar-grid .is-adjacent { color: #ae8da6; background: transparent; }
  .work-calendar-grid .is-today { outline-color: var(--gta-cyan); box-shadow: inset 0 0 0 4px #1d1025; }
  .timesheet-table .is-blank, .timesheet-legend .is-blank { color: #c5a5ba; }
  .timesheet-table .timesheet-total.timesheet-exact-time, .work-calendar-totals dd.work-calendar-exact-time,
  .timesheet-bulk-preview tr.is-changing td:last-child { color: var(--gta-cyan); }
  .work-calendar-totals { border-color: var(--gta-line); }
  .timesheet-selection-dialog, .timesheet-selection-panel, .timesheet-selection-dialog .timesheet-selection-heading,
  .timesheet-selection-dialog .timesheet-selection-actions { background: #28112b; color: var(--gta-cream); border-color: var(--gta-line); }
  .timesheet-selection-day:not([class*="is-"]) { background: var(--gta-deep); border-color: var(--gta-line); }
  .timesheet-field input, .timesheet-selection-panel .timesheet-field select, .mapping-controls input {
    border-color: var(--gta-line); background: var(--gta-deep); color: var(--gta-cream);
  }
  .timesheet-field input[readonly] { border-color: var(--gta-divider); color: var(--gta-muted); }
  .timesheet-field input:focus, .mapping-controls input:focus { border-color: var(--gta-cyan); }
  .timesheet-quickcodes button, .timesheet-view-switch, .timesheet-archived-list section {
    border-color: var(--gta-line); background: var(--gta-deep); color: var(--gta-muted);
  }
  .timesheet-view-switch button, .timesheet-manual-user > summary { color: var(--gta-muted); }
  .timesheet-view-switch button.active, .earnings-report-modes .filter-button[aria-pressed=true] {
    color: #161221; border-color: var(--gta-cyan); background: var(--gta-cyan); font-weight: 750;
  }
  .timesheet-roster-person strong, .timesheet-directory-list > button { color: var(--gta-cream); }
  .timesheet-roster-person span, .timesheet-directory-list small, .timesheet-archived-list span { color: var(--gta-muted); }
  .timesheet-remove-button, .timesheet-remove-button:hover {
    background: #4b202e; color: var(--gta-error); border-color: #996070;
  }

  /* Shared application dialogs, permission mapping, installation and feedback. */
  .details-dialog {
    border-color: #a55987; background: #2b122d; color: var(--gta-cream);
    box-shadow: 0 16px 64px #0b020ddd;
  }
  .details-dialog::backdrop, .timesheet-selection-dialog::backdrop { background: #140718be; }
  .dialog-header .icon-button { color: var(--gta-cyan); }
  .dialog-subtitle, .help-copy, .detail-earnings span, .detail-list dt, .mapping-hint,
  .mapping-controls label, .mapping-confirm p span, .pwa-install-copy, .pwa-app-address span,
  .pwa-install-copy .pwa-install-note { color: var(--gta-muted); }
  .help-copy strong, .detail-list dd, .detail-earnings strong, .pwa-install-steps h3,
  .pwa-device-hint { color: var(--gta-cream); }
  .detail-earnings, .formula, .mapping-confirm, .pwa-install-steps {
    background: var(--gta-card); border-color: var(--gta-line); color: var(--gta-cream);
  }
  .detail-list > div, .mapping-row, .pwa-app-address { border-color: var(--gta-divider); }
  .mapping-arrow, .pwa-app-address a { color: var(--gta-cyan); }
  .mapping-access.ready, .saved-notice, .timesheet-saved, .timesheet-bitrix-preview, .timesheet-net-preview,
  .pwa-install-copy .pwa-install-status { background-color: #15363b; color: #a3f1e4; border-color: #4c938b; }
  .mapping-access.unknown, .notice, .activity-period-empty {
    background-color: #36252f; border-color: #967446; color: var(--gta-warn);
  }
  .notice.error, .timesheet-edit-error, .timesheet-net-preview .timesheet-net-error {
    color: var(--gta-error); border-color: #a55c6d;
  }
  .notice.error { background: #431e30; }
  .empty-state, .report-note, .activity-note {
    background: var(--gta-deep); border-color: var(--gta-divider); color: var(--gta-muted);
  }
  .empty-state > .icon, .report-note .icon { color: var(--gta-cyan); }
  .empty-state p { color: var(--gta-muted); }
  .pwa-install-dialog .dialog-header { background: #2b122d; border-bottom-color: var(--gta-line); }
  .pwa-browser-link, .pwa-browser-link:hover { background: var(--gta-cyan); color: #101c25; border-color: var(--gta-cyan); }
  .skeleton { background-image: linear-gradient(90deg, #321530, #482442, #321530); }
}

@media (max-width: 700px) and (hover: hover) {
  .order-summary:hover, .booking-summary:hover, .work-item:hover, .order-works .work-item:hover,
  .timesheet-directory-list > button:hover { background-color: #44213e; }
  .text-button:hover, .refresh-button:hover { color: #a3fff8; }
  .primary-button:hover:not(:disabled) { background: #88fff3; }
  .secondary-button:hover:not(:disabled), .filter-button:hover:not(:disabled) { border-color: var(--gta-cyan); }
}

@media (orientation: landscape) and (pointer: coarse) and (max-height: 500px) and (max-width: 960px) {
  .topbar, #main { max-width: 740px; }
  .earnings-card::after, .team-stat:first-child::after { height: 118px; background-position: center, center 69%; }
  .page-heading > div:first-child { min-height: 102px; }
  .gta-group-break { display: inline; }
}

/* Desktop and large tablet presentation */
@media not all and (max-width: 700px) {
@media not all and (orientation: landscape) and (pointer: coarse) and (max-height: 500px) and (max-width: 960px) {
/* Desktop chrome. Wrapped at build time to match the complement of the mobile layout. */
:root {
  --gta-ink: #1b0b22;
  --gta-panel: #30142f;
  --gta-cream: #fff2dc;
  --gta-muted: #d0adc8;
  --gta-line: #724060;
  --gta-pink: #ff469e;
  --gta-coral: #ff8e7d;
  --gta-cyan: #44f2e3;
  --gta-display: 'Garage Display', Impact, 'Arial Black', system-ui, sans-serif;
  --rail-width: clamp(192px, 16.4vw, 248px);
  --page-gutter: clamp(24px, 2.55vw, 48px);
  color-scheme: dark;
  background-color: var(--gta-ink);
  color: var(--gta-cream);
}
.app-shell { background: var(--gta-ink); }
.sidebar {
  width: var(--rail-width);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #6e3659 #291029;
  padding: 30px 16px 19px;
  border-right-color: #6c3155;
  background: radial-gradient(ellipse at 12% 5%, #481739, transparent 54%),
              linear-gradient(162deg, #2a102b, #250d29 58%, #33112f);
}
.sidebar .brand {
  display: grid;
  grid-template-columns: 23px max-content;
  justify-content: start;
  align-items: center;
  gap: 20px 8px;
  padding: 0 10px 23px;
  border-bottom: 1px solid #6f3455;
  color: var(--gta-cream);
}
.sidebar .desktop-wordmark {
  grid-column: 1 / -1;
  justify-self: start;
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding-bottom: 7px;
  font: 900 clamp(25px, 2.75vw, 42px)/.81 var(--gta-display);
  color: #fff5e4;
  letter-spacing: -.055em;
  text-transform: uppercase;
  transform: skewX(-8deg);
  transform-origin: center left;
  -webkit-text-stroke: 2px #140916;
  paint-order: stroke fill;
  text-shadow: 1px 2px #140916, 2px 4px #140916;
}
.desktop-wordmark b { font-weight: 900; }
.desktop-wordmark::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--gta-pink);
  transform: rotate(-2deg);
  clip-path: polygon(0 34%, 64% 0, 100% 12%, 95% 66%, 18% 91%, 1% 100%);
}
.sidebar .brand-mark { width: 22px; height: 27px; }
.sidebar .brand strong {
  font: 900 15px/1 var(--gta-display);
  letter-spacing: .055em;
  color: var(--gta-cream);
}
.sidebar .brand small {
  margin-top: 3px;
  font-size: 8px;
  line-height: 1;
  letter-spacing: .13em;
  color: var(--gta-muted);
}
.sidebar-caption {
  color: var(--gta-muted);
  margin: 25px 13px 12px;
  font-size: 10px;
  letter-spacing: .125em;
}
.desktop-nav { gap: 6px; }
.desktop-nav .nav-item {
  width: 100%;
  min-height: 44px;
  padding: 11px 15px;
  color: #ebd6e7;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 550;
  line-height: 1.35;
}
.desktop-nav .nav-item .icon { width: 20px; height: 20px; }
.desktop-nav .nav-item:hover { color: var(--gta-cream); background: #4c1c41; }
.desktop-nav .nav-item.active {
  color: #fff0e0;
  border-color: #a04779;
  background: linear-gradient(112deg, #6b2355, #50163f);
}
.desktop-nav .nav-item.active .icon { color: var(--gta-cyan); }
.desktop-nav .nav-item.active::before {
  top: 8px;
  bottom: 8px;
  left: -1px;
  width: 3px;
  border-radius: 99px;
  background: var(--gta-cyan);
}
.sidebar-bottom { padding-top: 30px; }
.connection-note { color: #dcbdcf; }
.connection-note .live-dot { width: 6px; height: 6px; background: var(--gta-cyan); }
.sidebar-user { border-color: #693552; }
.sidebar-user strong { color: var(--gta-cream); }
.sidebar-user small, .breadcrumb { color: var(--gta-muted); }
.sidebar-user .avatar, .person-label > .avatar {
  color: #ffedf0;
  border-color: #a15980;
  background: linear-gradient(135deg,#763753,#3a183a 90%);
}
.workspace {
  min-width: 0;
  margin-left: var(--rail-width);
  background: radial-gradient(ellipse 80% 570px at 85% 0%, #47173698, transparent),
              linear-gradient(#251025, var(--gta-ink) 630px);
}
.topbar {
  height: 49px;
  padding-inline: max(var(--page-gutter), calc((100% - 1500px) / 2 + var(--page-gutter)));
  border-color: #542b47;
  background: #220e24;
}
.breadcrumb { display: flex; align-items: center; gap: 11px; font-size: 12px; }
.breadcrumb span { color: #a86385; padding: 0; }
.topbar-actions { gap: 9px; }
.topbar .help-button, .topbar .report-warning-button {
  background: #32132f;
  color: #f2d5e7;
  border: 1px solid #76405e;
}
.topbar .report-warning-button { color: #ffc390; border-color: #995f55; }
.topbar .icon-button:hover:not(:disabled), .month-switcher .icon-button:hover:not(:disabled) {
  color: var(--gta-cream);
  background: #572344;
}
.topbar .pwa-install-button {
  background: #311630;
  border-color: #78506b;
  color: var(--gta-cyan);
  min-height: 32px;
  padding: 5px 11px;
}
.topbar .pwa-install-button:hover { border-color: var(--gta-cyan); background: #3c1e39; }
#main { max-width: 1500px; padding: 24px var(--page-gutter) 28px; }
.page-heading {
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
}
.page-heading > div:first-child { min-width: 0; }
#page-eyebrow {
  color: #ff99c8;
  font-weight: 650;
  letter-spacing: .145em;
  font-size: 10px;
  margin: 0 0 5px;
}
#page-title {
  color: var(--gta-cream);
  font: 900 clamp(32px, 3.1vw, 52px)/1.03 var(--gta-display);
  letter-spacing: -.022em;
  text-wrap: balance;
}
#page-title .gta-usual-title { display: none; }
#page-title .gta-work-title { display: inline; }
#page-description {
  color: var(--gta-muted);
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.4;
}
/* All data panels below these compact section headers retain the full workspace width. */
#main:is(.bookings-view,.activity-view,.timesheet-view,.work-calendar-view) .page-heading,
#main:has(.gta-work-title) .page-heading {
  min-height: 126px;
  padding: 18px clamp(18px, 2vw, 32px);
  border: 1px solid #88466c;
  border-radius: 13px;
  background: linear-gradient(90deg, #2d112f 15%, #32112ff7 37%, #30112fd4 53%, #2c0d2a28 85%),
              url('/gta-garage-mobile.webp') right 65% / clamp(420px, 60%, 780px) auto no-repeat, var(--gta-panel);
}
#main:is(.bookings-view,.activity-view,.timesheet-view,.work-calendar-view) #page-description,
#main:has(.gta-work-title) #page-description { color: #f7dbe9; }
.month-switcher {
  flex: 0 0 auto;
  min-width: 224px;
  margin-top: 0;
  padding: 2px;
  border: 1px solid #a74878;
  border-radius: 8px;
  background: #35152f;
  box-shadow: inset 0 1px #ff81ab1c;
}
.month-switcher .icon-button { width: 34px; height: 35px; color: var(--gta-cyan); border-radius: 5px; }
.month-switcher select { color: #fff1e1; font-size: 14px; font-weight: 600; }
.month-switcher select option, .person-select option { color: #fff1e1; background: #30142f; }
.period-panel {
  margin: 0 0 15px;
  padding: 14px 17px;
  border: 1px solid #693451;
  border-radius: 10px;
  background: #2b122b;
}
#period-form:not([hidden]) {
  display: grid;
  grid-template-columns: minmax(106px,.75fr) minmax(335px,2.15fr) auto;
  gap: 9px 17px;
  align-items: center;
}
#period-form .period-panel-heading {
  display: block;
  margin: 0;
}
.period-panel-heading h2 {
  font: 900 18px/1.1 var(--gta-display);
  color: var(--gta-cream);
}
.period-panel-heading p {
  color: var(--gta-muted);
  font-size: 11px;
  line-height: 1.4;
}
#period-form .period-panel-heading p { margin-top: 5px; text-align: left; }
.period-controls { gap: 9px; }
.period-controls label { color: var(--gta-muted); gap: 4px; }
.period-controls input, .person-select {
  background-color: #200d24;
  border: 1px solid #784464;
  border-radius: 6px;
  color: var(--gta-cream);
}
.period-controls input { height: 36px; padding: 6px 8px; }
.period-controls input[aria-invalid="true"] { border-color: #ff9a85; }
.period-controls .primary-button {
  min-height: 36px;
  height: 36px;
  margin: 0;
  padding: 0 13px;
  border: 1px solid #76fff3;
  border-radius: 6px;
  color: #142429;
  background: var(--gta-cyan);
  font-weight: 700;
}
.period-controls .primary-button:hover:not(:disabled) { background: #83fff3; color: #142429; }
#period-form .period-presets { align-self: end; justify-content: flex-end; gap: 4px; margin: 0; }
.period-presets .filter-button {
  min-height: 33px;
  padding: 5px 9px;
  border: 1px solid #73435f;
  background: #35172f;
  color: #e8cfdf;
  border-radius: 6px;
  font-size: 11px;
}
.period-presets .filter-button.active, .period-presets .filter-button[aria-pressed="true"] {
  color: #8bfff5;
  border-color: #418881;
  background: #193a3d;
}
.period-presets .filter-button:hover:not(:disabled) { color: var(--gta-cream); border-color: #c56699; }
.period-error { grid-column: 1 / -1; color: #ffad99; margin: 0; }
.person-context { gap: 14px; margin: 0 0 16px; }
.person-label { gap: 10px; }
.person-label .avatar { width: 38px; height: 38px; font: 900 17px/1 var(--gta-display); }
.person-label strong { color: var(--gta-cream); font-size: 15px; }
.person-label small, .person-select-wrap label { color: var(--gta-muted); }
.person-label small { margin-top: 1px; }
.person-select { min-height: 36px; padding-block: 5px; }
.role-chip { background: #391a35; border-color: #794967; color: #f3c6dd; }
.demo-banner { color: #ffe2ae; border-color: #98614b; background: #402338; margin-bottom: 16px; }
.page-footer { color: #c7a2b9; border-top-color: #62354f; }
.app-shell :where(button,select,input,a,summary):focus-visible { outline-color: var(--gta-cyan); }

@media (max-width: 1190px) {
  #period-form:not([hidden]) {
    grid-template-columns: minmax(136px,.75fr) minmax(0,2fr);
    gap: 9px 16px;
  }
  #period-form .period-controls { max-width: none; }
  #period-form .period-presets { grid-column: 2; justify-content: flex-start; }
  #period-form .period-presets .filter-button { min-height: 29px; }
}
@media (max-width: 980px) {
  :root { --rail-width: 150px; --page-gutter: 20px; }
  .sidebar { padding: 22px 8px 15px; }
  .sidebar .brand { padding-inline: 7px; }
  .sidebar .desktop-wordmark { font-size: 24px; }
  .sidebar-caption { margin-inline: 8px; font-size: 9px; }
  .desktop-nav .nav-item { padding-inline: 10px; gap: 8px; font-size: 12px; }
  .connection-note { white-space: normal; padding-inline: 2px; }
  .sidebar-user { gap: 7px; }
  .sidebar-user strong { overflow-wrap: anywhere; }
  #period-form:not([hidden]) { grid-template-columns: minmax(109px,.6fr) minmax(0,2fr); }
  .month-switcher { min-width: 176px; }
}
@media (max-width: 805px) {
  :root { --rail-width: 118px; --page-gutter: 16px; }
  .sidebar .desktop-wordmark { font-size: 20px; }
  .sidebar .brand { grid-template-columns: 15px max-content; gap: 16px 5px; padding-left: 3px; }
  .sidebar .brand-mark { width: 14px; height: 21px; }
  .sidebar .brand strong { font-size: 13px; }
  .sidebar .brand small { font-size: 7px; }
  .desktop-nav .nav-item { padding: 10px 6px; gap: 6px; font-size: 11px; }
  .desktop-nav .nav-item .icon { width: 16px; height: 16px; }
  .sidebar-caption { margin-inline: 3px; font-size: 8px; }
  .sidebar-user { flex-wrap: wrap; }
  #main { padding-top: 18px; }
  #period-form:not([hidden]) { grid-template-columns: 1fr; }
  #period-form .period-panel-heading { display: flex; justify-content: space-between; gap: 8px; }
  #period-form .period-panel-heading p { margin: 0; }
  #period-form .period-presets { grid-column: 1; }
}
/* Desktop earnings reports. The existing salary, rate and scope drive the display. */
:root {
  --desk-cream: #fff2dc;
  --desk-soft: #d5b7cd;
  --desk-line: #714060;
  --desk-rule: #55324e;
  --desk-deep: #211025;
  --desk-card: linear-gradient(128deg, #321631, #29122c 74%);
  --desk-cyan: #44f2e3;
  --desk-pink: #ff469e;
  --desk-coral: #ff8e7d;
  --desk-warning: #ffda97;
  --desk-error: #ffafaa;
  --desk-type: 'Garage Display', Impact, 'Arial Black', system-ui, sans-serif;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.85fr) minmax(205px, .95fr);
  gap: clamp(12px, 1.55vw, 24px);
}
.earnings-card, .team-overview .team-stat:first-child {
  --hero-pad: clamp(20px, 2.1vw, 36px);
  isolation: isolate;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  min-height: clamp(238px, 20vw, 302px);
  padding: var(--hero-pad);
  border: 1px solid #965079;
  border-radius: 16px;
  background: #310f31;
  box-shadow: 0 10px 30px #1206164d;
}
.earnings-card::before, .team-overview .team-stat:first-child::before,
.earnings-card::after, .team-overview .team-stat:first-child::after {
  content: '';
  position: absolute;
  pointer-events: none;
  z-index: -1;
}
.earnings-card::before, .team-overview .team-stat:first-child::before {
  inset: 0 0 0 24%;
  background: url('/gta-garage-mobile.webp') center 67% / cover no-repeat;
}
.earnings-card::after, .team-overview .team-stat:first-child::after {
  inset: 0;
  background: linear-gradient(90deg, #2c0d2e 6%, #2c0d2ef2 27%, #2c0d2ebc 42%, #2c0d2e13 63%, transparent 77%),
              linear-gradient(0deg, #1d091fbb, transparent 34%);
}
.earnings-card .card-chevron { display: none; }
.earnings-label, .team-overview .team-stat:first-child .stat-label {
  color: var(--desk-cream);
  font: 900 clamp(19px, 1.65vw, 28px)/1.12 var(--desk-type);
  margin: 0 0 7px;
}
.earnings-value, .team-overview .team-stat:first-child strong {
  position: relative;
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  padding: 0 0 .11em;
  margin: 0;
  font: 900 clamp(52px, 5.45vw, 90px)/.98 var(--desk-type);
  letter-spacing: -.038em;
  overflow-wrap: anywhere;
  color: var(--desk-cream);
  -webkit-text-stroke: 3px #170a19;
  paint-order: stroke fill;
  text-shadow: 1px 3px 0 #170a19;
}
.earnings-value::after, .team-overview .team-stat:first-child strong::after {
  content: '';
  position: absolute;
  inset: auto 2% 0 1%;
  height: clamp(4px, .51vw, 8px);
  background: var(--desk-pink);
  clip-path: polygon(0 62%, 46% 18%, 100% 0, 94% 50%, 33% 86%, 1% 100%);
}
.earnings-card .earnings-value[data-gta-long], .team-overview .team-stat:first-child strong[data-gta-long] {
  font-size: clamp(37px, 3.65vw, 63px);
}
.earnings-value .gta-group-break, .team-stat strong .gta-group-break { display: inline; }
.earnings-card .earnings-value.missing { font-size: clamp(32px, 3.5vw, 55px); }
.earnings-value .currency { font-size: .76em; font-weight: 900; margin-left: .11em; }
.earnings-caption { margin-top: 9px; max-width: 54%; font-size: 12px; line-height: 1.45; color: #f2dae9; }
.earnings-card-rule { margin-top: 15px; max-width: 52%; background: #e794bb64; }
.earnings-bottom { gap: 12px; margin-top: 12px; width: fit-content; max-width: 100%; }
.earnings-bottom > div + div { border-left-color: #c776a67d; padding-left: clamp(12px, 1.5vw, 26px); }
.metric-label, .quantity-row, .stat-label, .support-card-header { color: var(--desk-soft); }
.metric-value, .hours-value, .team-stat strong, .quantity-row strong, .payroll-component-amount {
  color: var(--desk-cream);
  font-weight: 750;
  overflow-wrap: anywhere;
}
.earnings-bottom .metric-label, .earnings-bottom .metric-value { color: #fff0e4; text-shadow: 0 1px 3px #20091f; }
.earnings-bottom .metric-label { font-size: 11px; }
.metric-value { font-size: clamp(18px, 1.65vw, 27px); margin-top: 4px; }
.support-card, .team-stat, .activity-summary section, .payroll-component {
  min-width: 0;
  border: 1px solid var(--desk-line);
  border-radius: 14px;
  color: var(--desk-cream);
  background: var(--desk-card);
}
.support-card { padding: clamp(16px, 1.7vw, 26px); border-top: 3px solid var(--desk-cyan); }
.support-card-header { font-weight: 600; font-size: 13px; gap: 9px; }
.support-card .metric-icon {
  width: 35px; height: 35px;
  border-color: #377074;
  background: #14363c;
  color: var(--desk-cyan);
}
.hours-value, .team-stat strong, .activity-summary strong {
  font-family: var(--desk-type);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.hours-value { font-size: clamp(34px, 3.25vw, 54px); }
.hours-value span, .support-subtitle { color: var(--desk-soft); }
.support-separator { background: var(--desk-rule); }
.quantity-row { font-size: 13px; }
.quantity-row strong { font: 900 clamp(21px, 1.9vw, 32px)/1.15 var(--desk-type); color: var(--desk-coral); }
.team-overview { grid-template-columns: minmax(0, 2.8fr) minmax(185px, 1fr); gap: 12px 17px; }
.team-overview .team-stat:first-child { grid-row: span 2; }
.team-stat:not(:first-child) { display: flex; flex-direction: column; justify-content: center; border-left: 4px solid var(--desk-cyan); }
.team-stat:last-child { border-left-color: var(--desk-coral); }
.team-stat strong { font-size: clamp(25px, 2.55vw, 43px); margin-top: 7px; }
.manager-total.earnings-card { min-height: clamp(210px, 17.5vw, 268px); }
.manager-total.earnings-card::before { left: 31%; }
.payroll-component { border-top: 3px solid var(--desk-pink); }
.payroll-component:nth-child(2n) { border-top-color: var(--desk-coral); }
.payroll-component:nth-child(3n) { border-top-color: var(--desk-cyan); }
.payroll-component h3, .employee-name, .activity-person strong { color: var(--desk-cream); }
.payroll-component p, .employee-note { color: var(--desk-soft); }
.payroll-rate { background: #16373b; border-color: #356868; color: var(--desk-cyan); }

.section-title-row h2, .earnings-trend h2, .booking-day-heading h2, .dialog-header h2 {
  color: var(--desk-cream);
  font: 900 clamp(22px, 1.85vw, 31px)/1.17 var(--desk-type);
  letter-spacing: -.025em;
}
.earnings-trend {
  --plot-height: clamp(140px, 12vw, 202px);
  min-width: 0;
  padding: clamp(15px, 1.55vw, 24px);
  background: var(--desk-card);
  border: 1px solid #8c4b79;
  border-radius: 14px;
  color: var(--desk-cream);
}
.earnings-trend p, .trend-axis, .trend-column span, .sync-status,
.works-count, .period-label, .works-filter-note, .group-date, .pagination { color: var(--desk-soft); }
.trend-grid i, .trend-details th, .trend-details td { border-color: var(--desk-rule); }
.trend-grid .trend-zero { border-color: #c8a5be; }
.trend-column svg { fill: var(--desk-pink); }
.trend-column:nth-child(odd) svg { fill: var(--desk-coral); }
.trend-details summary, .text-button, .refresh-button, .sync-status .icon { color: var(--desk-cyan); }
.trend-scroll, .timesheet-scroll, .activity-table-wrap { scrollbar-color: #985982 var(--desk-deep); }
.sync-status.stale, .sync-status.stale .icon, .order-rate-warning, .rate-missing { color: var(--desk-warning); }
.text-button:hover, .refresh-button:hover { color: #a6fff5; }

/* The report still exposes the complete, paged work list beside the chart. */
@media (min-width: 1280px) {
  #view-content:has(> .earnings-trend) {
    display: grid;
    grid-template-columns: minmax(0, .93fr) minmax(0, 1.22fr);
    column-gap: clamp(16px, 1.6vw, 28px);
    align-items: start;
  }
  #view-content:has(> .earnings-trend) > :is(.overview-grid, .sync-line, .report-note) { grid-column: 1 / -1; }
  #view-content > .earnings-trend { margin: 0; }
  #view-content > .earnings-trend + section { min-width: 0; }
  #view-content > .earnings-trend + section .toolbar { flex-wrap: wrap; margin-block: 10px; gap: 8px 14px; }
  #view-content > .earnings-trend + section .search-field { flex: 1 1 100%; max-width: none; }
  #view-content > .earnings-trend + section .period-label { margin-left: auto; }
}
.order-card, .booking-card, .work-item {
  color: var(--desk-cream);
  background: var(--desk-card);
  border-color: var(--desk-line);
}
.order-card, .booking-card { border-radius: 12px; }
.order-card { border-inline-start: 3px solid #dc5797; }
.order-card[open], .booking-card[open] { border-color: var(--desk-pink); }
.order-summary { padding: 15px 18px 12px; gap: 8px 16px; }
.order-number, .work-name, .work-amount, .order-stats strong, .order-earnings strong { color: var(--desk-cream); }
.order-number { font-weight: 750; }
.order-earnings strong { font: 900 26px/1.1 var(--desk-type); }
.order-earnings.missing strong, .work-amount.missing { color: var(--desk-warning); }
.order-vehicle, .order-date, .order-amount-label, .order-stat-label, .order-works-caption,
.work-meta, .work-subamount, .work-item > .icon { color: var(--desk-soft); }
.order-count { background: #3a203a; border-color: #6f4365; color: #eccde0; }
.order-toggle { border-color: var(--desk-rule); color: var(--desk-cyan); padding-top: 9px; }
.order-works, .booking-details { border-color: var(--desk-rule); background: var(--desk-deep); }
.order-works .work-item { background: transparent; }
.order-works .work-item + .work-item { border-color: var(--desk-rule); }
.work-icon, .order-works .work-icon, .booking-car-icon { color: var(--desk-cyan); background: #15383e; }
.order-summary:hover, .booking-summary:hover, .work-item:hover, .order-works .work-item:hover { background: #ffffff09; }
.order-summary:focus-visible, .booking-summary:focus-visible { outline-color: var(--desk-cyan); }
.search-field, .pagination .icon-button, .secondary-button, .filter-button {
  border-color: var(--desk-line); color: var(--desk-cream); background: var(--desk-deep);
}
.search-field input { color: var(--desk-cream); }
.search-field .icon, .search-field input::placeholder { color: var(--desk-soft); }
.search-field:focus-within, .secondary-button:hover:not(:disabled), .filter-button:hover:not(:disabled) { border-color: var(--desk-cyan); }
.primary-button, .pwa-browser-link { background: var(--desk-cyan); border-color: var(--desk-cyan); color: #11252a; }
.primary-button:hover:not(:disabled), .pwa-browser-link:hover { background: #9afff4; border-color: #9afff4; color: #11252a; }
.earnings-report-modes .filter-button[aria-pressed=true], .timesheet-view-switch button.active {
  color: #112328; background: var(--desk-cyan); border-color: var(--desk-cyan);
}
.activity-controls .filter-button.active, .filter-button.active { background: #173f43; color: #bafff7; border-color: var(--desk-cyan); }
.team-table, .activity-table, .activity-table-wrap { background: var(--desk-deep); border-color: var(--desk-line); color: var(--desk-cream); }
.team-table th, .activity-table thead th { background: #3a2039; color: #f2d8e9; border-color: var(--desk-line); }
.team-table td, .activity-table td, .activity-table tbody th, .activity-sections li + li { border-color: var(--desk-rule); }
.team-table tbody tr:nth-child(even), .activity-table tbody tr:nth-child(even) { background: #ffffff04; }
.team-table tbody tr:hover, .activity-table tbody tr:hover { background: #ffffff0a; }
.employee-button:hover .employee-name { color: var(--desk-cyan); }
.employee-button .avatar, .activity-person .avatar { color: var(--desk-cream); background: #492144; border-color: #805173; }
.team-table tfoot td { color: var(--desk-cream); border-color: var(--desk-line); background: #3a1c38; }
.team-table td:last-child, .team-table tfoot td:last-child, .activity-count { color: var(--desk-cyan); }
.activity-summary section { border-left: 4px solid var(--desk-cyan); }
.activity-summary section:first-child { background: var(--desk-card); border-color: var(--desk-line); border-left: 4px solid var(--desk-pink); }
.activity-summary section:nth-child(2) { border-left-color: var(--desk-coral); }
.activity-summary strong, .activity-sections strong { color: var(--desk-cream); }
.activity-summary span, .activity-access, .activity-muted, .activity-collection, .activity-sections span { color: var(--desk-soft); }

.booking-controls, .work-calendar-panel { background: var(--desk-card); border-color: var(--desk-line); }
.booking-datebox, .booking-arrow, .booking-today, .booking-owner-filter select, .timesheet-month, .timesheet-month select {
  background: var(--desk-deep); border-color: var(--desk-line); color: var(--desk-cream);
}
.booking-datebox input, .booking-car-name, .booking-time, .booking-plate, .booking-meta dd { color: var(--desk-cream); }
.booking-arrow, .booking-datebox > .icon, .booking-today, .booking-expand, .booking-source .icon { color: var(--desk-cyan); }
.booking-week { border-color: var(--desk-rule); background: #241026; }
.booking-day, .booking-day-heading > span, .booking-owner-filter, .booking-timezone, .booking-source,
.booking-duration, .booking-field-label, .booking-request, .booking-details h3, .booking-works small, .booking-meta, .booking-muted { color: var(--desk-soft); }
.booking-day strong, .booking-day[aria-pressed=true] strong { color: var(--desk-cream); }
.booking-day:hover { background: #43213c; }
.booking-day[aria-pressed=true] { color: var(--desk-cream); border-color: var(--desk-pink); background: #562048; }
.booking-day-dot.has-bookings { background: var(--desk-cyan); }
.booking-summary { border-left-color: var(--desk-cyan); }
.booking-card-foot, .booking-works li { border-color: var(--desk-rule); }
.booking-unassigned > .booking-summary { border-left-color: var(--desk-warning); }
.booking-assignee { color: var(--desk-warning); }
.booking-comment, .booking-concern-text { color: #f0dfea; }
.booking-comment { border-left-color: var(--desk-pink); }

/* Calendar marks use the existing distinct colours for leave, illness and overtime. */
.timesheet-scroll, .timesheet-directory-list, .timesheet-bulk-preview { background: var(--desk-deep); border-color: var(--desk-line); }
.timesheet-table th, .timesheet-table td, .timesheet-bulk-preview th, .timesheet-bulk-preview td { border-color: var(--desk-rule); }
.timesheet-table thead th, .timesheet-bulk-preview thead th { background: #46233f; color: var(--desk-cream); }
.timesheet-table .timesheet-person { background: #351933; color: var(--desk-cream); box-shadow: 2px 0 var(--desk-line); }
.timesheet-table thead .timesheet-weekend { background: #503040; color: var(--desk-warning); }
.timesheet-day.timesheet-weekend { background: #352032; }
.timesheet-table .timesheet-group th, .timesheet-table .timesheet-summary th, .timesheet-table .timesheet-summary td, .timesheet-table .timesheet-total {
  color: var(--desk-cream); background: #40213f;
}
.timesheet-person button, .timesheet-person button:hover, .work-calendar-person strong, .work-calendar-totals dd { color: var(--desk-cream); }
.work-calendar-grid .is-blank { background: #371c36; color: #e5c8db; }
.work-calendar-grid .is-blank .work-calendar-mark, .timesheet-table .is-blank, .timesheet-legend .is-blank { color: #ceb2c5; }
.work-calendar-grid .is-adjacent { background: transparent; color: #c29fba; }
.work-calendar-grid .is-today { outline-color: var(--desk-cyan); box-shadow: inset 0 0 0 4px #231025; }
.timesheet-day-heading small, .timesheet-table .timesheet-summary-note, .timesheet-hint, .timesheet-source,
.timesheet-field, .timesheet-selection-weekday, .work-calendar-note, .work-calendar-person span, .work-calendar-grid th,
.timesheet-preserved-marks, .work-calendar-totals dt { color: var(--desk-soft); }
.timesheet-table .timesheet-total.timesheet-exact-time, .work-calendar-totals dd.work-calendar-exact-time,
.timesheet-bulk-preview tr.is-changing td:last-child { color: var(--desk-cyan); }
.timesheet-quickcodes button, .timesheet-view-switch, .timesheet-archived-list section, .timesheet-field input,
.timesheet-selection-panel .timesheet-field select, .mapping-controls input {
  background: var(--desk-deep); border-color: var(--desk-line); color: var(--desk-cream);
}
.timesheet-field input:focus, .mapping-controls input:focus { border-color: var(--desk-cyan); }
.timesheet-field input[readonly], .timesheet-roster-person span, .timesheet-archived-list span, .timesheet-directory-list small,
.timesheet-view-switch button, .timesheet-manual-user > summary { color: var(--desk-soft); }
.timesheet-roster-person strong, .timesheet-directory-list > button { color: var(--desk-cream); }
.timesheet-directory-list > button:hover { background: #42203c; }
.timesheet-remove-button, .timesheet-remove-button:hover { background: #4a2431; color: var(--desk-error); border-color: #976071; }
.work-calendar-totals { border-color: var(--desk-line); }
.timesheet-selection-dialog, .timesheet-selection-panel, .timesheet-selection-dialog .timesheet-selection-heading,
.timesheet-selection-dialog .timesheet-selection-actions { background: #29142c; color: var(--desk-cream); border-color: var(--desk-line); }
.timesheet-selection-day:not([class*='is-']) { background: var(--desk-deep); border-color: var(--desk-line); }

.details-dialog { border-color: #9e5985; border-radius: 16px; background: #2a152d; color: var(--desk-cream); box-shadow: 0 18px 75px #0e0411b8; }
.details-dialog::backdrop, .timesheet-selection-dialog::backdrop { background: #150917c7; }
.dialog-header .icon-button, .mapping-arrow, .pwa-app-address a { color: var(--desk-cyan); }
.help-copy, .dialog-subtitle, .detail-earnings span, .detail-list dt, .mapping-controls label, .mapping-hint,
.mapping-confirm p span, .pwa-install-copy, .pwa-app-address span, .pwa-install-copy .pwa-install-note { color: var(--desk-soft); }
.help-copy strong, .detail-list dd, .detail-earnings strong, .pwa-device-hint, .pwa-install-steps h3 { color: var(--desk-cream); }
.detail-earnings, .formula, .mapping-confirm, .pwa-install-steps { background: var(--desk-card); border-color: var(--desk-line); color: var(--desk-cream); }
.detail-list > div, .mapping-row, .pwa-app-address { border-color: var(--desk-rule); }
.pwa-install-dialog .dialog-header { background: #2a152d; border-color: var(--desk-line); }
.mapping-access.ready, .saved-notice, .timesheet-saved, .timesheet-bitrix-preview, .timesheet-net-preview,
.pwa-install-copy .pwa-install-status { background-color: #17383b; color: #b4f6e8; border-color: #538c84; }
.mapping-access.unknown, .notice, .activity-period-empty { background-color: #3a2831; color: var(--desk-warning); border-color: #8e704c; }
.notice.error, .timesheet-edit-error, .timesheet-net-preview .timesheet-net-error { color: var(--desk-error); border-color: #a35b6c; }
.notice.error { background-color: #442032; }
.empty-state, .report-note, .activity-note { background: var(--desk-deep); border-color: var(--desk-rule); color: var(--desk-soft); }
.empty-state h2 { color: var(--desk-cream); }
.empty-state p { color: var(--desk-soft); }
.empty-state > .icon, .report-note .icon { color: var(--desk-cyan); }
.skeleton { background-image: linear-gradient(90deg, #321930, #472441, #321930); }

@media (max-width: 1099px) {
  .overview-grid { grid-template-columns: minmax(0, 2.3fr) minmax(167px, .9fr); gap: 12px; }
  .support-card {
    display: flex; flex-direction: column; justify-content: space-between; padding: 17px;
  }
  .support-card .support-separator { display: block; margin: 12px 0; }
  .quantity-row { border: 0; padding: 0; align-items: flex-start; flex-direction: column; gap: 4px; }
  .team-overview { grid-template-columns: minmax(0, 2fr) minmax(160px, .9fr); }
  .earnings-card::before, .team-overview .team-stat:first-child::before { left: 15%; }
  .earnings-card, .team-overview .team-stat:first-child { min-height: 220px; }
  .earnings-caption { max-width: 74%; }
}
}
}

@media not all and (max-width: 700px) {
@media not all and (orientation: landscape) and (pointer: coarse) and (max-height: 500px) and (max-width: 960px) {
  .sidebar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin: 15px 0 8px;
  }
  .sidebar-controls .sidebar-caption { margin: 0 0 0 min(1vw, 13px); }
  #sidebar-toggle {
    display: inline-grid;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    color: var(--gta-muted);
    background: transparent;
    border: 1px solid var(--gta-line);
    border-radius: 8px;
    cursor: pointer;
  }
  #sidebar-toggle:hover, #sidebar-toggle:focus-visible {
    color: var(--gta-cyan);
    border-color: currentColor;
  }
  #sidebar-toggle .icon { width: 20px; height: 20px; }
  .app-shell.is-rail-collapsed { --rail-width: 60px; }
  .is-rail-collapsed .sidebar { padding: 18px 6px 12px; }
  .is-rail-collapsed .sidebar .brand {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0;
    padding: 5px 0 14px;
  }
  .is-rail-collapsed .sidebar .brand-mark { width: 21px; height: 29px; }
  .is-rail-collapsed .sidebar .brand > span,
  .is-rail-collapsed .sidebar-caption,
  .is-rail-collapsed .desktop-nav .nav-item > span { display: none; }
  .is-rail-collapsed .sidebar-controls { justify-content: center; margin: 10px 0; }
  .is-rail-collapsed #sidebar-toggle .sidebar-arrow {
    transform: translateX(29px) scaleX(-1);
  }
  .is-rail-collapsed .desktop-nav .nav-item {
    justify-content: center;
    width: 100%;
    padding: 0;
    gap: 0;
    flex-direction: row;
  }
  .is-rail-collapsed .desktop-nav .nav-item .icon { width: 20px; height: 20px; }
  .is-rail-collapsed .sidebar-user { justify-content: center; padding: 12px 0 0; }
  .is-rail-collapsed .connection-note,
  .is-rail-collapsed .sidebar-user > div {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
  }
  @media (max-width: 805px) {
    .sidebar-controls .sidebar-caption { margin-left: 2px; }
  }
}
}


/* Production timesheet: the table uses the workspace and scrolls with the page. */
#main.timesheet-view {
  width: 100%;
  max-width: none;
  min-width: 0;
  padding: 10px clamp(12px, 1.1vw, 22px) 12px;
}
#main.timesheet-view .page-heading {
  min-height: 0;
  margin: 0 0 10px;
  padding: 8px 14px;
  border-radius: 9px;
}
#main.timesheet-view .page-heading > div:first-child {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
}
#main.timesheet-view #page-title { font-size: clamp(26px, 2.3vw, 36px); line-height: 1.1; }
#main.timesheet-view :is(#page-description, #page-eyebrow, .page-footer) { display: none; }
.timesheet-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.timesheet-controls .timesheet-view-switch { flex: none; padding: 2px; margin: 0; }
.timesheet-controls .timesheet-view-switch button { padding: 5px 10px; min-height: 32px; }
.timesheet-controls .timesheet-toolbar {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 0;
}
.timesheet-controls .timesheet-month { margin: 0; }
.timesheet-controls .timesheet-month .icon-button { width: 31px; height: 32px; }
.timesheet-controls .timesheet-month select { font-size: 14px; padding-block: 5px; }
.timesheet-controls .timesheet-toolbar-actions { flex-wrap: wrap; gap: 5px; }
.timesheet-controls .timesheet-toolbar-actions button { min-height: 34px; padding: 5px 10px; }
.timesheet-meta { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin: 3px 0; }
.timesheet-meta .timesheet-saved { margin: 0; padding: 0; background: none; }
.timesheet-guide { max-width: 100%; font-size: 12px; }
.timesheet-guide > summary, .timesheet-person-totals > summary { cursor: pointer; color: #8af9ea; }
.timesheet-guide > summary { padding: 5px 1px; text-align: right; }
.timesheet-guide[open] { flex: 1 1 100%; }
.timesheet-guide-body { padding: 0 0 7px; }
.timesheet-guide-body p, .timesheet-guide-body .timesheet-legend { margin: 4px 0; }
.timesheet-person-totals { margin: 4px 0 16px; }
.timesheet-person-totals summary { padding: 7px 0; }
.timesheet-person-totals dl { margin: 5px 0; }
.timesheet-person-totals dl > div { display: flex; justify-content: space-between; gap: 12px; padding-block: 4px; }
.timesheet-person-totals dd { margin: 0; font-weight: 650; }
#timesheet-grid {
  width: 100%;
  min-width: 0;
  max-height: none;
  overflow: visible;
  border: none;
  border-radius: 0;
  background: none;
  container-type: inline-size;
}
#timesheet-grid .timesheet-name-col { width: 114px; }
@container (min-width: 1120px) { #timesheet-grid .timesheet-name-col { width: 150px; } }
@container (min-width: 1400px) { #timesheet-grid .timesheet-name-col { width: 182px; } }
@container (max-width: 380px) { #timesheet-grid .timesheet-name-col { width: 78px; } }
@container (min-width: 381px) and (max-width: 500px) { #timesheet-grid .timesheet-name-col { width: 96px; } }
#timesheet-grid .timesheet-table {
  width: 100%;
  min-width: 0;
  border: 1px solid #683d60;
  border-radius: 6px;
  background: #231024;
  table-layout: fixed;
}
#timesheet-grid .timesheet-table + .timesheet-table { margin-top: 8px; }
#timesheet-grid .timesheet-band-label {
  padding: 5px 0;
  color: #f5dceb;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}
#timesheet-grid .timesheet-table th, #timesheet-grid .timesheet-table td { min-width: 0; }
#timesheet-grid thead th {
  position: static;
  height: 35px;
  width: auto;
  padding: 2px 0;
  font-size: 13px;
  line-height: 1.15;
}
#timesheet-grid .timesheet-day-heading small { font-size: 10px; line-height: 1.1; margin-bottom: 1px; }
#timesheet-grid .timesheet-person {
  position: static;
  width: auto;
  max-width: none;
  padding: 0 7px;
  z-index: auto;
  box-shadow: none;
}
#timesheet-grid .timesheet-person button {
  font-size: 12px;
  line-height: 1.15;
  min-height: 30px;
  padding: 2px 0;
}
#timesheet-grid .timesheet-group th { height: 20px; padding: 2px 7px; line-height: 1.25; }
#timesheet-grid .timesheet-group span { position: static; max-width: none; }
#timesheet-grid .timesheet-cell {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  height: auto;
  padding: 2px 0;
  line-height: 1.1;
  font-size: 12px;
  white-space: normal;
  overflow-wrap: anywhere;
}
#timesheet-grid .timesheet-cell.has-late { min-width: 0; font-size: 10.5px; padding: 2px 0; }
#timesheet-grid .timesheet-late-badge { font-size: 9px; margin-top: 2px; white-space: normal; }
@media (min-width: 960px) and (max-width: 1100px) and (max-height: 820px) {
  #main.timesheet-view { padding-top: 5px; }
  #main.timesheet-view .page-heading { padding-block: 2px; margin-bottom: 5px; }
  #main.timesheet-view #page-title { font-size: 24px; }
  .timesheet-guide > summary { padding-block: 3px; }
  #timesheet-grid .timesheet-person button, #timesheet-grid .timesheet-cell { min-height: 28px; }
  #timesheet-grid .timesheet-group th { height: 18px; }
}
@media (min-width: 1400px) and (min-height: 820px) {
  @container (min-width: 1200px) {
    #timesheet-grid .timesheet-person button, #timesheet-grid .timesheet-cell {
      min-height: clamp(32px, calc(4.5vh - 5px), 42px);
      font-size: 14px;
    }
    #timesheet-grid .timesheet-cell.has-late { font-size: 12px; }
    #timesheet-grid .timesheet-late-badge { font-size: 10.5px; }
    #timesheet-grid .timesheet-group th { height: 22px; font-size: 12px; }
  }
}
.timesheet-weeks { display: flex; flex-wrap: wrap; gap: 3px; margin: 4px 0 7px; }
.timesheet-weeks button {
  flex: 1 1 auto;
  padding: 5px 7px;
  min-height: 36px;
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  border: 1px solid #714866;
  border-radius: 6px;
  background: #352036;
  color: #f2d7e7;
}
.timesheet-weeks button[aria-pressed="true"] { color: #09292c; background: #55e6d6; border-color: #55e6d6; font-weight: 650; }
.timesheet-weeks button:focus-visible, .timesheet-guide summary:focus-visible, .timesheet-person-totals summary:focus-visible {
  outline: 2px solid #ffdc29;
  outline-offset: 1px;
}
@media (max-width: 700px), (orientation: landscape) and (pointer: coarse) and (max-height: 500px) and (max-width: 960px) {
  #main.timesheet-view {
    padding: 4px max(8px, env(safe-area-inset-right)) calc(82px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  #main.timesheet-view .page-heading { padding: 5px 0; margin-bottom: 6px; }
  .timesheet-controls .timesheet-toolbar { justify-content: flex-start; }
  .timesheet-controls .timesheet-toolbar-actions .refresh-button { margin-left: 0; }
  #timesheet-grid[data-span="7"] .timesheet-person { padding-inline: 4px; }
  #timesheet-grid .timesheet-person button { font-size: 11px; }
  #timesheet-grid .timesheet-cell, #timesheet-grid .timesheet-person button { min-height: 40px; }
}


/* Department selection belongs to the editors' mobile timesheet. */
.timesheet-departments {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin: 0 0 8px;
}
.timesheet-departments button {
  min-width: 0;
  min-height: 40px;
  padding: 6px 3px;
  border: 1px solid #935776;
  border-radius: 7px;
  background: #341c33;
  color: #fbe5f0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.timesheet-departments button[aria-pressed="true"] {
  border-color: #fb91bc;
  background: #702b53;
  box-shadow: inset 0 -3px #ff92c0;
  color: #fff4f9;
}
.timesheet-departments button:disabled { border-color: #513247; color: #ac93a2; background: #281728; }
.timesheet-departments button:focus-visible { outline: 2px solid #ffdc29; outline-offset: 1px; }
@media (max-width: 410px) {
  .timesheet-departments { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


.login-entry-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}
.login-entry-actions > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  text-decoration: none;
}

.app-shell:has(.login-entry-actions) + .mobile-nav { display: none; }
@media (max-height: 520px) and (max-width: 960px) {
  #main:has(.login-entry-actions) .page-heading { display: none; }
}

.trend-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
}
.trend-modes { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--gta-line); border-radius: 9px; }
.trend-modes button {
  min-height: 34px;
  padding: 4px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.trend-modes button[aria-pressed="true"] { background: var(--gta-cyan); color: #151224; font-weight: 700; }
.trend-series button.trend-column {
  display: block;
  min-width: 0;
  height: calc(var(--plot-height) + 25px);
  padding: 0;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.trend-series button.trend-column svg { position: absolute; top: 0; left: 50%; transform: translateX(-50%); }
.trend-series button.trend-column[aria-pressed="true"] svg { fill: var(--gta-cyan); }
.trend-series button.trend-column:focus-visible { outline: 2px solid var(--gta-warn, #ffd58e); outline-offset: -2px; }
.trend-series button.trend-column .trend-date {
  position: absolute;
  top: var(--plot-height);
  left: 50%;
  transform: translateX(-50%);
  padding-inline: 0;
  white-space: nowrap;
}
.trend-series button.trend-column .trend-unknown {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0;
  color: var(--gta-warn, #ffd58e);
}
.trend-series button.trend-column[aria-pressed="true"] {
  background: rgb(48 241 226 / 9%);
  box-shadow: inset 0 -2px var(--gta-cyan);
}
.trend-series.trend-days { width: 100%; grid-auto-columns: minmax(0, 1fr); touch-action: pan-y pinch-zoom; }
.trend-series.trend-days-long { width: max-content; grid-auto-columns: minmax(16px, 1fr); touch-action: auto; }
.trend-days .trend-column:nth-child(2) .trend-date { left: 0; transform: none; }
.trend-days .trend-column:last-child .trend-date { right: 0; left: auto; transform: none; }
.trend-days .trend-column:nth-child(2):last-child .trend-date { left: 50%; right: auto; transform: translateX(-50%); }
.trend-inspector {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  align-items: start;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--gta-line);
}
.trend-selection { font-size: 13px; }
.trend-selection-date { line-height: 1.8; }
.trend-selection dl { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 6px 0 0; }
.trend-selection dt { color: var(--gta-muted); font-size: 12px; }
.trend-selection dd { margin: 3px 0 0; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.trend-steps { display: flex; gap: 4px; }
.trend-steps .icon-button { width: 40px; height: 40px; color: var(--gta-cyan); }
.trend-steps .icon-button:disabled { opacity: .35; }
.trend-details td { overflow-wrap: anywhere; }
.trend-details table:has(th:nth-child(3)) :is(th,td):not(:first-child) { text-align: right; white-space: normal; }
html:has(#mobile-earnings-views:not([hidden])) { scrollbar-gutter: stable; }
.workspace:has(#mobile-earnings-views:not([hidden])) {
  min-height: calc(100vh + var(--report-tab-offset, 0px));
}
.earnings-report-controls {
  display: grid;
  justify-items: start;
  gap: 8px;
}
.earnings-report-controls:has(> :not([hidden])) { margin-bottom: 12px; }

.mobile-earnings-views {
  display: none;
}

.mobile-earnings-views:not([hidden]) {
  display: grid;
  width: fit-content;
  max-width: 100%;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 3px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--gta-line);
  border-radius: 9px;
  background: var(--gta-deep);
}

.mobile-earnings-views > button {
  min-width: 0;
  min-height: 44px;
  padding: 5px 18px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--gta-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.mobile-earnings-views > button[hidden] { display: none; }
.mobile-earnings-views > button[aria-pressed="true"] {
  color: #151224;
  background: var(--gta-cyan);
}
.mobile-earnings-views > button:focus-visible {
  outline: 2px solid var(--gta-warn);
  outline-offset: -3px;
}
.mobile-earnings-views > button[aria-pressed="true"]:focus-visible {
  outline-color: #151224;
}

@media (max-width: 700px), (orientation: landscape) and (pointer: coarse) and (max-height: 500px) and (max-width: 960px) {
  .earnings-report-controls { justify-items: stretch; }
  .mobile-earnings-views:not([hidden]) { width: auto; }
  .mobile-earnings-views > button { padding-inline: 4px; }
  .mobile-nav,
  .mobile-nav.has-activity {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 3px;
    padding-inline: max(6px, env(safe-area-inset-left)) max(6px, env(safe-area-inset-right));
  }
  .mobile-nav .nav-item,
  .mobile-nav.has-activity .nav-item {
    max-width: none;
    font-size: clamp(11px, 3vw, 13px);
    letter-spacing: normal;
  }
}
