:root {
    color-scheme: light;

    --page: #e9eef5;
    --page-deep: #dfe7f1;
    --panel: #ffffff;
    --panel-soft: #f5f8fc;

    --ink: #12213a;
    --muted: #68768a;
    --line: #d6deea;

    --dhi-navy: #102b53;
    --dhi-blue: #1f67ca;
    --dhi-blue-soft: #e7f0ff;
    --dhi-cyan: #1da6c9;

    --table-head: #163867;
    --table-head-text: #ffffff;
    --table-row: #ffffff;
    --table-alt: #eef3f8;

    --shadow: 0 20px 50px rgba(17, 43, 83, 0.18);
}

html[data-theme="dark"] {
    color-scheme: dark;

    --page: #0d1724;
    --page-deep: #101d2c;
    --panel: #172334;
    --panel-soft: #1d2b3e;

    --ink: #edf3fb;
    --muted: #a9b5c5;
    --line: #314158;

    --dhi-navy: #0b1e3a;
    --dhi-blue: #4a91ef;
    --dhi-blue-soft: #1e3a60;
    --dhi-cyan: #4dc7e6;

    --table-head: #102d54;
    --table-head-text: #ffffff;
    --table-row: #172334;
    --table-alt: #1d2b3e;

    --shadow: 0 22px 52px rgba(0, 0, 0, 0.38);
}

* {
    box-sizing: border-box;
}

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

body {
    overflow-x: hidden;
    color: var(--ink);
    background:
        radial-gradient(
            circle at top right,
            color-mix(in srgb, var(--dhi-cyan) 16%, transparent),
            transparent 28rem
        ),
        linear-gradient(145deg, var(--page), var(--page-deep));
    font-family: Inter, Arial, Helvetica, sans-serif;
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
}

.guest-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

/* LOGIN */
.dhi-login-shell {
    width: min(760px, 100%);
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.dhi-login-brand {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 480px;
    padding: 34px;
    color: #ffffff;
    background: linear-gradient(
        155deg,
        rgba(29, 166, 201, 0.88),
        rgba(16, 43, 83, 0.98) 72%
    );
}

.dhi-mark {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    font-size: 0.85rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.dhi-login-brand span,
.dhi-dashboard-brand span {
    display: block;
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.dhi-login-brand h1 {
    margin: 9px 0 0;
    font-size: 2.1rem;
    line-height: 1;
}

.dhi-login-brand p {
    margin: 10px 0 0;
    font-size: 0.78rem;
    line-height: 1.5;
    opacity: 0.82;
}

.dhi-login-panel {
    position: relative;
    min-height: 480px;
    padding: 46px 42px 30px;
    color: var(--ink);
    background: var(--panel);
}

.corner-theme-button,
.dashboard-theme-button,
.icon-theme-button {
    display: grid;
    place-items: center;
    color: var(--ink);
    background: var(--panel-soft);
    border: 1px solid var(--line);
    cursor: pointer;
}

.corner-theme-button {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.login-heading span {
    color: var(--dhi-blue);
    font-size: 0.66rem;
    font-weight: 850;
    letter-spacing: 0.14em;
}

.login-heading h2 {
    margin: 7px 0 30px;
    font-size: 1.65rem;
}

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

.login-form label span {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
}

.login-form input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    color: var(--ink);
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
}

.login-form input:focus {
    border-color: var(--dhi-blue);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--dhi-blue) 18%, transparent);
}

.login-submit {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    background: linear-gradient(90deg, var(--dhi-blue), var(--dhi-cyan));
    font-size: 0.76rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    cursor: pointer;
}

.login-note {
    margin: 15px 0 0;
    color: var(--muted);
    font-size: 0.66rem;
    text-align: center;
}

.dhi-login-panel footer {
    margin-top: 36px;
    color: var(--muted);
    font-size: 0.64rem;
    text-align: center;
}

/* DASHBOARD */
.dashboard-screen {
    padding: clamp(24px, 5vh, 56px) clamp(20px, 4vw, 64px);
    background:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        radial-gradient(
            circle at 50% 15%,
            color-mix(in srgb, var(--dhi-blue) 15%, transparent),
            transparent 35rem
        ),
        linear-gradient(145deg, var(--page), var(--page-deep));
    background-size:
        40px 40px,
        40px 40px,
        auto,
        auto;
}

.dhi-dashboard-icon-display {
    width: min(1180px, 100%);
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.dashboard-command-header {
    min-height: 108px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 28px;
    color: #ffffff;
    background: linear-gradient(
        110deg,
        var(--dhi-navy),
        color-mix(in srgb, var(--dhi-blue) 78%, var(--dhi-navy))
    );
}

.dashboard-command-brand,
.dashboard-command-actions,
.dashboard-command-title,
.dashboard-scope-chips,
.dashboard-clock {
    display: flex;
    align-items: center;
}

.dashboard-command-brand {
    gap: 15px;
}

.dashboard-command-brand span {
    display: block;
    font-size: 0.64rem;
    font-weight: 850;
    letter-spacing: 0.13em;
}

.dashboard-command-brand h1 {
    margin: 5px 0 0;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}

.dashboard-command-actions {
    gap: 12px;
}

.dashboard-clock {
    min-width: 154px;
    align-items: flex-end;
    flex-direction: column;
    padding-right: 14px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.dashboard-clock strong {
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.06em;
}

.dashboard-clock span {
    margin-top: 4px;
    font-size: 0.62rem;
    opacity: 0.72;
    text-transform: uppercase;
}

.dashboard-theme-button {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 10px;
    cursor: pointer;
}

.dashboard-command-body {
    padding: 28px;
}

.dashboard-command-title {
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.dashboard-command-title > div:first-child > span {
    color: var(--dhi-blue);
    font-size: 0.63rem;
    font-weight: 900;
    letter-spacing: 0.14em;
}

.dashboard-command-title h2 {
    margin: 6px 0 0;
    font-size: 1.45rem;
    letter-spacing: -0.02em;
}

.dashboard-scope-chips {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.dashboard-scope-chips span {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    color: var(--muted);
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 850;
    letter-spacing: 0.04em;
}

.dashboard-icon-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.dashboard-module-card {
    position: relative;
    min-height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 14px;
    padding: 22px 16px;
    color: var(--ink);
    background: linear-gradient(
        155deg,
        color-mix(in srgb, var(--dhi-blue-soft) 48%, var(--panel)),
        var(--panel) 58%
    );
    border: 1px solid var(--line);
    border-radius: 15px;
    text-decoration: none;
    text-align: center;
    transition:
        transform 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease,
        background-color 0.16s ease;
}

.dashboard-module-card:not(.dashboard-module-card-disabled):hover {
    transform: translateY(-4px);
    border-color: var(--dhi-blue);
    box-shadow: 0 14px 30px rgba(31, 103, 202, 0.16);
}

.dashboard-module-card:not(.dashboard-module-card-disabled):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--dhi-blue) 32%, transparent);
    outline-offset: 3px;
}

.dashboard-module-icon {
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    color: #ffffff;
    background: linear-gradient(145deg, var(--dhi-blue), var(--dhi-cyan));
    box-shadow: 0 12px 24px rgba(31, 103, 202, 0.22);
}

.dashboard-module-icon svg {
    width: 40px;
    height: 40px;
}

.dashboard-module-card > strong {
    max-width: 180px;
    font-size: 0.88rem;
    line-height: 1.3;
}

.dashboard-module-status {
    position: absolute;
    top: 12px;
    right: 12px;
    min-height: 22px;
    display: inline-flex;
    align-items: center;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 0.53rem;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.dashboard-module-status-ready {
    color: #147849;
    background: #def4e8;
}

.dashboard-module-status-next {
    color: #8c6100;
    background: #fff0c8;
}

html[data-theme="dark"] .dashboard-module-status-ready {
    color: #81e3ac;
    background: #173d2b;
}

html[data-theme="dark"] .dashboard-module-status-next {
    color: #ffd57f;
    background: #3b301c;
}

.dashboard-module-card-disabled {
    opacity: 0.48;
    cursor: not-allowed;
    filter: grayscale(0.22);
}

.dashboard-module-card-disabled .dashboard-module-icon {
    background: var(--muted);
    box-shadow: none;
}

.dashboard-command-footer {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 28px;
    color: var(--muted);
    background: var(--panel-soft);
    border-top: 1px solid var(--line);
    font-size: 0.64rem;
}

.dashboard-command-footer a {
    color: var(--dhi-blue);
    font-weight: 900;
    letter-spacing: 0.05em;
    text-decoration: none;
}

.dashboard-command-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 1020px) {
    .dashboard-icon-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-module-card {
        min-height: 170px;
    }
}

@media (max-width: 650px) {
    .dashboard-screen {
        padding: 14px;
    }

    .dashboard-command-header,
    .dashboard-command-body {
        padding: 18px;
    }

    .dashboard-command-header {
        min-height: 90px;
    }

    .dashboard-clock {
        display: none;
    }

    .dashboard-command-title {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .dashboard-scope-chips {
        justify-content: flex-start;
    }

    .dashboard-icon-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-module-card {
        min-height: 142px;
    }

    .dashboard-command-footer {
        padding-inline: 18px;
    }
}

/* MODULE */
.module-screen {
    min-height: 100vh;
    color: var(--ink);
    background: var(--page);
}

.module-frame {
    min-height: 100vh;
}

.dhi-module-header {
    min-height: 82px;
    display: grid;
    grid-template-columns: 120px 1fr 120px;
    align-items: center;
    padding: 10px 16px;
    color: #ffffff;
    background: linear-gradient(
        100deg,
        var(--dhi-navy),
        color-mix(in srgb, var(--dhi-blue) 66%, var(--dhi-navy))
    );
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.dhi-module-title {
    text-align: center;
}

.dhi-module-title span {
    display: block;
    font-size: 0.58rem;
    font-weight: 850;
    letter-spacing: 0.16em;
    opacity: 0.72;
}

.dhi-module-title h1 {
    margin: 5px 0 0;
    font-size: clamp(1.55rem, 3.5vw, 2.8rem);
    letter-spacing: 0.06em;
}

.module-back {
    width: fit-content;
    padding: 9px 13px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 850;
}

.icon-theme-button {
    justify-self: end;
    width: 40px;
    height: 38px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.22);
    border-radius: 8px;
}

.module-content {
    padding: 10px;
}

/* TABLES */
.display-alert {
    padding: 14px;
    color: #ffffff;
    background: #8c2d2d;
    border-radius: 8px;
}

.display-table-panel {
    margin-bottom: 10px;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.display-table-panel h2 {
    margin: 0;
    padding: 8px 10px;
    color: #ffffff;
    background: var(--dhi-navy);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
}

.display-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.72rem;
}

.display-table th,
.display-table td {
    padding: 7px 8px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

.display-table th:last-child,
.display-table td:last-child {
    border-right: 0;
}

.display-table th {
    color: var(--table-head-text);
    background: var(--table-head);
    text-align: center;
    font-size: 0.64rem;
    letter-spacing: 0.03em;
}

.display-table tbody tr:nth-child(odd) {
    background: var(--table-row);
}

.display-table tbody tr:nth-child(even) {
    background: var(--table-alt);
}

.display-table tbody tr:last-child td {
    border-bottom: 0;
}

.display-table tfoot td {
    background: var(--panel-soft);
    font-weight: 850;
}

.display-table small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.6rem;
}

.number-cell {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

.total-cell {
    color: var(--dhi-blue);
    font-weight: 900;
}

.compact-plan-toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) 145px;
    margin-bottom: 8px;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.compact-plan-toolbar > div {
    padding: 9px 12px;
    border-right: 1px solid var(--line);
}

.compact-plan-toolbar span,
.compact-plan-toolbar strong {
    display: block;
}

.compact-plan-toolbar span {
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 850;
    text-transform: uppercase;
}

.compact-plan-toolbar strong {
    margin-top: 3px;
    font-size: 0.8rem;
}

.compact-plan-toolbar button {
    color: var(--muted);
    background: var(--panel-soft);
    border: 0;
    font-size: 0.64rem;
    font-weight: 850;
}

.daily-plan-table {
    font-size: 0.64rem;
}

.daily-plan-table th,
.daily-plan-table td {
    padding: 6px 4px;
}

.daily-plan-table .col-no {
    width: 3%;
}

.daily-plan-table .col-area {
    width: 7%;
}

.daily-plan-table .col-machine {
    width: 6%;
}

.daily-plan-table .col-wo {
    width: 9%;
}

.daily-plan-table .col-due {
    width: 6%;
}

.daily-plan-table .col-customer {
    width: 8%;
}

.daily-plan-table .col-part {
    width: 15%;
}

.daily-plan-table .col-qty {
    width: 9%;
}

.daily-plan-table .col-cvt {
    width: 7%;
}

.daily-plan-table .col-shift {
    width: 6%;
}

.daily-plan-table .col-total {
    width: 7%;
}

.daily-plan-table .col-remark {
    width: 11%;
}

/* Database health compatibility */
.page-intro {
    display: none;
}

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

.health-card {
    padding: 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.health-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.connection-name {
    color: var(--dhi-blue);
    font-size: 0.6rem;
    font-weight: 850;
    letter-spacing: 0.1em;
}

.health-card h3 {
    margin: 4px 0 0;
    font-size: 1rem;
}

.status {
    min-height: 23px;
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 850;
}

.status-online {
    color: #16814c;
    background: #e2f6eb;
}

.status-offline {
    color: #ad2b2b;
    background: #ffe7e7;
}

.status-degraded,
.status-not_checked {
    color: #986000;
    background: #fff1ce;
}

.health-card dl,
.details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin: 12px 0 0;
}

.health-card dl div,
.details div {
    padding: 9px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 7px;
}

.health-card dt,
.details span {
    display: block;
    color: var(--muted);
    font-size: 0.58rem;
}

.health-card dd,
.details strong {
    display: block;
    margin: 3px 0 0;
    font-size: 0.7rem;
    word-break: break-word;
}

.health-message {
    margin: 10px 0 0;
    padding: 9px;
    color: #986000;
    background: #fff1ce;
    border-radius: 7px;
    font-size: 0.7rem;
}

.reference-code {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.64rem;
}

@media (max-width: 800px) {
    .dhi-login-shell {
        grid-template-columns: 1fr;
    }

    .dhi-login-brand {
        min-height: 170px;
    }

    .dhi-login-panel {
        min-height: auto;
    }

    .dhi-menu-grid,
    .health-grid {
        grid-template-columns: 1fr;
    }

    .dhi-module-header {
        grid-template-columns: 78px 1fr 46px;
        min-height: 68px;
        padding-inline: 8px;
    }

    .dhi-module-title h1 {
        font-size: 1.15rem;
        letter-spacing: 0.03em;
    }

    .module-back {
        padding: 8px;
        font-size: 0.6rem;
    }

    .compact-plan-toolbar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .compact-plan-toolbar button {
        grid-column: 1 / -1;
        min-height: 34px;
    }

    .display-table {
        font-size: 0.56rem;
    }

    .display-table th,
    .display-table td {
        padding: 4px 3px;
    }
}

/* ==========================================================================
   PHASE 1.2B.001 · MULTI-PROCESS DAILY PLAN + ERP-STYLE PLANNING MONITOR
   ========================================================================== */
.module-status-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 8px;
    padding: 10px 12px;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 4px solid var(--dhi-cyan);
    border-radius: 8px;
}

.module-status-banner > div {
    min-width: 250px;
}

.module-status-banner span,
.module-status-banner strong {
    display: block;
}

.module-status-banner span {
    color: var(--dhi-blue);
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.module-status-banner strong {
    margin-top: 4px;
    font-size: 0.82rem;
}

.module-status-banner p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    font-size: 0.66rem;
    line-height: 1.45;
    text-align: right;
}

.module-feedback {
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.68rem;
    font-weight: 700;
}

.module-feedback small {
    display: block;
    margin-top: 4px;
    font-weight: 500;
}

.module-feedback-success {
    color: #176743;
    background: #e0f5e9;
    border: 1px solid #b7e4ca;
}

.module-feedback-error {
    color: #9a2929;
    background: #ffe8e8;
    border: 1px solid #f4bcbc;
}

html[data-theme="dark"] .module-feedback-success {
    color: #8be2b2;
    background: #173b2b;
    border-color: #2a6749;
}

html[data-theme="dark"] .module-feedback-error {
    color: #ffaaaa;
    background: #442323;
    border-color: #6c3434;
}

.module-filter-form {
    margin-bottom: 8px;
    padding: 8px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.module-filter-grid {
    display: grid;
    gap: 7px;
    align-items: end;
}

.daily-plan-filter-grid {
    grid-template-columns: 130px 1.1fr 130px 1.6fr 150px 170px 150px;
}

.planning-monitor-filter-grid {
    grid-template-columns: 126px 126px 1.1fr 120px 110px 135px 150px 1.15fr 150px;
}

.module-field {
    min-width: 0;
}

.module-field span {
    display: block;
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 0.55rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.module-field input,
.module-field select {
    width: 100%;
    height: 34px;
    min-width: 0;
    padding: 0 8px;
    color: var(--ink);
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    outline: none;
    font-size: 0.66rem;
}

.module-field input:focus,
.module-field select:focus {
    border-color: var(--dhi-blue);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--dhi-blue) 18%, transparent);
}

.module-primary-button {
    min-height: 34px;
    padding: 0 12px;
    color: #ffffff;
    background: linear-gradient(90deg, var(--dhi-blue), var(--dhi-cyan));
    border: 0;
    border-radius: 6px;
    font-size: 0.61rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    cursor: pointer;
}

.module-primary-button:disabled {
    opacity: 0.64;
    cursor: wait;
}

.snapshot-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 8px;
}

.snapshot-kpi-grid article {
    min-width: 0;
    padding: 8px 10px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 7px;
}

.snapshot-kpi-grid span,
.snapshot-kpi-grid strong {
    display: block;
}

.snapshot-kpi-grid span {
    color: var(--muted);
    font-size: 0.54rem;
    font-weight: 850;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.snapshot-kpi-grid strong {
    margin-top: 3px;
    color: var(--dhi-blue);
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}

.snapshot-kpi-warning {
    border-left: 3px solid #d59221 !important;
}

.operational-table-panel {
    margin-bottom: 0;
}

.operational-panel-header {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 7px 10px;
    color: #ffffff;
    background: var(--dhi-navy);
}

.operational-panel-header div span,
.operational-panel-header div strong {
    display: block;
}

.operational-panel-header div span {
    font-size: 0.55rem;
    font-weight: 900;
    letter-spacing: 0.1em;
}

.operational-panel-header div strong {
    margin-top: 3px;
    font-size: 0.64rem;
    font-weight: 600;
    opacity: 0.78;
}

.operational-panel-header > span {
    font-size: 0.58rem;
    opacity: 0.72;
}

.operational-table {
    font-size: 0.6rem;
}

.operational-table th,
.operational-table td {
    padding: 5px 4px;
}

.operational-table strong {
    font-size: 0.62rem;
}

.operational-table small {
    font-size: 0.54rem;
    line-height: 1.25;
}

.operational-empty-state {
    height: 160px;
    text-align: center !important;
}

.operational-empty-state strong,
.operational-empty-state span {
    display: block;
}

.operational-empty-state strong {
    font-size: 0.78rem;
}

.operational-empty-state span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.64rem;
}

.status-pill {
    width: fit-content;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    margin-top: 4px;
    padding: 1px 5px;
    color: var(--muted);
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.47rem;
    font-weight: 900;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.status-ready,
.status-complete,
.status-on-time-window,
.status-fg,
.status-wip {
    color: #167348;
    background: #dff5e9;
    border-color: #b7e5ca;
}

.status-running,
.status-due-today {
    color: #16628f;
    background: #dcefff;
    border-color: #b7d9f3;
}

.status-overdue,
.status-planned-after-due-date,
.status-not-started-late,
.status-over,
.status-warning,
.status-capacity-missing,
.status-capacity-inconsistent {
    color: #a2392c;
    background: #ffe7e3;
    border-color: #f2bbb2;
}

.status-shortfall,
.status-unknown {
    color: #8e6100;
    background: #fff1cf;
    border-color: #e7d39f;
}

html[data-theme="dark"] .status-ready,
html[data-theme="dark"] .status-complete,
html[data-theme="dark"] .status-on-time-window,
html[data-theme="dark"] .status-fg,
html[data-theme="dark"] .status-wip {
    color: #82dfab;
    background: #173c2b;
    border-color: #2a6749;
}

html[data-theme="dark"] .status-running,
html[data-theme="dark"] .status-due-today {
    color: #8dcdf0;
    background: #17344b;
    border-color: #2a5675;
}

html[data-theme="dark"] .status-overdue,
html[data-theme="dark"] .status-planned-after-due-date,
html[data-theme="dark"] .status-not-started-late,
html[data-theme="dark"] .status-over,
html[data-theme="dark"] .status-warning,
html[data-theme="dark"] .status-capacity-missing,
html[data-theme="dark"] .status-capacity-inconsistent {
    color: #ffaaa0;
    background: #452520;
    border-color: #6f3c35;
}

.row-detail-disclosure {
    margin-top: 4px;
}

.row-detail-disclosure summary {
    width: fit-content;
    color: var(--dhi-blue);
    cursor: pointer;
    font-size: 0.5rem;
    font-weight: 850;
    list-style: none;
}

.row-detail-disclosure summary::-webkit-details-marker {
    display: none;
}

.row-detail-disclosure summary::before {
    content: "+ ";
}

.row-detail-disclosure[open] summary::before {
    content: "− ";
}

.row-detail-disclosure dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    margin: 5px 0 0;
    padding: 6px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 5px;
}

.row-detail-disclosure dl div {
    min-width: 0;
}

.row-detail-disclosure dt {
    color: var(--muted);
    font-size: 0.46rem;
    font-weight: 850;
    text-transform: uppercase;
}

.row-detail-disclosure dd {
    margin: 2px 0 0;
    font-size: 0.52rem;
    overflow-wrap: anywhere;
}

.daily-open-wo-table .col-index {
    width: 3%;
}
.daily-open-wo-table .col-process {
    width: 9%;
}
.daily-open-wo-table .col-wo-source {
    width: 13%;
}
.daily-open-wo-table .col-due-source {
    width: 8%;
}
.daily-open-wo-table .col-customer-source {
    width: 12%;
}
.daily-open-wo-table .col-part-source {
    width: 17%;
}
.daily-open-wo-table .col-qty-source {
    width: 9%;
}
.daily-open-wo-table .col-capacity-source {
    width: 11%;
}

.monitor-view-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 8px;
    padding: 5px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.monitor-view-tabs a {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    color: var(--muted);
    background: var(--panel-soft);
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 0.57rem;
    font-weight: 850;
    text-decoration: none;
}

.monitor-view-tabs a.active {
    color: #ffffff;
    background: var(--dhi-blue);
    border-color: var(--dhi-blue);
}

.planning-monitor-detail-table .col-monitor-date {
    width: 7%;
}
.planning-monitor-detail-table .col-monitor-machine {
    width: 8%;
}
.planning-monitor-detail-table .col-monitor-plan {
    width: 13%;
}
.planning-monitor-detail-table .col-monitor-customer {
    width: 11%;
}
.planning-monitor-detail-table .col-monitor-part {
    width: 16%;
}
.planning-monitor-detail-table .col-monitor-process {
    width: 11%;
}
.planning-monitor-detail-table .col-monitor-qty {
    width: 9%;
}
.planning-monitor-detail-table .col-monitor-rate {
    width: 8%;
}
.planning-monitor-detail-table .col-monitor-status {
    width: 8%;
}

.monitor-summary-table,
.monitor-warning-table {
    font-size: 0.62rem;
}

@media (max-width: 1280px) {
    .daily-plan-filter-grid,
    .planning-monitor-filter-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .module-field-wide {
        grid-column: span 2;
    }
}

@media (max-width: 900px) {
    .module-status-banner {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .module-status-banner p {
        text-align: left;
    }

    .daily-plan-filter-grid,
    .planning-monitor-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .snapshot-kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .operational-table {
        font-size: 0.52rem;
    }

    .operational-table th,
    .operational-table td {
        padding: 4px 2px;
    }
}

@media (max-width: 560px) {
    .daily-plan-filter-grid,
    .planning-monitor-filter-grid,
    .snapshot-kpi-grid {
        grid-template-columns: 1fr;
    }

    .module-field-wide {
        grid-column: auto;
    }

    .monitor-view-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .monitor-view-tabs a {
        justify-content: center;
    }
}

/* PHASE 1.4A AUTHENTICATION & ACCESS CONTROL */
.auth-alert,
.system-flash {
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 0.72rem;
    line-height: 1.45;
}

.auth-alert-success,
.system-flash-success {
    color: #147849;
    background: #e3f6eb;
    border-color: #bce8ce;
}

.auth-alert-warning {
    color: #7a5700;
    background: #fff4cf;
    border-color: #f0d77d;
}

.system-flash-error {
    color: #9b2d2d;
    background: #fde8e8;
    border-color: #f3bcbc;
}

html[data-theme="dark"] .auth-alert-success,
html[data-theme="dark"] .system-flash-success {
    color: #8be0ae;
    background: #183c2b;
    border-color: #2f6448;
}

html[data-theme="dark"] .auth-alert-warning {
    color: #ffd77f;
    background: #3b301c;
    border-color: #6a5528;
}

html[data-theme="dark"] .system-flash-error {
    color: #ffaaaa;
    background: #482325;
    border-color: #71383b;
}

.field-error,
.system-field-grid em {
    display: block;
    margin: 3px 0 0;
    color: #c04444;
    font-size: 0.65rem;
    font-style: normal;
}

.auth-secondary-form {
    margin-top: 16px;
    text-align: center;
}

.auth-text-button,
.dashboard-logout-button,
.module-logout-button {
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    cursor: pointer;
    font: inherit;
    font-weight: 850;
}

.auth-text-button {
    color: var(--dhi-blue);
    font-size: 0.7rem;
}

.dashboard-user-summary {
    min-width: 150px;
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    padding-right: 14px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.dashboard-user-summary strong {
    max-width: 190px;
    overflow: hidden;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-user-summary span {
    margin-top: 3px;
    font-size: 0.58rem;
    opacity: 0.72;
    text-transform: uppercase;
}

.dashboard-icon-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-admin-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 18px;
    padding: 16px 18px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.dashboard-admin-strip > div {
    display: grid;
    gap: 4px;
}

.dashboard-admin-strip span {
    color: var(--dhi-blue);
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.13em;
}

.dashboard-admin-strip strong {
    font-size: 0.78rem;
}

.dashboard-admin-strip nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.dashboard-admin-strip a,
.module-header-link {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.62rem;
    font-weight: 850;
}

.dashboard-admin-strip a:hover {
    color: var(--dhi-blue);
    border-color: var(--dhi-blue);
}

.dashboard-logout-button {
    color: var(--dhi-blue);
    letter-spacing: 0.05em;
}

.dhi-module-header {
    grid-template-columns: 130px minmax(260px, 1fr) auto;
    gap: 14px;
}

.module-user-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
}

.module-user-chip {
    min-width: 120px;
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    padding-right: 8px;
}

.module-user-chip strong {
    max-width: 180px;
    overflow: hidden;
    font-size: 0.65rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.module-user-chip span {
    margin-top: 3px;
    font-size: 0.52rem;
    opacity: 0.68;
    text-transform: uppercase;
}

.module-header-link {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.22);
}

.module-logout-button {
    min-height: 38px;
    padding: 0 10px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    font-size: 0.62rem;
}

.system-admin-page {
    display: grid;
    gap: 14px;
}

.system-page-heading,
.system-filter-bar,
.system-form-actions {
    display: flex;
    align-items: center;
}

.system-page-heading {
    justify-content: space-between;
    gap: 20px;
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.system-page-heading span,
.system-form-card-heading > span {
    color: var(--dhi-blue);
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 0.13em;
}

.system-page-heading h2,
.system-form-card-heading h3 {
    margin: 5px 0 0;
}

.system-page-heading h2 {
    font-size: 1.35rem;
}

.system-page-heading p,
.system-form-card-heading p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.5;
}

.system-primary-button,
.system-form-actions button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    color: #ffffff;
    background: linear-gradient(90deg, var(--dhi-blue), var(--dhi-cyan));
    border: 0;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 900;
    cursor: pointer;
}

.system-filter-bar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.system-filter-bar label {
    min-width: 220px;
    display: grid;
    gap: 5px;
}

.system-user-filter label:first-child {
    flex: 1 1 300px;
}

.system-filter-bar label span,
.system-field-grid label > span {
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 750;
}

.system-filter-bar input,
.system-filter-bar select,
.system-field-grid input,
.system-field-grid select,
.system-field-grid textarea {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    color: var(--ink);
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 7px;
    outline: none;
}

.system-field-grid textarea {
    resize: vertical;
}

.system-filter-bar input:focus,
.system-filter-bar select:focus,
.system-field-grid input:focus,
.system-field-grid select:focus,
.system-field-grid textarea:focus {
    border-color: var(--dhi-blue);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--dhi-blue) 16%, transparent);
}

