@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@500;600;700&display=swap");

:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-alt: #f1f2f8;
    --sidebar: #ffffff;
    --sidebar-text: #14151a;
    --border: #e7e8f0;
    --text: #14151a;
    --muted: #6b7280;

    --marquee-purple: #6d5dfc;
    --marquee-purple-2: #8b73ff;
    --marquee-blue: #3b82f6;
    --marquee-green: #10b981;
    --marquee-pink: #ec4899;

    --accent: var(--marquee-purple);
    --accent-soft: #eef0ff;
    --success: var(--marquee-green);
    --danger: #ef4444;
    --warning: #f59e0b;

    --card-radius: 16px;
    --button-radius: 12px;
    --shadow: 0 14px 32px rgba(20, 21, 60, 0.055);

    --font-display:
        "Segoe UI",
        Tahoma,
        Arial,
        sans-serif;

    --font-body:
        "Segoe UI",
        Tahoma,
        Arial,
        sans-serif;
}

* { box-sizing: border-box; }

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font-body);
    color: var(--text);
}

body,
button,
input,
select,
textarea {
    font-family: var(--font-body);
}

a { color: inherit; }

.dashboard-body,
.login-body {
    background:
        radial-gradient(1100px 700px at 6% -10%, rgba(109, 92, 252, 0.10), transparent 55%),
        radial-gradient(950px 750px at 100% -5%, rgba(59, 130, 246, 0.08), transparent 50%),
        radial-gradient(900px 650px at 50% 115%, rgba(236, 72, 153, 0.07), transparent 55%),
        linear-gradient(180deg, #f6f7fb 0%, #ffffff 45%, #f6f7fb 100%);
    background-attachment: fixed;
}

/* =========================================================
   LOGIN
   ========================================================= */

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.login-shell {
    width: 100%;
    max-width: 430px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 26px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, #8b73ff 0%, #6d5dfc 55%, #3b82f6 100%);
    box-shadow: 0 10px 26px rgba(109, 92, 252, 0.30);
}

.brand-mark.small {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 17px;
}

.brand-name {
    font-size: 19px;
    font-weight: 750;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    margin-top: 2px;
    color: var(--muted);
    font-size: 13px;
}

.login-card {
    padding: 36px;
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(231, 232, 240, .9);
    border-radius: 22px;
    box-shadow: 0 20px 60px rgba(20, 21, 60, .08);
    backdrop-filter: blur(14px);
}

.login-heading h1 {
    margin: 4px 0 8px;
    font-size: 30px;
    letter-spacing: -0.04em;
}

.login-heading p:last-child {
    margin: 0 0 26px;
    color: var(--muted);
    line-height: 1.55;
}

.eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .14em;
}

.login-form {
    display: grid;
    gap: 18px;
}

.login-form label span {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 650;
}

.login-form input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--button-radius);
    background: var(--surface-alt);
    color: var(--text);
    outline: none;
}

.login-form input:focus,
.field input:focus,
.field textarea:focus,
.marquee-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.login-form button,
.primary-gradient-button {
    border: 0;
    border-radius: var(--button-radius);
    color: white;
    font-weight: 700;
    background: linear-gradient(135deg, #8b73ff 0%, #6d5dfc 55%, #3b82f6 100%);
    box-shadow: 0 10px 24px rgba(109, 92, 252, .24);
    cursor: pointer;
}

.login-form button {
    height: 50px;
    margin-top: 3px;
}

.login-form button:hover,
.primary-gradient-button:hover {
    filter: brightness(.98);
    transform: translateY(-1px);
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

.alert-error {
    padding: 12px 14px;
    margin-bottom: 18px;
    color: #922d2d;
    background: #fff0f0;
    border: 1px solid #ffd7d7;
    border-radius: 10px;
    font-size: 13px;
}

/* =========================================================
   GLOBAL TOP NAV
   ========================================================= */

.global-nav {
    position: fixed;
    inset: 0 0 auto 0;
    height: 60px;
    z-index: 80;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 0 22px;
    background: #0d0e13;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.global-nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #f5f6fa;
    text-decoration: none;
    font-size: 15px;
    font-weight: 750;
    white-space: nowrap;
}

.global-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.global-nav-link {
    color: #a7abbb;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    transition: .15s ease;
}

.global-nav-link:hover {
    color: #f5f6fa;
    background: rgba(255,255,255,.06);
}

.global-nav-link.active {
    color: white;
    background: linear-gradient(135deg, #8b73ff 0%, #6d5dfc 55%, #3b82f6 100%);
    box-shadow: 0 6px 18px rgba(109,92,252,.35);
}

.sidebar-toggle {
    appearance: none;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.04);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
}

.sidebar-toggle span {
    width: 15px;
    height: 1.5px;
    background: #c7cad3;
    border-radius: 1px;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,.09);
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.dashboard-body {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 60px;
    bottom: 0;
    left: 0;
    width: 255px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    padding: 24px 18px 18px;
    background: rgba(255,255,255,.94);
    color: var(--sidebar-text);
    border-right: 1px solid var(--border);
    box-shadow: 1px 0 0 rgba(20,21,60,.02);
    backdrop-filter: blur(16px);
    transition: width .2s ease, padding .2s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 8px 25px;
    font-size: 18px;
    font-weight: 750;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav-spacer {
    height: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 9px;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    transition: .16s ease;
}

.nav-item:hover {
    color: var(--text);
    background: rgba(241,242,248,.9);
}

.nav-item.active {
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 700;
    box-shadow: inset 2px 0 0 var(--accent);
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 17px;
}

.sidebar-user {
    margin-top: auto;
    padding: 16px 8px 3px;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--surface-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 750;
    font-size: 13px;
}

.user-info {
    min-width: 0;
}

.user-info strong {
    display: block;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
}

.logout-button:hover { color: var(--text); }

/* =========================================================
   CONTENT
   ========================================================= */

.content {
    width: calc(100% - 255px);
    margin-left: 255px;
    margin-top: 60px;
    padding: 34px 42px 46px;
    transition: margin-left .2s ease, width .2s ease;
}

.content > * {
    width: 100%;
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.topbar h1 {
    margin: 4px 0 0;
    font-size: 27px;
    letter-spacing: -.035em;
}

.status-pill,
.scanner-status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,.88);
    border-radius: 999px;
    font-size: 12px;
    color: var(--muted);
    box-shadow: var(--shadow);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(16,185,129,.14);
}

.welcome { margin-bottom: 24px; }
.welcome h2 { margin: 0 0 5px; font-size: 20px; letter-spacing: -.02em; }
.welcome p { margin: 0; color: var(--muted); font-size: 13px; }

.metrics {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card,
.panel,
.settings-card {
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(231,232,240,.95);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.metric-card {
    padding: 20px;
    border-top: 3px solid var(--metric-accent, var(--accent));
}

.metrics .metric-card:nth-child(1) { --metric-accent: var(--marquee-purple); }
.metrics .metric-card:nth-child(2) { --metric-accent: var(--marquee-blue); }
.metrics .metric-card:nth-child(3) { --metric-accent: var(--marquee-green); }
.metrics .metric-card:nth-child(4) { --metric-accent: var(--marquee-pink); }

.metric-label { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.metric-value { font-size: 25px; font-weight: 730; letter-spacing: -.04em; }
.metric-note { margin-top: 6px; color: var(--muted); font-size: 11px; }

.panel { min-height: 310px; }

.panel-header {
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    margin: 4px 0 0;
    font-size: 16px;
}

.empty-state {
    min-height: 225px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--muted);
    padding: 30px;
}

.empty-icon { font-size: 30px; color: var(--muted); }
.empty-state h4 { margin: 12px 0 5px; color: var(--text); }
.empty-state p { margin: 0; font-size: 13px; max-width: 520px; line-height: 1.55; }

/* =========================================================
   SETTINGS / APPEARANCE
   ========================================================= */

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 18px;
}

.settings-card {
    display: block;
    position: relative;
    overflow: hidden;
    padding: 24px;
    color: var(--text);
    text-decoration: none;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.settings-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--settings-accent, var(--accent));
}

.settings-card-purple { --settings-accent: var(--marquee-purple); }
.settings-card-blue { --settings-accent: var(--marquee-blue); }
.settings-card-green { --settings-accent: var(--marquee-green); }
.settings-card-pink { --settings-accent: var(--marquee-pink); }

.settings-card:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--settings-accent, var(--accent)) 45%, var(--border));
    box-shadow: 0 18px 42px rgba(20,21,60,.075);
}

.settings-card-icon {
    margin-bottom: 14px;
    color: var(--settings-accent, var(--accent));
    font-size: 20px;
}

