/*
    Themes.css - the Scheduler's selectable themes: Graphite, Daylight and Navy & Hi-Vis.

    PURELY ADDITIVE, like Modern.css and Chrome-Neutral.css. With no theme picked (Classic) the only
    rules in this file that apply are the Theme screen's own, at the bottom. To remove the themes
    altogether, remove this file's <link> from index.html.

    How a theme is switched on
      Scripts/Utils/Util.Theme.js puts two classes on <html> before first paint:

          totm-theme                 every shared rule below hangs off this one
          totm-theme-<id>            the palette: nothing but custom properties

      The choice is per browser (localStorage "totm-theme"), the same shape as Dark Mode. Dark Mode
      (Chrome-Neutral.css) and a theme are never on together: Util.Theme.js holds the theme back
      while Dark Mode is on, so nothing here needs a .totm-chrome-neutral case.

    Adding a theme
      1. Add a palette block below that sets every --th-* property the three existing ones set.
      2. Add it to THEMES in Util.Theme.js.
      That is all. No shared rule names a theme.

    Two rules this file keeps to
      1. Every shared selector starts with :where(.totm-theme). :where() adds no specificity, so a
         themed rule weighs exactly what the Classic rule it replaces weighs and wins only by loading
         last. Every exception the Classic sheets already make (the amber "unposted" button, the
         offline header, a status colour) therefore still beats it, exactly as it beats Classic.
         This sheet must stay the LAST stylesheet in index.html for that to hold.
      2. !important appears only where the rule being replaced already carries it.

    What is deliberately left alone
      - Job status and booking colours (Colours.css, and each tenant's own). They carry meaning.
      - Warning and error fills (unposted transactions, held files, the offline header).
      - The phone sketches on the Mobile settings screens: they show the Mobile app's colours.

    New Scheduler CSS should use var(--totm-brand) and the other --totm-* tokens rather than a
    literal #1976D2. Each palette redefines those tokens, so token-based rules follow the theme with
    nothing added here; a literal blue needs a line in the "Accent sweep" section.
*/


/* ===========================================================================
   Palettes
   =========================================================================== */

/* Graphite - one dark, neutral frame; blue only on things you can act on. */
.totm-theme-graphite {
    --th-canvas: #EEF0F3;
    --th-panel: #FFFFFF;
    --th-card: #FFFFFF;
    --th-subtle: #F6F7F9;
    --th-text: #18202B;
    --th-muted: #5B6676;
    --th-line: #E4E7EC;
    --th-line-faint: #EEF0F3;
    --th-line-strong: #CDD3DB;
    --th-out-of-hours: #F3F4F6;

    --th-accent: #1769C7;
    --th-accent-hover: #1257A8;
    --th-accent-fg: #FFFFFF;
    --th-accent-tint: #E8F1FB;
    --th-cta: #1769C7;
    --th-cta-hover: #1257A8;
    --th-cta-fg: #FFFFFF;
    --th-selected-bg: #1B2430;
    --th-selected-fg: #FFFFFF;
    --th-selected-border: #1B2430;
    --th-date-bg: var(--th-accent);
    --th-date-fg: #FFFFFF;
    --th-quiet-fg: #18202B;
    --th-quiet-hover: #EEF0F3;

    --th-header-bg: #1B2430;
    --th-header-fg: #FFFFFF;
    --th-header-muted: #A8B3C2;
    --th-header-chip: rgba(255, 255, 255, .07);
    --th-header-chip-hover: rgba(255, 255, 255, .16);
    --th-header-chip-border: rgba(255, 255, 255, .10);
    --th-header-chip-fg: #D5DCE6;
    --th-header-edge: none;

    --th-bar-bg: #2A3544;
    --th-bar-fg: #FFFFFF;
    --th-bar-border: #1B2430;
    --th-bar-btn-bg: rgba(255, 255, 255, .06);
    --th-bar-btn-hover: rgba(255, 255, 255, .18);
    --th-bar-btn-fg: #E3E8EF;
    --th-bar-btn-border: rgba(255, 255, 255, .18);
    --th-heading-size: 11px;
    --th-heading-case: uppercase;
    --th-heading-tracking: .08em;

    --th-radius: 3px;
    --th-radius-card: 3px;
    --th-radius-dialog: 4px;
    --th-spine: 5px;
    --th-card-shadow: none;

    --th-thead-bg: #F6F7F9;
    --th-thead-fg: #5B6676;
    --th-status-bg: #F6F7F9;
    --th-status-fg: #5B6676;

    --th-menu-bg: #1B2430;
    --th-menu-fg: #E6EBF2;
    --th-menu-muted: #8A96A8;
    --th-menu-line: rgba(255, 255, 255, .08);
    --th-menu-hover: rgba(255, 255, 255, .08);
    --th-menu-input: rgba(255, 255, 255, .07);
    --th-tip-bg: #0F1720;
}