.system-filter-bar button,
.system-filter-bar > a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    padding: 0 13px;
    color: var(--ink);
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 7px;
    text-decoration: none;
    font-size: 0.64rem;
    font-weight: 850;
    cursor: pointer;
}

.system-table-wrap {
    overflow-x: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.system-admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
}

.system-admin-table th {
    padding: 11px 10px;
    color: var(--table-head-text);
    background: var(--table-head);
    text-align: left;
    font-size: 0.6rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.system-admin-table td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.system-admin-table tbody tr:nth-child(even) {
    background: var(--table-alt);
}

.system-admin-table td strong,
.system-admin-table td small {
    display: block;
}

.system-admin-table td small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.61rem;
}

.system-action-column {
    width: 150px;
}

.system-row-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.system-row-actions a,
.system-row-actions button {
    padding: 6px 8px;
    color: var(--dhi-blue);
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.58rem;
    font-weight: 900;
    cursor: pointer;
}

.system-row-actions form {
    margin: 0;
}

.system-status,
.system-mini-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 4px 7px;
    border-radius: 999px;
    font-size: 0.54rem;
    font-weight: 900;
    letter-spacing: 0.03em;
}

.system-status.is-active {
    color: #147849;
    background: #def4e8;
}

.system-status.is-inactive {
    color: #9b2d2d;
    background: #fde5e5;
}

.system-mini-badge {
    margin-top: 4px;
    color: #7a5700;
    background: #fff0bd;
}

html[data-theme="dark"] .system-status.is-active {
    color: #8be0ae;
    background: #173d2b;
}

html[data-theme="dark"] .system-status.is-inactive {
    color: #ffaaaa;
    background: #482325;
}

html[data-theme="dark"] .system-mini-badge {
    color: #ffd77f;
    background: #3b301c;
}

.system-empty-cell {
    padding: 32px !important;
    color: var(--muted);
    text-align: center;
}

.system-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 0.65rem;
}

.system-pagination a {
    color: var(--dhi-blue);
    text-decoration: none;
    font-weight: 850;
}

.system-pagination span {
    color: var(--muted);
}

.system-editor-form,
.system-form-grid {
    display: grid;
    gap: 14px;
}

.system-form-grid {
    grid-template-columns: minmax(300px, 0.82fr) minmax(420px, 1.18fr);
}

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

.system-form-card {
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.system-form-card-heading {
    margin-bottom: 16px;
}

.system-form-card-heading h3 {
    font-size: 1rem;
}

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

.system-field-grid.one-column {
    grid-template-columns: 1fr;
}

.system-field-grid label {
    display: grid;
    gap: 5px;
}

.system-field-grid label small {
    color: var(--muted);
    font-size: 0.58rem;
    line-height: 1.4;
}

.system-field-wide {
    grid-column: 1 / -1;
}

.system-check-row {
    display: flex !important;
    align-items: center;
    grid-column: 1 / -1;
    gap: 8px !important;
    padding: 10px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 7px;
}

.system-check-row input,
.permission-option input {
    width: 16px;
    height: 16px;
    min-height: auto;
    margin: 0;
}

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

.permission-group {
    min-width: 0;
    margin: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.permission-group legend {
    padding: 0 5px;
    color: var(--dhi-blue);
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.permission-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 5px;
    border-bottom: 1px solid var(--line);
}

.permission-option:last-child {
    border-bottom: 0;
}

.permission-option > span {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.permission-option strong {
    font-size: 0.68rem;
}

.permission-option small,
.permission-option em {
    color: var(--muted);
    font-size: 0.56rem;
    font-style: normal;
    line-height: 1.35;
}

.system-form-actions {
    justify-content: flex-end;
    gap: 9px;
    padding: 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.system-form-actions a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.66rem;
    font-weight: 850;
}

.system-account-meta {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 14px;
    padding: 12px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.65rem;
}

.system-account-meta span {
    color: var(--muted);
}

.access-denied-card {
    width: min(520px, 100%);
    display: grid;
    justify-items: center;
    padding: 38px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    text-align: center;
}

.access-denied-card > span {
    margin-top: 18px;
    color: var(--dhi-blue);
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.14em;
}

.access-denied-card h1 {
    margin: 8px 0;
    font-size: 1.45rem;
}

.access-denied-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.55;
}

.access-denied-card a {
    margin-top: 20px;
    padding: 10px 16px;
    color: #ffffff;
    background: var(--dhi-blue);
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.66rem;
    font-weight: 900;
}

@media (max-width: 1100px) {
    .dhi-module-header {
        grid-template-columns: auto 1fr;
    }

    .dhi-module-title {
        text-align: right;
    }

    .module-user-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
        padding-top: 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.14);
    }

    .system-form-grid,
    .user-form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .dashboard-user-summary,
    .module-user-chip,
    .module-header-link {
        display: none;
    }

    .dashboard-admin-strip,
    .system-page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-admin-strip nav {
        justify-content: flex-start;
    }

    .dashboard-icon-grid,
    .permission-groups,
    .system-field-grid {
        grid-template-columns: 1fr;
    }

    .system-field-wide {
        grid-column: auto;
    }

    .system-check-row {
        grid-column: auto;
    }
}