.settings-card h3 { margin: 0 0 8px; }
.settings-card p { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.settings-card > span { color: var(--settings-accent, var(--accent)); font-size: 12px; font-weight: 700; }

.single-theme-panel { min-height: unset; }

.single-theme-body {
    display: grid;
    grid-template-columns: minmax(360px, .9fr) minmax(320px, 1.1fr);
    gap: 28px;
    padding: 24px;
    align-items: center;
}

.marquee-light-preview {
    position: relative;
    min-height: 250px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background:
        radial-gradient(500px 280px at 0% 0%, rgba(109,92,252,.13), transparent 55%),
        radial-gradient(500px 280px at 100% 0%, rgba(59,130,246,.10), transparent 55%),
        #f7f8fc;
}

.theme-mini-topbar {
    position: absolute;
    inset: 0 0 auto 0;
    height: 34px;
    background: #0d0e13;
}

.theme-mini-sidebar {
    position: absolute;
    top: 34px;
    bottom: 0;
    left: 0;
    width: 74px;
    background: rgba(255,255,255,.96);
    border-right: 1px solid var(--border);
}

.theme-mini-content {
    position: absolute;
    top: 58px;
    left: 98px;
    right: 24px;
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 8px;
}

.theme-mini-metric {
    height: 52px;
    background: white;
    border: 1px solid var(--border);
    border-top: 3px solid;
    border-radius: 9px;
    box-shadow: 0 8px 18px rgba(20,21,60,.05);
}

.theme-mini-metric.purple { border-top-color: var(--marquee-purple); }
.theme-mini-metric.blue { border-top-color: var(--marquee-blue); }
.theme-mini-metric.green { border-top-color: var(--marquee-green); }
.theme-mini-metric.pink { border-top-color: var(--marquee-pink); }

.theme-mini-panel {
    grid-column: 1 / -1;
    height: 90px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.single-theme-copy strong { font-size: 16px; }
.single-theme-copy p { color: var(--muted); font-size: 13px; line-height: 1.6; }

.selected-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
}

.appearance-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0 24px 24px;
}

.primary-gradient-button {
    padding: 11px 18px;
}

.appearance-help,
.form-note {
    color: var(--muted);
    font-size: 12px;
}

.marquee-select {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--button-radius);
    background: var(--surface-alt);
    color: var(--text);
    outline: none;
}

.time-format-options {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px;
}

.time-format-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 74px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-alt);
    cursor: pointer;
}

.time-format-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 3px rgba(109,93,252,.08);
}

.time-format-card strong,
.time-format-card span {
    display: block;
}

.time-format-card strong { font-size: 12px; }
.time-format-card span { margin-top: 3px; color: var(--muted); font-size: 11px; }

/* =========================================================
   COMMON FORM COMPATIBILITY
   ========================================================= */

.profile-form { display: grid; gap: 18px; }
.form-panel { min-height: unset; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 18px;
    padding: 24px;
}

.form-grid.four-columns { grid-template-columns: repeat(4,minmax(0,1fr)); }

.field { display: block; }
.field-full { grid-column: 1 / -1; }
.field > span { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 700; }

.field input,
.field textarea,
.priority-row select,
.priority-card select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--button-radius);
    background: var(--surface-alt);
    color: var(--text);
    outline: none;
}

.field input,
.priority-row select,
.priority-card select {
    height: 44px;
    padding: 0 12px;
}

.field textarea { padding: 12px; resize: vertical; }
.field small { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.45; }

.form-section-body { padding: 24px; }
.section-copy { margin: 0 0 18px; color: var(--muted); font-size: 12px; line-height: 1.55; }

.priority-card-grid {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 14px;
    padding: 24px;
}

.priority-card {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    background: var(--surface-alt);
}

.priority-card > span { font-size: 12px; font-weight: 700; }

.tag-editor { display: grid; gap: 12px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 32px; }