/* Daylight - white chrome, soft corners, the logo in its own colours. */
.totm-theme-daylight {
    --th-canvas: #F2F4F7;
    --th-panel: #FFFFFF;
    --th-card: #FFFFFF;
    --th-subtle: #F9FAFB;
    --th-text: #101828;
    --th-muted: #667085;
    --th-line: #EAECF0;
    --th-line-faint: #F2F4F7;
    --th-line-strong: #D0D5DD;
    --th-out-of-hours: #F7F8FA;

    --th-accent: #1570EF;
    --th-accent-hover: #175CD3;
    --th-accent-fg: #FFFFFF;
    --th-accent-tint: #EFF6FF;
    --th-cta: #1570EF;
    --th-cta-hover: #175CD3;
    --th-cta-fg: #FFFFFF;
    --th-selected-bg: #EFF6FF;
    --th-selected-fg: #175CD3;
    --th-selected-border: #84ADFF;
    --th-date-bg: var(--th-accent);
    --th-date-fg: #FFFFFF;
    --th-quiet-fg: #344054;
    --th-quiet-hover: #F2F4F7;

    --th-header-bg: #FFFFFF;
    --th-header-fg: #101828;
    --th-header-muted: #667085;
    --th-header-chip: #FFFFFF;
    --th-header-chip-hover: #F2F4F7;
    --th-header-chip-border: #E4E7EC;
    --th-header-chip-fg: #475467;
    --th-header-edge: 0 1px 0 #E4E7EC, 0 1px 3px rgba(16, 24, 40, .06);

    --th-bar-bg: #FFFFFF;
    --th-bar-fg: #101828;
    --th-bar-border: #EAECF0;
    --th-bar-btn-bg: #FFFFFF;
    --th-bar-btn-hover: #F2F4F7;
    --th-bar-btn-fg: #475467;
    --th-bar-btn-border: #D0D5DD;
    --th-heading-size: 14px;
    --th-heading-case: none;
    --th-heading-tracking: -0.01em;

    --th-radius: 6px;
    --th-radius-card: 8px;
    --th-radius-dialog: 12px;
    --th-spine: 4px;
    --th-card-shadow: 0 1px 2px rgba(16, 24, 40, .06);

    --th-thead-bg: #F9FAFB;
    --th-thead-fg: #667085;
    --th-status-bg: #FFFFFF;
    --th-status-fg: #667085;

    --th-menu-bg: #FFFFFF;
    --th-menu-fg: #101828;
    --th-menu-muted: #667085;
    --th-menu-line: #EAECF0;
    --th-menu-hover: #F2F4F7;
    --th-menu-input: #F9FAFB;
    --th-tip-bg: #101828;
}

/* Navy & Hi-Vis - the brand blue grown up into navy; amber is the one thing to do next. */
.totm-theme-navy {
    --th-canvas: #EAF0F7;
    --th-panel: #FFFFFF;
    --th-card: #FFFFFF;
    --th-subtle: #F3F6FA;
    --th-text: #0B1F3A;
    --th-muted: #55657D;
    --th-line: #DDE5EF;
    --th-line-faint: #EBF0F6;
    --th-line-strong: #BFCBDB;
    --th-out-of-hours: #F1F5FA;

    --th-accent: #0F4C9A;
    --th-accent-hover: #0B3B7A;
    --th-accent-fg: #FFFFFF;
    --th-accent-tint: #E6EEF9;
    --th-cta: #F5A524;
    --th-cta-hover: #E0931A;
    --th-cta-fg: #0B1F3A;
    --th-selected-bg: #0B2545;
    --th-selected-fg: #FFFFFF;
    --th-selected-border: #0B2545;
    --th-date-bg: #0B2545;
    --th-date-fg: #FFFFFF;
    --th-quiet-fg: #0F4C9A;
    --th-quiet-hover: #E6EEF9;

    --th-header-bg: #0B2545;
    --th-header-fg: #FFFFFF;
    --th-header-muted: #A9BAD3;
    --th-header-chip: rgba(255, 255, 255, .08);
    --th-header-chip-hover: rgba(255, 255, 255, .18);
    --th-header-chip-border: rgba(255, 255, 255, .12);
    --th-header-chip-fg: #DCE6F4;
    --th-header-edge: inset 0 -3px 0 #F5A524;

    --th-bar-bg: #E6EEF9;
    --th-bar-fg: #0B2545;
    --th-bar-border: #BFCBDB;
    --th-bar-btn-bg: #FFFFFF;
    --th-bar-btn-hover: #D7E3F4;
    --th-bar-btn-fg: #0F4C9A;
    --th-bar-btn-border: #BFCBDB;
    --th-heading-size: 12px;
    --th-heading-case: uppercase;
    --th-heading-tracking: .07em;

    --th-radius: 4px;
    --th-radius-card: 5px;
    --th-radius-dialog: 6px;
    --th-spine: 5px;
    --th-card-shadow: 0 1px 2px rgba(11, 37, 69, .08);

    --th-thead-bg: #E6EEF9;
    --th-thead-fg: #0B2545;
    --th-status-bg: #0B2545;
    --th-status-fg: #DCE6F4;

    --th-menu-bg: #0B2545;
    --th-menu-fg: #E3ECF8;
    --th-menu-muted: #8FA5C4;
    --th-menu-line: rgba(255, 255, 255, .10);
    --th-menu-hover: rgba(255, 255, 255, .10);
    --th-menu-input: rgba(255, 255, 255, .09);
    --th-tip-bg: #0B2545;
}

/* The app-wide tokens (Modern.css :root) follow the palette, so every token-based screen - the
   Settings hub, Customer history, the tour, the new calendar - is themed with no rule of its own. */
.totm-theme-graphite,
.totm-theme-daylight,
.totm-theme-navy {
    --totm-brand: var(--th-accent);
    --totm-brand-ink: var(--th-accent-hover);
    --totm-brand-tint: var(--th-accent-tint);
    --totm-border: var(--th-line);
    --totm-border-strong: var(--th-line-strong);
    --totm-text: var(--th-text);
    --totm-text-muted: var(--th-muted);
}


/* ===========================================================================
   Page and app header
   =========================================================================== */

:where(.totm-theme),
:where(.totm-theme) body {
    background: var(--th-canvas);
    color: var(--th-text);
}

/* background-color only, and not !important: .HeaderOffline (#999 !important) must still win. */
:where(.totm-theme) #SchedulerHeader {
    background-color: var(--th-header-bg);
    box-shadow: var(--th-header-edge);
    margin-bottom: 0;
    position: relative;
    z-index: 5;
}

/* One line, always. At Classic's 21px bold a two-word company name wrapped and was clipped by
   the 40px header. */