.module-readonly-badge {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: end;
    padding: 0 12px;
    color: var(--muted);
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.05em;
}

/* PHASE 1.4C.001 DAILY PLAN PIVOT & MANUAL EXTRUDER */
.daily-plan-status-banner p {
    max-width: 760px;
}

.daily-plan-tabs {
    display: inline-flex;
    gap: 5px;
    margin-bottom: 8px;
    padding: 5px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.daily-plan-tabs a {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    color: var(--muted);
    background: var(--panel-soft);
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-decoration: none;
}

.daily-plan-tabs a.active {
    color: #ffffff;
    background: var(--dhi-blue);
    border-color: var(--dhi-blue);
}

.daily-plan-pivot-filter-grid {
    grid-template-columns: 135px 1.1fr 1fr 1.6fr 135px 150px;
}

.module-secondary-button {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    color: var(--dhi-blue);
    background: var(--panel-soft);
    border: 1px solid color-mix(in srgb, var(--dhi-blue) 55%, var(--line));
    border-radius: 6px;
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-decoration: none;
    white-space: nowrap;
}

.module-secondary-button:hover {
    color: #ffffff;
    background: var(--dhi-blue);
}

.daily-plan-pivot-kpis .snapshot-kpi-primary {
    border-color: color-mix(in srgb, var(--dhi-blue) 55%, var(--line));
    background: color-mix(in srgb, var(--dhi-blue) 9%, var(--panel));
}

.daily-plan-pivot-kpis .snapshot-kpi-primary strong {
    color: var(--dhi-blue);
}

.daily-plan-source-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.plan-source-badge {
    min-height: 21px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 0.52rem;
    font-weight: 900;
    letter-spacing: 0.045em;
    white-space: nowrap;
}

.plan-source-badge.is-erp {
    color: #285a9f;
    background: #e7f0ff;
    border: 1px solid #bfd3f4;
}

.plan-source-badge.is-manual {
    color: #8a5b00;
    background: #fff2d5;
    border: 1px solid #efd18f;
}

.plan-source-badge.is-mixed {
    color: #6b49a3;
    background: #f0e9ff;
    border: 1px solid #d6c4f6;
}

html[data-theme="dark"] .plan-source-badge.is-erp {
    color: #9fc4ff;
    background: #1d3555;
    border-color: #345783;
}

html[data-theme="dark"] .plan-source-badge.is-manual {
    color: #ffd782;
    background: #493817;
    border-color: #765d28;
}

html[data-theme="dark"] .plan-source-badge.is-mixed {
    color: #d2b8ff;
    background: #362750;
    border-color: #5a4380;
}

.daily-plan-table-shell {
    width: 100%;
    overflow-x: auto;
}

.daily-plan-pivot-table {
    width: 100%;
    min-width: 1180px;
    table-layout: fixed;
    font-size: 0.59rem;
}

.daily-plan-pivot-table th,
.daily-plan-pivot-table td {
    padding: 5px 4px;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

.daily-plan-pivot-table .pivot-col-index {
    width: 3%;
}
.daily-plan-pivot-table .pivot-col-area {
    width: 8%;
}
.daily-plan-pivot-table .pivot-col-machine {
    width: 6%;
}
.daily-plan-pivot-table .pivot-col-customer {
    width: 11%;
}
.daily-plan-pivot-table .pivot-col-part-no {
    width: 10%;
}
.daily-plan-pivot-table .pivot-col-part-name {
    width: 18%;
}
.daily-plan-pivot-table .pivot-col-cvt {
    width: 5%;
}
.daily-plan-pivot-table .pivot-col-shift {
    width: 7%;
}
.daily-plan-pivot-table .pivot-col-total {
    width: 8%;
}
.daily-plan-pivot-table .pivot-col-source {
    width: 8%;
}

.daily-plan-pivot-table tr.is-manual-plan td {
    background: color-mix(in srgb, #f4b942 9%, var(--panel));
}

.manual-plan-management-panel {
    margin-top: 8px;
}

.manual-plan-table {
    min-width: 1040px;
    table-layout: fixed;
    font-size: 0.59rem;
}

.manual-plan-table th,
.manual-plan-table td {
    padding: 5px 4px;
    vertical-align: middle;
}

.manual-plan-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.manual-plan-actions a,
.manual-plan-actions button {
    min-height: 27px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border-radius: 5px;
    font-size: 0.52rem;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}

.manual-plan-actions a {
    color: var(--dhi-blue);
    background: var(--panel-soft);
    border: 1px solid var(--line);
}

.manual-plan-actions form {
    margin: 0;
}

.manual-plan-actions button {
    color: #a22d2d;
    background: #ffeaea;
    border: 1px solid #efb9b9;
}

html[data-theme="dark"] .manual-plan-actions button {
    color: #ffaaaa;
    background: #442323;
    border-color: #6c3434;
}

.manual-plan-form {
    display: grid;
    gap: 9px;
}

.manual-plan-form-panel {
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 9px;
}

.manual-plan-form-panel > header {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    background: var(--panel-soft);
    border-bottom: 1px solid var(--line);
}

.manual-plan-form-panel > header span,
.manual-plan-form-panel > header strong {
    display: block;
}

.manual-plan-form-panel > header > div > span {
    color: var(--dhi-blue);
    font-size: 0.55rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.manual-plan-form-panel > header > div > strong {
    margin-top: 3px;
    font-size: 0.78rem;
}

.manual-plan-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    padding: 12px;
}

.manual-plan-field-wide {
    grid-column: span 2;
}

.module-field span em {
    color: var(--muted);
    font-size: 0.5rem;
    font-style: normal;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.module-field input[readonly] {
    color: var(--muted);
    cursor: not-allowed;
}

.field-error {
    display: block;
    margin-top: 4px;
    color: #b53232;
    font-size: 0.56rem;
    font-weight: 700;
}

.manual-plan-shift-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    padding: 12px 12px 8px;
}

.manual-plan-live-total {
    min-width: 145px;
    text-align: right;
}

.manual-plan-live-total span {
    color: var(--muted) !important;
}

.manual-plan-live-total strong {
    color: var(--dhi-blue);
    font-size: 1rem !important;
    font-variant-numeric: tabular-nums;
}

.manual-plan-note {
    margin: 0;
    padding: 0 12px 12px;
    color: var(--muted);
    font-size: 0.61rem;
}

.manual-plan-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    padding-top: 2px;
}

.manual-plan-form-actions > a {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    color: var(--muted);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.6rem;
    font-weight: 900;
    text-decoration: none;
}

@media (max-width: 1280px) {
    .daily-plan-pivot-filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .manual-plan-form-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .daily-plan-tabs {
        width: 100%;
    }

    .daily-plan-tabs a {
        flex: 1;
    }

    .daily-plan-pivot-filter-grid,
    .manual-plan-form-grid,
    .manual-plan-shift-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .manual-plan-form-panel > header,
    .operational-panel-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .daily-plan-source-legend {
        justify-content: flex-start;
    }
}

@media (max-width: 560px) {
    .daily-plan-pivot-filter-grid,
    .manual-plan-form-grid,
    .manual-plan-shift-grid {
        grid-template-columns: 1fr;
    }

    .manual-plan-field-wide {
        grid-column: auto;
    }

    .manual-plan-form-actions > a,
    .manual-plan-form-actions > button {
        flex: 1;
    }
}

/* PHASE 1.4C.002 COMPACT DAILY PLAN & INLINE REMARK */
.daily-plan-pivot-filter-grid {
    grid-template-columns: 135px 1.1fr 1fr 1.6fr 135px 68px;
}

.daily-plan-action-menu,
.daily-plan-row-menu {
    position: relative;
}

.daily-plan-action-menu > summary {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    color: var(--muted);
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.57rem;
    font-weight: 900;
    letter-spacing: 0.045em;
    list-style: none;
    cursor: pointer;
}

.daily-plan-action-menu > summary::-webkit-details-marker,
.daily-plan-row-menu > summary::-webkit-details-marker {
    display: none;
}

.daily-plan-action-menu > div,
.daily-plan-row-menu > div {
    position: absolute;
    right: 0;
    z-index: 30;
    min-width: 190px;
    padding: 6px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 7px;
    box-shadow: 0 14px 36px rgba(17, 42, 76, 0.18);
}

.daily-plan-action-menu > div {
    top: calc(100% + 5px);
}

.daily-plan-action-menu a,
.daily-plan-row-menu a,
.daily-plan-row-menu button {
    width: 100%;
    min-height: 30px;
    display: flex;
    align-items: center;
    padding: 0 9px;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 5px;
    font: inherit;
    font-size: 0.58rem;
    font-weight: 800;
    text-decoration: none;
    text-align: left;
    cursor: pointer;
}

.daily-plan-action-menu a:hover,
.daily-plan-row-menu a:hover,
.daily-plan-row-menu button:hover {
    background: var(--panel-soft);
}

.daily-plan-row-count {
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 900;
}

.daily-plan-pivot-table {
    min-width: 1360px;
    font-size: 0.72rem;
}

.daily-plan-pivot-table th,
.daily-plan-pivot-table td {
    padding: 8px 7px;
    line-height: 1.35;
}

.daily-plan-pivot-table th {
    font-size: 0.73rem;
}

.daily-plan-pivot-table td {
    font-size: 0.72rem;
}

.daily-plan-pivot-table small {
    font-size: 0.64rem;
}

.daily-plan-pivot-table .pivot-col-part-name {
    width: 16%;
}
.daily-plan-pivot-table .pivot-col-remark {
    width: 18%;
}

.daily-plan-remark-cell {
    position: relative;
}

.daily-plan-remark-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px;
    align-items: center;
}

.daily-plan-remark-form input[name="remark_text"] {
    width: 100%;
    min-height: 27px;
    padding: 4px 7px;
    color: var(--ink);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 0.71rem;
}

.daily-plan-remark-form input[name="remark_text"]:hover,
.daily-plan-remark-form input[name="remark_text"]:focus {
    background: var(--panel);
    border-color: color-mix(in srgb, var(--dhi-blue) 55%, var(--line));
    outline: none;
}

.daily-plan-remark-status {
    min-width: 46px;
    color: var(--muted);
    font-size: 0.48rem;
    font-weight: 800;
    text-align: right;
}

.daily-plan-remark-status[data-state="saved"] {
    color: #197048;
}
.daily-plan-remark-status[data-state="error"] {
    color: #b33434;
}

.daily-plan-remark-readonly {
    color: var(--ink);
    font-size: 0.71rem;
}

.daily-plan-row-menu {
    position: absolute;
    top: 4px;
    right: 2px;
}

.daily-plan-row-menu > summary {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 5px;
    font-size: 0.62rem;
    font-weight: 900;
    list-style: none;
    cursor: pointer;
}

.daily-plan-row-menu > summary:hover {
    color: var(--dhi-blue);
    background: var(--panel-soft);
}

.daily-plan-row-menu > div {
    top: 28px;
}

.daily-plan-row-menu form {
    margin: 0;
}

.daily-plan-row-menu button {
    color: #a22d2d;
}

.daily-plan-remark-cell.has-row-menu .daily-plan-remark-form {
    padding-right: 28px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 1399px) {
    .daily-plan-pivot-filter-grid {
        grid-template-columns: 135px 1fr 1fr 1.4fr 135px 68px;
    }
}

/* Phase 1.4C.005: show one concise label in the Area column. */
.daily-plan-area-cell {
    vertical-align: middle;
}

.daily-plan-area-label {
    display: block;
    color: var(--ink);
    font-size: 0.72rem;
    font-weight: 850;
    line-height: 1.25;
    letter-spacing: 0.005em;
}

/* ==========================================================================
   PHASE 1.5B.001 · DAILY PRODUCTION RESULT
   ========================================================================== */
.daily-result-filter-grid {
    grid-template-columns:
        118px 118px minmax(150px, 1.15fr) 105px 92px
        minmax(130px, 0.95fr) 125px minmax(135px, 0.95fr) 115px 126px;
}

.daily-result-kpi-grid .snapshot-kpi-primary {
    border-left: 3px solid var(--dhi-cyan);
}

.daily-result-kpi-grid .snapshot-kpi-primary strong {
    font-size: 0.94rem;
}

.daily-result-detail-table {
    table-layout: fixed;
}

.daily-result-detail-table .col-result-no {
    width: 3%;
}
.daily-result-detail-table .col-result-date {
    width: 6%;
}
.daily-result-detail-table .col-result-process {
    width: 7%;
}
.daily-result-detail-table .col-result-machine {
    width: 5%;
}
.daily-result-detail-table .col-result-shift {
    width: 3%;
}
.daily-result-detail-table .col-result-planning {
    width: 8%;
}
.daily-result-detail-table .col-result-wo {
    width: 8%;
}
.daily-result-detail-table .col-result-customer {
    width: 11%;
}
.daily-result-detail-table .col-result-part {
    width: 15%;
}
.daily-result-detail-table .col-result-qty {
    width: 8%;
}
.daily-result-detail-table .col-result-pic {
    width: 7%;
}
.daily-result-detail-table .col-result-time {
    width: 8%;
}
.daily-result-detail-table .col-result-remark {
    width: 11%;
}

.daily-result-detail-table td {
    overflow-wrap: anywhere;
}

.daily-result-remark-cell {
    color: var(--muted);
    line-height: 1.3;
}

.daily-result-summary-table,
.daily-result-warning-table {
    table-layout: fixed;
    font-size: 0.62rem;
}

.status-error {
    color: #a2392c;
    background: #ffe7e3;
    border-color: #f2bbb2;
}

.status-info {
    color: #16628f;
    background: #dcefff;
    border-color: #b7d9f3;
}

html[data-theme="dark"] .status-error {
    color: #ffaaa0;
    background: #452520;
    border-color: #6f3c35;
}

html[data-theme="dark"] .status-info {
    color: #8dcdf0;
    background: #17344b;
    border-color: #2a5675;
}

@media (max-width: 1450px) {
    .daily-result-filter-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .daily-result-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .daily-result-view-tabs {
        overflow-x: auto;
    }
}

/* ==========================================================================
   PHASE 1.5B.002 · DAILY RESULT TODAY VIEW / PROCESS GROUPING
   ========================================================================== */
.module-context-actions {
    display: flex;
    align-items: center;
}

.daily-result-header-filter {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 5px 0 0;
}

.daily-result-header-filter label {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.56rem;
    font-weight: 900;
    letter-spacing: 0.1em;
}

.daily-result-header-filter select {
    width: 170px;
    min-height: 38px;
    padding: 0 30px 0 11px;
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    cursor: pointer;
}

.daily-result-header-filter select option {
    color: #10233f;
    background: #ffffff;
}

.daily-result-kpi-grid {
    margin-top: 0;
}

.daily-result-kpi-grid article {
    min-height: 58px;
    padding: 9px 11px;
}

.daily-result-kpi-grid article span {
    font-size: 0.61rem;
}

.daily-result-kpi-grid article strong,
.daily-result-kpi-grid .snapshot-kpi-primary strong {
    margin-top: 5px;
    font-size: 1.03rem;
}

.daily-result-view-tabs a {
    padding: 9px 13px;
    font-size: 0.66rem;
}

.daily-result-panel-header div span {
    font-size: 0.61rem;
}

.daily-result-panel-header div strong,
.daily-result-panel-header > span {
    font-size: 0.68rem;
}

.daily-result-detail-table {
    font-size: 0.7rem;
    line-height: 1.28;
}

.daily-result-detail-table th {
    padding: 7px 5px;
    font-size: 0.64rem;
}

.daily-result-detail-table td {
    padding: 7px 5px;
    overflow-wrap: anywhere;
}

.daily-result-detail-table strong {
    font-size: 0.71rem;
}

.daily-result-detail-table small {
    margin-top: 3px;
    font-size: 0.58rem;
    line-height: 1.28;
}

.daily-result-process-cell strong {
    font-size: 0.73rem;
    letter-spacing: 0.015em;
}

.daily-result-process-group-row td {
    padding: 0 !important;
    color: var(--ink);
    background: color-mix(in srgb, var(--dhi-blue) 8%, var(--panel));
    border-top: 2px solid color-mix(in srgb, var(--dhi-blue) 42%, var(--line));
    border-bottom: 1px solid
        color-mix(in srgb, var(--dhi-blue) 18%, var(--line));
}

.daily-result-process-group-heading {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 7px 10px;
}

.daily-result-process-group-heading strong {
    color: var(--dhi-blue);
    font-size: 0.78rem;
    font-weight: 950;
    letter-spacing: 0.045em;
}

.daily-result-process-group-heading span {
    color: var(--muted);
    font-size: 0.6rem;
    font-weight: 850;
    letter-spacing: 0.03em;
}

.daily-result-summary-table,
.daily-result-warning-table {
    font-size: 0.69rem;
}

.daily-result-summary-table th,
.daily-result-summary-table td,
.daily-result-warning-table th,
.daily-result-warning-table td {
    padding: 7px 6px;
}

.daily-result-summary-table strong,
.daily-result-warning-table strong {
    font-size: 0.71rem;
}

@media (max-width: 1450px) {
    .daily-result-header-filter select {
        width: 145px;
    }

    .daily-result-detail-table {
        font-size: 0.64rem;
    }

    .daily-result-detail-table strong {
        font-size: 0.66rem;
    }

    .daily-result-detail-table small {
        font-size: 0.54rem;
    }
}

@media (max-width: 1100px) {
    .module-context-actions {
        order: -1;
    }

    .daily-result-header-filter {
        margin-right: auto;
    }
}

@media (max-width: 760px) {
    .daily-result-header-filter label {
        display: none;
    }

    .daily-result-header-filter select {
        width: 150px;
    }

    .daily-result-process-group-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }
}