.tag-chip {
    border: 0;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.tag-list .tag-chip:nth-child(3n+1) { background: #eef0ff; color: #5b3df0; }
.tag-list .tag-chip:nth-child(3n+2) { background: #e6f0ff; color: #1d5fd6; }
.tag-list .tag-chip:nth-child(3n) { background: #fde6f2; color: #c22a83; }
.tag-chip span { color: inherit; opacity: .6; }

.tag-add-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.tag-add-row input {
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--button-radius);
    background: var(--surface-alt);
    color: var(--text);
}
.tag-add-row button {
    border: 0;
    border-radius: var(--button-radius);
    padding: 0 16px;
    background: linear-gradient(135deg,#8b73ff,#3b82f6);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.score-weight-grid,
.calibration-grid {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 14px;
    padding: 24px;
}

.calibration-grid.compact-grid {
    grid-template-columns: repeat(3,minmax(0,1fr));
    padding: 18px 0 0;
}

.score-weight-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    background: var(--surface-alt);
}

.score-weight-card > span { display: block; margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 700; }
.score-weight-card > div { display: flex; align-items: center; gap: 8px; }
.score-weight-card input {
    width: 90px;
    height: 42px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--button-radius);
    background: var(--surface);
    color: var(--text);
    font-size: 19px;
    font-weight: 700;
}

.weight-total-row { display: flex; justify-content: flex-end; gap: 12px; padding: 0 24px 24px; font-size: 13px; }
.weight-total-row strong.invalid { color: var(--danger); }

.profile-save-bar {
    position: sticky;
    bottom: 18px;
    z-index: 20;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
}
.profile-save-bar.visible { display: flex; }
.profile-save-bar strong,
.profile-save-bar span { display: block; }
.profile-save-bar strong { font-size: 12px; }
.profile-save-bar span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.profile-save-bar button {
    border: 0;
    border-radius: var(--button-radius);
    padding: 11px 17px;
    background: linear-gradient(135deg,#8b73ff,#6d5dfc 55%,#3b82f6);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.save-banner {
    margin-bottom: 18px;
    padding: 12px 15px;
    border: 1px solid #d9d5ff;
    border-radius: var(--button-radius);
    background: #f3f1ff;
    color: #4f3fd1;
    font-size: 13px;
}

/* =========================================================
   COLLAPSED SIDEBAR
   ========================================================= */

body.sidebar-collapsed .sidebar {
    width: 76px;
    padding-left: 12px;
    padding-right: 12px;
}

body.sidebar-collapsed .content {
    margin-left: 76px;
    width: calc(100% - 76px);
}

body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

body.sidebar-collapsed .sidebar-brand span,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .user-info {
    display: none;
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

body.sidebar-collapsed .sidebar-user {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1100px) {
    .priority-card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .score-weight-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .calibration-grid.compact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .metrics { grid-template-columns: repeat(2,1fr); }
    .single-theme-body { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
    .settings-grid,
    .form-grid { grid-template-columns: 1fr; }
    .field-full { grid-column: auto; }
}

@media (max-width: 720px) {
    .global-nav-brand span { display: none; }
    .global-nav { gap: 12px; padding: 0 12px; }
    .global-nav-link { padding: 7px 9px; font-size: 11px; }
}

@media (max-width: 680px) {
    .sidebar {
        width: 68px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .sidebar-brand { justify-content: center; }
    .sidebar-brand > span,
    .nav-label,
    .user-info,
    .logout-button { display: none; }

    .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }

    .content,
    body.sidebar-collapsed .content {
        width: calc(100% - 68px);
        margin-left: 68px;
        padding: 25px 18px;
    }

    .metrics,
    .priority-card-grid,
    .score-weight-grid,
    .time-format-options {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   PHASE 7B FINAL TYPOGRAPHY / GROUPING
   ========================================================= */

body,
button,
input,
select,
textarea,
.content,
table,
th,
td {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

.global-nav,
.global-nav-brand,
.global-nav-link,
.sidebar,
.sidebar-brand,
.nav-item,
.nav-group-label {
    font-family: "Raleway", "Segoe UI", Tahoma, Arial, sans-serif;
}

.nav-group-label {
    padding: 8px 12px 6px;
    color: #989cad;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.nav-group-label-config {
    margin-top: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

body.sidebar-collapsed .nav-group-label {
    font-size: 0;
    height: 10px;
    padding: 0;
    margin: 8px 0 2px;
    border-top: 1px solid var(--border);
}

body.sidebar-collapsed .nav-group-label:first-child {
    display: none;
}


/* =========================================================
   PHASE 7C TABLES
   ========================================================= */

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.marquee-table {
    width: 100%;
    border-collapse: collapse;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 13px;
}

.marquee-table th {
    padding: 12px 16px;
    text-align: left;
    color: var(--muted);
    background: #fafaff;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
}

.marquee-table td {
    padding: 15px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.marquee-table tbody tr:hover {
    background: rgba(109, 93, 252, .035);
}

.table-subtext {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.match-chip,
.score-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 8px;
    font-size: 10px;
    font-weight: 700;
}

.match-chip {
    color: #4e3cb9;
    background: #eeeaff;
}

.score-chip {
    color: #135a42;
    background: #e4f7ef;
}

.strong-score {
    color: white;
    background: linear-gradient(
        135deg,
        #8b73ff,
        #6d5dfc 55%,
        #3b82f6
    );
}


/* =========================================================
   PHASE 7D TYPOGRAPHY / NAVIGATION / SETTINGS / PROFILE
   ========================================================= */

:root {
    --font-content: "Segoe UI", Tahoma, Arial, sans-serif;
    --font-navigation: "Raleway", "Segoe UI", Tahoma, Arial, sans-serif;
}

html,
body,
button,
input,
select,
textarea,
.content,
.content *,
.panel,
.metric-card,
table,
th,
td,
form,
label {
    font-family: var(--font-content);
}

.global-nav,
.global-nav *,
.sidebar,
.sidebar *,
.sidebar-brand,
.nav-item,
.nav-group-label {
    font-family: var(--font-navigation);
}

.back-to-settings {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 18px;
    color: var(--muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 650;
}

.back-to-settings:hover {
    color: var(--accent);
}

.nav-expandable-row {
    display: grid;
    grid-template-columns: 1fr 30px;
    align-items: center;
}

.nav-expandable-row .nav-item {
    min-width: 0;
}

.nav-expand-toggle {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: transform .16s ease, background .16s ease;
}

.nav-expandable.open .nav-expand-toggle {
    transform: rotate(180deg);
}

.nav-expand-toggle:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.nav-submenu {
    display: none;
    padding: 3px 0 5px 43px;
}

.nav-expandable.open .nav-submenu {
    display: grid;
    gap: 2px;
}

.nav-submenu a {
    padding: 6px 8px;
    border-radius: 7px;
    color: var(--muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
}

.nav-submenu a:hover,
.nav-submenu a.active {
    color: var(--accent);
    background: var(--accent-soft);
}

body.sidebar-collapsed .nav-expand-toggle,
body.sidebar-collapsed .nav-submenu {
    display: none !important;
}

body.sidebar-collapsed .nav-expandable-row {
    display: block;
}

.profile-anchor-section {
    scroll-margin-top: 96px;
}

.profile-form {
    padding-bottom: 40px;
}

.compact-time-format {
    grid-template-columns: repeat(2, minmax(145px, 1fr));
    gap: 8px;
}

.compact-time-format .time-format-card {
    min-height: 48px;
    display: grid;
    grid-template-columns: 16px auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
}

.compact-time-format input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.time-radio-dot {
    width: 14px;
    height: 14px;
    border: 1.5px solid #b9bdc9;
    border-radius: 50%;
    background: white;
    box-shadow: inset 0 0 0 3px white;
}

.time-format-card:has(input:checked) .time-radio-dot {
    border-color: var(--accent);
    background: var(--accent);
}

.compact-time-format strong {
    margin: 0;
    white-space: nowrap;
}

.compact-time-format .time-example {
    margin: 0;
    text-align: right;
    white-space: nowrap;
    color: var(--muted);
}

@media (max-width: 700px) {
    .compact-time-format {
        grid-template-columns: 1fr;
    }

    .profile-form {
        padding-bottom: 28px;
    }
}


/* Phase 7E submenu sizing + Segoe UI tracking */
.content,
.content *,
.panel,
.metric-card,
table,
th,
td,
form,
label,
input,
select,
textarea,
button {
    letter-spacing: 0.012em;
}

.global-nav,
.global-nav *,
.sidebar,
.sidebar * {
    letter-spacing: normal;
}

.nav-submenu {
    padding-left: 38px;
}

.nav-submenu a {
    font-size: 13px;
    line-height: 1.25;
    padding: 7px 8px;
}

.nav-submenu a.is-disabled {
    opacity: .48;
    pointer-events: none;
}

.nav-expandable:not(.open) .nav-submenu {
    display: none;
}

.nav-expandable.open .nav-submenu {
    display: grid;
}

/* =========================================================
   PHASE 7F ROLE TRACKER / USAGE
   ========================================================= */

.tracker-sync-actions,
.inline-track-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tracker-funnel-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.tracker-metric {
    min-height: 96px;
}

.tracker-status-button {
    border: 0;
    border-radius: 999px;
    padding: 7px 10px;
    font: 650 12px "Segoe UI", Tahoma, Arial, sans-serif;
    cursor: pointer;
}

.status-interested { background: #f2efff; color: #5a46c9; }
.status-submitted { background: #e8f1ff; color: #255ea8; }
.status-audition { background: #fff5dc; color: #8a5b00; }
.status-callback { background: #fce9f4; color: #a33370; }
.status-casted { background: #e4f7ef; color: #13704e; }
.status-passed,
.status-closed { background: #f1f2f5; color: #666b76; }

.tracker-context-menu {
    position: fixed;
    z-index: 3000;
    min-width: 180px;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 18px 48px rgba(20,21,60,.16);
}

.tracker-context-menu button {
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 9px 10px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.tracker-context-menu button:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.tracker-note-preview {
    display: block;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tracker-conversion-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 10px;
}

.tracker-conversion-grid > div {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fafaff;
}

.tracker-conversion-grid span,
.usage-label {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 6px;
}

.tracker-conversion-grid strong {
    font-size: 20px;
}

.tracker-analytics-note {
    margin-top: 16px;
}

.table-action-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 650;
    white-space: nowrap;
}

.table-secondary-button {
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 7px 10px;
    background: white;
    color: var(--text);
    cursor: pointer;
    font-size: 12px;
    font-weight: 650;
}

.table-secondary-button:hover {
    border-color: #c9c4ff;
    background: var(--accent-soft);
    color: var(--accent);
}

.simple-modal[hidden] { display: none; }
.simple-modal {
    position: fixed;
    inset: 0;
    z-index: 3200;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.16);
    backdrop-filter: blur(12px);
}

.simple-modal-card {
    position: relative;
    width: min(520px, 92vw);
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: white;
    box-shadow: 0 24px 80px rgba(20,21,60,.18);
}

.simple-modal-card textarea { width: 100%; margin: 10px 0 14px; }
.simple-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: 0;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
}

.openai-usage-panel {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fafaff;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.openai-usage-panel strong {
    display: block;
    font-size: 22px;
    margin-bottom: 3px;
}

.integration-usage-note {
    margin: 8px 0 14px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

@media (max-width: 900px) {
    .tracker-funnel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tracker-conversion-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =========================================================
   PHASE 7G — ROLE WORKFLOW / NOTES / FILTERS / POLISH
   ========================================================= */

/* Faint sheen on option cards; controls stay solid white for contrast. */
.priority-card,
.score-weight-card {
    background:
        linear-gradient(145deg, rgba(255,255,255,.76) 0%, rgba(246,247,252,.86) 42%, rgba(239,241,248,.94) 100%);
    border-color: #e1e4ed;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.78);
}

.priority-card select,
.score-weight-card input,
.field select {
    background: #fff;
    border: 1px solid #dfe3ed;
}

.field select {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border-radius: var(--button-radius);
    color: var(--text);
    outline: none;
}

/* Role collection filters */
.role-filter-bar {
    display: grid;
    grid-template-columns: minmax(180px, 1.3fr) minmax(150px, .8fr) minmax(150px, .8fr) auto;
    gap: 12px;
    align-items: end;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: #fcfcff;
}

.role-filter-bar label > span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
}

.role-filter-bar select {
    width: 100%;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
}

.role-filter-actions {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.role-name-line {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.aa-match-chip {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 4px 7px;
    border-radius: 999px;
    background: #eeeaff;
    color: #5a46c9;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    cursor: help;
}

/* Keep a real table-cell. Flexing the TD itself caused the broken row line. */
.tracker-actions-cell {
    display: table-cell;
}

.tracker-actions-inner {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

/* Roles table keeps the permanent Actions column compact: View + Track on the
   first line, Open AA below. */
.roles-table .role-actions-compact {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    column-gap: 8px;
    row-gap: 3px;
    align-items: center;
}

.roles-table .role-action-links {
    display: contents;
}

.roles-table .role-action-links .role-report-link {
    grid-column: 1;
    grid-row: 1;
}

.roles-table .role-action-links .role-open-link {
    grid-column: 1;
    grid-row: 2;
}

.roles-table .role-actions-compact .inline-track-button {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    white-space: nowrap;
}

.roles-table .role-actions-compact .table-action-link {
    white-space: nowrap;
}

/* Equal outer gutter and inter-card spacing in conversion analytics. */
.tracker-conversion-grid {
    gap: 12px;
    padding: 12px;
}

.tracker-analytics-note {
    margin: 4px 0 0;
    padding: 0 12px 16px;
}

.tracker-context-divider {
    height: 1px;
    margin: 5px 4px;
    background: var(--border);
}

/* Rich role-note window */
.simple-modal.note-modal {
    background: rgba(246,247,251,.32);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.note-window {
    position: relative;
    width: min(560px, 92vw);
    height: min(430px, 78vh);
    min-width: min(420px, 92vw);
    min-height: 320px;
    max-width: 92vw;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 24px 72px rgba(31,34,73,.16);
}

.note-window-header {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 48px 12px 22px;
    border-bottom: 1px solid rgba(226,228,238,.72);
}

.note-window-header h3 {
    margin: 3px 0 0;
    font-size: 17px;
}

.note-window-subtitle {
    display: block;
    max-width: 420px;
    margin-top: 4px;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-window .simple-modal-close {
    top: 12px;
    right: 14px;
}

.role-note-editor {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 18px 22px;
    outline: none;
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    white-space: normal;
}

.role-note-editor:empty::before {
    content: attr(data-placeholder);
    color: #999eaa;
    pointer-events: none;
}

.role-note-editor ul,
.role-note-editor ol {
    margin: 8px 0 8px 22px;
    padding: 0;
}

.note-window-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 14px 12px;
    border-top: 1px solid var(--border);
    background: rgba(249,250,253,.96);
}

.note-format-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
}

.note-format-toolbar button {
    width: 34px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #5c606b;
    cursor: pointer;
    font-size: 13px;
}

.note-format-toolbar button:hover,
.note-format-toolbar button:focus-visible {
    background: #eceeff;
    color: var(--accent);
}

.note-save-button {
    flex: 0 0 auto;
}

.note-confirm[hidden] { display: none; }
.note-confirm {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 14px;
    border-top: 1px solid #dddff0;
    background: #f6f5ff;
    font-size: 12px;
}

.note-confirm-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.note-confirm-secondary {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 10px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-size: 11px;
    font-weight: 650;
}

/* Scanner project-type inclusion */
.scanner-project-types {
    margin: 0;
    padding: 0;
    border: 0;
}

.scanner-project-types legend {
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 700;
}

.scanner-project-types > p {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 11px;
}

.scanner-project-type-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.scanner-project-type-card {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #e1e4ed;
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(255,255,255,.78), rgba(241,243,249,.94));
    font-size: 11px;
    font-weight: 650;
    cursor: pointer;
}

.scanner-project-type-card:has(input:checked) {
    border-color: #c9c4ff;
    background: #f0eeff;
    color: #5a46c9;
}

.scanner-project-type-card input {
    accent-color: var(--accent);
}

/* Humanization presets */
.humanize-dependent,
.humanize-custom-panel {
    transition: opacity .15s ease;
}

.humanize-dependent.is-disabled,
.humanize-custom-panel.is-disabled {
    opacity: .42;
}

.humanize-custom-panel[hidden] { display: none; }
.humanize-custom-panel {
    margin: 0 22px 16px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fafaff;
}

.humanize-custom-heading {
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 700;
}

.humanize-custom-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width: 900px) {
    .role-filter-bar { grid-template-columns: 1fr 1fr; }
    .scanner-project-type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .humanize-custom-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    .role-filter-bar,
    .scanner-project-type-grid,
    .humanize-custom-grid { grid-template-columns: 1fr; }
    .note-window {
        width: 94vw !important;
        height: min(72vh, 620px) !important;
        min-width: 0;
        max-width: 94vw;
        resize: none;
    }
    .note-window-footer,
    .note-confirm { align-items: stretch; flex-direction: column; }
    .note-format-toolbar { flex-wrap: wrap; }
}

.scanner-project-types {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fafaff;
    overflow: hidden;
}

.scanner-project-types > summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    cursor: pointer;
}

.scanner-project-types > summary::-webkit-details-marker { display: none; }
.scanner-project-types > summary strong { display: block; font-size: 12px; }
.scanner-project-types > summary div > span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
}
.scanner-project-types[open] > summary { border-bottom: 1px solid var(--border); }
.scanner-project-types .scanner-project-type-grid { padding: 12px; }

/* =========================================================
   PHASE 7H — DESKTOP FEATURE PARITY / AI / REGIONS / ALERTS
   ========================================================= */

/* Sidebar secondary destinations */
.nav-item-subtle {
    margin-left: 16px;
    padding-left: 14px;
    font-size: 12px;
    opacity: .82;
}

.nav-item-subtle .nav-icon {
    width: 18px;
    font-size: 12px;
}

/* Roles ranked-results toolbar */
.roles-page-header {
    align-items: center;
}

.roles-header-tools {
    display: flex;
    align-items: center;
    gap: 10px;
}

.columns-control {
    position: relative;
}

.columns-popover {
    position: absolute;
    z-index: 120;
    top: calc(100% + 8px);
    right: 0;
    width: min(270px, 86vw);
    max-height: min(560px, 70vh);
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 18px 54px rgba(20,21,60,.14);
    backdrop-filter: blur(12px);
}

.columns-popover[hidden] { display: none; }

.columns-popover > strong {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
}

.columns-popover label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 5px;
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
}

.columns-popover input {
    accent-color: var(--accent);
}

.columns-reset {
    width: 100%;
    margin-top: 9px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
    cursor: pointer;
}

.role-filter-bar-v2 {
    grid-template-columns: minmax(190px,1.35fr) repeat(6,minmax(125px,.72fr)) auto;
    align-items: end;
}

.role-search-field input,
.role-filter-bar-v2 select {
    width: 100%;
    height: 40px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    outline: none;
}

.role-search-field input:focus,
.role-filter-bar-v2 select:focus {
    border-color: #c9c4ff;
    box-shadow: 0 0 0 3px rgba(109,93,252,.10);
}

.role-clear-filters {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
    text-decoration: none;
}

.roles-table-v2 {
    min-width: 1320px;
}

.roles-table-v2 th,
.roles-table-v2 td {
    vertical-align: top;
}

.priority-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
}

.priority-high { background: #e8f8f1; color: #167a57; }
.priority-medium { background: #fff5df; color: #9a6514; }
.priority-low { background: #eef0f6; color: #666d7c; }
.priority-ignore { background: #f4eef7; color: #76527f; }

.tracker-status-inline {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f0edff;
    color: #5b46d6;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

/* OpenAI usage panel gets the same gutter as the rest of the card. */
.openai-usage-shell {
    padding: 0 18px 18px;
}

.openai-usage-shell .openai-usage-panel {
    margin-top: 0;
}

.integration-metric-label,
.usage-error {
    display: block;
}

.usage-error {
    max-width: 560px;
    margin-top: 5px;
    color: #9a4b4b;
    font-size: 11px;
    line-height: 1.45;
}

/* Integrations */
.integration-grid-wide {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.integration-card {
    min-width: 0;
    overflow: hidden;
}

.integration-card .panel-header {
    align-items: flex-start;
}

.integration-status-chip {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #f4f5f9;
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
}

.integration-status-chip.connected {
    border-color: #d2efe3;
    background: #eafaf3;
    color: #0b8f61;
}

.integration-form {
    display: grid;
    gap: 14px;
    padding: 18px;
}

.integration-actions,
.form-actions-inline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.integration-actions .primary-gradient-button,
.form-actions-inline .primary-gradient-button {
    min-height: 40px;
    padding: 0 14px;
}

.provider-fields {
    display: grid;
    gap: 12px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fafaff;
}

.provider-fields[hidden] { display: none; }

.integration-connected-line {
    color: var(--muted);
    font-size: 11px;
}

.integration-connected-line strong { color: var(--text); }

.integration-test-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 18px 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.integration-test-form > span {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.4;
}

/* Multi-region scanning */
.scanner-regions {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.scanner-regions > legend {
    margin-bottom: 9px;
    font-size: 12px;
    font-weight: 700;
}

.scanner-region-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.scanner-region-card {
    position: relative;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 38px 8px 10px;
    border: 1px solid #e1e4ed;
    border-radius: 11px;
    background: linear-gradient(145deg, rgba(255,255,255,.80), rgba(241,243,249,.94));
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.scanner-region-card:hover {
    border-color: #cec9ff;
    transform: translateY(-1px);
}

.scanner-region-card:has(input:checked) {
    border-color: #c8c2ff;
    background: #f0eeff;
}

.scanner-region-card input {
    flex: 0 0 auto;
    accent-color: var(--accent);
}

.scanner-region-label {
    min-width: 0;
    font-size: 11px;
    font-weight: 650;
}

.region-help-button {
    position: absolute;
    top: 50%;
    right: 9px;
    width: 22px;
    height: 22px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    border: 1px solid #dcdfea;
    border-radius: 999px;
    background: rgba(255,255,255,.92);
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    cursor: help;
}

.region-help-popover {
    position: fixed;
    z-index: 3500;
    width: min(320px, calc(100vw - 24px));
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(255,255,255,.98);
    color: #4f5563;
    box-shadow: 0 14px 40px rgba(20,21,60,.14);
    font-size: 11px;
    line-height: 1.5;
    pointer-events: none;
}

.region-help-popover[hidden] { display: none; }

.scanner-scope-field small,
.field small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.4;
}

/* Travel economics */
.travel-profile-form {
    display: grid;
    gap: 18px;
}

.travel-table {
    min-width: 640px;
}

.travel-table td {
    vertical-align: middle;
}

.money-input {
    width: 160px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.money-input > span {
    color: var(--muted);
    font-weight: 650;
}

.money-input input {
    width: 100%;
    height: 38px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
}

.form-actions-inline {
    padding: 16px 18px 18px;
}

/* Marquee Alerts */
.alert-channel-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 18px;
}

.alert-channel-card {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: start;
    min-height: 126px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: linear-gradient(145deg, rgba(255,255,255,.80), rgba(244,245,251,.94));
}

.alert-channel-card > div strong,
.alert-channel-card > div span {
    display: block;
}

.alert-channel-card > div strong {
    margin-bottom: 4px;
    font-size: 12px;
}

.alert-channel-card > div span,
.alert-channel-note {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.4;
}

.alert-channel-card > input[type="checkbox"] {
    accent-color: var(--accent);
}

.alert-channel-card > input:not([type="checkbox"]) {
    grid-column: 1 / -1;
    width: 100%;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
}

.alert-channel-note { grid-column: 1 / -1; }

/* Scheduling preview */
.schedule-coming-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 13px 15px;
    border: 1px solid #ddd9ff;
    border-radius: 13px;
    background: #f3f1ff;
}

.schedule-coming-banner strong {
    flex: 0 0 auto;
    color: #5541c7;
    font-size: 11px;
}

.schedule-coming-banner span {
    color: #656b79;
    font-size: 11px;
    line-height: 1.45;
}

.status-badge.muted {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 999px;
    background: #f1f2f6;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.schedule-disabled-toggle {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px dashed #d8dae4;
    border-radius: 10px;
    background: #fafafa;
    color: var(--muted);
}

.schedule-disabled-toggle strong { color: #696e79; font-size: 11px; }
.schedule-disabled-toggle span { font-size: 10px; }

.schedule-inline-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.weekday-field {
    margin: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fafaff;
}

.weekday-field legend {
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
}

.weekday-field label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 4px 12px 4px 0;
    font-size: 11px;
}

.weekday-field input { accent-color: var(--accent); }

.schedule-summary-card {
    margin: 0 18px 16px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fafaff;
}

.schedule-summary-card strong,
.schedule-summary-card span {
    display: block;
}

.schedule-summary-card strong {
    margin-bottom: 4px;
    font-size: 11px;
}

.schedule-summary-card span {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
}

/* Make the new dense pages breathe on smaller displays. */
@media (max-width: 1350px) {
    .role-filter-bar-v2 {
        grid-template-columns: minmax(190px,1.3fr) repeat(3,minmax(135px,1fr));
    }
    .scanner-region-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
    .integration-grid-wide { grid-template-columns: 1fr; }
    .alert-channel-grid { grid-template-columns: 1fr; }
    .role-filter-bar-v2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .roles-header-tools { align-items: stretch; flex-direction: column; }
    .columns-popover { right: auto; left: 0; }
    .role-filter-bar-v2,
    .scanner-region-grid,
    .schedule-inline-fields { grid-template-columns: 1fr; }
    .integration-test-form { align-items: flex-start; flex-direction: column; }
    .schedule-coming-banner { align-items: flex-start; flex-direction: column; }
    .openai-usage-panel { align-items: flex-start; flex-direction: column; }
}

.scanner-project-types.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* =========================================================
   PHASE 7I WORKFLOW / VISUAL REFINEMENTS
   ========================================================= */

/* Dynamic Marquee Score traffic-light treatment. */
.score-chip.score-chip-green {
    color: #16704f;
    background: #e4f7ef;
    border: 1px solid #cdeedf;
}

.score-chip.score-chip-amber {
    color: #94620d;
    background: #fff3d6;
    border: 1px solid #f2dfad;
}

.score-chip.score-chip-red {
    color: #a34747;
    background: #fde8e8;
    border: 1px solid #f4cccc;
}

/* Alerts: clearer threshold split control + more breathing room around Methods. */
.alert-threshold-grid {
    align-items: start;
}

.alert-scheduled-threshold[hidden] {
    display: none !important;
}

.alert-methods-header {
    padding-bottom: 20px;
}

.alert-methods-header > div {
    width: 100%;
}

.alert-integrations-link {
    margin-top: 16px;
}

.alert-methods-panel .alert-channel-grid {
    padding-top: 20px;
}

/* Travel Economics: home market is visually locked at zero; manual overrides remain clear. */
.travel-home-row {
    background: rgba(109, 93, 252, .035);
}

.travel-home-row .money-input {
    background: #f3f4f8;
}

.travel-home-row .travel-rate-input[readonly] {
    color: #777d89;
    cursor: default;
}

.travel-home-chip {
    display: inline-flex;
    margin-left: 8px;
    padding: 3px 7px;
    border-radius: 999px;
    background: #eeeaff;
    color: #5c47cf;
    font-size: 9px;
    font-weight: 750;
    vertical-align: middle;
}

.travel-home-chip[hidden] {
    display: none !important;
}

.travel-save-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 18px 18px;
}

.travel-unsaved-indicator {
    margin-right: auto;
    color: #9a6514;
    font-size: 11px;
    font-weight: 650;
}

.travel-unsaved-indicator[hidden] {
    display: none !important;
}

/* Scanner now uses the same parent/submenu hierarchy as Profile and Settings. */
#scanner-nav-group .nav-submenu a {
    font-size: 13px;
    font-weight: 600;
}

/* Keep inner OpenAI usage panel visibly inset from the outer integration card. */
.openai-usage-shell {
    padding-left: 18px;
    padding-right: 18px;
}

@media (max-width: 700px) {
    .alert-methods-header { padding-bottom: 16px; }
    .travel-save-row { align-items: stretch; flex-direction: column; }
    .travel-unsaved-indicator { margin-right: 0; }
}

.tracker-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 5000;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 240px;
    max-width: calc(100vw - 32px);
    padding: 11px 13px;
    border: 1px solid #dedfea;
    border-radius: 12px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 16px 44px rgba(24,27,67,.18);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
}

.tracker-toast button {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font-weight: 750;
}

/* =========================================================
   PHASE 7J — Scanner collection mode clarity
   ========================================================= */
.scanner-project-collection {
    display: block;
}

.scanner-project-collection > .field-label {
    display: block;
    margin-bottom: 8px;
    color: #303445;
    font-size: 13px;
    font-weight: 650;
}

.scanner-collection-controls {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(220px, .8fr);
    gap: 12px;
    align-items: end;
}

.scanner-profile-scope-summary {
    margin-top: 12px;
    padding: 13px 14px;
    border: 1px solid #e5e7ef;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(255,255,255,.88), rgba(245,246,251,.96));
}

.scanner-profile-scope-label {
    display: block;
    margin-bottom: 9px;
    color: #697080;
    font-size: 12px;
    font-weight: 600;
}

.scanner-profile-scope-types {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.scanner-profile-scope-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    border: 1px solid #e4e5ee;
    border-radius: 999px;
    background: #fff;
    color: #404555;
    font-size: 12px;
    font-weight: 600;
}

.scanner-profile-scope-empty {
    display: grid;
    gap: 2px;
    color: #8a5b19;
    font-size: 12px;
}

.scanner-profile-edit-link {
    display: inline-flex;
    margin-top: 10px;
    color: #6557d8;
    font-size: 12px;
    font-weight: 650;
    text-decoration: none;
}

.scanner-profile-edit-link:hover {
    text-decoration: underline;
}

.scanner-project-collection .scanner-project-types {
    margin-top: 12px;
}

.scanner-project-collection [hidden] {
    display: none !important;
}

@media (max-width: 760px) {
    .scanner-collection-controls {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   PHASE 7K — GRID + REFRESH/PREVIEW POLISH
   ========================================================= */

/* A Roles grid can be wider than the viewport. Never squeeze every selected
   column into the content width; the wrapper owns horizontal scrolling. */
.roles-table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-gutter: auto;
}

.roles-table-v2 {
    width: max-content;
    min-width: 100%;
    table-layout: fixed;
}

.roles-table-v2 th,
.roles-table-v2 td {
    position: relative;
    box-sizing: border-box;
    overflow-wrap: anywhere;
}

.roles-table-v2 th[data-sort-type]:not([data-sort-type="none"]) {
    cursor: pointer;
    user-select: none;
    padding-right: 22px;
}

.column-sort-indicator::after {
    content: "";
    margin-left: 5px;
    color: #8a8fa0;
    font-size: 9px;
}

.roles-table-v2 th[data-sort-dir="asc"] .column-sort-indicator::after { content: "▲"; }
.roles-table-v2 th[data-sort-dir="desc"] .column-sort-indicator::after { content: "▼"; }

.column-resizer {
    position: absolute;
    z-index: 3;
    top: 0;
    right: -3px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    touch-action: none;
}

.column-resizer::after {
    content: "";
    position: absolute;
    top: 22%;
    bottom: 22%;
    left: 3px;
    width: 1px;
    background: transparent;
}

.roles-table-v2 th:hover .column-resizer::after,
.column-resizing .column-resizer::after {
    background: #c8c5dc;
}

.column-resizing,
.column-resizing * { cursor: col-resize !important; user-select: none !important; }
.roles-table-v2 th.column-dragging { opacity: .42; }
.roles-table-v2 th.column-drop-target { box-shadow: inset 3px 0 0 var(--accent); }

/* Compact custom project-type cards: same visual language, less vertical mass. */
.scanner-project-types > summary {
    padding: 9px 12px;
}

.scanner-project-types .scanner-project-type-grid {
    padding: 9px;
    gap: 6px;
}

.scanner-project-type-card {
    min-height: 52px;
    padding: 7px 9px;
    gap: 8px;
    border-radius: 9px;
    font-size: 12px;
    line-height: 1.15;
}

.scanner-project-type-card input {
    width: 22px;
    height: 22px;
    margin: 0;
    flex: 0 0 22px;
}

.scanner-project-type-card span {
    line-height: 1.15;
}

/* =========================================================
   PHASE 7M — RESPONSIVE SHELL / PROFILE / ROLES GRID
   ========================================================= */

/* Roles uses the available desktop workspace instead of the generic 1440px content cap. */
.role-list-panel {
    max-width: none !important;
    width: calc(100vw - 255px - 56px) !important;
    margin-left: 50% !important;
    margin-right: 0 !important;
    transform: translateX(-50%);
}
body.sidebar-collapsed .role-list-panel {
    width: calc(100vw - 76px - 56px) !important;
}

.roles-table-v2 th {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: normal;
    word-break: normal;
}
.roles-table-v2 td {
    overflow-wrap: break-word;
    word-break: normal;
}

.roles-mobile-list { display: none; }
.role-mobile-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    padding: 16px;
    box-shadow: 0 6px 20px rgba(20,21,60,.05);
}
.role-mobile-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.role-mobile-heading h3 { margin:0; font-size:15px; }
.role-mobile-heading p { margin:4px 0 0; color:var(--muted); font-size:12px; }
.role-mobile-meta { display:flex; flex-wrap:wrap; gap:7px; align-items:center; margin-top:10px; font-size:11px; color:var(--muted); }
.role-mobile-scores { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin-top:14px; }
.role-mobile-scores>div,.role-mobile-details>div { padding:10px; border-radius:10px; background:var(--surface-alt); min-width:0; }
.role-mobile-scores span,.role-mobile-details span { display:block; color:var(--muted); font-size:9px; margin-bottom:4px; }
.role-mobile-scores strong,.role-mobile-details strong { font-size:12px; overflow-wrap:anywhere; }
.role-mobile-details { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-top:8px; }
.role-mobile-actions { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-top:14px; }
.role-mobile-actions .table-secondary-button { min-height:38px; }

.profile-overview-grid { max-width:1180px; }

.mobile-nav-backdrop {
    display:none;
    position:fixed;
    inset:60px 0 0;
    z-index:54;
    border:0;
    background:rgba(22,24,34,.28);
    backdrop-filter:blur(2px);
}

/* Medium desktop: switch Scanner before its columns become cramped. */
@media (max-width: 1400px) {
    .scanner-main-grid { grid-template-columns: 1fr !important; }
    .scanner-preview-card { order: 2; }
    .scanner-filter-panel { order: 1; }
    .scanner-collection-controls { grid-template-columns: 1fr !important; }
    .role-list-panel,
    body.sidebar-collapsed .role-list-panel {
        width: calc(100vw - 255px - 40px) !important;
    }
    body.sidebar-collapsed .role-list-panel { width: calc(100vw - 76px - 40px) !important; }
}

@media (max-width: 1050px) {
    .content { padding-left:24px; padding-right:24px; }
    .role-list-panel { width:calc(100vw - 255px - 28px) !important; }
    body.sidebar-collapsed .role-list-panel { width:calc(100vw - 76px - 28px) !important; }
    .scanner-command-bar { grid-template-columns:1fr !important; }
    .scanner-command-actions { justify-content:stretch; width:100%; }
    .scanner-command-actions > *, .scanner-command-actions form, .scanner-command-actions button { flex:1; width:100%; }
    .scanner-schedule-compact { grid-column:auto !important; grid-row:auto !important; border-left:0 !important; border-top:1px solid var(--border); padding:12px 0 0 !important; }
}

/* First-class phone layout. */
@media (max-width: 760px) {
    html, body { overflow-x:hidden; }
    .global-nav { height:60px; padding:0 14px; gap:10px; }
    .global-nav-brand span { display:inline !important; }
    .global-nav-links { display:none !important; }
    .sidebar-toggle { margin-left:auto; }

    .sidebar,
    body.sidebar-collapsed .sidebar {
        display:flex !important;
        width:min(86vw,320px) !important;
        top:60px;
        left:0;
        bottom:0;
        padding:18px 14px 16px !important;
        transform:translateX(-105%);
        transition:transform .2s ease;
        z-index:65;
        box-shadow:18px 0 45px rgba(20,21,60,.18);
    }
    body.mobile-nav-open .sidebar { transform:translateX(0); }
    body.mobile-nav-open .mobile-nav-backdrop { display:block; }
    .sidebar-brand { display:none !important; }
    .sidebar .nav-label,
    .sidebar .user-info,
    .sidebar .logout-button { display:block !important; }
    .sidebar .nav-item,
    body.sidebar-collapsed .sidebar .nav-item { justify-content:flex-start !important; padding:11px 12px !important; }
    .sidebar .nav-group-label { display:block !important; font-size:9px !important; height:auto !important; padding:8px 12px 6px !important; margin:0 !important; border-top:0 !important; }
    .sidebar .nav-group-label-config { margin-top:10px !important; padding-top:14px !important; border-top:1px solid var(--border) !important; }
    .sidebar .nav-submenu { padding-left:42px; }
    .sidebar-user,
    body.sidebar-collapsed .sidebar-user { grid-template-columns:34px 1fr auto !important; justify-items:stretch !important; }

    .content,
    body.sidebar-collapsed .content {
        width:100% !important;
        margin-left:0 !important;
        margin-top:60px;
        padding:20px 14px 32px;
    }
    .content > * { max-width:none; }
    .topbar { margin-bottom:18px; align-items:flex-start; gap:10px; flex-wrap:wrap; }
    .topbar h1 { font-size:23px; }
    .topbar > :last-child:not(:first-child) { max-width:100%; }

    .panel-header { padding:16px; }
    .panel-header h3 { font-size:15px; }
    .panel { min-height:0; }
    .settings-grid, .metrics, .form-grid, .score-weight-grid, .priority-card-grid, .time-format-options { grid-template-columns:1fr !important; }
    .settings-card { padding:18px; }
    .form-grid, .form-section-body { padding:16px !important; }
    .profile-save-bar { bottom:10px; margin:0 0 4px; }

    .scanner-main-grid, .scanner-form-grid, .scanner-region-grid, .scanner-project-type-grid { grid-template-columns:1fr !important; }
    .scanner-form-grid { padding:16px !important; }
    .scanner-region-card, .scanner-project-type-card { min-height:48px; }
    .scanner-preview-frame { width:calc(100% - 20px); margin:10px; }
    .scanner-command-bar { padding:14px; gap:12px; }
    .scanner-command-actions { display:grid !important; grid-template-columns:1fr 1fr; }
    .scanner-command-actions form { width:100%; }
    .scanner-command-actions button { min-height:44px; }
    .advanced-settings-panel summary { padding:14px 16px; }

    .role-list-panel,
    body.sidebar-collapsed .role-list-panel {
        width:100% !important;
        margin-left:0 !important;
        transform:none !important;
    }
    .role-filter-bar-v2 { grid-template-columns:1fr !important; padding:14px !important; }
    .roles-header-tools { width:100%; flex-direction:row; align-items:center; }
    .roles-table-wrap { display:none; }
    .roles-mobile-list { display:grid; gap:12px; padding:14px; }
    .role-mobile-scores { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .role-mobile-details { grid-template-columns:1fr; }
    .role-mobile-actions > * { flex:1 1 130px; text-align:center; justify-content:center; }

    .table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; }
    .marquee-table { min-width:720px; }
    .travel-table { min-width:620px; }
    .scan-history-table, .alert-delivery-table { min-width:900px; }

    .role-report-shell { max-width:none !important; }
    .role-workflow-panel { padding:14px !important; }
    .role-score-strip, .role-report-score-strip { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
    .report-field-grid, .role-report-kv { grid-template-columns:1fr !important; padding:14px !important; }
    .report-section-heading { padding:9px 13px; }
    .assessment-block { padding:13px 14px; }
    .report-summary { margin:14px; }

    .schedule-status-grid, .scan-detail-grid, .scan-run-kv { grid-template-columns:1fr !important; }
    .schedule-run-now-panel { padding:16px !important; }
    .integration-grid-wide, .alert-channel-grid { grid-template-columns:1fr !important; }
    .integration-card, .alert-method-card { min-width:0; }

    .preview-viewer, .preview-modal-scroll { width:96vw !important; height:88vh !important; }
    .preview-zoom-toolbar { top:8px; max-width:calc(100% - 20px); }
    .preview-modal-time { display:none; }
    .preview-modal-close { top:10px; right:10px; }
}

@media (max-width: 430px) {
    .content, body.sidebar-collapsed .content { padding-left:10px; padding-right:10px; }
    .role-mobile-card { padding:14px; }
    .scanner-command-actions { grid-template-columns:1fr; }
    .role-mobile-actions { flex-direction:column; align-items:stretch; }
    .role-mobile-actions > * { width:100%; flex:auto; }
    .score-weight-card { min-width:0; }
}

/* =========================================================
   PHASE 7N — RESPONSIVE POLISH / REPORT / COLUMNS / TRAVEL
   ========================================================= */

/* Wider, glanceable column chooser on desktop. */
.columns-popover-wide {
    width: min(640px, calc(100vw - 48px));
    max-height: none;
    overflow: visible;
    padding: 16px;
}
.columns-option-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px 14px;
}
.columns-option-grid label {
    min-width: 0;
    white-space: nowrap;
}
.columns-popover-wide .columns-reset {
    width: auto;
    min-width: 130px;
}

/* Give Roles the widest practical desktop workspace. */
@media (min-width: 761px) {
    .role-list-panel {
        width: calc(100vw - 255px - 24px) !important;
        max-width: none !important;
    }
    body.sidebar-collapsed .role-list-panel {
        width: calc(100vw - 76px - 24px) !important;
    }
    .roles-table-wrap {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }
    .roles-table-v2 {
        width: max-content;
        min-width: 100%;
        table-layout: fixed;
    }
}

.roles-table-v2 th {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
}
.compensation-needs-review {
    display: inline-block;
    max-width: 150px;
    line-height: 1.2;
    color: #8b5d00;
    cursor: help;
}
.compensation-review-reason {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.35;
}

/* Scheduling form uses a calmer half-width rhythm for toggle/banner rows. */
.schedule-half {
    grid-column: span 1 !important;
    width: 100%;
    min-width: 0;
}
.weekday-field.schedule-half {
    align-self: stretch;
}

/* Role Report now follows Marquee Light instead of desktop teal. */
.role-workflow-panel {
    background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(246,244,252,.92));
}
.role-workflow-grid {
    grid-template-columns: minmax(220px, .9fr) minmax(320px, 1.6fr) auto;
    align-items: center;
}
.compensation-override-form {
    align-items: center;
}
.autosave-state {
    min-width: 48px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}
.report-section-heading {
    color: #3b315f !important;
    background: linear-gradient(135deg, rgba(246,242,255,.98), rgba(235,241,255,.96)) !important;
    border-top: 1px solid #e5def6;
    border-bottom: 1px solid #e2e5f2;
    letter-spacing: .04em;
}
.role-report-card {
    border-color: #e6e2ef;
}
.report-summary {
    background: linear-gradient(135deg, #f7f4ff, #f3f7ff) !important;
    color: var(--text);
}

/* Travel: desktop table + dedicated mobile cards. */
.travel-mobile-cards { display: none; }
.travel-mobile-card {
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    padding: 14px;
    box-shadow: 0 5px 18px rgba(20,21,60,.04);
}
.travel-mobile-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}
.travel-mobile-card .field + .field { margin-top: 10px; }

@media (max-width: 1100px) and (min-width: 761px) {
    .columns-option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .columns-popover-wide { width: min(500px, calc(100vw - 300px)); }
    .role-workflow-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .columns-control { position: static; }
    .columns-popover-wide {
        position: fixed;
        left: 12px;
        right: 12px;
        top: 76px;
        width: auto;
        max-height: calc(100vh - 96px);
        overflow: auto;
        z-index: 140;
    }
    .columns-option-grid { grid-template-columns: 1fr 1fr; gap: 2px 10px; }

    .travel-profile-form .panel-header { padding: 14px; }
    .travel-profile-form .panel-description { line-height: 1.35; }
    .travel-profile-form .table-wrap { display: none; }
    .travel-mobile-cards {
        display: grid;
        gap: 10px;
        padding: 12px 14px 4px;
    }
    .travel-save-row {
        padding: 14px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .travel-save-row .primary-gradient-button { width: 100%; }
    .travel-profile-form .setting-toggle { width: 100%; min-width: 0; }
    .travel-profile-form .money-input,
    .travel-profile-form .money-input input { width: 100%; }
    .topbar .table-secondary-button { max-width: 100%; }

    .role-report-top-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }
    .role-report-top-actions .table-secondary-button,
    .role-report-top-actions .primary-action { width: 100%; justify-content: center; text-align: center; }
    .role-workflow-grid { grid-template-columns: 1fr !important; gap: 10px; }
    .role-status-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
    .role-status-form .field { min-width: 0; }
    .compensation-override-form { display: block; }
    .autosave-state { display: block; margin-top: 5px; }
    .role-score-strip>div { padding: 10px 11px; }
    .role-score-strip strong { font-size: 16px; }

    .schedule-half { grid-column: 1 / -1 !important; }
}

@media (max-width: 430px) {
    .columns-option-grid { grid-template-columns: 1fr; }
    .travel-mobile-card { padding: 12px; }
}

/* =========================================================
   PHASE 7O — TRACKER SYNC / ALERT TEMPLATES / UI POLISH
   ========================================================= */

/* Notes: full-viewport, barely blurred backdrop. */
.simple-modal.note-modal {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(246,247,251,.18) !important;
    backdrop-filter: blur(2px) !important;
    -webkit-backdrop-filter: blur(2px) !important;
}

/* Roles command area: less narration, less empty space. */
.roles-page-header.compact-page-header { padding-bottom: 10px; }
.roles-page-header .page-subtitle { margin-top: 3px; font-size: 12px; color: var(--muted); }
.role-list-header { padding-top: 14px; padding-bottom: 12px; }
.role-list-header .roles-header-tools { margin-left: auto; }
.role-filter-bar-v2 { padding-top: 12px; padding-bottom: 12px; row-gap: 10px; }
@media (min-width: 1500px) {
    .role-filter-bar-v2 { grid-template-columns: minmax(230px,1.45fr) repeat(8,minmax(108px,.76fr)) auto; }
}

/* Desktop chooser opens into the workspace, never back over the sidebar. */
@media (min-width: 761px) {
    .columns-popover-wide { left: 0 !important; right: auto !important; }
}

/* Compact role report controls. */
.compact-role-controls { padding: 14px 16px; }
.role-controls-heading { margin: 0 0 8px; }
.role-workflow-grid {
    display: grid;
    grid-template-columns: minmax(220px,.8fr) minmax(320px,1.15fr) auto;
    align-items: end;
    gap: 14px;
}
.role-status-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.role-status-form .field { min-width: 0; }
.role-status-form select { width: 100%; }
.compensation-override-form { min-width: 0; }
.compensation-override-form .compact-toggle { width: 100%; min-height: 62px; }
.role-rescore-form { align-self: end; }
.autosave-state { min-width: 44px; font-size: 10px; color: var(--muted); }
@media (max-width: 1000px) and (min-width: 761px) {
    .role-workflow-grid { grid-template-columns: 1fr 1fr; }
    .role-rescore-form { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
    .compact-role-controls { padding: 12px; }
    .role-workflow-grid { grid-template-columns: 1fr !important; gap: 10px; }
    .role-status-form { grid-template-columns: 1fr auto; }
    .compensation-override-form .compact-toggle { min-height: 0; }
    .role-rescore-form, .role-rescore-form button { width: 100%; }
}

/* Alert template builder. */
.alert-variable-chips { display:flex; flex-wrap:wrap; gap:7px; padding:14px 16px 4px; }
.alert-variable-chip { border:1px solid #dcd9f5; background:#f7f5ff; color:#5e50c8; border-radius:999px; padding:6px 9px; font:600 10px/1.1 "Segoe UI",sans-serif; cursor:pointer; }
.alert-variable-chip:hover { background:#eeeaff; }
.alert-template-grid { display:grid; grid-template-columns:1.3fr .85fr .85fr; gap:12px; padding:12px 16px 16px; }
.alert-template-method { border:1px solid var(--border); border-radius:14px; padding:14px; background:linear-gradient(145deg,#fff,#fbfbff); }
.alert-template-method h4 { margin:0 0 10px; }
.alert-template-textarea { min-height:150px; resize:vertical; }
.alert-template-textarea.compact { min-height:96px; }
.alert-template-preview-wrap { display:flex; align-items:flex-start; gap:12px; padding:0 16px 16px; }
.alert-template-preview { flex:1; min-width:0; border:1px solid var(--border); border-radius:12px; padding:12px 14px; background:var(--surface-alt); }
.alert-template-preview strong { display:block; margin-bottom:8px; }
.alert-template-preview pre { margin:0; white-space:pre-wrap; font:12px/1.45 "Segoe UI",sans-serif; color:var(--text); }
.audition-alert-grid { grid-template-columns:1fr 1fr; }
.audition-reminder-options { display:flex; flex-wrap:wrap; gap:8px 14px; padding-top:8px; }
.audition-reminder-options label { display:inline-flex; gap:6px; align-items:center; font-size:12px; }
.audition-delivery-history { margin-top:18px; }
@media (max-width: 980px) {
    .alert-template-grid { grid-template-columns:1fr; }
    .audition-alert-grid { grid-template-columns:1fr; }
}
@media (max-width: 760px) {
    .alert-variable-chips { padding:12px; }
    .alert-template-grid { padding:8px 12px 12px; }
    .alert-template-preview-wrap { flex-direction:column; padding:0 12px 12px; }
    .alert-template-preview, .alert-template-preview-wrap button { width:100%; }
}


/* =========================================================
   PHASE 7X MATCH / TRACKER CONSISTENCY
   ========================================================= */
.tracker-status-inline.status-interested { background:#f2efff; color:#5a46c9; }
.tracker-status-inline.status-submitted { background:#e8f1ff; color:#255ea8; }
.tracker-status-inline.status-audition,
.tracker-status-inline.status-audition_received,
.tracker-status-inline.status-audition_confirmed,
.tracker-status-inline.status-audition_in_progress,
.tracker-status-inline.status-audition_submitted { background:#fff5dc; color:#8a5b00; }
.tracker-status-inline.status-callback { background:#fce9f4; color:#a33370; }
.tracker-status-inline.status-booked,
.tracker-status-inline.status-casted { background:#e4f7ef; color:#13704e; }
.tracker-status-inline.status-passed,
.tracker-status-inline.status-closed { background:#f1f2f5; color:#666b76; }

.match-actions-compact { align-items:flex-start; }
.match-action-buttons { display:flex; align-items:center; gap:6px; }
.inline-unmatch-form { margin:0; }
.unmatch-button { white-space:nowrap; }
.role-match-override-form { align-self:end; }

@media (max-width: 760px) {
    .match-action-buttons { flex-wrap:wrap; }
}


/* =========================================================
   PHASE 8E — MODAL CONSISTENCY
   ========================================================= */
.simple-modal {
    backdrop-filter: blur(2px) !important;
    -webkit-backdrop-filter: blur(2px) !important;
}
.marquee-modal-close,
.simple-modal-close {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(95, 84, 160, .16) !important;
    border-radius: 999px;
    background: rgba(248, 247, 255, .94) !important;
    color: #55506f;
    box-shadow: 0 8px 24px rgba(31, 34, 73, .10);
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.marquee-modal-close:hover,
.simple-modal-close:hover {
    background: #f0edff !important;
    border-color: rgba(95, 84, 160, .28) !important;
    transform: translateY(-1px);
}
.marquee-modal-close svg,
.simple-modal-close svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}


/* Phase 8K: scheduling hierarchy + compact cadence controls. */
.schedule-master-header {
    align-items: center;
    gap: 18px;
}
.schedule-master-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 6px;
}
.schedule-master-switch input {
    width: 22px;
    height: 22px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}
.schedule-controls {
    min-inline-size: 0;
    margin: 0;
    padding: 0;
    border: 0;
    transition: opacity 180ms ease;
}
.schedule-controls.is-disabled {
    opacity: .48;
}
.schedule-core-grid {
    align-items: start;
}
.schedule-days-compact {
    min-height: 0;
    padding: 12px 14px 10px;
    align-self: start !important;
}
.schedule-days-compact label {
    margin-top: 2px;
    margin-bottom: 2px;
}
.schedule-run-every {
    align-self: start;
}
.schedule-panel > .form-actions-inline {
    margin-top: 18px;
}
@media (max-width: 760px) {
    .schedule-master-header {
        align-items: flex-start;
    }
    .schedule-master-switch {
        margin-top: 2px;
    }
}

/* =========================================================
   PHASE 8L SCHEDULING LAYOUT REFINEMENTS
   ========================================================= */
.schedule-master-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}
.schedule-master-header > div {
    min-width: 0;
}
.schedule-master-header h3 {
    margin-top: 0;
}
.schedule-master-switch {
    margin-left: auto;
    padding: 2px 0 0 10px;
}
.schedule-left-stack {
    display: grid;
    align-content: start;
    gap: 16px;
    min-width: 0;
}
.schedule-run-every {
    margin: 0;
}
.schedule-run-now-panel {
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 22px;
}
.schedule-run-now-panel > div {
    min-width: 0;
}
.schedule-run-now-panel h3 {
    margin: 0 0 6px;
    font-size: 16px;
}
.schedule-run-now-panel .section-copy {
    margin: 0;
    max-width: 760px;
}
.schedule-run-now-panel form {
    flex: 0 0 auto;
    margin: 0;
}

@media (max-width: 760px) {
    .schedule-master-header {
        align-items: flex-start;
    }
    .schedule-master-switch {
        padding-top: 1px;
    }
    .schedule-run-now-panel {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
        padding: 16px !important;
    }
}

/* =========================================================
   PHASE 8U — live processing + maintenance
   ========================================================= */
.schedule-left-stack {
    align-self: start;
    align-content: start;
    grid-auto-rows: max-content;
    gap: 10px;
}
.schedule-run-every {
    margin-top: 0 !important;
}

.processing-sparkle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #6d5dfc;
    font-weight: 700;
    white-space: nowrap;
}
.processing-sparkle::before {
    content: "✦";
    display: inline-block;
    font-size: .9em;
    transform-origin: 50% 50%;
    animation: marquee-processing-sparkle 1.35s ease-in-out infinite;
}
@keyframes marquee-processing-sparkle {
    0%, 100% { opacity: .48; transform: scale(.86) rotate(-8deg); }
    50% { opacity: 1; transform: scale(1.08) rotate(8deg); }
}
@media (prefers-reduced-motion: reduce) {
    .processing-sparkle::before { animation: none; opacity: .8; }
}

.maintenance-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.maintenance-action-card {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 330px;
}
.maintenance-action-copy h3 { margin: 3px 0 7px; }
.maintenance-action-copy p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}
.maintenance-danger-card { border-color: #ead9df; }
.maintenance-count-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
}
.maintenance-count-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.maintenance-count-grid > div {
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-alt);
}
.maintenance-count-grid span,
.maintenance-count-grid strong { display: block; }
.maintenance-count-grid span { color: var(--muted); font-size: 10px; }
.maintenance-count-grid strong { margin-top: 3px; font-size: 16px; }
.maintenance-preserve-note,
.maintenance-blocked {
    padding: 11px 12px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.5;
}
.maintenance-preserve-note {
    background: rgba(109,93,252,.06);
    border: 1px solid rgba(109,93,252,.13);
    color: var(--muted);
}
.maintenance-blocked {
    background: rgba(164,55,75,.07);
    border: 1px solid rgba(164,55,75,.18);
    color: #8a3345;
}
.maintenance-action-card > button { align-self: flex-start; margin-top: auto; }
.danger-outline-button,
.danger-solid-button {
    min-height: 36px;
    padding: 0 13px;
    border-radius: var(--button-radius);
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}
.danger-outline-button {
    border: 1px solid rgba(164,55,75,.3);
    background: #fff;
    color: #97384b;
}
.danger-solid-button {
    border: 1px solid #9e3c50;
    background: #9e3c50;
    color: #fff;
}
.danger-outline-button:disabled { opacity: .45; cursor: not-allowed; }
.maintenance-output-panel { margin-bottom: 18px; }
.maintenance-output-log {
    display: grid;
    gap: 8px;
    padding: 18px 22px 22px;
}
.maintenance-output-log > div {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 12px;
    line-height: 1.5;
}
.maintenance-output-mark { color: #4d927c; font-weight: 800; }

.marquee-confirm-dialog {
    width: min(520px, calc(100vw - 28px));
    border: 1px solid #e4def0;
    border-radius: 16px;
    padding: 0;
    background: rgba(255,255,255,.98);
    color: var(--text);
    box-shadow: 0 18px 60px rgba(38,32,62,.16);
}
.marquee-confirm-dialog::backdrop {
    background: rgba(255,255,255,.02);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.maintenance-confirm-form {
    position: relative;
    display: grid;
    gap: 15px;
    padding: 24px;
}
.maintenance-confirm-form h3 { margin: 0; font-size: 18px; }
.maintenance-confirm-form > p:not(.eyebrow) {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
    padding-right: 36px;
}
.marquee-dialog-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #e6e0f2;
    border-radius: 50%;
    background: #fbfaff;
    color: #5f557b;
    cursor: pointer;
}
.marquee-dialog-close svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
}
.marquee-dialog-close:hover { background: #f4f0ff; }
.maintenance-confirm-check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.45;
}
.maintenance-confirm-check input { margin-top: 2px; }
.maintenance-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding-top: 3px;
}
@media (max-width: 760px) {
    .maintenance-grid { grid-template-columns: 1fr; }
    .maintenance-count-grid,
    .maintenance-count-grid-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