:where(.totm-theme) #HeaderBar_CompanyName {
    color: var(--th-header-fg);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 40px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 0 0 14px;
    margin: 0;
}

:where(.totm-theme) #HeaderCompanyPanel label {
    color: var(--th-header-muted);
    font-size: 12px;
    font-weight: 500;
}

:where(.totm-theme) #HeaderCompanyPanel select {
    border: 1px solid var(--th-header-chip-border);
    background-color: var(--th-header-chip);
    color: var(--th-header-fg);
    border-radius: var(--th-radius);
    height: 28px;
}

    :where(.totm-theme) #HeaderCompanyPanel select option {
        color: #111;
        background-color: #fff;
    }

/* The header's chips. Same selectors, same weight, as Modern.css's translucent-chip rule, so the
   two "there is a problem" buttons (#UnpostedTransactionsButton, #HeldJobFilesButton) keep the
   warning fill their own, heavier rule gives them. */
:where(.totm-theme) #SchedulerHeader button,
:where(.totm-theme) #SchedulerHeader input[type=button],
:where(.totm-theme) #HeaderMiddlePanel button {
    background-color: var(--th-header-chip) !important;
    color: var(--th-header-chip-fg) !important;
    box-shadow: inset 0 0 0 1px var(--th-header-chip-border);
    border-radius: var(--th-radius) !important;
}

    :where(.totm-theme) #SchedulerHeader button:hover,
    :where(.totm-theme) #SchedulerHeader input[type=button]:hover,
    :where(.totm-theme) #HeaderMiddlePanel button:hover {
        background-color: var(--th-header-chip-hover) !important;
        color: var(--th-header-fg) !important;
    }

/* Classic's icon row is 36px tall from 2px down, i.e. down to 1px off the header's bottom edge.
   Navy & Hi-Vis draws its amber rule in the bottom 3px of the header, so the solid amber warning
   chips (Unposted Transactions, Files Not Uploaded) covered it and seemed to run into it; the
   translucent chips only hid it less obviously. Centred at 30px they clear it in every theme and
   sit with the 26px Logout/search/help/menu buttons on the right. */
:where(.totm-theme) #HeaderMiddlePanel button {
    height: 30px;
    margin-top: 0;
}

/* The header "?" is an <a>, so the button rules above never reach it. */
:where(.totm-theme) #HelpButton {
    background-color: var(--th-header-chip);
    color: var(--th-header-chip-fg) !important;
    box-shadow: inset 0 0 0 1px var(--th-header-chip-border);
    border-radius: var(--th-radius);
}

    :where(.totm-theme) #HelpButton:hover {
        background-color: var(--th-header-chip-hover) !important;
        color: var(--th-header-fg) !important;
    }

:where(.totm-theme) #TradieHeader {
    height: 22px;
    margin-top: 3px;
}


/* ===========================================================================
   Bars: the calendar toolbar, pane headings and dialog title bars
   =========================================================================== */

:where(.totm-theme) .SectionHeading,
:where(.totm-theme) .cal-toolbar,
:where(.totm-theme) .fc-toolbar {
    background: var(--th-bar-bg);
    border-bottom: 1px solid var(--th-bar-border);
    color: var(--th-bar-fg);
}

:where(.totm-theme) .SectionHeading h2,
:where(.totm-theme) #SettingsDialogHeader {
    color: var(--th-bar-fg);
    font-size: var(--th-heading-size);
    font-weight: 600;
    text-transform: var(--th-heading-case);
    letter-spacing: var(--th-heading-tracking);
}

:where(.totm-theme) .cal-title,
:where(.totm-theme) .fc-toolbar h2 {
    color: var(--th-bar-fg);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* The toolbar's "Hide weekends" / "Show times" checkboxes. Scheduler.css paints their labels white
   for Classic's blue bar, which vanishes on a theme's lighter bar (Daylight's is white). */
:where(.totm-theme) .HideWeekendsCheckboxLabel,
:where(.totm-theme) .ShowDayTimesCheckboxLabel {
    color: var(--th-bar-fg);
}

/* Buttons that sit on a bar. Their edge is an inset ring rather than a border: Classic's buttons
   have no border, and a ring leaves every one of them exactly the size it was. */
:where(.totm-theme) .cal-btn,
:where(.totm-theme) .fc-toolbar button,
:where(.totm-theme) .SectionHeading button,
:where(.totm-theme) .SectionHeading .HelpButton,
:where(.totm-theme) #SettingsDialogHeaderButtonContainer button {
    background-color: var(--th-bar-btn-bg) !important;
    color: var(--th-bar-btn-fg) !important;
    border-radius: var(--th-radius) !important;
    box-shadow: inset 0 0 0 1px var(--th-bar-btn-border);
}

/* The in-house calendar's buttons do have a border of their own (Calendar.css); it takes the
   ring's place. */
:where(.totm-theme) .cal-btn {
    border-color: var(--th-bar-btn-border);
    box-shadow: none;
}

    :where(.totm-theme) .cal-btn:hover,
    :where(.totm-theme) .fc-toolbar button:hover,
    :where(.totm-theme) .SectionHeading button:hover,
    :where(.totm-theme) .SectionHeading .HelpButton:hover,
    :where(.totm-theme) #SettingsDialogHeaderButtonContainer button:hover {
        background-color: var(--th-bar-btn-hover) !important;
        color: var(--th-bar-fg) !important;
    }

/* The one filled button on the Jobs List bar. */
:where(.totm-theme) .SectionHeading button#CreateJobButton {
    background-color: var(--th-cta) !important;
    color: var(--th-cta-fg) !important;
    box-shadow: none;
}

    :where(.totm-theme) .SectionHeading button#CreateJobButton:hover {
        background-color: var(--th-cta-hover) !important;
        color: var(--th-cta-fg) !important;
    }


