/* Job Manager colour themes. Loaded after modern-shell.css; picked in Settings > Appearance (see themes.js).
   Each theme is only a set of --jm-* variables. With no data-theme, or data-theme="dark", nothing changes from the original dark look.
   Screen only: printing and PDFs are untouched. */
@media screen {

/* Extra colours derived from each theme's own palette, so a theme only has to define its base colours. */
html[data-theme]:not([data-theme="dark"]) {
  --jm-button: color-mix(in srgb, var(--jm-surface-raised), var(--jm-text) 7%);
  --jm-button-hover: color-mix(in srgb, var(--jm-surface-raised), var(--jm-text) 14%);
  --jm-button-hover-border: color-mix(in srgb, var(--jm-border), var(--jm-text) 22%);
  --jm-input: color-mix(in srgb, var(--jm-bg), var(--jm-surface) 45%);
  --jm-nav-hover: color-mix(in srgb, var(--jm-sidebar), var(--jm-text) 8%);
  --jm-active-bg: color-mix(in srgb, var(--jm-accent) 16%, transparent);
  --jm-account-bg: color-mix(in srgb, var(--jm-sidebar), var(--jm-text) 3%);
  --jm-avatar-bg: color-mix(in srgb, var(--jm-accent) 20%, var(--jm-sidebar));
  --jm-group-label: color-mix(in srgb, var(--jm-text-secondary), var(--jm-sidebar) 20%);
  --jm-badge-bg: color-mix(in srgb, var(--jm-surface), var(--jm-text) 8%);
  --jm-badge-text: var(--jm-text-secondary);
  --jm-topbar: color-mix(in srgb, var(--jm-bg) 96%, transparent);
  --jm-row-hover: color-mix(in srgb, var(--jm-text) 4%, transparent);
  --jm-backdrop: rgba(10, 20, 30, .5);
}

/* --- light themes ---------------------------------------------------------------------------------------- */
html[data-theme="daylight"] { --jm-bg:#eaf1f6; --jm-surface:#ffffff; --jm-surface-raised:#ffffff; --jm-sidebar:#ffffff; --jm-accent:#0a7f9e; --jm-accent-strong:#086b86; --jm-text:#14283a; --jm-text-secondary:#4b6478; --jm-border:#c3d3df; --jm-success:#177a4c; --jm-warning:#96600a; --jm-danger:#c0392b; --jm-on-accent:#ffffff; --jm-scheme:light; --jm-logo-filter:none; }
html[data-theme="sky"]      { --jm-bg:#e3eef7; --jm-surface:#ffffff; --jm-surface-raised:#ffffff; --jm-sidebar:#ffffff; --jm-accent:#0b7a95; --jm-accent-strong:#086880; --jm-text:#15293b; --jm-text-secondary:#4d667a; --jm-border:#b9d0e0; --jm-success:#177a4c; --jm-warning:#96600a; --jm-danger:#c0392b; --jm-on-accent:#ffffff; --jm-scheme:light; --jm-logo-filter:none; }
html[data-theme="sand"]     { --jm-bg:#f2ebdf; --jm-surface:#fffcf6; --jm-surface-raised:#fffcf6; --jm-sidebar:#fffcf6; --jm-accent:#a8692c; --jm-accent-strong:#8a531a; --jm-text:#2b2418; --jm-text-secondary:#6d6248; --jm-border:#d9c9a8; --jm-success:#23703f; --jm-warning:#96600a; --jm-danger:#b83a2e; --jm-on-accent:#ffffff; --jm-scheme:light; --jm-logo-filter:none; }
html[data-theme="sage"]     { --jm-bg:#e4eee9; --jm-surface:#ffffff; --jm-surface-raised:#ffffff; --jm-sidebar:#ffffff; --jm-accent:#177a63; --jm-accent-strong:#0f6350; --jm-text:#152b23; --jm-text-secondary:#4d6b5f; --jm-border:#b4cdc2; --jm-success:#177a4c; --jm-warning:#96600a; --jm-danger:#c0392b; --jm-on-accent:#ffffff; --jm-scheme:light; --jm-logo-filter:none; }
html[data-theme="indigo"]   { --jm-bg:#eaecf3; --jm-surface:#ffffff; --jm-surface-raised:#ffffff; --jm-sidebar:#ffffff; --jm-accent:#4553cc; --jm-accent-strong:#3441b3; --jm-text:#1a2033; --jm-text-secondary:#535b7a; --jm-border:#c3c8de; --jm-success:#177a4c; --jm-warning:#96600a; --jm-danger:#c0392b; --jm-on-accent:#ffffff; --jm-scheme:light; --jm-logo-filter:none; }

/* --- mid-tone and darker themes -------------------------------------------------------------------------- */
html[data-theme="ocean"]    { --jm-bg:#46719a; --jm-surface:#3d6790; --jm-surface-raised:#46739d; --jm-sidebar:#33587e; --jm-accent:#ffd166; --jm-accent-strong:#fff0c0; --jm-text:#ffffff; --jm-text-secondary:#eef5fb; --jm-border:#8fb3d4; --jm-success:#b5f5cf; --jm-warning:#ffe08f; --jm-danger:#ffe0de; --jm-on-accent:#2a2408; --jm-scheme:dark; }
html[data-theme="navy"]     { --jm-bg:#0f1c2e; --jm-surface:#152539; --jm-surface-raised:#1a2d46; --jm-sidebar:#0b1626; --jm-accent:#2ee6ff; --jm-accent-strong:#5ff0ff; --jm-text:#eef8ff; --jm-text-secondary:#a9c0d2; --jm-border:#2b5d80; --jm-success:#3dffa8; --jm-warning:#ffbf47; --jm-danger:#ff6b7e; --jm-on-accent:#062b36; --jm-scheme:dark; }
html[data-theme="slate"]    { --jm-bg:#202a35; --jm-surface:#2a3644; --jm-surface-raised:#304050; --jm-sidebar:#1a222c; --jm-accent:#4fd6c4; --jm-accent-strong:#7de8d9; --jm-text:#f0f5fa; --jm-text-secondary:#b0bfcc; --jm-border:#4a6178; --jm-success:#55d69a; --jm-warning:#efb85c; --jm-danger:#f0787f; --jm-on-accent:#08302b; --jm-scheme:dark; }
html[data-theme="twilight"] { --jm-bg:#1b2145; --jm-surface:#262e5c; --jm-surface-raised:#2d3670; --jm-sidebar:#151a38; --jm-accent:#8fb0ff; --jm-accent-strong:#b5c9ff; --jm-text:#f1f3ff; --jm-text-secondary:#b3bbe6; --jm-border:#4a559a; --jm-success:#6ee0a4; --jm-warning:#f0c060; --jm-danger:#ff8590; --jm-on-accent:#0f1a45; --jm-scheme:dark; }
html[data-theme="bronze"]   { --jm-bg:#24272c; --jm-surface:#30343b; --jm-surface-raised:#383d45; --jm-sidebar:#1c1f23; --jm-accent:#e0a45a; --jm-accent-strong:#f0bd7c; --jm-text:#f6f1e8; --jm-text-secondary:#c4b9a6; --jm-border:#5f5545; --jm-success:#7ed4a0; --jm-warning:#f0c060; --jm-danger:#f08078; --jm-on-accent:#3a2508; --jm-scheme:dark; }

/* --- apply the variables where modern-shell.css hard-codes a colour (each falls back to the original dark value) ----- */
:root:has(.shell), :root:has(.auth) { color-scheme: var(--jm-scheme, dark); }
.nav-group-label { color: var(--jm-group-label, #667680); }
.shell .sidebar .nav-item:hover { background: var(--jm-nav-hover, #15222b); }
.shell .sidebar .nav-item.active { background: var(--jm-active-bg, rgba(47,181,170,.12)); }
.sidebar-brand img { filter: var(--jm-logo-filter, grayscale(1) brightness(0) invert(1)); opacity: 1; }
.sidebar-account { background: var(--jm-account-bg, #0a1117); }
.account-avatar { background: var(--jm-avatar-bg, #21333a); }
.topbar { background: var(--jm-topbar, rgba(17,24,32,.96)); }
.shell button, dialog button, .auth button, .button-link { background: var(--jm-button, #202c36); }
.shell button:hover:not(:disabled), dialog button:hover:not(:disabled), .auth button:hover:not(:disabled) { background: var(--jm-button-hover, #273640); border-color: var(--jm-button-hover-border, #40515e); }
.shell button.primary, dialog button.primary, .auth button.primary { color: var(--jm-on-accent, #071312); }
.shell button.primary { background: var(--jm-accent); }
.shell button.primary:hover:not(:disabled), dialog button.primary:hover:not(:disabled), .auth button.primary:hover:not(:disabled) { background: var(--jm-accent-strong); }
.shell .sidebar .nav-item, .shell .account-actions button, .shell button.quiet, .shell button.link, .icon-button { background: transparent; }
.collapse-button { background: var(--jm-sidebar); }
.shell input, .shell select, .shell textarea, dialog input, dialog select, dialog textarea, .auth input { background: var(--jm-input, #111a22); }
.shell .badge, dialog .badge { background: var(--jm-badge-bg, #202b34); color: var(--jm-badge-text, #b8c3ca); }
.shell tbody tr:hover td { background: var(--jm-row-hover, rgba(255,255,255,.025)); }
.mobile-backdrop { background: var(--jm-backdrop, rgba(3,8,12,.65)); }
.auth-art, .auth-art h1 { color: var(--jm-text); }
.auth-art p { color: var(--jm-text-secondary); }
.shell button:disabled { opacity: .5; }

/* Invoices, quotes and the client cover stay white "paper" with dark text in every theme. */
.document, .client-cover, .document * {
  --jm-text: #182e3b; --jm-text-secondary: #5c707e; --jm-border: #d9e1e6; --jm-accent: #167367; --jm-accent-strong: #106a7a;
}
.shell .document, .shell .client-cover { color: #182e3b; }
.shell .document button { background: #ffffff; color: #182e3b; border-color: #d9e1e6; }
.shell .document th, .shell .document td { border-bottom-color: #e5ebef; }
.shell .document tbody tr:hover td { background: transparent; }
.shell .document .badge { background: #edf1f4; color: #405865; border-color: #d9e1e6; }

/* --- text size (Settings > Appearance > Text size). Almost everything is sized in rem, so scaling the root scales the whole app. --- */
html[data-text="large"]  { font-size: 18px; --jm-sidebar-width: 270px; }
html[data-text="xlarge"] { font-size: 20px; --jm-sidebar-width: 292px; }
html[data-text="large"] .shell.sidebar-collapsed, html[data-text="xlarge"] .shell.sidebar-collapsed { --jm-sidebar-width: 250px; }
/* the smallest labels in the redesign are hard to read, so lift them a little at every size */
.nav-group-label, .brand-copy span, .metric .label, .topbar small, .topbar-user span, .account-copy span, .shell .account-actions button, .eyebrow, .pagehead .eyebrow { font-size: max(.8rem, 13px); }
.brand-copy strong, .account-copy strong, .topbar-context { font-size: max(.88rem, 14px); }
.shell .sidebar .nav-item, .shell button, dialog button, .auth button { font-size: max(.85rem, 13.5px); }
.shell th, dialog th { font-size: max(.78rem, 12.5px); }

}
@media screen {
  .portal-shell { background: var(--jm-bg, #111820); color: var(--jm-text, #eef8ff); color-scheme: var(--jm-scheme, dark); }
  .portal-shell header, .portal-shell .panel { background: var(--jm-surface, #18232e); border-color: var(--jm-border, #40515e); }
  .portal-shell .portal-appearance { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--jm-border, #40515e); }
  .portal-appearance label { font-size: 13px; }
  .portal-appearance select { width: 100%; max-width: 240px; }
  .portal-shell input, .portal-shell select, .portal-shell textarea { background: var(--jm-input, #111a22); color: var(--jm-text, #eef8ff); border-color: var(--jm-border, #40515e); }
  .portal-shell .muted, .portal-shell .sub, .portal-shell small { color: var(--jm-text-secondary, #a9c0d2); }
  .portal-shell button { background: var(--jm-button, #202c36); color: var(--jm-text, #eef8ff); border-color: var(--jm-border, #40515e); }
  .portal-shell button.primary { background: var(--jm-accent, #2fb5aa); color: var(--jm-on-accent, #071312); }
  .portal-shell .schedule-track { background: var(--jm-border, #40515e); }
  .portal-shell .schedule-axis, .portal-shell .schedule-chart-row small { color: var(--jm-text-secondary, #a9c0d2); }
  .portal-shell .schedule-bar { background: var(--jm-accent, #2fb5aa); }
}