/* ==========================================================================
   PHASE 1.5B.003 · DAILY RESULT AUTOSCROLL / FROZEN CONTROL DECK
   ========================================================================== */
body.daily-result-live-screen {
    overflow: hidden;
}

body.daily-result-live-screen .module-frame {
    height: 100vh;
    overflow: hidden;
}

body.daily-result-live-screen .module-content {
    padding-bottom: 0;
}

.daily-result-panel {
    margin-bottom: 0;
}

.daily-result-scroll-region {
    min-height: 240px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scroll-behavior: auto;
}

.daily-result-scroll-region .display-table {
    margin: 0;
}

.daily-result-scroll-region .display-table thead th {
    position: sticky;
    top: 0;
    z-index: 12;
    background: var(--table-head);
    box-shadow: 0 1px 0 var(--line);
}

.daily-result-scroll-region::-webkit-scrollbar {
    width: 9px;
}

.daily-result-scroll-region::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--dhi-blue) 42%, var(--line));
    border: 2px solid var(--panel);
    border-radius: 999px;
}

.daily-result-scroll-region::-webkit-scrollbar-track {
    background: var(--panel);
}

@media (max-width: 760px) {
    body.daily-result-live-screen {
        overflow: auto;
    }

    body.daily-result-live-screen .module-frame {
        height: auto;
        overflow: visible;
    }

    .daily-result-scroll-region {
        height: auto !important;
        max-height: none;
        overflow: visible;
    }

    .daily-result-scroll-region .display-table thead th {
        position: static;
    }
}

/* ==========================================================================
   PHASE 1.5B.004 · TRUE-CENTER TITLE / PLANNING NUMBER VISIBILITY
   ========================================================================== */
.daily-result-planning-cell strong {
    font-size: 0.7rem;
    letter-spacing: 0.01em;
}

/* Keep the title centered to the viewport, not to the space left by controls. */
@media (min-width: 1500px) {
    body.daily-result-live-screen .dhi-module-header {
        position: relative;
    }

    body.daily-result-live-screen .dhi-module-title {
        position: absolute;
        top: 50%;
        left: 50%;
        width: min(720px, 43vw);
        transform: translate(-50%, -50%);
        text-align: center;
        pointer-events: none;
        z-index: 1;
    }

    body.daily-result-live-screen .module-back,
    body.daily-result-live-screen .module-user-actions {
        position: relative;
        z-index: 2;
    }
}

/* ==========================================================================
   PHASE 1.5B.005 · ADAPTIVE 19/43-INCH DISPLAY + DAILY PLAN CONTROL DECK
   ========================================================================== */

/*
 * Keep 1366/1920 workstations readable, then deliberately scale typography on
 * 2K/4K control-room panels. The layout continues to use the full viewport,
 * so a 43-inch display does not render the application as a tiny island.
 */
html {
    font-size: 16px;
}

.module-content {
    padding: clamp(8px, 0.55vw, 22px);
}

.dhi-dashboard-icon-display {
    width: min(3200px, 96vw);
}

.dashboard-command-header,
.dashboard-command-body,
.dashboard-command-footer {
    padding-left: clamp(18px, 1.7vw, 52px);
    padding-right: clamp(18px, 1.7vw, 52px);
}

.dashboard-icon-grid {
    gap: clamp(12px, 0.85vw, 28px);
}

.dashboard-module-card {
    min-height: clamp(168px, 18vh, 320px);
    padding: clamp(18px, 1.35vw, 42px) clamp(14px, 1vw, 30px);
}

.dashboard-module-icon {
    width: clamp(68px, 4.3vw, 118px);
    height: clamp(68px, 4.3vw, 118px);
}

.dashboard-module-icon svg {
    width: clamp(36px, 2.35vw, 66px);
    height: clamp(36px, 2.35vw, 66px);
}

.display-table,
.system-admin-table {
    font-size: 0.76rem;
}

.display-table th,
.system-admin-table th {
    font-size: 0.67rem;
}

.display-table td,
.system-admin-table td {
    line-height: 1.34;
}

.module-field input,
.module-field select,
.system-filter-bar input,
.system-filter-bar select,
.system-field-grid input,
.system-field-grid select,
.system-field-grid textarea {
    font-size: 0.72rem;
}

.snapshot-kpi-grid article strong {
    font-size: 1rem;
}

/* True viewport centering for module titles on workstation/TV layouts. */
@media (min-width: 1180px) {
    .dhi-module-header {
        position: relative;
        min-height: clamp(78px, 5.5vh, 126px);
        padding-left: clamp(12px, 1vw, 38px);
        padding-right: clamp(12px, 1vw, 38px);
    }

    .dhi-module-title,
    body.daily-result-live-screen .dhi-module-title {
        position: absolute;
        top: 50%;
        left: 50%;
        z-index: 1;
        width: min(58vw, 62rem);
        transform: translate(-50%, -50%);
        text-align: center;
        pointer-events: none;
    }

    .dhi-module-title h1 {
        margin-top: 0.22rem;
        font-size: clamp(2rem, 2.3vw, 4rem);
        line-height: 0.98;
    }

    .module-back,
    .module-user-actions {
        position: relative;
        z-index: 2;
    }
}

/* Dedicated density for 2K and 4K control-room displays. */
@media (min-width: 2400px) and (min-height: 1200px) {
    html {
        font-size: 19px;
    }

    .module-content {
        padding: 16px;
    }

    .dashboard-command-header {
        min-height: 132px;
    }

    .module-back,
    .module-logout-button,
    .icon-theme-button,
    .daily-result-header-filter select {
        min-height: 46px;
    }

    .icon-theme-button {
        width: 46px;
        height: 46px;
    }

    .display-table th,
    .display-table td,
    .system-admin-table th,
    .system-admin-table td {
        padding-top: 9px;
        padding-bottom: 9px;
    }
}

@media (min-width: 3400px) and (min-height: 1800px) {
    html {
        font-size: 22px;
    }

    .module-content {
        padding: 20px;
    }

    .dhi-login-shell {
        width: min(1400px, 88vw);
    }

    .dashboard-command-header {
        min-height: 154px;
    }

    .dashboard-command-body {
        padding-top: 38px;
        padding-bottom: 38px;
    }

    .display-table th,
    .display-table td,
    .system-admin-table th,
    .system-admin-table td {
        padding-top: 11px;
        padding-bottom: 11px;
    }
}

/* DAILY PRODUCTION PLAN: freeze the control deck, scroll only the data area. */
body.daily-plan-live-screen {
    overflow: hidden;
}

body.daily-plan-live-screen .module-frame {
    height: 100vh;
    overflow: hidden;
}

body.daily-plan-live-screen .module-content {
    padding-bottom: 0;
}

body.daily-plan-live-screen .daily-plan-pivot-panel {
    margin-bottom: 0;
}

body.daily-plan-live-screen .daily-plan-table-shell {
    min-height: 230px;
    overflow-x: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

body.daily-plan-live-screen .daily-plan-pivot-table {
    margin: 0;
}

body.daily-plan-live-screen .daily-plan-pivot-table thead th {
    position: sticky;
    top: 0;
    z-index: 18;
    background: var(--table-head);
    box-shadow: 0 1px 0 var(--line);
}

body.daily-plan-live-screen .daily-plan-pivot-table tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 17;
    background: var(--panel-soft);
    box-shadow: 0 -1px 0 var(--line);
}

body.daily-plan-live-screen .daily-plan-table-shell::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

body.daily-plan-live-screen .daily-plan-table-shell::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--dhi-blue) 42%, var(--line));
    border: 2px solid var(--panel);
    border-radius: 999px;
}

body.daily-plan-live-screen .daily-plan-table-shell::-webkit-scrollbar-track {
    background: var(--panel);
}

/* Remarks become a quiet combobox. The affordance appears on hover/focus. */
.daily-plan-remark-form {
    position: relative;
    display: block;
}

.daily-plan-remark-combobox {
    position: relative;
    min-width: 0;
}

.daily-plan-remark-trigger {
    width: 100%;
    min-height: 32px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18px;
    align-items: center;
    gap: 5px;
    padding: 5px 7px;
    color: var(--ink);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.72rem;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
}

.daily-plan-remark-trigger > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.daily-plan-remark-chevron {
    opacity: 0;
    color: var(--dhi-blue);
    font-size: 0.9rem;
    font-weight: 900;
    text-align: center;
    transform: translateY(-1px);
    transition: opacity 0.12s ease;
}

.daily-plan-remark-cell:hover .daily-plan-remark-trigger,
.daily-plan-remark-combobox:focus-within .daily-plan-remark-trigger {
    background: var(--panel);
    border-color: color-mix(in srgb, var(--dhi-blue) 42%, var(--line));
}

.daily-plan-remark-cell:hover .daily-plan-remark-chevron,
.daily-plan-remark-combobox:focus-within .daily-plan-remark-chevron {
    opacity: 1;
}

.daily-plan-remark-trigger:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--dhi-blue) 28%, transparent);
    outline-offset: 1px;
}

.daily-plan-remark-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 90;
    width: max(100%, 270px);
    max-width: min(380px, 40vw);
    overflow: hidden;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid color-mix(in srgb, var(--dhi-blue) 28%, var(--line));
    border-radius: 8px;
    box-shadow: 0 18px 44px rgba(14, 38, 72, 0.24);
}

.daily-plan-remark-menu[hidden] {
    display: none !important;
}

.daily-plan-remark-combobox.opens-up .daily-plan-remark-menu {
    top: auto;
    bottom: calc(100% + 4px);
}

.daily-plan-remark-cell:focus-within {
    z-index: 88;
}

.daily-plan-remark-options {
    max-height: 220px;
    overflow-y: auto;
    padding: 5px;
}

.daily-plan-remark-option,
.daily-plan-remark-clear,
.daily-plan-remark-add-toggle {
    width: 100%;
    min-height: 34px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 6px;
    font-size: 0.68rem;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
}

.daily-plan-remark-option span {
    overflow-wrap: anywhere;
}

.daily-plan-remark-option strong {
    visibility: hidden;
    color: var(--dhi-blue);
}

.daily-plan-remark-option:hover,
.daily-plan-remark-option.is-selected,
.daily-plan-remark-clear:hover,
.daily-plan-remark-add-toggle:hover {
    background: var(--panel-soft);
}

.daily-plan-remark-option.is-selected strong {
    visibility: visible;
}

.daily-plan-remark-empty {
    padding: 10px 8px;
    color: var(--muted);
    font-size: 0.64rem;
    line-height: 1.35;
}

.daily-plan-remark-clear {
    display: block;
    min-height: 30px;
    padding: 5px 13px;
    color: #a23a3a;
    border-top: 1px solid var(--line);
    border-radius: 0;
    font-size: 0.62rem;
}

.daily-plan-remark-add {
    border-top: 1px solid var(--line);
    background: var(--panel-soft);
}

.daily-plan-remark-add-toggle {
    display: block;
    min-height: 36px;
    padding: 7px 12px;
    color: var(--dhi-blue);
    border-radius: 0;
    font-weight: 900;
}

.daily-plan-remark-add-editor {
    display: grid;
    gap: 6px;
    padding: 8px;
}

.daily-plan-remark-add-editor[hidden] {
    display: none !important;
}

.daily-plan-remark-add-editor input {
    width: 100%;
    min-height: 36px;
    padding: 6px 8px;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    outline: none;
    font-size: 0.68rem;
}

.daily-plan-remark-add-editor input:focus {
    border-color: var(--dhi-blue);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--dhi-blue) 16%, transparent);
}

.daily-plan-remark-add-editor > div {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
}

.daily-plan-remark-add-editor button {
    min-height: 29px;
    padding: 0 9px;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 5px;
    font-size: 0.57rem;
    font-weight: 900;
    cursor: pointer;
}

.daily-plan-remark-add-editor button:first-child {
    color: #ffffff;
    background: var(--dhi-blue);
    border-color: var(--dhi-blue);
}

.daily-plan-remark-status {
    display: block;
    min-height: 12px;
    margin-top: 2px;
    padding-right: 3px;
}

.daily-plan-remark-cell.has-row-menu .daily-plan-remark-form {
    padding-right: 28px;
}

/* Keep table density usable on a 19-inch 1366x768 workstation. */
@media (min-width: 1101px) and (max-width: 1500px) {
    .daily-plan-pivot-table {
        min-width: 1280px;
        font-size: 0.7rem;
    }

    .daily-plan-pivot-table th,
    .daily-plan-pivot-table td {
        padding: 7px 6px;
    }

    .daily-plan-pivot-filter-grid {
        grid-template-columns: 130px 1.05fr 0.95fr 1.45fr 128px 66px;
    }

    .snapshot-kpi-grid article {
        min-height: 54px;
    }
}

/* On narrow/mobile layouts return to normal document scrolling. */
@media (max-width: 1100px) {
    body.daily-plan-live-screen {
        overflow: auto;
    }

    body.daily-plan-live-screen .module-frame {
        height: auto;
        overflow: visible;
    }

    body.daily-plan-live-screen .daily-plan-table-shell {
        height: auto !important;
        max-height: none;
        overflow-x: auto;
        overflow-y: visible;
    }

    body.daily-plan-live-screen .daily-plan-pivot-table thead th,
    body.daily-plan-live-screen .daily-plan-pivot-table tfoot td {
        position: static;
    }

    .daily-plan-remark-menu {
        right: auto;
        left: 0;
        max-width: min(360px, 82vw);
    }
}

/* ==========================================================================
   PHASE 1.5B.006 · SHARED AUTO-SCROLL FOR DASHBOARD MODULE TABLES
   Daily Production Plan, Daily Production Result, and Master Configuration
   now share one auto-scroll behavior from mes-modules.js.
   ========================================================================== */
[data-mes-auto-scroll] {
    scroll-behavior: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

body.daily-plan-live-screen .daily-open-wo-table-shell .daily-open-wo-table {
    margin: 0;
}

body.daily-plan-live-screen
    .daily-open-wo-table-shell
    .daily-open-wo-table
    thead
    th {
    position: sticky;
    top: 0;
    z-index: 18;
    background: var(--table-head);
    box-shadow: 0 1px 0 var(--line);
}

body.master-configuration-live-screen {
    overflow: hidden;
}

body.master-configuration-live-screen .module-frame {
    height: 100vh;
    overflow: hidden;
}

body.master-configuration-live-screen .module-content {
    padding-bottom: 0;
}

.master-configuration-scroll-region {
    min-height: 240px;
    overflow-x: hidden;
    overflow-y: auto;
}

.master-configuration-scroll-region .display-table-panel:last-child {
    margin-bottom: 0;
}

.master-configuration-scroll-region::-webkit-scrollbar {
    width: 10px;
}

.master-configuration-scroll-region::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--dhi-blue) 42%, var(--line));
    border: 2px solid var(--panel);
    border-radius: 999px;
}

.master-configuration-scroll-region::-webkit-scrollbar-track {
    background: var(--panel);
}

/* Auto-scroll is a display aid, never a trap on narrow/mobile layouts. */
@media (max-width: 760px) {
    body.master-configuration-live-screen {
        overflow: auto;
    }

    body.master-configuration-live-screen .module-frame {
        height: auto;
        overflow: visible;
    }

    .master-configuration-scroll-region {
        height: auto !important;
        max-height: none;
        overflow: visible;
    }
}

/* ==========================================================================
   PHASE 1.6A · PRODUCTION CONTROL MODULE FOUNDATION
   ========================================================================== */
.production-control-screen {
    display: grid;
    gap: 9px;
}