/* ===========================================================================
   Buttons

   Classic paints every button the same solid blue (Scheduler.css: `button, input[type=button]`,
   !important). The themes keep that as the meaning of a filled button - the thing to do - and
   give everything else an outline. A button is quiet when it carries .TotmSecondaryButton, or
   is one of the named ones below. The outline is an inset ring, not a border, so a quiet button
   is the same size as the filled one beside it.
   =========================================================================== */

/* Not Google's own buttons in the map - see the same exclusion on Scheduler.css's base rule. */
:where(.totm-theme) button:not(:where(.gm-style button, #UserMapActualMap button)),
:where(.totm-theme) input[type=button] {
    background-color: var(--th-accent) !important;
    color: var(--th-accent-fg) !important;
    border-radius: var(--th-radius) !important;
}

:where(.totm-theme) button:not(:where(.gm-style button, #UserMapActualMap button)):hover,
:where(.totm-theme) input[type=button]:hover {
    background-color: var(--th-accent-hover) !important;
}

:where(.totm-theme) button:disabled,
:where(.totm-theme) input[type=button]:disabled {
    opacity: .55;
    cursor: default;
}

:where(.totm-theme) .JobDetailsAttachmentButton {
    background-color: var(--th-accent);
    border-radius: var(--th-radius) !important;
}

    :where(.totm-theme) .JobDetailsAttachmentButton:hover {
        background-color: var(--th-accent-hover);
    }

/* Quiet buttons. */
:where(.totm-theme) button.TotmSecondaryButton,
:where(.totm-theme) input.TotmSecondaryButton,
:where(.totm-theme) button.TimesheetPdfButton,
:where(.totm-theme) button.TimesheetSignOffButton,
:where(.totm-theme) button.PayHeroExportOpenButton,
:where(.totm-theme) button.SmartlyExportOpenButton,
:where(.totm-theme) button.ProductFilterToggle,
:where(.totm-theme) button.AddUserCalendarButton,
:where(.totm-theme) #TimesheetDatesCollection button,
:where(.totm-theme) .UserTable button.fa,
:where(.totm-theme) #ClearSearchButton,
:where(.totm-theme) #ToggleFilterDropDownArea,
:where(.totm-theme) #NewJobCancelButton,
:where(.totm-theme) #JobDetailsAttachmentBrowseButton,
:where(.totm-theme) #JobInformationArea input[type=button] {
    background-color: var(--th-panel) !important;
    color: var(--th-quiet-fg) !important;
    box-shadow: inset 0 0 0 1px var(--th-line-strong);
}

    :where(.totm-theme) button.TotmSecondaryButton:hover,
    :where(.totm-theme) input.TotmSecondaryButton:hover,
    :where(.totm-theme) button.TimesheetPdfButton:hover,
    :where(.totm-theme) button.TimesheetSignOffButton:hover,
    :where(.totm-theme) button.PayHeroExportOpenButton:hover,
    :where(.totm-theme) button.SmartlyExportOpenButton:hover,
    :where(.totm-theme) button.ProductFilterToggle:hover,
    :where(.totm-theme) button.AddUserCalendarButton:hover,
    :where(.totm-theme) #TimesheetDatesCollection button:hover,
    :where(.totm-theme) .UserTable button.fa:hover,
    :where(.totm-theme) #ClearSearchButton:hover,
    :where(.totm-theme) #ToggleFilterDropDownArea:hover,
    :where(.totm-theme) #NewJobCancelButton:hover,
    :where(.totm-theme) #JobDetailsAttachmentBrowseButton:hover,
    :where(.totm-theme) #JobInformationArea input[type=button]:hover {
        background-color: var(--th-quiet-hover) !important;
    }

/* A Rapid Fire button's status-colour strip (Modern.css) - the outline rule above sets box-shadow
   for its ring at the same weight, so both are restated here, after it. */
:where(.totm-theme) #JobInformationArea input[type=button].SchedulerStatusButtonColoured {
    box-shadow: inset 4px 0 0 var(--totm-status-colour), inset 0 0 0 1px var(--th-line-strong);
}

/* The chosen week on Timesheets: a selected segment, not a link. */
:where(.totm-theme) #TimesheetDatesCollection button.TimesheetDatesCollectionSelectedItem,
:where(.totm-theme) #TimesheetDatesCollection button.TimesheetDatesCollectionSelectedItem:hover {
    background-color: var(--th-selected-bg) !important;
    color: var(--th-selected-fg) !important;
    box-shadow: inset 0 0 0 1px var(--th-selected-border);
    text-decoration: none;
}

/* Modern.css already makes these two an outline; they only need the palette. */
:where(.totm-theme) input.FormFooterControl#SettingsDialogCancelButton,
:where(.totm-theme) input.FormFooterControl#ConfirmActionScreenNoButton {
    background-color: var(--th-panel) !important;
    color: var(--th-quiet-fg) !important;
    border: 1px solid var(--th-line-strong) !important;
}

    :where(.totm-theme) input.FormFooterControl#SettingsDialogCancelButton:hover,
    :where(.totm-theme) input.FormFooterControl#ConfirmActionScreenNoButton:hover {
        background-color: var(--th-quiet-hover) !important;
    }


/* ---------------------------------------------------------------------------
   Exceptions that tie with the four base rules above

   The base button rules above weigh the same as the Classic rules they replace, so anything
   heavier still beats them. But a Classic exception that weighs EXACTLY the same as its base
   rule, and wins only because it comes later in the file, would now lose - this sheet comes after
   everything. These are all of them (button and input rules at (0,1,1), input:hover rules at
   (0,2,1)), each restated here so it comes later again. Colours that carry meaning are restated
   as they are; ordinary fills take the palette.

   Adding a Classic rule of the shape `input.Something` or `button.Something` that sets an
   !important fill? It needs a line here too, or a theme repaints it.
   --------------------------------------------------------------------------- */

