/* Phase 3 Step 6.5 — premium enterprise portal UI foundation.
   Public website styling remains separate. Internal light mode is intentionally
   calm grey rather than bright white for long operational sessions. */
:root {
    color-scheme: light;
    --portal-bg: #F4F6F9;
    --portal-bg-deep: #dde2e7;
    --portal-surface: #f3f5f7;
    --portal-surface-strong: #f8f9fa;
    --portal-surface-muted: #eceff2;
    --portal-input: #f7f8f9;
    --portal-text: #242b33;
    --portal-heading: #1c232b;
    --portal-muted: #66717d;
    --portal-subtle: #87919c;
    --portal-border: #d0d6dc;
    --portal-border-soft: #dce1e6;
    --portal-accent: #dfbd32;
    --portal-accent-hover: #e7cf5c;
    --portal-primary: #17191c;
    --portal-primary-hover: #303236;
    --portal-primary-soft: rgba(223, 189, 50, .18);
    --portal-secondary: #66635b;
    --portal-secondary-soft: rgba(102, 99, 91, .10);
    --portal-success: #3f8d63;
    --portal-success-soft: rgba(63, 141, 99, .11);
    --portal-warning: #a36b14;
    --portal-warning-soft: rgba(163, 107, 20, .11);
    --portal-danger: #b24d47;
    --portal-danger-soft: rgba(178, 77, 71, .10);
    --portal-shadow-xs: 0 1px 2px rgba(27, 35, 43, .04);
    --portal-shadow: inset 0 1px 0 rgba(255, 255, 255, .85), 0 2px 4px rgba(27, 35, 43, .06), 0 10px 22px -8px rgba(27, 35, 43, .18);
    --portal-shadow-lg: 0 18px 50px rgba(27, 35, 43, .09);
    --portal-radius-sm: .65rem;
    --portal-radius: .9rem;
    --portal-radius-lg: 1.1rem;
    --portal-content: 92rem;
}

html[data-color-mode="dark"] {
    color-scheme: dark;
    --portal-bg: #202124;
    --portal-bg-deep: #17191c;
    --portal-surface: #292b2f;
    --portal-surface-strong: #303236;
    --portal-surface-muted: #25272b;
    --portal-input: #202124;
    --portal-text: #edf0f3;
    --portal-heading: #f7f8f9;
    --portal-muted: #b5bdc6;
    --portal-subtle: #929da8;
    --portal-border: #3d4650;
    --portal-border-soft: #343d46;
    --portal-primary: #dfbd32;
    --portal-primary-hover: #e7cf5c;
    --portal-primary-soft: rgba(223, 189, 50, .18);
    --portal-secondary: #c2bdaa;
    --portal-secondary-soft: rgba(194, 189, 170, .10);
    --portal-success: #72bd90;
    --portal-success-soft: rgba(114, 189, 144, .12);
    --portal-warning: #e2b15b;
    --portal-warning-soft: rgba(226, 177, 91, .12);
    --portal-danger: #e48780;
    --portal-danger-soft: rgba(228, 135, 128, .12);
    --portal-shadow-xs: 0 1px 2px rgba(0, 0, 0, .12);
    --portal-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 2px 4px rgba(0, 0, 0, .16), 0 12px 24px -8px rgba(0, 0, 0, .38);
    --portal-shadow-lg: 0 22px 55px rgba(0, 0, 0, .22);
}

html,
body { min-height: 100%; }

body.portal-body {
    margin: 0;
    background:
        radial-gradient(circle at 100% 0%, var(--portal-primary-soft), transparent 31rem),
        linear-gradient(180deg, var(--portal-bg) 0%, var(--portal-bg-deep) 100%) !important;
    color: var(--portal-text) !important;
    font-size: 15px;
    line-height: 1.55;
}

html:not([data-color-mode="dark"]) body.portal-body {
    background: var(--portal-bg) !important;
}

body.portal-body,
body.portal-body button,
body.portal-body input,
body.portal-body select,
body.portal-body textarea {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--portal-primary); }
a:hover { color: var(--portal-primary-hover); }

.portal-app-shell { min-height: 100vh; }