.production-control-header-action {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-decoration: none;
}

.production-control-header-action:hover {
    background: rgba(255, 255, 255, 0.15);
}

.production-control-command-bar {
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 9px 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.production-control-command-bar > div span,
.production-control-command-bar > div strong {
    display: block;
}

.production-control-command-bar > div span {
    color: var(--muted);
    font-size: 0.55rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.production-control-command-bar > div strong {
    margin-top: 4px;
    color: var(--ink);
    font-size: 0.74rem;
}

.production-control-command-note {
    flex: 1;
}

.production-control-command-bar > .status-pill {
    margin: 0;
    white-space: nowrap;
}

.production-control-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.production-control-kpi-grid article {
    min-width: 0;
    padding: 10px 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 3px solid #2d9d65;
    border-radius: 8px;
}

.production-control-kpi-grid article span,
.production-control-kpi-grid article strong,
.production-control-kpi-grid article small {
    display: block;
}

.production-control-kpi-grid article span {
    color: var(--muted);
    font-size: 0.57rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.production-control-kpi-grid article strong {
    margin-top: 4px;
    color: var(--ink);
    font-size: 1.08rem;
}

.production-control-kpi-grid article small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.54rem;
}

.production-control-kpi-grid .production-control-kpi-delivery {
    border-left-color: #d59221;
}

.production-control-kpi-grid .production-control-kpi-production,
.production-control-kpi-grid .production-control-kpi-critical {
    border-left-color: #c34b3d;
}

.production-control-source-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
}

.production-control-source-strip article {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 9px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 7px;
}

.production-control-source-strip article div span,
.production-control-source-strip article div strong {
    display: block;
}

.production-control-source-strip article div span {
    color: var(--ink);
    font-size: 0.57rem;
    font-weight: 850;
}

.production-control-source-strip article div strong {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.49rem;
    letter-spacing: 0.04em;
}

.production-control-source-strip .status-pill {
    flex: 0 0 auto;
    margin: 0;
    font-size: 0.43rem;
}

.production-control-panel {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.production-control-panel-header {
    min-height: 44px;
}

.production-control-table-wrap {
    overflow-x: auto;
}

.production-control-table {
    width: 100%;
    min-width: 1180px;
    table-layout: fixed;
    font-size: 0.65rem;
}

.production-control-table th,
.production-control-table td {
    padding: 7px 5px;
}

.production-control-table th:first-child {
    width: 13%;
}
.production-control-table th:nth-child(2) {
    width: 9%;
}
.production-control-table th:nth-child(3) {
    width: 10%;
}
.production-control-table th:nth-child(4) {
    width: 9%;
}
.production-control-table th:nth-child(5) {
    width: 9%;
}
.production-control-table th:nth-child(6) {
    width: 10%;
}
.production-control-table th:nth-child(7) {
    width: 9%;
}
.production-control-table th:nth-child(8) {
    width: 11%;
}
.production-control-table th:nth-child(9) {
    width: 11%;
}
.production-control-table th:nth-child(10) {
    width: 9%;
}

.production-control-empty-state {
    height: 230px;
}

.production-control-data-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.production-control-data-card {
    min-width: 0;
    padding: 11px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.production-control-data-card header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.production-control-data-card header span,
.production-control-data-card header h2 {
    display: block;
}

.production-control-data-card header div > span {
    color: var(--muted);
    font-size: 0.5rem;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.production-control-data-card h2 {
    margin: 4px 0 0;
    color: var(--ink);
    font-size: 0.72rem;
}

.production-control-data-card .status-pill {
    flex: 0 0 auto;
    margin: 0;
    font-size: 0.43rem;
}

.production-control-data-card dl {
    margin: 12px 0;
}

.production-control-data-card dl div {
    padding: 7px 0;
    border-top: 1px solid var(--line);
}

.production-control-data-card dt {
    color: var(--muted);
    font-size: 0.48rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.production-control-data-card dd {
    margin: 4px 0 0;
    color: var(--ink);
    font-size: 0.58rem;
    font-weight: 750;
}

.production-control-extract-list {
    display: grid;
    gap: 3px;
}

.production-control-extract-list span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.production-control-extract-list strong {
    color: var(--ink);
    font-weight: 850;
}

.production-control-data-card button {
    width: 100%;
    min-height: 32px;
    color: var(--muted);
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.5rem;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.production-control-contract-panel {
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.production-control-contract-panel > header {
    padding: 10px 12px;
    color: #ffffff;
    background: var(--dhi-navy);
}

.production-control-contract-panel > header span,
.production-control-contract-panel > header strong {
    display: block;
}

.production-control-contract-panel > header span {
    font-size: 0.54rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.production-control-contract-panel > header strong {
    margin-top: 3px;
    font-size: 0.62rem;
    font-weight: 600;
    opacity: 0.8;
}

.production-control-formula-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.production-control-formula-grid article {
    min-width: 0;
    padding: 12px;
    border-right: 1px solid var(--line);
}

.production-control-formula-grid article:last-child {
    border-right: 0;
}

.production-control-formula-grid span,
.production-control-formula-grid strong {
    display: block;
}

.production-control-formula-grid span {
    color: var(--muted);
    font-size: 0.49rem;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.production-control-formula-grid strong {
    margin-top: 5px;
    color: var(--ink);
    font-size: 0.61rem;
    line-height: 1.35;
}

@media (max-width: 1450px) {
    .production-control-source-strip,
    .production-control-data-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .production-control-kpi-grid,
    .production-control-formula-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .production-control-source-strip,
    .production-control-data-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .production-control-command-bar {
        align-items: flex-start;
        flex-direction: column;
        gap: 9px;
    }

    .production-control-kpi-grid,
    .production-control-source-strip,
    .production-control-data-grid,
    .production-control-formula-grid {
        grid-template-columns: 1fr;
    }

    .production-control-formula-grid article {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
}

@media (min-width: 3400px) and (min-height: 1800px) {
    .production-control-kpi-grid article {
        min-height: 92px;
        padding: 15px 17px;
    }

    .production-control-kpi-grid article span,
    .production-control-source-strip article div span {
        font-size: 0.78rem;
    }

    .production-control-kpi-grid article strong {
        font-size: 1.55rem;
    }

    .production-control-kpi-grid article small,
    .production-control-source-strip article div strong {
        font-size: 0.7rem;
    }

    .production-control-table {
        font-size: 0.9rem;
    }

    .production-control-table th,
    .production-control-table td {
        padding: 10px 8px;
    }
}

/* ==========================================================================
   PHASE 1.6B.002 · MATTEL WEEKLY PLAN & BOH EXCEL UPLOAD
   ========================================================================== */
.production-control-data-card-active {
    border-color: rgba(50, 144, 222, 0.45);
    box-shadow: inset 0 0 0 1px rgba(50, 144, 222, 0.08);
}

.production-control-source-meta {
    display: grid;
    gap: 3px;
}

.production-control-source-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.production-control-upload-form {
    display: grid;
    gap: 7px;
}

.production-control-upload-form label {
    display: grid;
    gap: 5px;
}

.production-control-upload-form label > span,
.production-control-upload-form small {
    color: var(--muted);
    font-size: 0.48rem;
    font-weight: 800;
}

.production-control-upload-form input[type="file"] {
    width: 100%;
    min-height: 34px;
    padding: 6px;
    color: var(--ink);
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.52rem;
}

.production-control-upload-form button,
.production-control-button-primary,
.production-control-button-secondary {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 6px;
    font-size: 0.52rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    cursor: pointer;
}

.production-control-upload-form button,
.production-control-button-primary {
    color: #ffffff;
    background: var(--dhi-blue);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.production-control-upload-form button:hover,
.production-control-button-primary:hover {
    filter: brightness(1.08);
}

.production-control-button-secondary {
    color: var(--ink);
    background: var(--panel-soft);
    border: 1px solid var(--line);
}

.production-control-preview-panel {
    overflow: hidden;
    background: var(--panel);
    border: 1px solid rgba(45, 157, 101, 0.5);
    border-radius: 8px;
}

.production-control-preview-panel > header {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    background: rgba(45, 157, 101, 0.08);
    border-bottom: 1px solid var(--line);
}

.production-control-preview-panel > header div span,
.production-control-preview-panel > header div strong {
    display: block;
}

.production-control-preview-panel > header div span {
    color: #55c88a;
    font-size: 0.52rem;
    font-weight: 900;
    letter-spacing: 0.07em;
}

.production-control-preview-panel > header div strong {
    margin-top: 4px;
    color: var(--ink);
    font-size: 0.67rem;
}

.production-control-preview-kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border-bottom: 1px solid var(--line);
}

.production-control-preview-kpis article {
    min-width: 0;
    padding: 10px 12px;
    border-right: 1px solid var(--line);
}

.production-control-preview-kpis article:last-child {
    border-right: 0;
}

.production-control-preview-kpis span,
.production-control-preview-kpis strong,
.production-control-preview-kpis small {
    display: block;
}

.production-control-preview-kpis span {
    color: var(--muted);
    font-size: 0.48rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.production-control-preview-kpis strong {
    margin-top: 4px;
    color: var(--ink);
    font-size: 0.86rem;
}

.production-control-preview-kpis small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.46rem;
}

.production-control-preview-warning {
    display: grid;
    gap: 4px;
    margin: 9px 10px 0;
    padding: 8px 10px;
    color: #eab85d;
    background: rgba(213, 146, 33, 0.08);
    border: 1px solid rgba(213, 146, 33, 0.35);
    border-radius: 6px;
    font-size: 0.52rem;
}

.production-control-preview-warning strong {
    font-size: 0.49rem;
    letter-spacing: 0.06em;
}

.production-control-preview-table-wrap {
    padding: 9px 10px 0;
    overflow-x: auto;
}

.production-control-preview-table {
    width: 100%;
    min-width: 620px;
    table-layout: fixed;
    font-size: 0.58rem;
}

.production-control-preview-table th,
.production-control-preview-table td {
    padding: 6px 7px;
}

.production-control-preview-table th:first-child {
    width: 13%;
}
.production-control-preview-table th:nth-child(2) {
    width: 37%;
}
.production-control-preview-table th:nth-child(3) {
    width: 25%;
}
.production-control-preview-table th:nth-child(4) {
    width: 25%;
}

.production-control-preview-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px;
}

.production-control-preview-actions > div {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    color: var(--muted);
    font-size: 0.49rem;
    font-weight: 700;
}

.production-control-preview-actions form {
    margin: 0;
}

@media (max-width: 1180px) {
    .production-control-preview-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .production-control-preview-actions,
    .production-control-preview-actions > div {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 680px) {
    .production-control-preview-kpis {
        grid-template-columns: 1fr 1fr;
    }
}

/* Phase 1.6C.001 - Production Control upload history */
.production-control-history-panel {
    margin-top: 10px;
    border: 1px solid rgba(120, 160, 205, 0.32);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(17, 37, 59, 0.72);
}

.production-control-history-panel > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px;
    background: rgba(10, 45, 83, 0.86);
    border-bottom: 1px solid rgba(120, 160, 205, 0.25);
}

.production-control-history-panel > header div {
    display: grid;
    gap: 2px;
}

.production-control-history-panel > header span,
.production-control-history-panel > header strong,
.production-control-history-panel > header small {
    display: block;
}

.production-control-history-panel > header span {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.production-control-history-panel > header strong {
    font-size: 13px;
}

.production-control-history-panel > header small {
    color: #b9d4ee;
    font-size: 10px;
    font-weight: 700;
}

.production-control-history-table-wrap {
    overflow-x: auto;
}

.production-control-history-table {
    min-width: 1120px;
    margin: 0;
}

.production-control-history-table th,
.production-control-history-table td {
    padding: 8px 10px;
    white-space: nowrap;
    vertical-align: middle;
}

.production-control-history-table td:nth-child(3) {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.production-control-history-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    padding: 3px 7px;
    border: 1px solid rgba(105, 171, 225, 0.5);
    border-radius: 999px;
    background: rgba(36, 108, 166, 0.22);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.production-control-history-action-replace {
    border-color: rgba(255, 183, 77, 0.58);
    background: rgba(188, 116, 26, 0.22);
}

.production-control-history-action-upload {
    border-color: rgba(68, 201, 132, 0.58);
    background: rgba(31, 145, 89, 0.2);
}

.production-control-history-action-baseline {
    border-color: rgba(142, 164, 190, 0.5);
    background: rgba(86, 105, 126, 0.24);
}

.production-control-history-empty {
    padding: 20px !important;
    text-align: center;
    color: #9eb7cf;
}

/* Phase 1.6C.002 - Production Control Upload Story + monthly Week labels */
.production-control-period-block {
    min-width: 108px;
}

.production-control-command-bar .production-control-period-block small {
    display: block;
    margin-top: 2px;
    color: #8fb2d2;
    font-size: 0.47rem;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.production-control-current-version {
    width: max-content;
    padding: 2px 7px;
    color: #7ce0aa;
    background: rgba(31, 145, 89, 0.16);
    border: 1px solid rgba(68, 201, 132, 0.38);
    border-radius: 999px;
    font-size: 0.47rem;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.production-control-story-panel {
    margin-top: 10px;
    overflow: hidden;
    background: rgba(17, 37, 59, 0.72);
    border: 1px solid rgba(120, 160, 205, 0.32);
    border-radius: 10px;
}

.production-control-story-panel > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px;
    background: rgba(10, 45, 83, 0.86);
    border-bottom: 1px solid rgba(120, 160, 205, 0.25);
}

.production-control-story-panel > header div,
.production-control-story-week > header div {
    display: grid;
    gap: 2px;
}

.production-control-story-panel > header span,
.production-control-story-panel > header strong,
.production-control-story-panel > header small,
.production-control-story-week > header span,
.production-control-story-week > header strong,
.production-control-story-week > header small {
    display: block;
}

.production-control-story-panel > header span,
.production-control-story-week > header span {
    color: #b7d8f5;
    font-size: 0.5rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.production-control-story-panel > header strong {
    color: var(--ink);
    font-size: 0.76rem;
}

.production-control-story-panel > header small,
.production-control-story-week > header small {
    color: #9bbbd7;
    font-size: 0.5rem;
    font-weight: 700;
}

.production-control-story-weeks {
    display: grid;
    gap: 8px;
    padding: 9px;
}

.production-control-story-week {
    overflow: hidden;
    border: 1px solid rgba(120, 160, 205, 0.24);
    border-radius: 8px;
    background: rgba(14, 31, 50, 0.55);
}

.production-control-story-week > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    background: rgba(31, 70, 108, 0.3);
    border-bottom: 1px solid rgba(120, 160, 205, 0.18);
}

.production-control-story-week > header strong {
    color: #ffffff;
    font-size: 0.72rem;
}

.production-control-story-list {
    display: grid;
}

.production-control-story-item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-bottom: 1px solid rgba(120, 160, 205, 0.13);
}

.production-control-story-item:last-child {
    border-bottom: 0;
}

.production-control-story-item.is-current {
    background: linear-gradient(90deg, rgba(38, 154, 96, 0.1), transparent 36%);
}

.production-control-story-version {
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 48px;
    border: 1px solid rgba(96, 171, 231, 0.34);
    border-radius: 7px;
    background: rgba(31, 83, 128, 0.2);
}

.production-control-story-version span {
    color: #8db3d5;
    font-size: 0.42rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.production-control-story-version strong {
    color: #ffffff;
    font-size: 0.9rem;
}

.production-control-story-body {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.production-control-story-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.production-control-story-title strong {
    color: var(--ink);
    font-size: 0.61rem;
}

.production-control-story-state,
.production-control-story-action {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 0.42rem;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.production-control-story-state {
    color: #a9bdd0;
    border: 1px solid rgba(142, 164, 190, 0.36);
    background: rgba(86, 105, 126, 0.17);
}

.production-control-story-state.is-active {
    color: #7ce0aa;
    border-color: rgba(68, 201, 132, 0.44);
    background: rgba(31, 145, 89, 0.17);
}

.production-control-story-action {
    color: #e9c57e;
    border: 1px solid rgba(226, 168, 65, 0.36);
    background: rgba(188, 116, 26, 0.14);
}

.production-control-story-file {
    overflow: hidden;
    color: #cce0f1;
    font-size: 0.56rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.production-control-story-body small {
    color: #8faac2;
    font-size: 0.49rem;
    font-weight: 700;
}

.production-control-story-meta {
    min-width: 150px;
    display: grid;
    justify-items: end;
    gap: 3px;
    color: #9eb8cf;
    text-align: right;
}

.production-control-story-meta strong {
    color: #d8e7f3;
    font-size: 0.53rem;
}

.production-control-story-meta span {
    font-size: 0.47rem;
    font-weight: 700;
}

.production-control-story-empty {
    padding: 24px 12px;
    color: #9eb7cf;
    font-size: 0.56rem;
    font-weight: 700;
    text-align: center;
}

@media (max-width: 760px) {
    .production-control-story-item {
        grid-template-columns: 58px minmax(0, 1fr);
    }

    .production-control-story-meta {
        grid-column: 2;
        min-width: 0;
        justify-items: start;
        text-align: left;
    }
}

/* ==========================================================================
   PHASE 1.6C.002B · ACTIVE WEEK CONTROL
   ========================================================================== */
.production-control-command-bar-week {
    gap: 14px;
}

.production-control-week-control {
    display: inline-flex;
    align-items: stretch;
    gap: 6px;
    flex: 0 0 auto;
}

.production-control-week-nav,
.production-control-current-week-action {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    color: #cfe4f8;
    background: rgba(32, 67, 101, 0.46);
    border: 1px solid rgba(126, 170, 211, 0.34);
    border-radius: 7px;
    font-size: 0.5rem;
    font-weight: 950;
    letter-spacing: 0.045em;
    text-decoration: none;
    white-space: nowrap;
}

.production-control-week-nav:hover,
.production-control-current-week-action:hover {
    color: #ffffff;
    background: rgba(52, 111, 170, 0.52);
    border-color: rgba(124, 190, 244, 0.62);
}

.production-control-week-nav.is-disabled {
    cursor: default;
    color: #667f98;
    background: rgba(32, 50, 68, 0.24);
    border-color: rgba(107, 131, 154, 0.18);
}

.production-control-current-week-action {
    color: #9fe7be;
    border-color: rgba(68, 201, 132, 0.42);
    background: rgba(31, 145, 89, 0.15);
}

.production-control-current-week-action.is-active {
    cursor: default;
    color: #b7f3d0;
    background: rgba(31, 145, 89, 0.24);
    border-color: rgba(68, 201, 132, 0.62);
}

.production-control-week-control .production-control-period-block {
    min-width: 116px;
    padding: 5px 10px;
    text-align: center;
    background: rgba(11, 40, 68, 0.56);
    border: 1px solid rgba(113, 157, 199, 0.26);
    border-radius: 7px;
}

.production-control-week-control .production-control-period-block strong {
    margin-top: 2px;
    font-size: 0.72rem;
}

.production-control-week-control .production-control-period-block small {
    width: max-content;
    margin: 3px auto 0;
    padding: 1px 6px;
    border-radius: 999px;
}

.production-control-week-control
    .production-control-period-block
    small.is-current {
    color: #7ce0aa;
    background: rgba(31, 145, 89, 0.16);
    border: 1px solid rgba(68, 201, 132, 0.34);
}

.production-control-week-control
    .production-control-period-block
    small.is-historical {
    color: #ffce82;
    background: rgba(191, 124, 34, 0.14);
    border: 1px solid rgba(242, 167, 64, 0.32);
}

@media (max-width: 1180px) {
    .production-control-command-bar-week {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .production-control-week-control {
        width: 100%;
    }

    .production-control-command-note {
        min-width: 280px;
    }
}

@media (max-width: 720px) {
    .production-control-week-control {
        display: grid;
        grid-template-columns: 1fr 1.25fr 1fr;
    }

    .production-control-current-week-action {
        grid-column: 1 / -1;
    }
}

/* Phase 1.6C.003 · Production Control revision snapshot */
.production-control-story-view {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 9px;
    border: 1px solid rgba(96, 165, 250, 0.45);
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: #bfdbfe;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-decoration: none;
    white-space: nowrap;
}

.production-control-story-view:hover {
    background: rgba(37, 99, 235, 0.22);
    color: #eff6ff;
}

.production-control-story-view.is-disabled {
    border-color: rgba(148, 163, 184, 0.22);
    background: rgba(51, 65, 85, 0.18);
    color: #64748b;
    cursor: default;
}

.production-control-version-panel {
    overflow: hidden;
    margin-top: 10px;
    border: 1px solid rgba(59, 130, 246, 0.42);
    border-radius: 8px;
    background: #132238;
}

.production-control-version-panel > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    background: #0d2d54;
}

.production-control-version-panel > header > div:first-child {
    display: grid;
    gap: 2px;
}

.production-control-version-panel > header span,
.production-control-version-summary span {
    color: #93c5fd;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.production-control-version-panel > header strong {
    color: #f8fafc;
    font-size: 13px;
}

.production-control-version-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.production-control-version-actions > a {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 10px;
    font-weight: 800;
    text-decoration: none;
}

.production-control-version-summary {
    display: grid;
    grid-template-columns: 0.8fr 2fr 0.7fr 1fr;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.production-control-version-summary > div {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 10px 12px;
    border-right: 1px solid rgba(148, 163, 184, 0.16);
}

.production-control-version-summary > div:last-child {
    border-right: 0;
}

.production-control-version-summary strong {
    overflow: hidden;
    color: #f8fafc;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.production-control-version-table-wrap {
    max-height: 430px;
    overflow-y: auto;
}

.production-control-version-table {
    width: 100%;
    table-layout: fixed;
}

.production-control-version-table th:first-child,
.production-control-version-table td:first-child {
    width: 34%;
    text-align: left;
}

.production-control-version-table th:not(:first-child),
.production-control-version-table td:not(:first-child) {
    text-align: right;
}

.production-control-version-empty {
    padding: 24px !important;
    color: #94a3b8 !important;
    text-align: center !important;
}

@media (max-width: 900px) {
    .production-control-version-summary {
        grid-template-columns: 1fr 1fr;
    }

    .production-control-version-summary > div:nth-child(2) {
        border-right: 0;
    }
}

/* ==========================================================================
   PHASE 1.7.001 · PRODUCTION CONTROL INDEX REFINEMENT
   ========================================================================== */
.production-control-overview-screen {
    gap: 8px;
}

.production-control-overview-screen .production-control-command-bar-week {
    min-height: 46px;
    gap: 8px;
    padding: 5px 7px;
}

.production-control-overview-screen .production-control-week-control {
    width: 100%;
    display: grid;
    grid-template-columns: 118px minmax(180px, 1fr) 118px auto;
    gap: 6px;
}

.production-control-overview-screen .production-control-week-nav,
.production-control-overview-screen .production-control-current-week-action {
    min-height: 34px;
    padding-inline: 9px;
    font-size: 0.48rem;
}

.production-control-overview-screen .production-control-period-block {
    min-width: 0;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 9px;
}

.production-control-overview-screen .production-control-period-block > span {
    display: none;
}

.production-control-overview-screen .production-control-period-block strong {
    margin: 0;
    font-size: 0.72rem;
    white-space: nowrap;
}

.production-control-overview-screen .production-control-period-block small {
    width: auto;
    margin: 0;
    white-space: nowrap;
}

.production-control-overview-screen .production-control-kpi-grid article {
    min-height: 57px;
    padding: 7px 10px;
}

.production-control-overview-screen .production-control-kpi-grid article span {
    font-size: 0.53rem;
}

.production-control-overview-screen
    .production-control-kpi-grid
    article
    strong {
    margin-top: 2px;
    font-size: 1.05rem;
    line-height: 1.05;
}

.production-control-overview-screen .production-control-kpi-grid article small {
    margin-top: 2px;
    font-size: 0.5rem;
}

.production-control-overview-screen
    .production-control-kpi-grid
    .production-control-kpi-total {
    border-left-color: var(--dhi-blue);
}

.production-control-overview-screen .production-control-source-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.production-control-overview-screen .production-control-source-strip article {
    min-height: 34px;
    padding: 5px 8px;
}

.production-control-overview-screen
    .production-control-source-strip
    article
    div
    span {
    font-size: 0.54rem;
}

.production-control-overview-screen
    .production-control-source-strip
    .status-pill {
    font-size: 0.42rem;
}

.production-control-overview-screen .production-control-panel {
    margin-bottom: 0;
}

.production-control-overview-screen .production-control-panel-header {
    min-height: 40px;
    padding-block: 6px;
}

.production-control-overview-screen .production-control-table-wrap {
    height: calc(100vh - 330px);
    min-height: 300px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.production-control-overview-screen
    .production-control-table-wrap:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--dhi-blue) 65%, transparent);
    outline-offset: -2px;
}

.production-control-overview-screen .production-control-table {
    width: 100%;
    min-width: 0;
    margin: 0;
    table-layout: fixed;
    font-size: 0.65rem;
}

.production-control-overview-screen .production-control-table thead th {
    position: sticky;
    top: 0;
    z-index: 12;
    background: var(--table-head);
    box-shadow: 0 1px 0 var(--line);
}

.production-control-overview-screen .production-control-table th,
.production-control-overview-screen .production-control-table td {
    padding: 7px 4px;
}

.production-control-overview-screen .production-control-table th:first-child {
    width: 15%;
}
.production-control-overview-screen .production-control-table th:nth-child(2) {
    width: 10%;
}
.production-control-overview-screen .production-control-table th:nth-child(3) {
    width: 10%;
}
.production-control-overview-screen .production-control-table th:nth-child(4) {
    width: 9%;
}
.production-control-overview-screen .production-control-table th:nth-child(5) {
    width: 9%;
}
.production-control-overview-screen .production-control-table th:nth-child(6) {
    width: 11%;
}
.production-control-overview-screen .production-control-table th:nth-child(7) {
    width: 9%;
}
.production-control-overview-screen .production-control-table th:nth-child(8) {
    width: 12%;
}
.production-control-overview-screen .production-control-table th:nth-child(9) {
    width: 15%;
}

.production-control-overview-screen .production-control-table td:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.production-control-overview-screen
    .production-control-table
    td:first-child
    strong {
    font-weight: 900;
}

.production-control-overview-screen
    .production-control-table
    .production-control-need-cell
    strong {
    font-weight: 950;
}

.production-control-overview-screen .production-control-table td:last-child {
    text-align: center;
}

.production-control-overview-screen
    .production-control-table
    td:last-child
    .status-pill {
    max-width: 100%;
    margin: 0;
    white-space: nowrap;
}

.production-control-overview-screen
    .production-control-table
    tbody
    tr.production-control-row-need-production {
    background: color-mix(in srgb, #c34b3d 8%, var(--table-row));
}

.production-control-overview-screen
    .production-control-table
    tbody
    tr.production-control-row-need-delivery {
    background: color-mix(in srgb, #d59221 8%, var(--table-row));
}

.production-control-overview-screen
    .production-control-table
    tbody
    tr.production-control-row-need-production
    td:first-child {
    box-shadow: inset 3px 0 #c34b3d;
}

.production-control-overview-screen
    .production-control-table
    tbody
    tr.production-control-row-need-delivery
    td:first-child {
    box-shadow: inset 3px 0 #d59221;
}

.production-control-overview-screen
    .production-control-table-wrap::-webkit-scrollbar {
    width: 9px;
}

.production-control-overview-screen
    .production-control-table-wrap::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--dhi-blue) 42%, var(--line));
    border: 2px solid var(--panel);
    border-radius: 999px;
}

.production-control-overview-screen
    .production-control-table-wrap::-webkit-scrollbar-track {
    background: var(--panel);
}

@media (max-width: 900px) {
    .production-control-overview-screen .production-control-week-control {
        grid-template-columns: 1fr 1.5fr 1fr;
    }

    .production-control-overview-screen
        .production-control-current-week-action {
        grid-column: 1 / -1;
    }

    .production-control-overview-screen .production-control-source-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .production-control-overview-screen .production-control-table-wrap {
        height: auto;
        max-height: 62vh;
        min-height: 280px;
    }

    .production-control-overview-screen .production-control-table {
        font-size: 0.58rem;
    }

    .production-control-overview-screen .production-control-table th,
    .production-control-overview-screen .production-control-table td {
        padding-inline: 3px;
    }
}

@media (max-width: 680px) {
    .production-control-overview-screen .production-control-source-strip {
        grid-template-columns: 1fr;
    }

    .production-control-overview-screen
        .production-control-table
        th:nth-child(2),
    .production-control-overview-screen
        .production-control-table
        td:nth-child(2),
    .production-control-overview-screen
        .production-control-table
        th:nth-child(4),
    .production-control-overview-screen
        .production-control-table
        td:nth-child(4),
    .production-control-overview-screen
        .production-control-table
        th:nth-child(5),
    .production-control-overview-screen
        .production-control-table
        td:nth-child(5),
    .production-control-overview-screen
        .production-control-table
        th:nth-child(6),
    .production-control-overview-screen
        .production-control-table
        td:nth-child(6) {
        display: none;
    }

    .production-control-overview-screen
        .production-control-table
        th:first-child {
        width: 24%;
    }
    .production-control-overview-screen
        .production-control-table
        th:nth-child(3) {
        width: 18%;
    }
    .production-control-overview-screen
        .production-control-table
        th:nth-child(7) {
        width: 17%;
    }
    .production-control-overview-screen
        .production-control-table
        th:nth-child(8) {
        width: 18%;
    }
    .production-control-overview-screen
        .production-control-table
        th:nth-child(9) {
        width: 23%;
    }
}

/* ==========================================================================
   PHASE 1.7.002 · BUSINESS WORDING + PART DETAIL
   ========================================================================== */
.production-control-part-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    color: var(--ink);
    text-decoration: none;
}

.production-control-part-link strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.production-control-part-link span {
    flex: 0 0 auto;
    color: var(--dhi-blue);
    font-size: 0.92rem;
    font-weight: 950;
    line-height: 1;
    transition: transform 0.16s ease;
}

.production-control-part-link:hover {
    color: var(--dhi-blue);
}

.production-control-part-link:hover span {
    transform: translateX(2px);
}

.production-control-part-detail-screen {
    gap: 10px;
}

.production-control-part-hero {
    display: grid;
    grid-template-columns: minmax(260px, 0.8fr) minmax(210px, 0.55fr) minmax(
            420px,
            1.65fr
        );
    align-items: stretch;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.production-control-part-hero > * {
    min-width: 0;
    padding: 14px 16px;
}

.production-control-part-identity,
.production-control-part-status {
    border-right: 1px solid var(--line);
}

.production-control-part-identity > span,
.production-control-part-status > span:first-child,
.production-control-part-metric-card header span,
.production-control-part-reading > header span {
    color: var(--muted);
    font-size: 0.53rem;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.production-control-part-identity h2 {
    margin: 4px 0 0;
    color: var(--ink);
    font-size: 1.28rem;
    letter-spacing: 0.015em;
}

.production-control-part-identity small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.57rem;
}

.production-control-part-status {
    display: grid;
    align-content: center;
    justify-items: start;
    gap: 4px;
}

.production-control-part-status > strong {
    color: var(--ink);
    font-size: 1rem;
    letter-spacing: 0.03em;
}

.production-control-part-status .status-pill {
    margin: 2px 0 0;
}

.production-control-part-hero > p {
    display: flex;
    align-items: center;
    margin: 0;
    color: var(--ink);
    font-size: 0.67rem;
    font-weight: 650;
    line-height: 1.55;
}

.production-control-part-metric-grid {
    display: grid;
    grid-template-columns: 0.8fr 1.15fr 1fr;
    gap: 9px;
}

.production-control-part-metric-card {
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 9px;
}

.production-control-part-metric-card header,
.production-control-part-reading > header {
    padding: 10px 12px;
    background: var(--panel-soft);
    border-bottom: 1px solid var(--line);
}

.production-control-part-metric-card header span,
.production-control-part-metric-card header strong,
.production-control-part-reading > header span,
.production-control-part-reading > header strong {
    display: block;
}

.production-control-part-metric-card header strong,
.production-control-part-reading > header strong {
    margin-top: 3px;
    color: var(--ink);
    font-size: 0.66rem;
}

.production-control-part-metric-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.production-control-part-metric-card:nth-child(2) dl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.production-control-part-metric-card dl > div {
    min-width: 0;
    padding: 14px 12px;
    border-right: 1px solid var(--line);
}

.production-control-part-metric-card dl > div:last-child {
    border-right: 0;
}

.production-control-part-metric-card dt {
    color: var(--muted);
    font-size: 0.54rem;
    font-weight: 850;
}

.production-control-part-metric-card dd {
    margin: 5px 0 0;
    color: var(--ink);
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
    font-weight: 900;
}

.production-control-part-metric-emphasis dd {
    color: var(--dhi-blue);
}

.production-control-part-reading {
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 9px;
}

.production-control-part-reading-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.production-control-part-reading-grid article {
    min-width: 0;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 9px;
    padding: 13px 14px;
    border-right: 1px solid var(--line);
}

.production-control-part-reading-grid article:last-child {
    border-right: 0;
}

.production-control-part-reading-grid article > span {
    width: 25px;
    height: 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--dhi-blue);
    background: color-mix(in srgb, var(--dhi-blue) 10%, var(--panel));
    border: 1px solid color-mix(in srgb, var(--dhi-blue) 32%, var(--line));
    border-radius: 999px;
    font-size: 0.48rem;
    font-weight: 950;
}

.production-control-part-reading-grid strong {
    color: var(--ink);
    font-size: 0.65rem;
}

.production-control-part-reading-grid p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.59rem;
    line-height: 1.5;
}

.production-control-part-reading footer {
    padding: 9px 12px;
    color: var(--muted);
    background: var(--panel-soft);
    border-top: 1px solid var(--line);
    font-size: 0.54rem;
    font-weight: 700;
}

@media (max-width: 1150px) {
    .production-control-part-hero {
        grid-template-columns: 1fr 1fr;
    }

    .production-control-part-hero > p {
        grid-column: 1 / -1;
        border-top: 1px solid var(--line);
    }

    .production-control-part-status {
        border-right: 0;
    }

    .production-control-part-metric-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .production-control-part-hero {
        grid-template-columns: 1fr;
    }

    .production-control-part-identity,
    .production-control-part-status {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .production-control-part-hero > p {
        grid-column: auto;
        border-top: 0;
    }

    .production-control-part-reading-grid {
        grid-template-columns: 1fr;
    }

    .production-control-part-reading-grid article {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .production-control-part-reading-grid article:last-child {
        border-bottom: 0;
    }
}

/* ==========================================================================
   PHASE 1.7.003A · INDEX FILTER + DISPLAY CLEANUP
   ========================================================================== */
.production-control-overview-screen {
    gap: 7px;
}

.production-control-overview-screen .production-control-kpi-grid article {
    min-height: 54px;
    align-content: center;
}

.production-control-overview-screen .production-control-source-strip article {
    min-height: 31px;
}

.production-control-filter-bar {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) minmax(170px, 0.65fr) auto auto;
    gap: 7px;
    align-items: end;
    padding: 7px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 9px;
}

.production-control-filter-bar label {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.production-control-filter-bar label > span {
    color: var(--muted);
    font-size: 0.48rem;
    font-weight: 950;
    letter-spacing: 0.07em;
}

.production-control-filter-bar input,
.production-control-filter-bar select {
    width: 100%;
    min-width: 0;
    height: 32px;
    padding: 0 10px;
    color: var(--ink);
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 7px;
    outline: none;
    font: inherit;
    font-size: 0.66rem;
    font-weight: 750;
}

.production-control-filter-bar input:focus,
.production-control-filter-bar select:focus {
    border-color: var(--dhi-blue);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--dhi-blue) 16%, transparent);
}

.production-control-filter-bar button,
.production-control-filter-bar > a {
    min-width: 72px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: 7px;
    font-size: 0.55rem;
    font-weight: 950;
    letter-spacing: 0.04em;
    text-decoration: none;
}

.production-control-filter-bar button {
    color: #fff;
    background: var(--dhi-blue);
    border: 1px solid var(--dhi-blue);
    cursor: pointer;
}

.production-control-filter-bar > a {
    color: var(--ink);
    background: var(--panel-soft);
    border: 1px solid var(--line);
}

.production-control-overview-screen .production-control-panel-header {
    min-height: 31px;
}

.production-control-overview-screen
    .production-control-panel-header
    > div
    > span {
    font-size: 0.54rem;
}

.production-control-part-hero {
    grid-template-columns: minmax(320px, 1.35fr) minmax(240px, 0.65fr);
}

.production-control-part-status {
    border-right: 0;
}

@media (max-width: 920px) {
    .production-control-filter-bar {
        grid-template-columns: 1fr 1fr auto auto;
    }
}

@media (max-width: 680px) {
    .production-control-filter-bar {
        grid-template-columns: 1fr 1fr;
    }

    .production-control-filter-bar button,
    .production-control-filter-bar > a {
        width: 100%;
    }

    .production-control-part-hero {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   PHASE 1.7.003B · DAILY REQUIREMENT + DELIVERY TARGET D-1
   ========================================================================== */
.production-control-overview-screen .production-control-table th:first-child {
    width: 13%;
}
.production-control-overview-screen .production-control-table th:nth-child(2) {
    width: 9%;
}
.production-control-overview-screen .production-control-table th:nth-child(3) {
    width: 9%;
}
.production-control-overview-screen .production-control-table th:nth-child(4) {
    width: 8%;
}
.production-control-overview-screen .production-control-table th:nth-child(5) {
    width: 8%;
}
.production-control-overview-screen .production-control-table th:nth-child(6) {
    width: 9%;
}
.production-control-overview-screen .production-control-table th:nth-child(7) {
    width: 8%;
}
.production-control-overview-screen .production-control-table th:nth-child(8) {
    width: 10%;
}
.production-control-overview-screen .production-control-table th:nth-child(9) {
    width: 12%;
}
.production-control-overview-screen .production-control-table th:nth-child(10) {
    width: 14%;
}

.production-control-target-cell {
    text-align: center;
    white-space: nowrap;
}

.production-control-target-cell strong {
    color: var(--ink);
    font-size: 0.63rem;
    font-variant-numeric: tabular-nums;
    font-weight: 900;
}

.production-control-target-cell > span:not(:only-child) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 21px;
    height: 17px;
    margin-left: 4px;
    padding: 0 5px;
    color: var(--dhi-blue);
    background: color-mix(in srgb, var(--dhi-blue) 9%, var(--panel));
    border: 1px solid color-mix(in srgb, var(--dhi-blue) 28%, var(--line));
    border-radius: 999px;
    font-size: 0.47rem;
    font-weight: 950;
}

.production-control-part-hero {
    grid-template-columns: minmax(290px, 1.15fr) minmax(210px, 0.65fr) minmax(
            220px,
            0.7fr
        );
}

.production-control-part-status {
    border-right: 1px solid var(--line);
}

.production-control-part-target {
    display: grid;
    align-content: center;
    justify-items: start;
    gap: 4px;
}

.production-control-part-target > span {
    color: var(--muted);
    font-size: 0.53rem;
    font-weight: 950;
    letter-spacing: 0.08em;
}

.production-control-part-target > strong {
    color: var(--dhi-blue);
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
    font-weight: 950;
}

.production-control-part-target > small {
    color: var(--muted);
    font-size: 0.54rem;
    font-weight: 700;
}

.production-control-daily-panel {
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 9px;
}

.production-control-daily-panel > header {
    min-height: 39px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 11px;
    background: var(--panel-soft);
    border-bottom: 1px solid var(--line);
}

.production-control-daily-panel > header span,
.production-control-daily-panel > header strong {
    display: block;
}

.production-control-daily-panel > header span {
    color: var(--muted);
    font-size: 0.52rem;
    font-weight: 950;
    letter-spacing: 0.07em;
}

.production-control-daily-panel > header strong {
    margin-top: 2px;
    color: var(--ink);
    font-size: 0.67rem;
}

.production-control-daily-panel > header small {
    color: var(--muted);
    font-size: 0.53rem;
    font-weight: 750;
    white-space: nowrap;
}

.production-control-daily-table-wrap {
    overflow-x: auto;
}

.production-control-daily-table {
    width: 100%;
    table-layout: fixed;
    font-size: 0.64rem;
}

.production-control-daily-table th,
.production-control-daily-table td {
    padding: 8px 9px;
}

.production-control-daily-table th:first-child {
    width: 15%;
}
.production-control-daily-table th:nth-child(2) {
    width: 12%;
}
.production-control-daily-table th:nth-child(3),
.production-control-daily-table th:nth-child(4),
.production-control-daily-table th:nth-child(5) {
    width: 10%;
}
.production-control-daily-table th:nth-child(6) {
    width: 13%;
}
.production-control-daily-table th:nth-child(7) {
    width: 10%;
}
.production-control-daily-table th:nth-child(8) {
    width: 20%;
}

.production-control-daily-total {
    font-weight: 900;
}

.production-control-daily-variance {
    color: var(--muted);
    font-weight: 850;
}

.production-control-daily-table
    tr.is-variance
    .production-control-daily-variance {
    color: var(--status-shortfall-text);
    background: color-mix(in srgb, var(--status-shortfall-bg) 55%, transparent);
}

.production-control-daily-target {
    color: var(--dhi-blue);
    text-align: center;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-weight: 900;
}

@media (max-width: 1120px) {
    .production-control-part-hero {
        grid-template-columns: 1fr 1fr;
    }

    .production-control-part-target {
        grid-column: 1 / -1;
        border-top: 1px solid var(--line);
    }

    .production-control-part-status {
        border-right: 0;
    }
}

@media (max-width: 680px) {
    .production-control-overview-screen
        .production-control-table
        th:nth-child(2),
    .production-control-overview-screen
        .production-control-table
        td:nth-child(2),
    .production-control-overview-screen
        .production-control-table
        th:nth-child(4),
    .production-control-overview-screen
        .production-control-table
        td:nth-child(4),
    .production-control-overview-screen
        .production-control-table
        th:nth-child(5),
    .production-control-overview-screen
        .production-control-table
        td:nth-child(5),
    .production-control-overview-screen
        .production-control-table
        th:nth-child(6),
    .production-control-overview-screen
        .production-control-table
        td:nth-child(6) {
        display: none;
    }

    .production-control-overview-screen
        .production-control-table
        th:first-child {
        width: 23%;
    }
    .production-control-overview-screen
        .production-control-table
        th:nth-child(3) {
        width: 16%;
    }
    .production-control-overview-screen
        .production-control-table
        th:nth-child(7) {
        width: 14%;
    }
    .production-control-overview-screen
        .production-control-table
        th:nth-child(8) {
        width: 16%;
    }
    .production-control-overview-screen
        .production-control-table
        th:nth-child(9) {
        width: 16%;
    }
    .production-control-overview-screen
        .production-control-table
        th:nth-child(10) {
        width: 15%;
    }

    .production-control-part-hero {
        grid-template-columns: 1fr;
    }

    .production-control-part-identity,
    .production-control-part-status,
    .production-control-part-target {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .production-control-part-target {
        grid-column: auto;
    }

    .production-control-daily-table {
        min-width: 760px;
    }
}

/* ==========================================================================
   PHASE 1.7.004A.001 · SUMMARY KPI PERCENTAGE POLISH
   ========================================================================== */
.production-control-overview-screen .production-control-kpi-grid article {
    --kpi-accent: #2d9d65;
}

.production-control-overview-screen
    .production-control-kpi-grid
    .production-control-kpi-total {
    --kpi-accent: var(--dhi-blue);
    border-left-color: var(--kpi-accent);
}

.production-control-overview-screen
    .production-control-kpi-grid
    .production-control-kpi-delivery {
    --kpi-accent: #d59221;
    border-left-color: var(--kpi-accent);
}

.production-control-overview-screen
    .production-control-kpi-grid
    .production-control-kpi-production {
    --kpi-accent: #c34b3d;
    border-left-color: var(--kpi-accent);
}

.production-control-kpi-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.production-control-overview-screen
    .production-control-kpi-grid
    article
    .production-control-kpi-percent {
    flex: 0 0 auto;
    padding: 2px 6px;
    color: var(--kpi-accent);
    background: color-mix(in srgb, var(--kpi-accent) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--kpi-accent) 28%, transparent);
    border-radius: 999px;
    font-size: 0.52rem;
    font-style: normal;
    font-weight: 950;
    line-height: 1.2;
    letter-spacing: 0;
}

.production-control-kpi-meter {
    height: 3px;
    margin-top: 5px;
    overflow: hidden;
    background: color-mix(in srgb, var(--kpi-accent) 12%, var(--panel-soft));
    border-radius: 999px;
}

.production-control-kpi-meter i {
    display: block;
    width: min(100%, max(0%, var(--kpi-fill, 0%)));
    height: 100%;
    background: var(--kpi-accent);
    border-radius: inherit;
}

/* ==========================================================================
   PHASE 1.7.004G.002 · GLOBAL MES TABLE RESPONSIVE FOUNDATION

   Goal
   ----
   Keep MES tables readable and operational across common display classes
   without creating one-off responsive rules in every Blade.

   IMPORTANT
   ---------
   CSS responds to viewport resolution, not physical monitor inches.

   Practical profiles:
   1180-1599px  : Compact / common 19" office workstation
   1600-2199px  : Standard / 24"-27" Full-HD workstation
   2200-2999px  : Large / common 32" QHD workstation
   >=3000px     : Wall / 55" 4K class

   A 55" Full-HD display still has a 1920px viewport and correctly uses the
   Standard profile. Its pixels are physically larger, so the same CSS is
   naturally easier to read from a distance.

   Production Control main index is intentionally excluded from generic table
   typography because it owns a dedicated daily Delivery + Supply Window grid.
   ========================================================================== */

/* Shared table variables. Defaults cover the normal desktop baseline. */
.module-screen {
    --mes-table-font: 13px;
    --mes-table-head-font: 12px;
    --mes-table-strong-font: 13px;
    --mes-table-small-font: 10.5px;
    --mes-table-status-font: 10px;
    --mes-table-pad-y: 7px;
    --mes-table-pad-x: 6px;
    --mes-table-panel-font: 11px;
}

/* --------------------------------------------------------------------------
   SHARED TABLE TYPOGRAPHY
   -------------------------------------------------------------------------- */
.display-table:not(.production-control-daily-delivery-table),
.system-admin-table {
    width: 100%;
    font-size: var(--mes-table-font) !important;
    line-height: 1.28;
}

.display-table:not(.production-control-daily-delivery-table) th,
.system-admin-table th {
    padding: var(--mes-table-pad-y) var(--mes-table-pad-x) !important;
    font-size: var(--mes-table-head-font) !important;
    line-height: 1.18;
}

.display-table:not(.production-control-daily-delivery-table) td,
.system-admin-table td {
    padding: var(--mes-table-pad-y) var(--mes-table-pad-x) !important;
    font-size: var(--mes-table-font) !important;
    line-height: 1.3;
}

.display-table:not(.production-control-daily-delivery-table) strong,
.system-admin-table strong {
    font-size: var(--mes-table-strong-font) !important;
}

.display-table:not(.production-control-daily-delivery-table) small,
.system-admin-table small {
    font-size: var(--mes-table-small-font) !important;
    line-height: 1.22;
}

.display-table:not(.production-control-daily-delivery-table) .status-pill,
.system-admin-table .status-pill,
.system-admin-table .system-status,
.system-admin-table .system-mini-badge {
    font-size: var(--mes-table-status-font) !important;
    line-height: 1.08;
}

/* Operational header should scale with its table instead of staying tiny. */
.operational-panel-header div span {
    font-size: var(--mes-table-panel-font);
}

.operational-panel-header div strong,
.operational-panel-header > span {
    font-size: calc(var(--mes-table-panel-font) + 1px);
}

/* --------------------------------------------------------------------------
   DESKTOP TABLE WIDTH CONTRACT
   On operational desktop displays these tables should use the viewport first.
   Horizontal scrolling remains available in existing wrappers as a safety net,
   but fixed historical min-width values no longer force a scrollbar.
   -------------------------------------------------------------------------- */
@media (min-width: 1180px) {
    .daily-plan-pivot-table,
    .daily-open-wo-table,
    .manual-plan-table,
    .planning-monitor-detail-table,
    .monitor-summary-table,
    .monitor-warning-table,
    .daily-result-detail-table,
    .daily-result-summary-table,
    .daily-result-warning-table,
    .production-control-preview-table,
    .production-control-version-table,
    .production-control-daily-table,
    .production-control-delivery-detail-table,
    .system-admin-table {
        width: 100% !important;
        min-width: 0 !important;
    }

    .daily-plan-pivot-table,
    .daily-open-wo-table,
    .planning-monitor-detail-table,
    .daily-result-detail-table,
    .production-control-preview-table,
    .production-control-version-table,
    .production-control-daily-table,
    .production-control-delivery-detail-table {
        table-layout: fixed;
    }

    /* Wrap long descriptive fields, keep business quantities readable. */
    .daily-plan-pivot-table td,
    .daily-open-wo-table td,
    .planning-monitor-detail-table td,
    .daily-result-detail-table td,
    .production-control-preview-table td,
    .production-control-version-table td,
    .system-admin-table td {
        overflow-wrap: anywhere;
    }

    .number-cell,
    .total-cell,
    .daily-result-detail-table .col-result-qty,
    .daily-result-detail-table .col-result-time {
        white-space: nowrap;
    }
}

/* --------------------------------------------------------------------------
   COMPACT · 19" / 1366-class workstation
   -------------------------------------------------------------------------- */
@media (min-width: 1180px) and (max-width: 1599px) {
    .module-screen {
        --mes-table-font: 11.5px;
        --mes-table-head-font: 10.5px;
        --mes-table-strong-font: 12px;
        --mes-table-small-font: 9.5px;
        --mes-table-status-font: 9px;
        --mes-table-pad-y: 5px;
        --mes-table-pad-x: 4px;
        --mes-table-panel-font: 10px;
    }

    .display-table-panel,
    .operational-table-panel,
    .system-table-wrap {
        border-radius: 7px;
    }

    .daily-plan-pivot-table,
    .daily-result-detail-table,
    .planning-monitor-detail-table {
        letter-spacing: 0;
    }

    /* Preserve row density on 1366x768. */
    .daily-plan-pivot-table th,
    .daily-plan-pivot-table td,
    .daily-result-detail-table th,
    .daily-result-detail-table td,
    .planning-monitor-detail-table th,
    .planning-monitor-detail-table td {
        padding-top: 5px !important;
        padding-bottom: 5px !important;
    }

    .daily-result-process-group-heading {
        min-height: 30px;
        padding: 5px 8px;
    }

    .system-admin-table .system-row-actions {
        gap: 4px;
    }
}

/* --------------------------------------------------------------------------
   STANDARD · 24"-27" / Full-HD class
   -------------------------------------------------------------------------- */
@media (min-width: 1600px) and (max-width: 2199px) {
    .module-screen {
        --mes-table-font: 13px;
        --mes-table-head-font: 12px;
        --mes-table-strong-font: 13.5px;
        --mes-table-small-font: 10.5px;
        --mes-table-status-font: 10px;
        --mes-table-pad-y: 7px;
        --mes-table-pad-x: 6px;
        --mes-table-panel-font: 11px;
    }
}

/* --------------------------------------------------------------------------
   LARGE · 32" / QHD class
   Use extra pixels for readability instead of tiny rows in a large viewport.
   -------------------------------------------------------------------------- */
@media (min-width: 2200px) and (max-width: 2999px) {
    .module-screen {
        --mes-table-font: 15.5px;
        --mes-table-head-font: 14px;
        --mes-table-strong-font: 16px;
        --mes-table-small-font: 12.5px;
        --mes-table-status-font: 12px;
        --mes-table-pad-y: 9px;
        --mes-table-pad-x: 8px;
        --mes-table-panel-font: 13px;
    }

    .operational-panel-header {
        min-height: 50px;
        padding: 9px 12px;
    }

    .daily-result-process-group-heading {
        min-height: 40px;
        padding: 8px 12px;
    }
}

/* --------------------------------------------------------------------------
   WALL · 55" 4K class
   Wall screens need larger real typography, not merely more rows.
   -------------------------------------------------------------------------- */
@media (min-width: 3000px) {
    .module-screen {
        --mes-table-font: 19px;
        --mes-table-head-font: 17px;
        --mes-table-strong-font: 19.5px;
        --mes-table-small-font: 15px;
        --mes-table-status-font: 14px;
        --mes-table-pad-y: 12px;
        --mes-table-pad-x: 10px;
        --mes-table-panel-font: 16px;
    }

    .display-table-panel h2 {
        padding: 11px 14px;
        font-size: 16px;
    }

    .operational-panel-header {
        min-height: 62px;
        padding: 11px 16px;
    }

    .status-pill {
        min-height: 26px;
        padding: 4px 9px;
    }

    .daily-result-process-group-heading {
        min-height: 50px;
        padding: 10px 14px;
    }

    .system-table-wrap {
        border-radius: 12px;
    }
}

/* --------------------------------------------------------------------------
   PRODUCTION CONTROL SUPPORT PAGES
   Main index keeps its dedicated inline responsive rules.
   These rules cover Manage Data, Part Detail, Daily Requirement and SJ Detail.
   -------------------------------------------------------------------------- */
@media (min-width: 1180px) and (max-width: 1599px) {
    .production-control-preview-table,
    .production-control-version-table,
    .production-control-daily-table,
    .production-control-delivery-detail-table {
        font-size: 11.5px !important;
    }

    .production-control-part-detail-screen .production-control-daily-table th,
    .production-control-part-detail-screen .production-control-daily-table td,
    .production-control-part-detail-screen
        .production-control-delivery-detail-table
        th,
    .production-control-part-detail-screen
        .production-control-delivery-detail-table
        td {
        padding: 5px 4px !important;
    }
}

@media (min-width: 2200px) {
    .production-control-part-detail-screen .production-control-daily-table,
    .production-control-part-detail-screen
        .production-control-delivery-detail-table,
    .production-control-preview-table,
    .production-control-version-table {
        font-size: var(--mes-table-font) !important;
    }
}

/* --------------------------------------------------------------------------
   ADMIN TABLES
   Admin/master data may still scroll as a fallback when content truly cannot
   fit, but font size is never sacrificed below the compact profile.
   -------------------------------------------------------------------------- */
.system-table-wrap {
    max-width: 100%;
}

@media (min-width: 1180px) {
    .system-admin-table th,
    .system-admin-table td {
        overflow-wrap: break-word;
    }

    .system-admin-table .system-action-column {
        width: 150px;
    }
}

@media (min-width: 2200px) {
    .system-admin-table .system-action-column {
        width: 190px;
    }
}

/* ==========================================================================
   PHASE 1.7.004G.003 · GLOBAL MODULE HEADER TITLE FIT

   Fix long module titles on workstation/QHD displays:
   - keep desktop titles on one line
   - stop 2K/27" titles from becoming oversized
   - preserve larger wall-display typography at 4K
   ========================================================================== */

@media (min-width: 1180px) {
    .dhi-module-header {
        min-height: 76px;
    }

    .dhi-module-title,
    body.daily-result-live-screen .dhi-module-title {
        width: min(74vw, 86rem);
    }

    .dhi-module-title h1 {
        margin-top: 0.18rem;
        white-space: nowrap;
        font-size: clamp(1.45rem, 1.75vw, 2.25rem);
        line-height: 1;
        letter-spacing: 0.045em;
    }

    .dhi-module-title span {
        font-size: 0.56rem;
        letter-spacing: 0.15em;
    }
}

/* 19" / 1366-class */
@media (min-width: 1180px) and (max-width: 1599px) {
    .dhi-module-header {
        min-height: 72px;
    }

    .dhi-module-title,
    body.daily-result-live-screen .dhi-module-title {
        width: min(72vw, 58rem);
    }

    .dhi-module-title h1 {
        font-size: clamp(1.35rem, 1.65vw, 1.75rem);
        letter-spacing: 0.035em;
    }
}

/* 24"-27" Full-HD / common workstation */
@media (min-width: 1600px) and (max-width: 2199px) {
    .dhi-module-header {
        min-height: 78px;
    }

    .dhi-module-title,
    body.daily-result-live-screen .dhi-module-title {
        width: min(72vw, 72rem);
    }

    .dhi-module-title h1 {
        font-size: clamp(1.65rem, 1.8vw, 2.15rem);
    }
}

/* 27"-32" QHD class */
@media (min-width: 2200px) and (max-width: 2999px) {
    .dhi-module-header {
        min-height: 88px;
    }

    .dhi-module-title,
    body.daily-result-live-screen .dhi-module-title {
        width: min(72vw, 86rem);
    }

    .dhi-module-title h1 {
        font-size: clamp(1.95rem, 1.7vw, 2.55rem);
        letter-spacing: 0.04em;
    }

    .dhi-module-title span {
        font-size: 0.66rem;
    }
}

/* 55" / 4K wall display */
@media (min-width: 3000px) {
    .dhi-module-header {
        min-height: 118px;
    }

    .dhi-module-title,
    body.daily-result-live-screen .dhi-module-title {
        width: min(72vw, 108rem);
    }

    .dhi-module-title h1 {
        font-size: clamp(2.8rem, 1.55vw, 3.8rem);
        letter-spacing: 0.045em;
    }

    .dhi-module-title span {
        font-size: 0.9rem;
    }
}

/* ==========================================================================
   PHASE 1.9B · DAILY PRODUCTION RESULT MACHINE STATUS BOARD
   Planning-based status: RUNNING = green, STOP = red.
   ========================================================================== */
.daily-result-header-filter {
    gap: 10px;
}

.daily-result-header-filter-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.daily-result-header-filter input[type="date"] {
    min-width: 146px;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
    font: inherit;
    font-weight: 800;
    color-scheme: dark;
}

.daily-result-board-kpi-grid .daily-result-kpi-running {
    border-top: 3px solid #18833a;
}

.daily-result-board-kpi-grid .daily-result-kpi-stop {
    border-top: 3px solid #c62828;
}

.daily-result-board-panel {
    overflow: hidden;
    border: 1px solid #c7d7ea;
    border-radius: 8px;
    background: #f4f7fb;
}

.daily-result-board-header {
    border-radius: 0;
}

.daily-result-board-scroll {
    max-height: calc(100vh - 302px);
    min-height: 360px;
    overflow: auto;
    padding: 10px;
    scroll-behavior: smooth;
}

.daily-result-machine-process-group + .daily-result-machine-process-group {
    margin-top: 14px;
}

.daily-result-machine-process-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1px solid #bfd0e5;
    border-radius: 7px;
    background: #e9f1fb;
}

.daily-result-machine-process-heading > div:first-child {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.daily-result-machine-process-heading strong {
    color: #0755b8;
    font-size: 13px;
    letter-spacing: 0.025em;
}

.daily-result-machine-process-heading span {
    color: #52657d;
    font-size: 10px;
    font-weight: 800;
}

.daily-result-machine-process-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.daily-result-machine-process-summary span {
    padding: 3px 7px;
    border-radius: 999px;
    background: #fff;
    box-shadow: inset 0 0 0 1px #ccd9e8;
}

.daily-result-machine-process-summary .is-running {
    color: #137233;
}

.daily-result-machine-process-summary .is-stop {
    color: #b52222;
}

.daily-result-machine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.daily-result-machine-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #b9c7d8;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(23, 49, 78, 0.08);
}

.daily-result-machine-card.is-running {
    border-color: #18833a;
}

.daily-result-machine-card.is-stop {
    border-color: #c62828;
}

.daily-result-machine-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 48px;
    padding: 7px 9px;
    color: #fff;
}

.daily-result-machine-card.is-running .daily-result-machine-card-header {
    background: #18833a;
}

.daily-result-machine-card.is-stop .daily-result-machine-card-header {
    background: #c62828;
}

.daily-result-machine-card-header > div {
    min-width: 0;
}

.daily-result-machine-card-header strong {
    display: block;
    font-size: 20px;
    line-height: 1;
    letter-spacing: 0.02em;
}

.daily-result-machine-card-header small {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    font-size: 9px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.9;
}

.daily-result-machine-card-header > span {
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.daily-result-machine-card-body {
    padding: 8px;
}

.daily-result-machine-stop-note,
.daily-result-machine-warning {
    margin-bottom: 7px;
    padding: 5px 7px;
    border-radius: 5px;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.035em;
    text-align: center;
}

.daily-result-machine-stop-note {
    background: #fff0f0;
    color: #a82020;
}

.daily-result-machine-warning {
    background: #fff5db;
    color: #805d00;
}

.daily-result-machine-main-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr 0.65fr;
    gap: 5px;
}

.daily-result-machine-main-metrics > div,
.daily-result-machine-shifts > div {
    min-width: 0;
    padding: 6px;
    border: 1px solid #d6e0ec;
    border-radius: 5px;
    background: #f8fafc;
}

.daily-result-machine-main-metrics span,
.daily-result-machine-shifts span {
    display: block;
    color: #718096;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.daily-result-machine-main-metrics strong {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: #102a49;
    font-size: 14px;
    line-height: 1.1;
    text-overflow: ellipsis;
}

.daily-result-machine-shifts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-top: 5px;
}

.daily-result-machine-shifts strong {
    display: block;
    margin-top: 2px;
    color: #213f62;
    font-size: 11px;
}

.daily-result-machine-jobs {
    margin-top: 7px;
    border: 1px solid #cfdae7;
    border-radius: 5px;
    background: #fff;
}

.daily-result-machine-jobs summary {
    cursor: pointer;
    padding: 6px 8px;
    color: #185eb2;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.035em;
    user-select: none;
}

.daily-result-machine-job-list {
    display: grid;
    gap: 5px;
    padding: 0 6px 6px;
}

.daily-result-machine-job-row {
    padding: 6px;
    border: 1px solid #dce4ee;
    border-radius: 5px;
    background: #f9fbfd;
}

.daily-result-machine-job-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.daily-result-machine-job-title strong {
    min-width: 0;
    overflow: hidden;
    color: #102a49;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.daily-result-machine-job-title span {
    flex: 0 0 auto;
    color: #66788c;
    font-size: 7px;
    font-weight: 900;
}

.daily-result-machine-job-row > small {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: #687b91;
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.daily-result-machine-job-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 8px;
    margin-top: 5px;
    color: #6d7f92;
    font-size: 8px;
    font-weight: 800;
}

.daily-result-machine-job-metrics strong {
    color: #213f62;
}

.daily-result-board-empty {
    min-height: 220px;
}

@media (min-width: 1180px) and (max-width: 1599px) {
    .daily-result-machine-grid {
        grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
    }

    .daily-result-board-scroll {
        max-height: calc(100vh - 286px);
        padding: 8px;
    }
}

@media (min-width: 1600px) and (max-width: 2199px) {
    .daily-result-machine-grid {
        grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    }

    .daily-result-machine-card-header strong {
        font-size: 22px;
    }
}

@media (min-width: 2200px) and (max-width: 2999px) {
    .daily-result-machine-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 11px;
    }

    .daily-result-machine-card-header {
        min-height: 60px;
        padding: 10px 12px;
    }

    .daily-result-machine-card-header strong {
        font-size: 27px;
    }

    .daily-result-machine-main-metrics strong {
        font-size: 18px;
    }

    .daily-result-machine-shifts strong {
        font-size: 15px;
    }
}

@media (min-width: 3000px) {
    .daily-result-machine-grid {
        grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
        gap: 14px;
    }

    .daily-result-machine-card-header {
        min-height: 78px;
        padding: 13px 16px;
    }

    .daily-result-machine-card-header strong {
        font-size: 36px;
    }

    .daily-result-machine-card-header small,
    .daily-result-machine-card-header > span {
        font-size: 14px;
    }

    .daily-result-machine-card-body {
        padding: 12px;
    }

    .daily-result-machine-main-metrics strong {
        font-size: 23px;
    }

    .daily-result-machine-shifts strong {
        font-size: 20px;
    }

    .daily-result-machine-main-metrics span,
    .daily-result-machine-shifts span,
    .daily-result-machine-jobs summary {
        font-size: 12px;
    }
}

@media (max-width: 760px) {
    .daily-result-header-filter {
        width: 100%;
        flex-wrap: wrap;
    }

    .daily-result-header-filter-field {
        flex: 1 1 150px;
    }

    .daily-result-header-filter input[type="date"],
    .daily-result-header-filter select {
        width: 100%;
        min-width: 0;
    }

    .daily-result-board-scroll {
        max-height: none;
        min-height: 0;
        overflow: visible;
    }

    .daily-result-machine-process-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .daily-result-machine-process-summary {
        justify-content: flex-start;
    }

    .daily-result-machine-grid {
        grid-template-columns: 1fr;
    }
}

.daily-result-machine-job-preview {
    margin-bottom: 7px;
    padding: 6px;
    border: 1px solid #d4dfeb;
    border-radius: 5px;
    background: #f7fafe;
}

.daily-result-machine-job-preview > span {
    display: block;
    margin-bottom: 4px;
    color: #708398;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.daily-result-machine-job-preview > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) auto;
    align-items: center;
    gap: 5px;
    min-height: 20px;
}

.daily-result-machine-job-preview strong,
.daily-result-machine-job-preview small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.daily-result-machine-job-preview strong {
    color: #12365f;
    font-size: 9px;
}

.daily-result-machine-job-preview small {
    color: #64788f;
    font-size: 8px;
}

.daily-result-machine-job-preview b {
    color: #102a49;
    font-size: 9px;
}

.daily-result-machine-job-preview em {
    display: block;
    margin-top: 3px;
    color: #54708f;
    font-size: 8px;
    font-style: normal;
    font-weight: 900;
}


/* ==========================================================================
   PHASE 1.9B.001 · HEADER FILTER BALANCE
   Date lives on the left beside Dashboard; Process remains on the right.
   ========================================================================== */
.module-left-actions {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.module-context-left-actions {
    display: flex;
    align-items: center;
}

.dhi-module-header.has-left-context {
    grid-template-columns: minmax(300px, auto) minmax(260px, 1fr) auto;
}

.daily-result-header-date-filter {
    display: flex;
    align-items: center;
}

.daily-result-header-date-filter .daily-result-header-filter-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.daily-result-header-date-filter label,
.daily-result-header-filter label {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.daily-result-header-date-filter input[type="date"] {
    min-width: 146px;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
    color-scheme: dark;
    font: inherit;
    font-weight: 800;
}

@media (max-width: 1100px) {
    .dhi-module-header.has-left-context {
        grid-template-columns: 1fr auto;
    }

    .module-left-actions {
        flex-wrap: wrap;
    }

    .module-user-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .dhi-module-header.has-left-context {
        grid-template-columns: 1fr;
    }

    .module-left-actions {
        width: 100%;
        justify-content: space-between;
    }

    .daily-result-header-date-filter input[type="date"] {
        min-width: 136px;
    }
}