/* Block is red and Unblock is green in every theme: that is what they mean. */
:where(.totm-theme) input.UserBlockButton {
    background-color: #c0392b !important;
    color: #fff !important;
}

    :where(.totm-theme) input.UserBlockButton:hover {
        background-color: #a5281a !important;
    }

:where(.totm-theme) input.UserUnblockButton {
    background-color: #27795b !important;
    color: #fff !important;
}

    :where(.totm-theme) input.UserUnblockButton:hover {
        background-color: #1f5f47 !important;
    }

:where(.totm-theme) input.CreateBookingPrimaryButton {
    background-color: var(--th-accent) !important;
    color: var(--th-accent-fg) !important;
}

    :where(.totm-theme) input.CreateBookingPrimaryButton:hover {
        background-color: var(--th-accent-hover) !important;
    }

:where(.totm-theme) input.CreateBookingSecondaryButton {
    background-color: var(--th-panel) !important;
    color: var(--th-quiet-fg) !important;
}

    :where(.totm-theme) input.CreateBookingSecondaryButton:hover {
        background-color: var(--th-quiet-hover) !important;
    }

/* Link-style and card-style buttons with no hover rule of their own: in Classic their fill also
   holds while hovered, because it comes after `button:hover`. Same selectors, so same weight. */
:where(.totm-theme) button.JacLnUnlink,
:where(.totm-theme) button.JacLinkUnlink,
:where(.totm-theme) button.JacLinkClose {
    background-color: transparent !important;
}

:where(.totm-theme) button.CifLink {
    background: none !important;
}

:where(.totm-theme) button.JacJobStep,
:where(.totm-theme) button.JacJobMatters,
:where(.totm-theme) button.UpcomingWorkRow {
    background-color: var(--th-panel) !important;
}


/* ===========================================================================
   Date strip
   =========================================================================== */

:where(.totm-theme) #DateQuickLinks {
    background-color: var(--th-panel);
    border-bottom: 1px solid var(--th-line);
}

    :where(.totm-theme) #DateQuickLinks :hover {
        background-color: transparent;
        color: inherit;
    }

:where(.totm-theme) .DateQuickLinkButton {
    border-right-color: transparent;
    border-radius: var(--th-radius);
}

:where(.totm-theme) #DateQuickLinks .DateQuickLinkButton:hover {
    background-color: var(--th-accent-tint);
}

    :where(.totm-theme) #DateQuickLinks .DateQuickLinkButton:hover .DateQuickLinkDayName,
    :where(.totm-theme) #DateQuickLinks .DateQuickLinkButton:hover .DateQuickLinkDateNumber {
        color: var(--th-text);
    }

:where(.totm-theme) .DateQuickLinkDayName {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--th-muted);
}

:where(.totm-theme) .DateQuickLinkDateNumber {
    font-size: 15px;
    font-weight: 600;
    line-height: 22px;
    color: var(--th-text);
}

:where(.totm-theme) .DateQuickLinkButtonSelected {
    background-color: var(--th-date-bg) !important;
    box-shadow: none;
}

    :where(.totm-theme) .DateQuickLinkButtonSelected :hover {
        background-color: transparent !important;
    }

    :where(.totm-theme) #DateQuickLinks .DateQuickLinkButtonSelected .DateQuickLinkDayName,
    :where(.totm-theme) #DateQuickLinks .DateQuickLinkButtonSelected .DateQuickLinkDateNumber,
    :where(.totm-theme) #DateQuickLinks .DateQuickLinkButtonSelected:hover .DateQuickLinkDayName,
    :where(.totm-theme) #DateQuickLinks .DateQuickLinkButtonSelected:hover .DateQuickLinkDateNumber {
        color: var(--th-date-fg);
    }

:where(.totm-theme) .DateQuickLinkButtonHasAllocations {
    border-bottom-color: var(--th-accent);
}


/* ===========================================================================
   Calendar body (the in-house engine; FullCalendar only gets the toolbar above)
   =========================================================================== */

:where(.totm-theme) #CalendarWrapper,
:where(.totm-theme) .cal-root {
    background-color: var(--th-panel);
}

/* #Spacer is styled inline in index.html, which only !important can beat. */
:where(.totm-theme) #Spacer {
    background-color: var(--th-canvas) !important;
}

:where(.totm-theme) .cal-resource-area-header,
:where(.totm-theme) .cal-time-axis,
:where(.totm-theme) .cal-group-row,
:where(.totm-theme) .cal-lane--group {
    background: var(--th-subtle);
}

:where(.totm-theme) .cal-group-row {
    color: var(--th-muted);
    font-size: 11px;
    letter-spacing: .06em;
}

:where(.totm-theme) .cal-resource-cell {
    color: var(--th-text);
    font-size: 13px;
    font-weight: 600;
}

:where(.totm-theme) .cal-slot-label {
    color: var(--th-muted);
    font-weight: 500;
}

/* Quarter hours whisper, hours speak: the grid reads as hours first. */
:where(.totm-theme) .cal-slot-line {
    background: var(--th-line-faint);
}

:where(.totm-theme) .cal-slot-line--hour,
:where(.totm-theme) .cal-slot-line--day {
    background: var(--th-line-strong);
}

:where(.totm-theme) .cal-out-of-hours {
    background: var(--th-out-of-hours);
    opacity: 1;
}

:where(.totm-theme) .cal-event-content {
    border-radius: var(--th-radius);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .18);
}

:where(.totm-theme) .cal-resource-row--highlighted {
    background: var(--th-accent-tint);
}


/* ===========================================================================
   Jobs list
   =========================================================================== */

:where(.totm-theme) #external-events,
:where(.totm-theme) #Details {
    background: var(--th-panel);
    border-left: 1px solid var(--th-line-strong);
}