.portal-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 clamp(1rem, 2.3vw, 2rem);
    background: #dfbd32;
    border-bottom: 1px solid #17191c;
    box-shadow: 0 2px 10px rgb(0 0 0 / 10%);
}

.portal-topbar-inner {
    width: 100%;
    min-height: 4rem;
    margin: 0 auto;
    padding: .5rem 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1.5rem;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.portal-brand {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    color: var(--portal-text);
    text-decoration: none;
}

.portal-topbar .portal-topbar-inner {
    background: transparent;
    border-color: rgb(255 255 255 / 25%);
    box-shadow: none;
}
.portal-topbar .portal-brand,
.portal-topbar .portal-brand-copy strong,
.portal-topbar .portal-brand-copy small,
.portal-topbar .portal-user-copy strong,
.portal-topbar .portal-user-copy small { color: #fff; }
.portal-topbar .portal-primary-nav {
    background: transparent;
    border: 0;
    padding: 0;
    justify-self: start;
}
.portal-topbar .portal-user-chip { background: transparent; border: 0; padding: 0; }
.portal-topbar .portal-brand-mark { width: 2.25rem; height: 2.25rem; background: #fff; color: #17191c; box-shadow: none; border-radius: .6rem; }
.portal-topbar .portal-user-avatar { background: rgb(255 255 255 / 18%); box-shadow: none; }
.portal-topbar .portal-topbar-logout { margin: 0; display: flex; }
.portal-topbar .portal-primary-nav a { color: #fff; }
.portal-topbar .portal-primary-nav a:hover,
.portal-topbar .portal-primary-nav a.is-active { background: #fff; color: #17191c; }
.portal-topbar .app-mode-toggle,
.portal-topbar .portal-icon-button {
    background: rgb(255 255 255 / 12%) !important;
    border-color: rgb(255 255 255 / 40%);
    color: #fff !important;
}
.portal-topbar .app-mode-toggle:hover,
.portal-topbar .app-mode-toggle:focus-visible,
.portal-topbar .portal-icon-button:hover,
.portal-topbar .portal-icon-button:focus-visible {
    background: rgb(255 255 255 / 24%) !important;
    border-color: #fff;
}

.portal-brand:hover { color: var(--portal-text); }

.portal-brand-mark,
.portal-user-avatar,
.portal-dashboard-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: .8rem;
    background: linear-gradient(145deg, #dfbd32, #f6e68a);
    color: #17191c;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(223, 189, 50, .18);
}

.portal-brand-mark { width: 2.7rem; height: 2.7rem; font-size: 1rem; }
.portal-brand-copy,
.portal-user-copy { display: grid; min-width: 0; }
.portal-brand-copy strong { color: var(--portal-heading); font-size: .98rem; line-height: 1.2; }
.portal-brand-copy small,
.portal-user-copy small { color: var(--portal-muted); font-size: .72rem; }

.portal-primary-nav {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .28rem;
    border: 1px solid var(--portal-border-soft);
    border-radius: .8rem;
    background: var(--portal-surface-muted);
}

.portal-primary-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 2.45rem;
    padding: .48rem .85rem;
    border-radius: .62rem;
    color: var(--portal-muted);
    text-decoration: none;
    font-size: .82rem;
    font-weight: 750;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.portal-primary-nav a:hover,
.portal-primary-nav a.is-active {
    background: var(--portal-surface-strong);
    color: var(--portal-heading);
    box-shadow: var(--portal-shadow-xs);
}

.portal-primary-nav a.is-active::before {
    content: "";
    width: .38rem;
    height: .38rem;
    margin-inline-end: .45rem;
    border-radius: 50%;
    background: var(--portal-accent);
}

.portal-topbar-actions {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .55rem;
}

.app-mode-toggle,
.portal-icon-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: .42rem;
    min-height: 2.6rem;
    border: 1px solid var(--portal-border);
    border-radius: .72rem;
    background: var(--portal-surface-muted) !important;
    color: var(--portal-text) !important;
    box-shadow: none;
    font-size: .78rem;
    font-weight: 800;
    cursor: pointer;
}

.app-mode-toggle { padding: .55rem .72rem; }
.portal-icon-button { width: 2.6rem; padding: 0; }
.portal-icon-button svg { width: 1.12rem; height: 1.12rem; }
.app-mode-toggle:hover,
.portal-icon-button:hover,
.app-mode-toggle:focus-visible,
.portal-icon-button:focus-visible {
    border-color: color-mix(in srgb, var(--portal-primary) 55%, var(--portal-border));
    background: var(--portal-surface-strong) !important;
    outline: none;
}

.guest-mode-toggle { position: fixed; top: 1rem; inset-inline-end: 1rem; z-index: 100; }

.portal-user-chip {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .58rem;
    padding: .35rem .55rem .35rem .4rem;
    border: 1px solid transparent;
    border-radius: .75rem;
}
.portal-user-avatar { width: 2.15rem; height: 2.15rem; border-radius: .65rem; font-size: .78rem; }
.portal-user-copy strong {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--portal-heading);
    font-size: .8rem;
    line-height: 1.15;
}

.portal-main.shell {
    min-height: auto;
    display: block !important;
    place-items: initial !important;
    width: 100%;
    padding: clamp(1.15rem, 2.5vw, 2rem) clamp(1rem, 2.3vw, 2rem) 3rem !important;
}

.guest-shell.shell { min-height: 100vh; padding-block-start: 5rem; }
.guest-website-link { position: absolute; top: 1rem; inset-inline-start: 1rem; z-index: 100; }

.portal-main > * {
    width: min(100%, var(--portal-content));
    margin-inline: auto;
}

.auth-card,
.portal-card,
.foundation-card,
.ops-summary-grid article,
.ops-panel,
.ops-filters,
.ops-table-wrap,
.tech-summary-grid article,
.tech-job-card,
.portal-dashboard-hero,
.portal-launch-card {
    border: 1px solid var(--portal-border) !important;
    background: var(--portal-surface) !important;
    color: var(--portal-text) !important;
    box-shadow: var(--portal-shadow);
}

.auth-card,
.portal-card,
.foundation-card {
    border-radius: var(--portal-radius-lg);
}

.portal-dashboard { display: grid; gap: 1.25rem; }
.portal-dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: clamp(1.5rem, 3vw, 2.3rem);
    border-radius: var(--portal-radius-lg);
    background:
        linear-gradient(115deg, var(--portal-surface-strong), var(--portal-surface)) !important;
}
.portal-dashboard-hero h1 { margin: .2rem 0 .5rem; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.035em; }
.portal-dashboard-hero p { max-width: 48rem; margin: 0; color: var(--portal-muted); }
.portal-dashboard-identity {
    min-width: 15rem;
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .85rem 1rem;
    border: 1px solid var(--portal-border-soft);
    border-radius: var(--portal-radius);
    background: var(--portal-surface-muted);
}
.portal-dashboard-avatar { width: 3rem; height: 3rem; }
.portal-dashboard-identity div { display: grid; }
.portal-dashboard-identity small,
.portal-dashboard-identity span { color: var(--portal-muted); font-size: .78rem; }
.portal-dashboard-identity strong { color: var(--portal-heading); }
.portal-launch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.portal-launch-card {
    min-height: 7rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
    border-radius: var(--portal-radius);
    color: var(--portal-text);
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.portal-launch-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--portal-primary) 45%, var(--portal-border)) !important; color: var(--portal-text); box-shadow: var(--portal-shadow-lg); }
.portal-launch-card > span:nth-child(2),
.portal-launch-card > .portal-launch-copy { display: grid; gap: .15rem; }
.portal-launch-card strong { color: var(--portal-heading); }
.portal-launch-card small { color: var(--portal-muted); }
.portal-launch-icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: .8rem;
    background: var(--portal-primary-soft);
    color: var(--portal-primary);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .04em;
}
.portal-launch-primary .portal-launch-icon { background: var(--portal-accent); color: #17191c; }
.portal-launch-arrow { color: var(--portal-subtle); font-size: 1.5rem; }
.portal-launch-disabled { opacity: .8; }

.eyebrow {
    margin: 0 0 .45rem;
    color: var(--portal-primary) !important;
    font-size: .7rem;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: .15em;
    font-weight: 900;
}

.ops-shell,
.tech-shell { width: min(100%, var(--portal-content)) !important; margin: 0 auto; }
.tech-shell { --portal-content: 88rem; }

.ops-header,
.tech-header {
    min-height: 7rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin: 0 0 1.25rem;
    padding: clamp(1.35rem, 2.5vw, 2rem);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-lg);
    background: linear-gradient(120deg, var(--portal-surface-strong), var(--portal-surface));
    box-shadow: var(--portal-shadow);
}
.ops-header h1,
.tech-header h1 {
    margin: .12rem 0 .35rem;
    color: var(--portal-heading);
    font-size: clamp(1.8rem, 3.5vw, 2.65rem);
    line-height: 1.05;
    letter-spacing: -.035em;
}
.ops-header p,
.tech-header p { margin: 0; color: var(--portal-muted) !important; }
.ops-header a:first-child,
.tech-header a:first-child { font-size: .82rem; font-weight: 800; text-decoration: none; }

