/* css/polish-1120.css -- polish1120 (2026-11-20). ADD-ONLY visual polish. Loaded last. No company-specific rules.
 * Every rule is scoped by html.polish1120 (set by js/polish-1120.js; kill switch localStorage 'polish1120-off'='1'),
 * except the token aliases in section 0, which only give a value to names the app already uses but never defines.
 * Uses the app's own tokens (--primary, --surface, --border-color, --text, --text-secondary, --radius, --font ...).
 */

/* 0. TOKENS THE APP USES BUT NEVER DEFINES -------------------------------------------------------------------------
 * var(--border) (53 uses, incl. the Settings rate boxes), var(--text-primary), var(--bg-primary), var(--text-muted),
 * var(--danger) ... have no definition on the app pages, so the declarations that use them are dropped by the browser
 * (borderless inputs, default-black text). :where() keeps specificity at 0 so any real definition still wins. */
:where(:root) {
  --border: var(--border-color);
  --text-primary: var(--text);
  --text-muted: var(--text-secondary);
  --bg-primary: var(--surface);
  --bg-secondary: var(--gray-50);
  --danger: var(--red);
  --warning: var(--yellow);
  --info: #3b82f6;
}
/* readable brand colour for TEXT on light surfaces: --primary (#14b8a6) on white is 2.5:1; this is 5.5:1 */
:where(:root) { --p1120-primary-text: var(--primary); }
:where(html.light) { --p1120-primary-text: #0f766e; }

/* 1. FLOATING BUTTONS OVERLAP ---------------------------------------------------------------------------------------
 * #afb-btn (Feedback), #uc1109-fab (Report a problem) and #rl2-jump-btn (Sections) are each fixed to the same corner
 * by three different modules. Stack them, and give the dashed transparent one a solid surface. */
html.polish1120 #uc1109-fab {
  background: var(--surface); color: var(--text); border: 1px solid var(--border-color); border-radius: 999px;
  box-shadow: var(--shadow-md); min-height: 36px; padding: 0 14px; font-size: 13px; font-weight: 600;
}
html.polish1120.p1120-fab-feedback #uc1109-fab { bottom: 62px; right: 16px; }
html.polish1120.p1120-fab-report #rl2-jump-btn { bottom: 62px; right: 16px; }
html.polish1120.p1120-fab-feedback.p1120-fab-report #rl2-jump-btn { bottom: 106px; }

/* 2. EMAIL CONNECT PANEL MOUNTED ON <body> --------------------------------------------------------------------------
 * Until the script has moved it into Settings (or if Settings is absent) it must not print under the sidebar. */
html.polish1120 body > #emc-root { display: none !important; }
html.polish1120 .polish1120-emc { margin: 16px 0 32px; }
html.polish1120 .polish1120-emc #emc-root > h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 600; color: var(--text); }
html.polish1120 .polish1120-emc .emc-card { border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 12px; background: var(--surface); }
html.polish1120 .polish1120-emc .emc-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
html.polish1120 .polish1120-emc .emc-muted, html.polish1120 .polish1120-emc .emc-meta { color: var(--text-secondary); font-size: 13px; }

/* 3. JOB PAGE TAB STRIP WIDER THAN THE PAGE ------------------------------------------------------------------------
 * 16 tabs in one unwrapped row pushed the document to 1646px at a 1440px window (sideways page scroll, last tabs cut).
 * Keep the strip inside the column and let it scroll on its own; one line per label. */
html.polish1120 #job-detail-tabs { display: flex; flex-wrap: wrap; max-width: 100%; box-sizing: border-box; row-gap: 4px; }
html.polish1120 #job-detail-tabs > .dash-tab { flex: 0 0 auto; white-space: nowrap; }
html.polish1120 #job-detail-tabs > .dash-tab br { display: none; }
html.polish1120 #job-detail-panel { min-width: 0; max-width: 100%; }