:where(.totm-theme) #JobSearch {
    border: 1px solid var(--th-line-strong);
    border-radius: var(--th-radius);
    color: var(--th-text);
}

/* Pending / Progress / Admin. jQuery UI's buttonset brings its own font and gradient. */
:where(.totm-theme) #JobsToDisplayToggle label {
    font-family: var(--totm-font);
    font-size: 12px;
    font-weight: 600;
    background: var(--th-panel);
    color: var(--th-muted);
    border: 1px solid var(--th-line-strong);
}

:where(.totm-theme) #JobsToDisplayToggle .ui-state-active,
:where(.totm-theme) #JobsToDisplayToggle input[type="radio"]:checked + label {
    background-color: var(--th-selected-bg) !important;
    color: var(--th-selected-fg) !important;
    border-color: var(--th-selected-border);
}

    :where(.totm-theme) #JobsToDisplayToggle label .ui-button-text {
        color: inherit;
    }

    /* jQuery UI turns a hovered option its own blue, which belongs to no palette here. */
    :where(.totm-theme) #JobsToDisplayToggle label.ui-state-hover {
        color: var(--th-text);
    }

/* A job card: white, dark text, and the status colour as a spine down the left edge rather than
   a 25px slab on the right. Classic's card is a grey slab with white text, which reads as
   disabled. */
:where(.totm-theme) .UnassignedJob {
    background-color: var(--th-card);
    color: var(--th-text);
    border: 1px solid var(--th-line);
    border-radius: var(--th-radius-card);
    box-shadow: var(--th-card-shadow);
    box-sizing: border-box;
    position: relative;
}

    :where(.totm-theme) .UnassignedJob:hover {
        opacity: 1;
        border-color: var(--th-accent);
    }

/* On hold and completed keep saying so: a tint of what Classic paints them, with dark text. */
:where(.totm-theme) .OnHoldUnassignedJob {
    background-color: #FBECEC !important;
    border: 1px solid #E6B8B8 !important;
}

:where(.totm-theme) .CompletedJob {
    background-color: #EAF6EC !important;
    border-color: #A9D8B0 !important;
}

/* Modern.css restores each status fill while a job is highlighted, at (0,2,0) and (0,3,0); the
   themed card has no fill to restore, so the highlight is a tint plus the same ring. */
:where(.totm-theme) .UnassignedJob.HighlightedJob {
    background-color: var(--th-accent-tint) !important;
    border-color: var(--th-accent);
}

:where(.totm-theme) .UnassignedJob.OnHoldUnassignedJob.HighlightedJob {
    background-color: #FBECEC !important;
}

:where(.totm-theme) .UnassignedJob.CompletedJob.HighlightedJob {
    background-color: #EAF6EC !important;
}

:where(.totm-theme) .UnassignedJob .JobStatusIndicator {
    float: none;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--th-spine);
    height: auto;
}

:where(.totm-theme) .UnassignedJob .JobListItemDetailArea {
    padding: 5px 10px 5px 15px;
}

:where(.totm-theme) .UnassignedJob .JobHeadingJobNo {
    font-size: 13px;
    font-weight: 600;
}

:where(.totm-theme) .UnassignedJob .JobHeadingCustomerName,
:where(.totm-theme) .UnassignedJob .JobHeadingSiteAddress {
    width: 100%;
    color: var(--th-muted);
    font-size: 12px;
}


/* ===========================================================================
   Job details pane
   =========================================================================== */

:where(.totm-theme) #JobInformationArea .JobInfoElement {
    border-bottom-color: var(--th-line);
}

:where(.totm-theme) #JobInformationArea .JobInfoElementTitle {
    color: var(--th-muted);
}

:where(.totm-theme) #JobInformationArea .JobInfoElement label,
:where(.totm-theme) #JobInformationArea .JobInfoElement textarea {
    color: var(--th-text);
}

:where(.totm-theme) .JobDetailsAttachmentDropZone {
    border-color: var(--th-line-strong);
    border-radius: var(--th-radius-card);
    background-color: var(--th-subtle);
}


/* ===========================================================================
   Dialogs, fields and tables
   =========================================================================== */

:where(.totm-theme) .ModalDialog {
    background-color: var(--th-panel);
    color: var(--th-text);
    border-radius: var(--th-radius-dialog);
}

    :where(.totm-theme) .ModalDialog > .SectionHeading {
        border-radius: var(--th-radius-dialog) var(--th-radius-dialog) 0 0;
    }

:where(.totm-theme) #SettingWrapperDialog,
:where(.totm-theme) #SettingsDialogContent {
    background-color: var(--th-panel);
}

    :where(.totm-theme) #SettingsDialogContent h2,
    :where(.totm-theme) #SettingsDialogContent h3 {
        color: var(--th-text);
    }

    :where(.totm-theme) #SettingsDialogContent table tr:hover {
        background-color: var(--th-accent-tint);
    }

/* Classic's fields are borderless white boxes on a grey dialog. On a white dialog they need an
   edge of their own. 1px solid, never inset. */
:where(.totm-theme) .ModalDialog input[type=text],
:where(.totm-theme) .ModalDialog input[type=search],
:where(.totm-theme) .ModalDialog input[type=number],
:where(.totm-theme) .ModalDialog input[type=email],
:where(.totm-theme) .ModalDialog input[type=password],
:where(.totm-theme) .ModalDialog input[type=date],
:where(.totm-theme) .ModalDialog input[type=time],
:where(.totm-theme) .ModalDialog input:not([type]),
:where(.totm-theme) .ModalDialog select,
:where(.totm-theme) .ModalDialog textarea {
    border: 1px solid var(--th-line-strong);
    border-radius: var(--th-radius);
    color: var(--th-text);
}