.tech-header-accent {
    display: flex;
    align-items: end;
    gap: .35rem;
    height: 3.2rem;
    padding: .65rem .8rem;
    border: 1px solid var(--portal-border-soft);
    border-radius: .8rem;
    background: var(--portal-surface-muted);
}
.tech-header-accent span {
    width: .42rem;
    border-radius: 999px;
    background: var(--portal-accent);
}
.tech-header-accent span:nth-child(1) { height: 42%; opacity: .65; }
.tech-header-accent span:nth-child(2) { height: 78%; opacity: .82; }
.tech-header-accent span:nth-child(3) { height: 100%; }

.ops-header-actions,
.portal-actions,
.ops-filter-actions,
.tech-summary-actions,
.tech-workflow-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem !important;
}
.ops-header-actions { justify-content: flex-end; }

button,
.portal-button {
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border: 1px solid var(--portal-primary);
    border-radius: .72rem !important;
    background: var(--portal-accent);
    color: #17191c;
    padding: .68rem 1rem;
    font-weight: 800;
    line-height: 1.15;
    text-decoration: none;
    box-shadow: 0 7px 16px rgba(223, 189, 50, .12);
    transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
button:hover,
.portal-button:hover { transform: translateY(-1px); background: var(--portal-accent-hover); border-color: var(--portal-accent-hover); color: #17191c; box-shadow: 0 9px 20px rgba(223, 189, 50, .16); }
button:focus-visible,
.portal-button:focus-visible { outline: 3px solid var(--portal-primary); outline-offset: 2px; }
.portal-button.button-secondary,
button.button-secondary {
    background: var(--portal-surface-strong) !important;
    border-color: var(--portal-border) !important;
    color: var(--portal-text) !important;
    box-shadow: var(--portal-shadow-xs);
}
.portal-button.button-secondary:hover,
button.button-secondary:hover { border-color: color-mix(in srgb, var(--portal-primary) 45%, var(--portal-border)) !important; }
.tech-complete-button { background: var(--portal-success) !important; border-color: var(--portal-success) !important; color: #fff !important; box-shadow: 0 7px 16px var(--portal-success-soft); }

input,
select,
textarea {
    width: 100%;
    min-height: 2.75rem;
    border: 1px solid var(--portal-border) !important;
    border-radius: .72rem !important;
    background: var(--portal-input) !important;
    color: var(--portal-text) !important;
    padding: .72rem .85rem;
    outline: none;
    box-shadow: inset 0 1px 1px rgba(27, 35, 43, .02);
}
textarea { min-height: 7.5rem; resize: vertical; }
input:focus,
select:focus,
textarea:focus { border-color: var(--portal-primary) !important; box-shadow: 0 0 0 3px var(--portal-primary-soft) !important; }
label { gap: .48rem; }
label > span { color: var(--portal-heading); font-size: .8rem; font-weight: 800; }

.notice,
.tech-workflow-error,
.error.ops-error-list {
    margin: 0 0 1rem;
    padding: .9rem 1rem;
    border-radius: .72rem;
}
.notice { border: 1px solid color-mix(in srgb, var(--portal-success) 38%, var(--portal-border)) !important; background: var(--portal-success-soft) !important; color: var(--portal-text) !important; }
.tech-workflow-error,
.error.ops-error-list { border: 1px solid color-mix(in srgb, var(--portal-danger) 45%, var(--portal-border)) !important; background: var(--portal-danger-soft) !important; color: var(--portal-danger) !important; }

.ops-summary-grid,
.tech-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin: 0 0 1.25rem;
}
.ops-summary-grid article,
.tech-summary-grid article {
    min-height: 7.4rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: .55rem;
    padding: 1.15rem 1.2rem;
    border-radius: var(--portal-radius) !important;
}
.ops-summary-grid article::after,
.tech-summary-grid article::after {
    content: "";
    position: absolute;
    width: 4.8rem;
    height: 4.8rem;
    inset-inline-end: -1.4rem;
    top: -1.4rem;
    border-radius: 50%;
    background: var(--portal-primary-soft);
}
.ops-summary-grid strong,
.tech-summary-grid strong { color: var(--portal-heading); font-size: 2rem; line-height: 1; letter-spacing: -.04em; }
.ops-summary-grid span,
.tech-summary-grid span { color: var(--portal-muted) !important; font-size: .78rem; font-weight: 750; }

.ops-panel,
.ops-filters,
.ops-table-wrap,
.tech-job-card {
    border-radius: var(--portal-radius) !important;
}
.ops-panel { padding: 1.25rem; }
.ops-panel h2 { margin: 0 0 1rem; color: var(--portal-heading); font-size: 1rem; line-height: 1.25; }
.ops-panel h3 { margin: 0 0 .35rem; color: var(--portal-heading); font-size: .82rem; }
.ops-panel p { color: var(--portal-muted) !important; }

.ops-detail-grid,
.tech-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.ops-panel-wide,
.tech-panel-wide { grid-column: 1 / -1; }

.ops-dl,
dl.ops-dl { margin: 0; }
.ops-dl div,
.tech-job-meta div,
dl div {
    border-color: var(--portal-border-soft) !important;
}
.ops-dl div {
    grid-template-columns: minmax(8.5rem, .75fr) minmax(0, 1.25fr);
    gap: 1rem;
    padding: .78rem 0;
}
dt { color: var(--portal-muted) !important; font-size: .82rem; }
dd { color: var(--portal-heading); font-weight: 700; }

.ops-filters {
    grid-template-columns: minmax(16rem, 2fr) minmax(11rem, 1fr) minmax(13rem, 1fr) auto;
    gap: 1rem;
    padding: 1.15rem;
    margin-bottom: 1rem;
}
.ops-filter-actions { min-height: 2.75rem; }
.ops-filter-actions a { padding: .6rem .4rem; font-weight: 800; text-decoration: none; }

.ops-table-wrap { overflow-x: auto; }
.ops-table { width: 100%; min-width: 68rem; border-collapse: separate; border-spacing: 0; }
.ops-table th,
.ops-table td { padding: .95rem 1rem; text-align: start; border-bottom: 1px solid var(--portal-border-soft) !important; vertical-align: middle; }
.ops-table th { background: var(--portal-surface-muted); color: var(--portal-muted) !important; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 900; }
.ops-table tbody tr { transition: background .14s ease; }
.ops-table tbody tr:hover { background: color-mix(in srgb, var(--portal-primary-soft) 35%, transparent); }
.ops-table td:first-child a { font-weight: 850; text-decoration: none; }
.ops-empty,
.ops-pagination { padding: 1rem 1.15rem; }

.ops-badge,
.tech-status-badge,
.tech-state-chip,
.tech-paused-pill,
.tech-running-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border: 1px solid color-mix(in srgb, var(--portal-primary) 42%, var(--portal-border)) !important;
    border-radius: 999px !important;
    background: var(--portal-primary-soft) !important;
    color: color-mix(in srgb, var(--portal-primary) 78%, var(--portal-heading)) !important;
    padding: .34rem .62rem;
    font-size: .74rem;
    font-weight: 900;
    line-height: 1.2;
}
.tech-status-paused,
.tech-state-paused .tech-state-chip,
.tech-paused-pill { border-color: color-mix(in srgb, var(--portal-warning) 48%, var(--portal-border)) !important; background: var(--portal-warning-soft) !important; color: var(--portal-warning) !important; }
.tech-status-completed,
.tech-state-completed .tech-state-chip { border-color: color-mix(in srgb, var(--portal-success) 46%, var(--portal-border)) !important; background: var(--portal-success-soft) !important; color: var(--portal-success) !important; }

.tech-command-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(19rem, .75fr);
    gap: 1.1rem;
    margin-bottom: 1.1rem;
}
.tech-state-banner,
.tech-workflow-panel { margin: 0 !important; }
.tech-state-banner {
    min-height: 9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-inline-start: 4px solid var(--portal-primary) !important;
}
.tech-state-paused { border-inline-start-color: var(--portal-warning) !important; }
.tech-state-completed { border-inline-start-color: var(--portal-success) !important; }
.tech-state-banner h2 { margin: .1rem 0 .35rem; color: var(--portal-heading); font-size: clamp(1.7rem, 3.2vw, 2.45rem); letter-spacing: -.035em; }
.tech-state-banner p { margin: 0; }
.tech-workflow-panel { min-height: 9rem; display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 1rem; }
.tech-workflow-panel h2 { margin: .15rem 0 .45rem; }
.tech-workflow-actions { justify-content: flex-start; }
.tech-workflow-actions > form { margin: 0; }
.tech-workflow-actions > form .portal-button { width: auto; }