/* 4. LIFECYCLE STEPPER NUMBERS INVISIBLE IN THE LIGHT THEME --------------------------------------------------------
 * .lifecycle-num keeps its dark-theme chip (#30363d) with grey digits (#525252) -> 1.6:1. */
html.polish1120.light .lifecycle-step:not(.active):not(.completed):not(.done) .lifecycle-num {
  background: var(--gray-200); color: var(--gray-700);
}

/* 5. SETTINGS: UNSTYLED "REASON / SOURCE FOR CHANGE" BOXES AND BORDERLESS RATE BOXES --------------------------------
 * inputs added by later modules carry inline styles and the browser default 2px inset border. */
html.polish1120 #settings-section input[id$="reason1106"],
html.polish1120 #settings-section .settings-panel > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html.polish1120 #settings-section .settings-panel > label > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html.polish1120 #settings-section .beta-defaults > input:not([type="checkbox"]):not([type="radio"]),
html.polish1120 #settings-section .beta-rate-field input,
html.polish1120 #settings-section .beta-defaults input:not([type="checkbox"]):not([type="radio"]) {
  border: 1px solid var(--border-color) !important; border-radius: var(--radius-sm) !important;
  background: var(--surface) !important; color: var(--text) !important; font: inherit !important; font-size: 14px !important;
  padding: 10px 14px !important; min-height: 41px; box-shadow: none; outline-offset: 2px;
}
html.polish1120 #settings-section input[id$="reason1106"]:focus,
html.polish1120 #settings-section .beta-defaults input:focus { border-color: var(--primary) !important; outline: 2px solid color-mix(in srgb, var(--primary) 30%, transparent); }
html.polish1120 #settings-section .settings-panel > label,
html.polish1120 #settings-section .beta-defaults label { font-size: 12.6px; font-weight: 600; color: var(--text-secondary); letter-spacing: .02em; }
html.polish1120 #settings-section #is1109-panel { padding: 20px; }
html.polish1120 #settings-section .settings-lead-pursuit-wrap {
  background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 20px; margin-top: 16px;
}

/* 6. SIDEBAR --------------------------------------------------------------------------------------------------------
 * "Customize quick buttons" was cut to "Customize quick butt..." at the default sidebar width. */
html.polish1120 #mn1107-customize .nav-label { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; text-align: left; }
html.polish1120 #mn1107-customize { height: auto; min-height: 36px; }

/* 7. BRAND-COLOURED TEXT ON LIGHT SURFACES (2.3-2.5:1) -> the darker text teal ----------------------------------------
 * text and outline buttons only; filled primary buttons keep the brand fill (see ISSUES.md, not changed here). */
html.polish1120.light .nav-btn.active,
html.polish1120.light .nav-btn.active .nav-label,
html.polish1120.light .lifecycle-step.active .lifecycle-label { color: var(--p1120-primary-text); }
html.polish1120.light .t30-qa.t30-go,
html.polish1120.light .ph1109-link,
html.polish1120.light .upload-link,
html.polish1120.light .dl04-link,
html.polish1120.light .cp-review-btn,
html.polish1120.light .rf04-mk,
html.polish1120.light .jsck-x,
html.polish1120.light .rfi-source-btn.active,
html.polish1120.light .rfi-email-btn.active,
html.polish1120.light .bidlock-card > a,
html.polish1120.light .btn.btn-secondary:not(.btn-primary) { color: var(--p1120-primary-text) !important; }
html.polish1120.light .btn.btn-secondary:not(.btn-primary) { border-color: var(--p1120-primary-text); }
/* grey helper text below 4.5:1 on the light surface (#a3a3a3 = 2.5:1) */
html.polish1120.light .upload-hint, html.polish1120.light .rfi-step-desc { color: var(--text-secondary); }
html.polish1120.light .nav-btn.active svg { color: var(--p1120-primary-text); stroke: currentColor; }