:where(.totm-theme) .ProductFilterBar {
    background-color: var(--th-subtle);
    border: 1px solid var(--th-line);
    border-radius: var(--th-radius-card);
}

:where(.totm-theme) .UserTable thead,
:where(.totm-theme) .BatchTable thead {
    background-color: var(--th-thead-bg);
}

    :where(.totm-theme) .UserTable thead td,
    :where(.totm-theme) .UserTable thead th,
    :where(.totm-theme) .BatchTable thead td,
    :where(.totm-theme) .BatchTable thead th {
        background-color: var(--th-thead-bg);
        color: var(--th-thead-fg);
        border-bottom: 1px solid var(--th-line-strong);
    }

:where(.totm-theme) .UserTable tbody td {
    border-bottom-color: var(--th-line);
}


/* ===========================================================================
   Hamburger menu
   =========================================================================== */

:where(.totm-theme) #HamburgerMenu,
:where(.totm-theme) .HamburgerFilterWrap {
    background-color: var(--th-menu-bg);
    color: var(--th-menu-fg);
}

:where(.totm-theme) #HamburgerHeading {
    border-bottom: 1px solid var(--th-menu-line);
}

    :where(.totm-theme) #HamburgerHeading i {
        color: var(--th-menu-fg);
    }

:where(.totm-theme) #HamburgerFilter {
    background-color: var(--th-menu-input);
    border: 1px solid var(--th-menu-line);
    border-radius: var(--th-radius);
}

:where(.totm-theme) #HamburgerFilterInput {
    color: var(--th-menu-fg);
}

    :where(.totm-theme) #HamburgerFilterInput::placeholder {
        color: var(--th-menu-muted);
    }

:where(.totm-theme) .HamburgerFilterIcon,
:where(.totm-theme) .HamburgerFilterClear,
:where(.totm-theme) #HamburgerFilterCount {
    color: var(--th-menu-muted);
}

/* Classic fills every row with brand blue (!important); here a row is flat until hovered. */
:where(.totm-theme) .HamburgerMenuButton {
    background-color: transparent !important;
    color: var(--th-menu-fg) !important;
    border-color: var(--th-menu-line);
    font-weight: 500 !important;
}

:where(.totm-theme) .HamburgerMenuItem {
    color: var(--th-menu-fg);
    border-color: var(--th-menu-line);
}

:where(.totm-theme) .HamburgerMenuButton:hover,
:where(.totm-theme) .HamburgerMenuItem:hover {
    background-color: var(--th-menu-hover) !important;
}

:where(.totm-theme) .HamburgerButtonIcon,
:where(.totm-theme) .HamburgerText i {
    color: var(--th-menu-muted);
}

:where(.totm-theme) .HamburgerText {
    color: var(--th-menu-fg);
}

:where(.totm-theme) .HamburgerSectionHeader {
    color: var(--th-menu-muted);
    border-color: var(--th-menu-line);
}

    :where(.totm-theme) .HamburgerSectionHeader:hover {
        color: var(--th-menu-fg);
    }

:where(.totm-theme) .HamburgerMenuDivider {
    background-color: var(--th-menu-line);
    border-color: var(--th-menu-line);
}


/* ===========================================================================
   Status bar and tooltip
   =========================================================================== */

:where(.totm-theme) #NotificationBar {
    background-color: var(--th-status-bg);
    border-top: 1px solid var(--th-line-strong);
}

:where(.totm-theme) #NotificationContent {
    color: var(--th-status-fg);
    font-size: 12px;
}

:where(.totm-theme) .totm-tooltip,
:where(.totm-theme) .totm-tooltip-arrow {
    background: var(--th-tip-bg);
}


/* ===========================================================================
   Accent sweep

   Every other place the Classic sheets write the brand blue as a literal, restated against the
   theme's accent, selector for selector. (The ones written var(--totm-brand, #1976D2) need
   nothing: the palettes redefine the token.)
   =========================================================================== */

:where(.totm-theme) .WhiteTextBlueBackground {
    background-color: var(--th-accent) !important;
}

:where(.totm-theme) .SelectableStaffMember:hover,
:where(.totm-theme) .NewJobSelectableResource:hover {
    background-color: var(--th-accent) !important;
}

:where(.totm-theme) .ResourceHoursNumber,
:where(.totm-theme) .TenantOptionLabel:hover,
:where(.totm-theme) .TimesheetTimeBar,
:where(.totm-theme) .BlockedUserTag.StaffUserTag {
    background-color: var(--th-accent);
}

:where(.totm-theme) .ProductFilterSummary,
:where(.totm-theme) .ProductFilterAddRule,
:where(.totm-theme) .TimesheetNoteIcon,
:where(.totm-theme) .TimesheetLunchIcon,
:where(.totm-theme) .TimesheetServiceChargeIcon,
:where(.totm-theme) .TimesheetSignOffIcon,
:where(.totm-theme) .TimesheetOvertimeIcon,
:where(.totm-theme) .TimesheetOvertimeOverriddenIcon,
:where(.totm-theme) .TimesheetEditSubmittedIcon:hover,
:where(.totm-theme) .TimesheetEditSubmittedIcon:focus,
:where(.totm-theme) .UserEditTable tr.UserEditSectionCollapsible:hover .UserEditSectionTitle {
    color: var(--th-accent);
}

:where(.totm-theme) .TimesheetEditSubmittedIcon:focus-visible {
    outline-color: var(--th-accent);
}

:where(.totm-theme) .SaveButtonDirty,
:where(.totm-theme) .SaveButtonDirty:hover,
:where(.totm-theme) .SaveButton:focus {
    color: var(--th-accent) !important;
}

:where(.totm-theme) .SaveButton:focus {
    outline-color: var(--th-accent) !important;
}