.tech-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.tech-job-card {
    position: relative;
    overflow: hidden;
    display: block;
    min-height: 15rem;
    padding: 1.25rem;
    color: var(--portal-text);
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.tech-job-card::after { content: "→"; position: absolute; inset-inline-end: 1.15rem; bottom: 1rem; color: var(--portal-subtle); font-size: 1.25rem; }
.tech-job-card:hover,
.tech-job-card:focus-visible { transform: translateY(-2px); border-color: color-mix(in srgb, var(--portal-primary) 48%, var(--portal-border)) !important; box-shadow: var(--portal-shadow-lg); outline: none; }
.tech-job-card h2 { margin: .85rem 0 .3rem; color: var(--portal-heading); font-size: 1.2rem; }
.tech-job-card > p { margin: 0 0 1rem; color: var(--portal-muted) !important; }
.tech-job-topline { display: flex; justify-content: space-between; gap: .8rem; align-items: center; }
.tech-job-meta { margin: .9rem 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.tech-job-meta div { grid-template-columns: minmax(6rem, .75fr) minmax(0, 1.25fr); gap: .7rem; padding: .52rem 0; }

.tech-report-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.tech-report-form label,
.tech-note-form label { display: grid; gap: .5rem; font-weight: 700; }
.tech-report-form .portal-button { grid-column: 1 / -1; justify-self: start; margin-top: .15rem; }
.tech-help { color: var(--portal-muted) !important; margin: -.25rem 0 1rem; }
.tech-note-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.tech-note-grid > div { padding: 1rem; border: 1px solid var(--portal-border) !important; border-radius: .75rem; background: var(--portal-surface-muted) !important; color: var(--portal-text) !important; }
.tech-note-grid h3 { margin: 0 0 .35rem; }
.tech-note-grid p { margin: 0; }

.tech-upload-form {
    display: grid;
    grid-template-columns: minmax(9rem, .7fr) minmax(11rem, 1fr) minmax(18rem, 1.65fr) auto;
    gap: 1rem;
    align-items: end;
    padding: 1rem;
    margin: .9rem 0 1.2rem;
    border: 1px solid var(--portal-border);
    border-radius: .85rem;
    background: var(--portal-surface-muted);
}
.tech-upload-form label { display: grid; gap: .42rem; font-weight: 700; }
.tech-upload-form small { color: var(--portal-muted); font-weight: 500; }
.tech-file-field input[type="file"] { padding: .58rem; }

.tech-media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.tech-media-card {
    overflow: hidden;
    display: grid;
    grid-template-rows: 155px auto;
    border: 1px solid var(--portal-border);
    border-radius: .82rem;
    background: var(--portal-surface-muted);
    box-shadow: var(--portal-shadow-xs);
}
.tech-media-card img { width: 100%; height: 155px; object-fit: cover; display: block; }
.tech-media-card > div:last-child { display: grid; gap: .28rem; padding: .85rem; }
.tech-media-card span { color: var(--portal-muted); font-size: .76rem; }
.tech-media-card a { font-size: .78rem; font-weight: 850; text-decoration: none; }
.tech-document-icon { display: grid; place-items: center; min-height: 155px; background: var(--portal-primary-soft); color: var(--portal-primary); font-size: 1.2rem; font-weight: 900; letter-spacing: .08em; }
.tech-note-form { display: grid; gap: .8rem; margin-top: 1rem; }
.tech-note-form .portal-button { justify-self: start; }

.ops-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.ops-list li { display: grid; gap: .25rem; padding: .8rem 0; border-bottom: 1px solid var(--portal-border-soft) !important; }
.ops-list li:last-child { border-bottom: 0 !important; }
.ops-list span { color: var(--portal-muted) !important; }

.tech-completion-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    margin-bottom: 1.1rem;
    border: 1px solid color-mix(in srgb, var(--portal-success) 42%, var(--portal-border));
    border-radius: var(--portal-radius);
    background: var(--portal-success-soft);
}
.tech-completion-hero h2 { margin: .1rem 0 .25rem; }
.tech-completion-hero p { margin: 0; }
.tech-completion-check { display: grid; place-items: center; width: 3rem; height: 3rem; flex: 0 0 3rem; border-radius: .8rem; background: var(--portal-success); color: #fff; font-size: 1.4rem; font-weight: 900; }
.tech-summary-actions { margin-top: .85rem; }
.print-only { display: none; }

@media (max-width: 1180px) {
    .portal-topbar-inner { grid-template-columns: auto 1fr auto; }
    .portal-brand-copy small,
    .portal-user-copy { display: none; }
    .portal-primary-nav { justify-self: center; }
    .tech-command-grid { grid-template-columns: 1fr; }
    .tech-workflow-panel { min-height: auto; }
}

@media (max-width: 980px) {
    .portal-topbar { padding-inline: .75rem; }
    .portal-topbar-inner { display: flex; flex-wrap: wrap; justify-content: space-between; }
    .portal-primary-nav { order: 3; width: 100%; overflow-x: auto; justify-content: flex-start; }
    .portal-primary-nav a { white-space: nowrap; }
    .ops-summary-grid,
    .tech-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ops-filters { grid-template-columns: 1fr 1fr; }
    .tech-upload-form { grid-template-columns: 1fr 1fr; }
    .tech-media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tech-list { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .portal-topbar { position: static; padding: 0 .75rem; }
    .portal-topbar-inner { border-radius: 0; gap: .65rem; }
    .portal-brand-copy { display: grid; }
    .portal-brand-copy strong { max-width: min(10rem, calc(100vw - 13rem)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
    .portal-user-chip { display: none; }
    .portal-main.shell { padding: .9rem .75rem 2rem !important; }
    .ops-header,
    .tech-header,
    .portal-dashboard-hero { display: grid; align-items: start; padding: 1.15rem; }
    .ops-header-actions { width: 100%; justify-content: flex-start; }
    .ops-header-actions > *,
    .ops-header-actions form,
    .ops-header-actions .portal-button { width: 100%; }
    .ops-detail-grid,
    .tech-detail-grid,
    .tech-note-grid { grid-template-columns: 1fr; }
    .ops-panel-wide,
    .tech-panel-wide { grid-column: auto; }
    .portal-launch-grid { grid-template-columns: 1fr; }
    .portal-dashboard-identity { min-width: 0; width: 100%; }
    .tech-state-banner { align-items: flex-start; flex-direction: column; }
    .tech-workflow-actions { display: grid; grid-template-columns: 1fr; width: 100%; gap: .75rem !important; }
    .tech-workflow-actions > form,
    .tech-workflow-actions > form .portal-button,
    .tech-workflow-actions > .portal-button { width: 100%; }
    .tech-report-form,
    .tech-upload-form,
    .tech-media-grid { grid-template-columns: 1fr; }
    .tech-report-form .portal-button,
    .tech-note-form .portal-button { width: 100%; }
    .tech-job-meta { grid-template-columns: 1fr; }
    .tech-job-meta div,
    .ops-dl div,
    dl div { grid-template-columns: 1fr; gap: .18rem; }
}

@media (max-width: 520px) {
    .app-mode-toggle [data-mode-label] { display: none; }
    .app-mode-toggle { width: 2.6rem; padding-inline: 0; }
    .portal-topbar-actions { gap: .35rem; }
    .ops-summary-grid,
    .tech-summary-grid { grid-template-columns: 1fr 1fr; gap: .7rem; }
    .ops-summary-grid article,
    .tech-summary-grid article { min-height: 6.4rem; padding: .95rem; }
    .ops-summary-grid strong,
    .tech-summary-grid strong { font-size: 1.6rem; }
    .ops-filters { grid-template-columns: 1fr; }
}

/* PowerSpike charcoal navigation with gold selections. */
.portal-topbar { background: #17191c !important; border-bottom-color: #dfbd32; }
.portal-topbar .portal-brand,
.portal-topbar .portal-brand-copy strong,
.portal-topbar .portal-brand-copy small,
.portal-topbar .portal-user-copy strong,
.portal-topbar .portal-user-copy small,
.portal-topbar .portal-primary-nav a,
.portal-topbar .portal-user-avatar { color: #f4f2e9; }
.portal-topbar .app-mode-toggle,
.portal-topbar .portal-icon-button { color: #f4f2e9 !important; }
.portal-topbar .portal-primary-nav a:hover,
.portal-topbar .portal-primary-nav a.is-active { background: #dfbd32; color: #17191c; }
.portal-topbar .portal-user-avatar { background: #dfbd32; color: #17191c; box-shadow: none; }
.portal-dashboard-avatar { background: #dfbd32; color: #17191c; }

@media print {
    @page { margin: 14mm; }
    :root,
    html[data-color-mode="dark"] {
        color-scheme: light;
        --portal-bg: #fff;
        --portal-bg-deep: #fff;
        --portal-surface: #fff;
        --portal-surface-strong: #fff;
        --portal-surface-muted: #fff;
        --portal-input: #fff;
        --portal-text: #111;
        --portal-heading: #111;
        --portal-muted: #444;
        --portal-border: #bbb;
        --portal-border-soft: #d5d5d5;
        --portal-shadow: none;
        --portal-shadow-lg: none;
    }
    body.portal-body { background: #fff !important; color: #111 !important; }
    .portal-main.shell { display: block !important; padding: 0 !important; }
    .no-print,
    .portal-topbar,
    .app-mode-toggle { display: none !important; }
    .print-only { display: block !important; }
    .tech-shell { width: 100% !important; max-width: none !important; }
    .ops-panel,
    .tech-media-card,
    .tech-note-grid > div { background: #fff !important; color: #111 !important; border-color: #bbb !important; box-shadow: none !important; }
    .tech-detail-grid { grid-template-columns: 1fr 1fr !important; }
    .tech-panel-wide { grid-column: 1 / -1 !important; }
    .tech-note-grid { grid-template-columns: 1fr 1fr !important; }
    .tech-media-grid-print { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .tech-media-card { grid-template-rows: 120px auto; break-inside: avoid; }
    .tech-media-card img { height: 120px; }
    .print-avoid-break { break-inside: avoid; }
    a { color: #111 !important; text-decoration: none !important; }
}

/* Phase 3 Step 6.5 Fix 1 — keep KPI/panel surfaces clean and text-led.
   Decorative corner ornaments are intentionally removed; meaningful status
   indicators and navigation affordances remain. */
.ops-summary-grid article::after,
.tech-summary-grid article::after {
    content: none !important;
    display: none !important;
}

.portal-language-switch {
    text-decoration: none;
    font-weight: 850;
}