/* 8. OUTLINE BUTTONS LOOK LIKE PLACEHOLDERS -----------------------------------------------------------------------
 * styles.css: .btn-outline{border:1px dashed var(--gray-300);color:var(--text-secondary)} -> "Refresh", "Open job",
 * "Export CSV", "More filters", "Got it" read as disabled drop-zones next to the solid dashboard buttons (.t30-btn).
 * Same tokens, solid line, normal text colour. */
html.polish1120 .btn.btn-outline:not(.btn-primary):not(.btn-danger):not(#uc1109-fab) {
  border-style: solid; border-color: var(--border-color); color: var(--text); background: var(--surface);
}
html.polish1120 .btn.btn-outline:not(.btn-primary):not(.btn-danger):not(#uc1109-fab):hover { border-color: var(--gray-400); }

/* 9. SUB WORKSPACE WALL (.bidlock-card) ------------------------------------------------------------------------------
 * actions wrap with a 12px inline indent on the second row; a signed-in person is offered "Sign in" beside "Sign out". */
html.polish1120 .bidlock-card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
html.polish1120 .bidlock-card > h1, html.polish1120 .bidlock-card > p { flex: 0 0 100%; margin-left: 0; margin-right: 0; }
html.polish1120 .bidlock-card > .btn, html.polish1120 .bidlock-card > a { margin-left: 0 !important; min-height: 44px; display: inline-flex; align-items: center; }
html.polish1120 body.authenticated .bidlock-card > a[href="/login.html"] { display: none; }

/* 10. PHONE --------------------------------------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* "Report a problem" sat on top of the bottom bar's RFIs / More buttons */
  html.polish1120 #uc1109-fab { bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; right: 12px !important; }
  html.polish1120.p1120-fab-report #rl2-jump-btn { bottom: calc(126px + env(safe-area-inset-bottom, 0px)); right: 12px; }
  html.polish1120.p1120-fab-feedback #uc1109-fab { bottom: calc(126px + env(safe-area-inset-bottom, 0px)) !important; }
  html.polish1120.p1120-fab-feedback.p1120-fab-report #rl2-jump-btn { bottom: calc(176px + env(safe-area-inset-bottom, 0px)); }
  /* bottom bar used a blue (#2563eb) that is not in the app palette */
  html.polish1120 #uir-bb .uir-bb-btn[aria-current="page"], html.polish1120 #uir-bb .uir-bb-btn.active,
  html.polish1120 #uir-bb .uir-bb-btn[aria-current="page"] .nav-label, html.polish1120 #uir-bb .uir-bb-btn.active .nav-label { color: var(--p1120-primary-text) !important; }
  html.polish1120 #uir-bb .uir-bb-btn[data-mobile-destination="scan"] svg.nav-icon { background: var(--primary); }
  /* drawer rows were 28px tall */
  html.polish1120 #app-sidebar .nav-btn { min-height: 44px; font-size: 14px; }
  html.polish1120 #app-sidebar .nav-btn .nav-label { font-size: 14px; }
  /* topbar icon buttons and small actions: 44px touch area without changing the drawn size */
  html.polish1120 .app-topbar button, html.polish1120 .app-topbar a { min-width: 44px; min-height: 44px; }
  html.polish1120 .btn.btn-sm, html.polish1120 .btn.t30-btn, html.polish1120 .dash-tab, html.polish1120 .rc-btn { min-height: 44px !important; }
  /* job tabs: one sideways-scrolling row instead of five wrapped rows (half the first screen) */
  html.polish1120 #job-detail-tabs { flex-wrap: nowrap !important; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 4px; gap: 2px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
  html.polish1120 #job-detail-tabs::-webkit-scrollbar { display: none; }
  html.polish1120 #job-detail-tabs > .dash-tab:last-child { margin-right: 28px; }
  html.polish1120 #app-sidebar .sidebar-nav { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  /* content must clear the fixed bottom bar */
  html.polish1120 #app-content { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}