:where(.totm-theme) .TimesheetAddRow .AddRowLunchToggle {
    color: var(--th-accent) !important;
    box-shadow: inset 0 0 0 1px var(--th-accent);
}

:where(.totm-theme) .TimesheetAddRow .AddRowLunchToggle.AddRowLunchToggleOn {
    background-color: var(--th-accent) !important;
}

:where(.totm-theme) .CompletedFormsSignedOffBadge {
    background-color: var(--th-accent-tint);
}

:where(.totm-theme) .fc-scroller::-webkit-scrollbar-thumb,
:where(.totm-theme) #TheJobs::-webkit-scrollbar-thumb,
:where(.totm-theme) #JobInformationArea::-webkit-scrollbar-thumb,
:where(.totm-theme) #SettingsDialogContent::-webkit-scrollbar-thumb,
:where(.totm-theme) #SwitchTenantContent::-webkit-scrollbar-thumb {
    background-color: var(--th-line-strong);
}


/* The Mobile Home Screen and Mobile Allocated Jobs settings screens keep their own copy of the
   brand blue for their controls - the selected segment, focus outlines, links. The phone drawn on
   those screens shows the Mobile app's colours through separate properties, which stay as they
   are. */
:where(.totm-theme) #MobileHomeSettingsScreen,
:where(.totm-theme) #MobileJobSettingsScreen,
:where(.totm-theme) .MpsSketchHost {
    --mhs-brand: var(--th-accent);
    --mhs-brand-tint: var(--th-accent-tint);
    --mjs-brand: var(--th-accent);
    --mjs-brand-tint: var(--th-accent-tint);
}


/* ===========================================================================
   The Theme screen (View.ThemePicker.js)

   Not scoped to .totm-theme: this is where a theme is chosen, so it has to work in Classic too.
   Each card previews its own palette by carrying that palette's class, which is why the drawing
   below reads the same --th-* properties the rest of this file does. Classic has no palette
   block, so its card gets the Classic colours spelled out here.
   =========================================================================== */

.ThemePickerClassicPreview {
    --th-canvas: #EEEEEE;
    --th-panel: #FFFFFF;
    --th-card: #777777;
    --th-line: #DCDCDC;
    --th-header-bg: #1976D2;
    --th-bar-bg: #4791DB;
    --th-cta: #1976D2;
    --th-radius: 0;
    --th-radius-card: 0;
}

.ThemePickerIntro {
    margin: 4px 0 14px;
    color: var(--totm-text-muted);
    font-size: var(--totm-fs-sm);
}

.ThemePickerOptions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.ThemePickerOption {
    display: block;
    padding: 10px;
    border: 2px solid var(--totm-border);
    border-radius: 6px;
    background-color: #fff;
    cursor: pointer;
    transition: border-color var(--totm-motion), box-shadow var(--totm-motion);
}

    .ThemePickerOption:hover {
        border-color: var(--totm-border-strong);
        box-shadow: var(--totm-shadow-card);
    }

    .ThemePickerOption.ThemePickerOptionSelected {
        border-color: var(--totm-brand);
    }

    .ThemePickerOption:focus-within {
        outline: 2px solid var(--totm-brand);
        outline-offset: 2px;
    }

    /* The radio is the control; the card is its label. Kept focusable, just not drawn. */
    .ThemePickerOption input[type=radio] {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

.ThemePickerName {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    color: var(--totm-text);
    font-size: 14px;
    font-weight: 600;
}

.ThemePickerInUse {
    display: none;
    color: var(--totm-brand);
    font-size: var(--totm-fs-xs);
    font-weight: 600;
}

.ThemePickerOptionSelected .ThemePickerInUse {
    display: inline;
}

.ThemePickerDescription {
    margin-top: 2px;
    color: var(--totm-text-muted);
    font-size: var(--totm-fs-xs);
    line-height: 1.4;
}

/* The drawing: a header, a bar, three calendar rows and a jobs pane. */
.ThemePickerPreview {
    display: grid;
    grid-template-columns: 1fr 34%;
    grid-template-rows: 12px 10px 1fr;
    height: 108px;
    overflow: hidden;
    border: 1px solid var(--th-line);
    border-radius: 4px;
    background-color: var(--th-panel);
}

.ThemePickerPreviewHeader {
    grid-column: 1 / 3;
    background-color: var(--th-header-bg);
    box-shadow: var(--th-header-edge, none);
}

.ThemePickerPreviewBar {
    grid-column: 1 / 3;
    background-color: var(--th-bar-bg);
    border-bottom: 1px solid var(--th-line);
}

.ThemePickerPreviewCalendar {
    display: grid;
    grid-template-rows: repeat(3, 1fr);
    border-right: 1px solid var(--th-line);
}

    .ThemePickerPreviewCalendar span {
        position: relative;
        border-bottom: 1px solid var(--th-line);
    }

        .ThemePickerPreviewCalendar span::after {
            content: "";
            position: absolute;
            top: 5px;
            bottom: 5px;
            border-radius: var(--th-radius);
        }

        .ThemePickerPreviewCalendar span:nth-child(1)::after { left: 12%; width: 34%; background-color: #3A0CA3; }
        .ThemePickerPreviewCalendar span:nth-child(2)::after { left: 40%; width: 26%; background-color: #F7B500; }
        .ThemePickerPreviewCalendar span:nth-child(3)::after { left: 22%; width: 44%; background-color: #C5E128; }

.ThemePickerPreviewJobs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 5px;
    background-color: var(--th-panel);
}

    .ThemePickerPreviewJobs i {
        height: 9px;
        border-radius: var(--th-radius);
        background-color: var(--th-cta);
    }

    .ThemePickerPreviewJobs span {
        flex: 1 1 0;
        border: 1px solid var(--th-line);
        border-radius: var(--th-radius-card);
        background-color: var(--th-card);
    }
