/* ROTA UI system
   A restrained, high-density operations surface layered over the existing
   Blazor workflows. Spreadsheet entry canvases intentionally keep their
   established cell geometry and keyboard behaviour. */

:root {
    color-scheme: light;
    --rota-blue-700: #175cd3;
    --rota-blue-600: #246bda;
    --rota-blue-100: #eaf2ff;
    --rota-blue-50: #f3f7ff;
    --rota-ink: #111827;
    --rota-ink-soft: #344054;
    --rota-muted: #667085;
    --rota-line: #e3e8ef;
    --rota-line-strong: #d0d7e2;
    --rota-canvas: #f7f9fc;
    --rota-surface: #ffffff;
    --rota-surface-muted: #f8fafc;
    --rota-green: #17a05e;
    --rota-green-soft: #eaf8f0;
    --rota-amber: #d97706;
    --rota-amber-soft: #fff7e8;
    --rota-red: #dc3f3f;
    --rota-red-soft: #fff0f0;
    --rota-radius-control: 8px;
    --rota-radius-panel: 10px;
    --rota-shadow-float: 0 12px 32px rgba(16, 24, 40, .12);
    --ink: var(--rota-ink);
    --muted: var(--rota-muted);
    --navy: var(--rota-blue-700);
    --navy-dark: #104aaf;
    --paper: var(--rota-surface);
    --canvas: var(--rota-canvas);
    --line: var(--rota-line);
    --line-strong: var(--rota-line-strong);
    --amber: var(--rota-amber);
    --amber-soft: var(--rota-amber-soft);
    --green: var(--rota-green);
    --green-soft: var(--rota-green-soft);
    --red: var(--rota-red);
    --red-soft: var(--rota-red-soft);
    --blue-soft: var(--rota-blue-100);
    --focus: var(--rota-blue-600);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html {
    background: var(--rota-canvas);
    font-size: 16px;
}

body {
    background: var(--rota-canvas);
    color: var(--rota-ink);
    font-size: 1rem;
    line-height: 1.45;
}

::selection {
    background: #cfe0ff;
    color: var(--rota-ink);
}

:focus-visible {
    outline: 2px solid var(--rota-blue-600);
    outline-offset: 2px;
}

h1,
h2,
h3 {
    color: var(--rota-ink);
    letter-spacing: -.025em;
}

h1 {
    font-size: clamp(1.55rem, 2vw, 2rem);
    line-height: 1.2;
}

h2 {
    font-size: 1.15rem;
}

h3 {
    font-size: 1rem;
}

.eyebrow {
    color: var(--rota-blue-700);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .08em;
    margin-bottom: .3rem;
    text-transform: uppercase;
}

/* Application shell */
.app-shell {
    display: grid;
    grid-template:
        "nav header" 72px
        "nav main" minmax(0, 1fr) /
        240px minmax(0, 1fr);
    min-height: 100vh;
    transition: grid-template-columns .18s ease;
}

.app-shell.sidebar-is-collapsed {
    grid-template-columns: 76px minmax(0, 1fr);
}

.app-nav {
    background: var(--rota-surface);
    border-right: 1px solid var(--rota-line);
    color: var(--rota-ink-soft);
    display: grid;
    grid-area: nav;
    grid-template-rows: 72px minmax(0, 1fr) auto;
    height: 100vh;
    inset: 0 auto 0 0;
    overflow: hidden;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 20;
}

.sidebar-brand-row {
    align-items: center;
    border-bottom: 1px solid var(--rota-line);
    display: flex;
    gap: .5rem;
    min-width: 0;
    padding: 0 14px 0 18px;
}

.brand {
    align-items: center;
    color: var(--rota-ink);
    display: flex;
    flex: 1;
    gap: 10px;
    min-width: 0;
    text-decoration: none;
}

.brand__mark {
    align-items: center;
    background: var(--rota-blue-100);
    border: 1px solid #c9dcff;
    border-radius: 8px;
    color: var(--rota-blue-700);
    display: flex;
    flex: 0 0 34px;
    height: 34px;
    justify-content: center;
    overflow: hidden;
    padding: 0;
    position: relative;
    width: 34px;
}

.brand__mark::before,
.brand__mark::after,
.brand__mark i {
    border: 1px solid currentColor;
    content: "";
    height: 11px;
    opacity: .28;
    position: absolute;
    transform: rotate(30deg) skewX(-30deg);
    width: 11px;
}

.brand__mark::before { left: 5px; top: 5px; }
.brand__mark::after { bottom: 5px; right: 5px; }
.brand__mark i { right: 5px; top: 5px; }

.brand__mark b {
    font-size: .9rem;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.brand__mark::before,
.brand__mark::after,
.brand__mark i {
    display: none;
}

.brand__text {
    display: grid;
    line-height: 1.05;
    min-width: 0;
}

.brand__text strong {
    color: #164e9b;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -.04em;
}

.brand__text small {
    color: var(--rota-muted);
    font-size: .62rem;
    margin-top: 3px;
    white-space: nowrap;
}

.sidebar-toggle {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    flex: 0 0 28px;
    height: 30px;
    justify-content: center;
    padding: 0;
    width: 28px;
}

.sidebar-toggle:hover {
    background: var(--rota-blue-50);
}

.sidebar-toggle span,
.sidebar-toggle span::before,
.sidebar-toggle span::after {
    background: #667085;
    border-radius: 2px;
    content: "";
    display: block;
    height: 1.5px;
    width: 14px;
}

.sidebar-toggle span { position: relative; }
.sidebar-toggle span::before { position: absolute; top: -5px; }
.sidebar-toggle span::after { position: absolute; top: 5px; }

.ui-icon {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    font-family: "Segoe Fluent Icons", "Segoe MDL2 Assets", sans-serif;
    font-size: 1rem;
    font-style: normal;
    font-weight: 400;
    justify-content: center;
    line-height: 1;
    min-height: 1em;
    min-width: 1em;
    speak: none;
    vertical-align: middle;
}

.sidebar-toggle .ui-icon,
.sidebar-toggle .ui-icon::before,
.sidebar-toggle .ui-icon::after {
    background: transparent;
    content: none;
    display: inline-flex;
    height: auto;
    position: static;
    width: auto;
}

.sidebar-toggle .ui-icon {
    color: #667085;
    font-size: 1rem;
    transition: transform .18s ease;
}

.app-nav nav {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px 10px 20px;
    scrollbar-color: #cbd5e1 transparent;
    scrollbar-width: thin;
}

.app-nav a,
.app-nav .nav-link {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #344054;
    display: flex;
    font-size: .9rem;
    font-weight: 600;
    gap: 10px;
    margin: 2px 0;
    min-height: 38px;
    overflow: hidden;
    padding: 7px 9px;
    text-decoration: none;
    white-space: nowrap;
}

.app-nav a:hover,
.app-nav .nav-link:hover {
    background: #f7f9fc;
    border-color: #edf1f5;
    color: var(--rota-ink);
}

.app-nav a.active,
.app-nav .nav-link.active {
    background: var(--rota-blue-100);
    border-color: #d9e6ff;
    color: var(--rota-blue-700);
}

.nav-icon {
    align-items: center;
    border: 1px solid #d6dde7;
    border-radius: 6px;
    color: #667085;
    display: inline-flex;
    flex: 0 0 24px;
    font-size: .55rem;
    font-weight: 800;
    height: 24px;
    justify-content: center;
    letter-spacing: -.01em;
    width: 24px;
}

.app-nav a.active .nav-icon {
    background: #fff;
    border-color: #bcd3ff;
    color: var(--rota-blue-700);
}

.app-nav a > .ui-icon {
    color: #667085;
    font-size: 1.05rem;
    order: -1;
    width: 24px;
}

.app-nav a.active > .ui-icon {
    color: var(--rota-blue-700);
}

.nav-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-heading {
    color: #98a2b3;
    display: block;
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .07em;
    margin: 18px 8px 6px;
    overflow: hidden;
    text-transform: uppercase;
    white-space: nowrap;
}

.nav-footer {
    align-items: center;
    background: #fbfcfe;
    border-top: 1px solid var(--rota-line);
    display: flex;
    gap: 9px;
    margin: 0;
    min-height: 62px;
    padding: 12px 18px;
}

.nav-footer__signal {
    background: var(--rota-green);
    border: 3px solid #dff5e9;
    border-radius: 50%;
    flex: 0 0 12px;
    height: 12px;
    width: 12px;
}

.nav-footer__content {
    display: grid;
    line-height: 1.25;
    min-width: 0;
}

.nav-footer strong,
.nav-footer small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-footer strong {
    color: #344054;
    font-size: .72rem;
}

.nav-footer small {
    color: var(--rota-muted);
    font-size: .61rem;
}

.sidebar-is-collapsed .brand__text,
.sidebar-is-collapsed .nav-label,
.sidebar-is-collapsed .nav-heading,
.sidebar-is-collapsed .nav-footer__content {
    display: none;
}

.sidebar-is-collapsed .sidebar-brand-row {
    gap: 0;
    justify-content: center;
    padding: 0 8px;
}

.sidebar-is-collapsed .brand {
    display: none;
}

.sidebar-is-collapsed .sidebar-toggle {
    display: inline-flex;
}

.sidebar-is-collapsed .sidebar-toggle .ui-icon {
    transform: rotate(180deg);
}

.sidebar-is-collapsed .app-nav nav {
    padding-inline: 12px;
}

.sidebar-is-collapsed .app-nav a {
    font-size: 0;
    justify-content: center;
    padding-inline: 8px;
}

.sidebar-is-collapsed .app-nav a > .ui-icon {
    font-size: 1.05rem;
}

.sidebar-is-collapsed .nav-footer {
    justify-content: center;
    padding-inline: 8px;
}

.app-header {
    align-items: center;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--rota-line);
    color: var(--rota-ink);
    display: flex;
    gap: 24px;
    grid-area: header;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 15;
}

.header-context {
    display: grid;
    line-height: 1.2;
}

.header-context__eyebrow {
    color: #98a2b3;
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .08em;
}

.header-context strong {
    font-size: 1.15rem;
    letter-spacing: -.02em;
}

.header-actions,
.user-area {
    align-items: center;
    display: flex;
}

.header-actions {
    gap: 12px;
}

.header-status {
    background: var(--rota-green-soft);
    border: 1px solid #ccebd9;
    border-radius: 999px;
    color: #187348;
    display: flex;
    font-size: .72rem;
    font-weight: 700;
    gap: 6px;
    min-height: 32px;
    padding: 5px 10px;
}

.status-dot {
    border-radius: 50%;
    height: 7px;
    width: 7px;
}

.status-dot--ok { background: var(--rota-green); }
.status-dot--warning { background: var(--rota-amber); }
.status-dot--error { background: var(--rota-red); }

.work-order-notifications {
    color: var(--rota-ink);
    margin: 0;
}

.work-order-notifications__summary {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-radius: 8px;
    color: #344054;
    font-size: .74rem;
    min-height: 36px;
    padding: 6px 10px;
}

.work-order-notifications__summary:hover,
.work-order-notifications[open] .work-order-notifications__summary {
    background: var(--rota-blue-50);
}

.work-order-notifications__icon {
    color: var(--rota-blue-700);
    font-size: .9rem;
}

.work-order-notifications__count {
    background: var(--rota-red);
}

.work-order-notifications__panel {
    border-color: var(--rota-line-strong);
    border-radius: var(--rota-radius-panel);
    box-shadow: var(--rota-shadow-float);
}

.user-area {
    border-left: 1px solid var(--rota-line);
    gap: 9px;
    margin: 0;
    padding-left: 14px;
}

.user-area__avatar {
    align-items: center;
    background: #182230;
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    flex: 0 0 34px;
    font-size: .68rem;
    font-weight: 750;
    height: 34px;
    justify-content: center;
    text-transform: uppercase;
    width: 34px;
}

.user-area__identity {
    display: grid;
    line-height: 1.2;
}

.user-area__identity strong {
    color: var(--rota-ink);
    font-size: .76rem;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-area small {
    color: var(--rota-muted);
    font-size: .62rem;
}

.user-area .button--quiet {
    background: #fff;
    border: 1px solid var(--rota-line-strong);
    color: #475467;
    font-size: .68rem;
    min-height: 32px;
    padding: 5px 9px;
}

.user-area .button--quiet:hover {
    background: #f8fafc;
    border-color: #aab4c2;
}

.button > .ui-icon,
.button--quiet > .ui-icon {
    font-size: 1rem;
    margin: 0;
}

.app-main {
    background: var(--rota-canvas);
    grid-area: main;
    min-width: 0;
    overflow: visible;
    padding: 22px 24px 36px;
}

/* Shared controls and surfaces */
.button {
    align-items: center;
    border-radius: var(--rota-radius-control);
    display: inline-flex;
    font-size: .9rem;
    font-weight: 700;
    gap: .5rem;
    justify-content: center;
    line-height: 1.2;
    min-height: 38px;
    padding: 8px 13px;
}

.button--primary {
    background: var(--rota-blue-600);
    border-color: var(--rota-blue-600);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}

.button--primary:hover {
    background: var(--rota-blue-700);
}

.button--secondary {
    background: #fff;
    border-color: var(--rota-line-strong);
    color: #344054;
}

.button--danger {
    background: #fff;
    border-color: #f1a5a5;
    color: var(--rota-red);
}

.button--small {
    min-height: 34px;
    padding: 6px 10px;
}

.button--large {
    min-height: 48px;
}

.page-header {
    align-items: flex-end;
    background: transparent;
    border: 0;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin: 0 0 18px;
    padding: 0;
}

.page-header h1 {
    margin-bottom: 4px;
}

.page-header > div:first-child > p:last-child {
    color: var(--rota-muted);
    font-size: .94rem;
    margin: 0;
    max-width: 760px;
}

.shift-summary,
.record-count,
.section-heading__meta {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-control);
    color: var(--rota-muted);
    min-width: 0;
    padding: 8px 12px;
}

.shift-summary strong {
    color: var(--rota-ink);
    font-size: .95rem;
}

.message {
    border: 1px solid var(--rota-line-strong);
    border-left-width: 3px;
    border-radius: var(--rota-radius-control);
    font-size: .88rem;
    padding: 10px 12px;
}

.message--info {
    background: var(--rota-blue-50);
    border-color: #c9dcff;
    border-left-color: var(--rota-blue-600);
}

.message--success {
    background: var(--rota-green-soft);
    border-color: #bde5ce;
    border-left-color: var(--rota-green);
}

.message--error,
.message--danger {
    background: var(--rota-red-soft);
    border-color: #f2b8b8;
    border-left-color: var(--rota-red);
}

.status-strip {
    background: var(--rota-surface);
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-panel);
    display: grid;
    gap: 0;
    margin: 14px 0 18px;
    overflow: hidden;
}

.status-strip article {
    background: #fff;
    border-color: var(--rota-line);
    min-height: 86px;
    padding: 14px 16px;
}

.status-strip span,
.status-strip small {
    color: var(--rota-muted);
    font-size: .7rem;
}

.status-strip strong {
    color: var(--rota-ink);
    font-size: 1.45rem;
}

.section-heading {
    align-items: flex-end;
    border: 0;
    display: flex;
    justify-content: space-between;
    margin: 0 0 12px;
    padding: 0;
}

.section-heading h2 {
    margin: 0;
}

.section-heading p:last-child {
    color: var(--rota-muted);
    font-size: .84rem;
}

.form-panel,
.data-panel,
.management-card,
.station-card,
.operator-rule,
.field-confirmation-panel,
.pab-section,
.pab-entry-card {
    background: var(--rota-surface);
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-panel);
    box-shadow: none;
}

.form-panel,
.data-panel,
.pab-section {
    padding: 16px;
}

.field {
    gap: 5px;
}

.field label,
.field-label {
    color: #344054;
    font-size: .84rem;
    font-weight: 700;
}

.field > input,
.field > select,
.field > textarea,
.field > .input-control,
.field > output,
.readonly-value {
    background: #fff;
    border: 1px solid var(--rota-line-strong);
    border-radius: var(--rota-radius-control);
    color: var(--rota-ink);
    min-height: 40px;
    padding: 8px 10px;
}

.field > textarea {
    min-height: 84px;
}

.field > input:hover,
.field > select:hover,
.field > textarea:hover {
    border-color: #98a2b3;
}

.field > input:focus,
.field > select:focus,
.field > textarea:focus {
    border-color: var(--rota-blue-600);
    box-shadow: 0 0 0 3px rgba(36, 107, 218, .12);
    outline: 0;
}

.field small,
.field-hint {
    color: var(--rota-muted);
    font-size: .76rem;
}

.data-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: .84rem;
    width: 100%;
}

.data-table th {
    background: #f8fafc;
    border-bottom: 1px solid var(--rota-line-strong);
    color: #667085;
    font-size: .72rem;
    font-weight: 750;
    letter-spacing: .035em;
    padding: 9px 11px;
    text-transform: uppercase;
}

.data-table td {
    background: #fff;
    border-bottom: 1px solid #edf0f4;
    color: #344054;
    padding: 10px 11px;
}

.data-table tbody tr:hover td {
    background: #f8fbff;
}

.status-badge,
.tag,
.pab-status {
    background: #f2f4f7;
    border: 1px solid transparent;
    border-radius: 999px;
    color: #475467;
    display: inline-flex;
    font-size: .72rem;
    font-weight: 750;
    line-height: 1;
    padding: 5px 8px;
}

.status-badge--info,
.tag {
    background: var(--rota-blue-100);
    color: var(--rota-blue-700);
}

.status-badge--success,
.pab-status.is-ok {
    background: var(--rota-green-soft);
    color: #16804c;
}

.status-badge--warning,
.pab-status.is-warning {
    background: var(--rota-amber-soft);
    color: #a35c05;
}

.status-badge--danger {
    background: var(--rota-red-soft);
    color: var(--rota-red);
}

.status-badge--muted {
    background: #f2f4f7;
    color: #667085;
}

.empty-state {
    background: #fbfcfe;
    border: 1px dashed var(--rota-line-strong);
    border-radius: var(--rota-radius-panel);
    color: var(--rota-muted);
    font-size: .76rem;
    padding: 22px;
    text-align: center;
}

.empty-state--warning {
    background: var(--rota-amber-soft);
    border-color: #e8c78e;
    color: #8d5108;
}

.form-grid {
    gap: 12px;
}

.action-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.inline-action-row td,
.inline-action-row--success td {
    background: #f8fbff;
}

.inline-action {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: auto minmax(180px, 1fr) auto auto;
}

.inline-action label {
    color: #344054;
    font-size: .68rem;
    font-weight: 700;
}

.inline-action input {
    border: 1px solid var(--rota-line-strong);
    border-radius: var(--rota-radius-control);
    min-height: 36px;
    padding: 7px 9px;
}

/* Home / module launcher */
.station-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.station-card {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 92px;
    padding: 14px;
}

.station-card--link:hover {
    border-color: #bcd3ff;
    box-shadow: 0 3px 10px rgba(16, 24, 40, .05);
    transform: translateY(-1px);
}

.station-card__number {
    align-items: center;
    background: var(--rota-blue-50);
    border: 1px solid #d9e6ff;
    border-radius: 8px;
    color: var(--rota-blue-700);
    display: flex;
    font-size: .68rem;
    height: 40px;
    justify-content: center;
    padding: 0;
    width: 40px;
}

.station-card__number .ui-icon,
.kpi-card__index .ui-icon,
.production-flow__index .ui-icon {
    font-size: 1rem;
}

.station-card__title {
    color: var(--rota-ink);
    font-size: .88rem;
}

.station-card__description {
    color: var(--rota-muted);
    font-size: .7rem;
    line-height: 1.4;
    margin-top: 3px;
}

.station-card--emergency {
    background: #fffbfb;
    border-color: #f3c4c4;
}

.station-card--emergency .station-card__number {
    background: var(--rota-red-soft);
    border-color: #f3c4c4;
    color: var(--rota-red);
}

.operator-rule {
    align-items: center;
    border-left: 3px solid var(--rota-blue-600);
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding: 12px 14px;
}

.operator-rule strong {
    color: var(--rota-blue-700);
    white-space: nowrap;
}

.operator-rule span {
    color: var(--rota-muted);
    font-size: .74rem;
}

/* Operator workflow chrome: actions remain touch-friendly, data cells remain unchanged. */
.operator-workflow-page {
    display: grid;
    gap: 14px;
}

.operator-flow-shell {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-panel);
    box-shadow: none;
    display: grid;
    gap: 12px;
    padding: 16px;
}

.operator-flow-shell__header {
    align-items: flex-start;
}

.operator-flow-shell__title h1 {
    font-size: 1.55rem;
}

.operator-flow-shell__title > p:last-child {
    color: var(--rota-muted);
    font-size: .8rem;
}

.operator-flow-context-grid {
    gap: 8px;
}

.operator-flow-context-grid > div {
    background: var(--rota-surface-muted);
    border: 1px solid #edf0f4;
    border-radius: 8px;
    padding: 10px 12px;
}

.operator-flow-context-grid span,
.operator-flow-context-grid small {
    color: var(--rota-muted);
    font-size: .65rem;
}

.operator-flow-context-grid strong {
    color: var(--rota-ink);
    font-size: .88rem;
}

.operator-flow-shell__next {
    background: var(--rota-blue-50);
    border: 1px solid #c9dcff;
    border-radius: 8px;
    color: var(--rota-blue-700);
    padding: 10px 12px;
}

.operator-flow-shell__next--blocked {
    background: var(--rota-amber-soft);
    border-color: #f2d19c;
    color: #8d5108;
}

.operator-workflow-page .button--large,
.packaging-page .button--large {
    min-height: 52px;
}

.excel-entry-sheet,
.frm-eps07-stage,
.silo-register-document {
    border-radius: 4px;
    overflow: hidden;
}

/* Dashboard */
.executive-dashboard {
    --dash-navy: var(--rota-ink);
    --dash-blue: var(--rota-blue-600);
    --dash-cyan: #4a8ce4;
    --dash-green: var(--rota-green);
    --dash-amber: var(--rota-amber);
    --dash-red: var(--rota-red);
    gap: 14px;
}

.executive-dashboard .dashboard-header {
    align-items: flex-end;
    background: transparent;
    border: 0;
    border-radius: 0;
    color: var(--rota-ink);
    min-height: 0;
    overflow: visible;
    padding: 0 0 4px;
}

.executive-dashboard .dashboard-header::after {
    display: none;
}

.executive-dashboard .dashboard-header h1 {
    color: var(--rota-ink);
    font-size: 1.7rem;
}

.executive-dashboard .dashboard-header p {
    color: var(--rota-muted);
    font-size: .92rem;
}

.executive-dashboard .dashboard-header .eyebrow {
    color: var(--rota-blue-700);
}

.executive-dashboard .dashboard-header__actions {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    min-width: 0;
}

.executive-dashboard .period-switch {
    background: #fff;
    border: 1px solid var(--rota-line-strong);
    border-radius: 8px;
    padding: 3px;
}

.executive-dashboard .period-switch button,
.executive-dashboard .dashboard-refresh {
    border-radius: 6px;
    font-size: .82rem;
    min-height: 34px;
    padding: 6px 10px;
}

.executive-dashboard .dashboard-refresh {
    align-items: center;
    display: inline-flex;
    gap: .45rem;
    justify-content: center;
}

.executive-dashboard .dashboard-refresh .ui-icon {
    margin: 0;
}

.executive-dashboard .period-switch button {
    color: var(--rota-muted);
}

.executive-dashboard .period-switch button.is-selected {
    background: var(--rota-blue-100);
    color: var(--rota-blue-700);
}

.executive-dashboard .dashboard-refresh {
    background: #fff;
    border: 1px solid var(--rota-line-strong);
    color: #344054;
}

.dashboard-context {
    color: var(--rota-muted);
    font-size: .8rem;
    padding: 0;
}

.kpi-grid {
    gap: 10px;
}

.kpi-card {
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-panel);
    gap: 11px;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 132px;
    padding: 14px;
    position: relative;
}

.kpi-card__index {
    background: var(--rota-blue-100);
    border: 1px solid #d5e4ff;
    color: var(--rota-blue-700);
    grid-column: 2;
    grid-row: 1;
    height: 34px;
    width: 34px;
}

.kpi-card > div {
    grid-column: 1;
    grid-row: 1;
}

.kpi-card div > span,
.performance-grid article > span,
.flow-strip span {
    color: #475467;
    font-size: .68rem;
    letter-spacing: 0;
    text-transform: none;
}

.kpi-card strong {
    color: var(--rota-ink);
    font-size: clamp(1.7rem, 2.2vw, 2.15rem);
    margin: 10px 0 6px;
}

.kpi-card p {
    color: var(--rota-muted);
    font-size: .67rem;
}

.performance-grid {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-panel);
    gap: 0;
}

.performance-grid article {
    background: #fff;
    border-right: 1px solid var(--rota-line);
    min-height: 96px;
    padding: 13px 15px;
}

.performance-grid article:last-child {
    border-right: 0;
}

.performance-grid strong {
    color: var(--rota-ink);
    font-size: 1.22rem;
}

.metric-track {
    background: #e9edf3;
    height: 5px;
}

.metric-track > span {
    background: var(--rota-blue-600);
}

.flow-strip {
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-panel);
    overflow: hidden;
}

.flow-strip article {
    border-color: var(--rota-line);
    min-height: 86px;
    padding: 13px 15px;
}

.flow-strip article.has-risk {
    background: var(--rota-red-soft);
    box-shadow: inset 0 3px 0 var(--rota-red);
}

.flow-strip article.has-warning {
    background: var(--rota-amber-soft);
    box-shadow: inset 0 3px 0 var(--rota-amber);
}

.flow-strip strong {
    color: var(--rota-ink);
    font-size: 1.45rem;
}

.production-flow-panel {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-panel);
    padding: 15px;
}

.production-flow-panel__heading {
    align-items: flex-end;
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.production-flow-panel__heading h2 {
    font-size: 1.05rem;
    margin: 0;
}

.production-flow-panel__heading small {
    color: var(--rota-muted);
    font-size: .75rem;
}

.production-flow {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: relative;
}

.production-flow::before {
    background: var(--rota-line-strong);
    content: "";
    height: 2px;
    left: 10%;
    position: absolute;
    right: 10%;
    top: 20px;
}

.production-flow__node {
    align-items: center;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0 8px;
    position: relative;
    text-align: center;
    z-index: 1;
}

.production-flow__index {
    align-items: center;
    background: #f3f5f8;
    border: 1px solid var(--rota-line-strong);
    border-radius: 50%;
    color: var(--rota-muted);
    display: flex;
    font-size: .58rem;
    font-weight: 800;
    height: 40px;
    justify-content: center;
    margin-bottom: 9px;
    width: 40px;
}

.production-flow__node.is-normal .production-flow__index {
    background: var(--rota-green-soft);
    border-color: #bde5ce;
    color: var(--rota-green);
}

.production-flow__node.is-warning .production-flow__index {
    background: var(--rota-amber-soft);
    border-color: #f2d19c;
    color: var(--rota-amber);
}

.production-flow__node strong {
    color: var(--rota-ink);
    font-size: .86rem;
}

.production-flow__status {
    background: #f2f4f7;
    border-radius: 999px;
    color: #667085;
    font-size: .68rem;
    font-weight: 750;
    margin: 5px 0;
    padding: 3px 7px;
}

.production-flow__node.is-normal .production-flow__status {
    background: var(--rota-green-soft);
    color: #16804c;
}

.production-flow__node.is-warning .production-flow__status {
    background: var(--rota-amber-soft);
    color: #a35c05;
}

.production-flow__node small {
    color: var(--rota-muted);
    font-size: .7rem;
    overflow-wrap: anywhere;
}

.dashboard-main-grid {
    gap: 12px;
}

.dashboard-panel {
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-panel);
    padding: 15px;
}

.dashboard-panel__heading {
    border-color: var(--rota-line);
    margin-bottom: 12px;
    padding-bottom: 10px;
}

.dashboard-panel__heading h2 {
    color: var(--rota-ink);
    font-size: 1.05rem;
}

.dashboard-panel__heading > a,
.dashboard-panel__heading > span {
    color: var(--rota-blue-700);
}

.production-chart {
    border-color: var(--rota-line-strong);
    height: 210px;
}

.production-chart__bars span {
    border-radius: 4px 4px 0 0;
}

.trace-score {
    background: var(--rota-green-soft);
    border: 1px solid #ccebd9;
    border-left: 3px solid var(--rota-green);
    border-radius: 8px;
}

.trace-score.has-gap {
    background: var(--rota-amber-soft);
    border-color: #f2d19c;
    border-left-color: var(--rota-amber);
}

.attention-item,
.order-row {
    background: #fff;
    border-color: var(--rota-line);
    border-radius: 8px;
}

.attention-item:hover,
.order-row:hover {
    background: #f8fbff;
    border-color: #cbdcf8;
}

/* Management and reporting */
.management-grid {
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.management-card {
    min-height: 126px;
    padding: 15px;
}

.management-card:hover {
    border-color: #bcd3ff;
    box-shadow: 0 3px 10px rgba(16, 24, 40, .05);
    transform: translateY(-1px);
}

.management-card__count {
    background: var(--rota-blue-100);
    border-radius: 8px;
    color: var(--rota-blue-700);
}

.pab-health-grid article,
.pab-entry-card {
    border-color: var(--rota-line);
    border-radius: var(--rota-radius-panel);
    box-shadow: none;
}

.pab-filter {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-panel);
    padding: 12px;
}

/* Search, traceability and operational audit surfaces */
.table-wrap > table:not(.data-table),
.pab-table-wrap > table:not(.data-table) {
    border-collapse: separate;
    border-spacing: 0;
    font-size: .76rem;
    width: 100%;
}

.table-wrap > table:not(.data-table) th,
.pab-table-wrap > table:not(.data-table) th {
    background: #f8fafc;
    border-bottom: 1px solid var(--rota-line-strong);
    color: #667085;
    font-size: .65rem;
    font-weight: 750;
    letter-spacing: .035em;
    padding: 9px 11px;
    text-align: left;
    text-transform: uppercase;
}

.table-wrap > table:not(.data-table) td,
.pab-table-wrap > table:not(.data-table) td {
    background: #fff;
    border-bottom: 1px solid #edf0f4;
    color: #344054;
    padding: 10px 11px;
}

.table-wrap > table:not(.data-table) tbody tr:hover td,
.pab-table-wrap > table:not(.data-table) tbody tr:hover td {
    background: #f8fbff;
}

.trace-section-tabs {
    background: transparent;
    border-bottom: 1px solid var(--rota-line);
    display: flex;
    gap: 18px;
    margin-bottom: 14px;
    padding: 0;
}

.trace-section-tabs a {
    border-bottom: 2px solid transparent;
    color: var(--rota-muted);
    font-size: .73rem;
    font-weight: 700;
    margin-bottom: -1px;
    padding: 9px 2px;
    text-decoration: none;
}

.trace-section-tabs a.is-active {
    background: transparent;
    border-color: var(--rota-blue-600);
    color: var(--rota-blue-700);
}

.trace-search {
    padding: 13px;
}

.search-action {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.search-action input {
    border: 1px solid var(--rota-line-strong);
    border-radius: var(--rota-radius-control);
    min-height: 40px;
    padding: 8px 10px;
}

.trace-identity {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-panel);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
}

.trace-identity > div {
    background: #fff;
    border-right: 1px solid var(--rota-line);
    display: grid;
    gap: 4px;
    min-height: 78px;
    padding: 12px 14px;
}

.trace-identity > div:last-child {
    border-right: 0;
}

.trace-identity span,
.trace-timeline span,
.trace-timeline small {
    color: var(--rota-muted);
    font-size: .65rem;
}

.trace-identity strong {
    color: var(--rota-ink);
    font-size: .86rem;
    overflow-wrap: anywhere;
}

.trace-integrity {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-panel);
    box-shadow: none;
}

.trace-integrity__score {
    background: var(--rota-green-soft);
    border-color: #bde5ce;
}

.trace-integrity__score.has-gap {
    background: var(--rota-amber-soft);
    border-color: #e8c78e;
}

.trace-check {
    background: #fff;
    border-color: var(--rota-line);
    border-radius: 8px;
}

.trace-timeline {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-panel);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
}

.trace-timeline article {
    background: #fff;
    border-color: var(--rota-line);
    min-height: 96px;
    padding: 13px 14px;
}

.trace-grid {
    gap: 12px;
}

/* Inventory and reporting cards follow the same neutral surface language. */
.raw-material-dashboard__grid {
    gap: 10px;
}

.raw-material-stock-card,
.raw-material-stock-card--gray,
.raw-material-stock-card--white,
.raw-material-stock-card--neutral {
    background: #fff;
    border-color: var(--rota-line);
    border-left-width: 3px;
    border-radius: var(--rota-radius-panel);
    box-shadow: none;
}

.raw-material-stock-card::after {
    display: none;
}

.raw-material-stock-card--critical {
    border-left-color: var(--rota-red);
    box-shadow: none;
}

.raw-material-stock-card--warning { border-left-color: var(--rota-amber); }
.raw-material-stock-card--healthy { border-left-color: var(--rota-green); }

.report-export-panel,
.report-export-card,
.printer-test-card,
.report-preview-shell {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-panel);
    box-shadow: none;
}

.report-export-panel,
.report-export-card,
.printer-test-card {
    padding: 15px;
}

.report-export-grid,
.printer-test-grid {
    gap: 10px;
}

.report-export-card__code {
    background: var(--rota-blue-100);
    border-radius: 6px;
    color: var(--rota-blue-700);
}

/* Excel mode is a data-entry capability, not an application-wide theme.
   These higher-specificity rules keep the spreadsheet canvases intact while
   restoring the ROTA shell and shared controls around them. */
.ui-mode-excel .app-header {
    background: rgba(255, 255, 255, .97);
    border-bottom-color: var(--rota-line);
    color: var(--rota-ink);
    min-height: 72px;
}

.ui-mode-excel .app-nav {
    background: var(--rota-surface);
    border-right-color: var(--rota-line);
}

.ui-mode-excel .app-nav a,
.ui-mode-excel .nav-item {
    border-left-color: transparent;
    color: #344054;
}

.ui-mode-excel .app-nav a:hover {
    background: #f7f9fc;
    color: var(--rota-ink);
}

.ui-mode-excel .app-nav a.active {
    background: var(--rota-blue-100);
    border-color: #d9e6ff;
    color: var(--rota-blue-700);
}

.ui-mode-excel .app-main {
    background-color: var(--rota-canvas);
    background-image: none;
}

.ui-mode-excel .button {
    border-radius: var(--rota-radius-control);
}

.ui-mode-excel .button--primary {
    background: var(--rota-blue-600);
    border-color: var(--rota-blue-600);
}

.ui-mode-excel .button--primary:hover {
    background: var(--rota-blue-700);
}

.ui-mode-excel .button--secondary {
    background: #fff;
    border-color: var(--rota-line-strong);
}

.ui-mode-excel .button--danger {
    background: #fff;
    border-color: #f1a5a5;
    color: var(--rota-red);
}

.ui-mode-excel :is(.form-panel, .data-panel, .management-card, .station-card, .operator-flow-shell, .dashboard-panel) {
    border-color: var(--rota-line);
    border-radius: var(--rota-radius-panel);
    box-shadow: none;
}

/* Modern shell around the preserved FRM-EPS-07 spreadsheet canvas. */
.ui-mode-excel .frm-eps07-stage {
    background: transparent;
    border: 0;
    box-shadow: none;
    margin-bottom: 18px;
}

.ui-mode-excel .frm-eps07-stage__intro {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-bottom: 0;
    border-radius: var(--rota-radius-panel) var(--rota-radius-panel) 0 0;
    padding: 16px 18px;
}

.ui-mode-excel .frm-eps07-stage__intro > div,
.ui-mode-excel .frm-eps07-section-heading > div,
.ui-mode-excel .frm-eps07-action-bar > div {
    gap: 3px;
}

.ui-mode-excel .frm-eps07-stage__intro span,
.ui-mode-excel .frm-eps07-section-heading span {
    color: var(--rota-blue-700);
    font: 800 .62rem/1.2 Inter, ui-sans-serif, system-ui, sans-serif;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.ui-mode-excel .frm-eps07-stage__intro strong,
.ui-mode-excel .frm-eps07-section-heading h2 {
    color: var(--rota-ink);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.ui-mode-excel .frm-eps07-stage__intro strong {
    font-size: 1.05rem;
}

.ui-mode-excel .frm-eps07-stage__intro small,
.ui-mode-excel .frm-eps07-action-bar span {
    color: var(--rota-muted);
    font-size: .72rem;
}

.ui-mode-excel .frm-eps07-stage__intro > b,
.ui-mode-excel .frm-eps07-section-heading > strong {
    background: var(--rota-blue-50);
    border: 1px solid #c9dcff;
    border-radius: 7px;
    color: var(--rota-blue-700);
    font: 750 .7rem/1 Inter, ui-sans-serif, system-ui, sans-serif;
    padding: 8px 10px;
}

.ui-mode-excel .frm-eps07-validation-summary {
    border: 1px solid #f2b8b8;
    border-bottom: 0;
    color: #9b2929;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    padding: 9px 12px;
}

.ui-mode-excel .frm-eps07-order-row {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-bottom: 0;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    grid-template-columns: minmax(300px, .9fr) minmax(320px, 1.1fr);
}

.ui-mode-excel .frm-eps07-order-row > label,
.ui-mode-excel .frm-eps07-order-row > div {
    align-content: start;
    gap: 6px;
    padding: 13px 16px;
}

.ui-mode-excel .frm-eps07-order-row > label {
    border-right-color: var(--rota-line);
    grid-template-columns: 1fr;
}

.ui-mode-excel .frm-eps07-order-row span,
.ui-mode-excel .frm-eps07-order-row small {
    color: var(--rota-muted);
    font-size: .66rem;
}

.ui-mode-excel .frm-eps07-order-row span {
    color: #344054;
    font-weight: 750;
    letter-spacing: 0;
    text-transform: none;
}

.ui-mode-excel .frm-eps07-order-row select {
    background: #fff;
    border: 1px solid var(--rota-line-strong);
    border-radius: var(--rota-radius-control);
    color: var(--rota-ink);
    font: 650 .74rem/1.3 Inter, ui-sans-serif, system-ui, sans-serif;
    min-height: 40px;
    padding: 8px 10px;
}

.ui-mode-excel .frm-eps07-order-row strong {
    color: var(--rota-ink);
    font-size: .78rem;
}

.ui-mode-excel .frm-eps07-silo-picker {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-top: 0;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    padding: 16px 18px;
}

.ui-mode-excel .frm-eps07-silo-picker > header {
    align-items: flex-start;
    margin-bottom: 12px;
}

.ui-mode-excel .frm-eps07-silo-picker > header > div {
    gap: 3px;
}

.ui-mode-excel .frm-eps07-silo-picker > header span {
    color: var(--rota-blue-700);
    font-size: .6rem;
    letter-spacing: .06em;
}

.ui-mode-excel .frm-eps07-silo-picker > header h3 {
    color: var(--rota-ink);
    font-size: .95rem;
}

.ui-mode-excel .frm-eps07-silo-picker > header small {
    color: var(--rota-muted);
    font-size: .68rem;
}

.ui-mode-excel .frm-eps07-silo-picker > header > strong {
    background: var(--rota-blue-50);
    border: 1px solid #c9dcff;
    border-radius: 7px;
    color: var(--rota-blue-700);
    font-size: .68rem;
    padding: 7px 9px;
}

.ui-mode-excel .frm-eps07-silo-selection {
    background: var(--rota-blue-50);
    border: 1px solid #c9dcff;
    border-radius: 8px;
    margin-top: 12px;
    padding: 9px 11px;
}

.ui-mode-excel .frm-eps07-silo-selection span {
    color: var(--rota-muted);
    font-size: .6rem;
}

.ui-mode-excel .frm-eps07-silo-selection strong {
    color: var(--rota-blue-700);
    font-size: .72rem;
}

.ui-mode-excel .frm-eps07-silo-selection button {
    align-items: center;
    color: #475467;
    display: inline-flex;
    gap: 5px;
    text-decoration: none;
}

.ui-mode-excel .frm-eps07-silo-selection button:hover {
    color: var(--rota-red);
}

.ui-mode-excel .frm-eps07-source-note {
    background: var(--rota-green-soft);
    border: 1px solid #bde5ce;
    color: #187348;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    margin-top: 10px;
    padding: 9px 11px;
}

.ui-mode-excel .frm-eps07-action-bar {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-radius: 0 0 var(--rota-radius-panel) var(--rota-radius-panel);
    padding: 13px 16px;
}

.ui-mode-excel .frm-eps07-action-bar strong {
    color: var(--rota-ink);
    font-size: .78rem;
}

.ui-mode-excel .frm-eps07-action-bar .button {
    border-radius: var(--rota-radius-control);
    min-width: 148px;
}

.ui-mode-excel .frm-eps07-active-section {
    margin: 24px 0;
}

.ui-mode-excel .frm-eps07-section-heading {
    margin-bottom: 10px;
}

.ui-mode-excel .frm-eps07-section-heading h2 {
    font-size: 1.05rem;
}

.ui-mode-excel .frm-eps07-empty-row {
    background: #fff;
    border: 1px dashed var(--rota-line-strong);
    border-radius: var(--rota-radius-panel);
    color: var(--rota-muted);
    font: .74rem/1.4 Inter, ui-sans-serif, system-ui, sans-serif;
    padding: 18px;
}

.ui-mode-excel .frm-eps07-active-toolbar {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-bottom: 0;
    border-radius: var(--rota-radius-panel) var(--rota-radius-panel) 0 0;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    padding: 13px 16px;
}

.ui-mode-excel .frm-eps07-active-toolbar span {
    color: var(--rota-blue-700);
    font-size: .6rem;
    letter-spacing: .05em;
}

.ui-mode-excel .frm-eps07-active-toolbar small {
    color: var(--rota-muted);
    font-size: .66rem;
}

.ui-mode-excel .frm-eps07-downtime-button {
    background: var(--rota-amber-soft);
    border: 1px solid #e8c78e;
    border-radius: var(--rota-radius-control);
    color: #995b0b;
    font-weight: 750;
}

.ui-mode-excel .frm-eps07-downtime-button:hover {
    background: #ffefd1;
}

.ui-mode-excel .frm-eps07-downtime-form,
.ui-mode-excel .frm-eps07-downtime-history {
    background: #fff;
    border: 1px solid var(--rota-line);
    color: var(--rota-ink);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.ui-mode-excel .frm-eps07-downtime-title {
    background: var(--rota-amber-soft);
    border: 0;
    border-bottom: 1px solid #e8c78e;
    color: #8d5108;
    padding: 10px 13px;
}

.ui-mode-excel .frm-eps07-downtime-entry {
    gap: 10px;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    padding: 13px;
}

.ui-mode-excel .frm-eps07-downtime-entry > label,
.ui-mode-excel .frm-eps07-downtime-entry > output {
    border: 0;
    gap: 5px;
    grid-template-rows: auto 1fr;
}

.ui-mode-excel .frm-eps07-downtime-entry > label > span,
.ui-mode-excel .frm-eps07-downtime-entry > output > span {
    background: transparent;
    border: 0;
    color: #344054;
    font-size: .62rem;
    padding: 0;
    text-transform: none;
}

.ui-mode-excel .frm-eps07-downtime-entry input,
.ui-mode-excel .frm-eps07-downtime-entry select,
.ui-mode-excel .frm-eps07-downtime-entry textarea,
.ui-mode-excel .frm-eps07-downtime-entry output strong {
    background: #fff;
    border: 1px solid var(--rota-line-strong);
    border-radius: var(--rota-radius-control);
    color: var(--rota-ink);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    min-height: 40px;
    padding: 8px 10px;
}

.ui-mode-excel .frm-eps07-downtime-entry > .button {
    align-self: end;
    min-height: 40px;
}

.ui-mode-excel .frm-eps07-downtime-history {
    border-top: 0;
    border-radius: 0 0 var(--rota-radius-panel) var(--rota-radius-panel);
    padding: 10px 13px;
}

.ui-mode-excel .frm-eps07-downtime-history > div {
    border-top-color: var(--rota-line);
}

.ui-mode-excel .frm-eps07-silo-picker .silo-map__zone {
    border-top-color: var(--rota-line);
}

.ui-mode-excel .frm-eps07-silo-picker .silo-map__zone-heading h3 {
    color: #344054;
    font-size: .72rem;
    letter-spacing: 0;
    text-transform: none;
}

.ui-mode-excel .frm-eps07-silo-picker .silo-map__tile {
    background: #fff;
    border-width: 2px;
    border-radius: 8px;
    min-height: 64px;
}

.ui-mode-excel .frm-eps07-silo-picker .silo-map__tile-inner {
    border-radius: 5px;
}

.ui-mode-excel .frm-eps07-silo-picker .silo-map__tile.is-selected {
    box-shadow: 0 0 0 3px rgba(36, 107, 218, .12);
    outline-color: var(--rota-blue-600);
}

/* The actual spreadsheet entry canvas remains visually and behaviourally
   identical, including its embedded completion action. */
.ui-mode-excel .frm-eps07-sheet .button {
    border-radius: 0;
}

.ui-mode-excel .frm-eps07-sheet .button--primary {
    background: #217346;
    border-color: #185c37;
}

.ui-mode-excel .frm-eps07-sheet .button--primary:hover {
    background: #185c37;
}

/* Reusable contextual drawer */
.detail-drawer-backdrop {
    background: rgba(16, 24, 40, .32);
    border: 0;
    cursor: default;
    height: 100%;
    inset: 0;
    padding: 0;
    position: fixed;
    width: 100%;
    z-index: 70;
}

.detail-drawer {
    background: #fff;
    border-left: 1px solid var(--rota-line-strong);
    box-shadow: -18px 0 40px rgba(16, 24, 40, .12);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100dvh;
    max-width: calc(100vw - 24px);
    position: fixed;
    right: 0;
    top: 0;
    width: min(480px, calc(100vw - 24px));
    z-index: 71;
}

.detail-drawer--wide {
    width: min(720px, calc(100vw - 24px));
}

.detail-drawer__header {
    align-items: flex-start;
    border-bottom: 1px solid var(--rota-line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 20px;
}

.detail-drawer__header h2 {
    font-size: 1.15rem;
    margin: 2px 0 4px;
}

.detail-drawer__header p {
    color: var(--rota-muted);
    font-size: .72rem;
    margin: 0;
    max-width: 520px;
}

.detail-drawer__eyebrow {
    color: var(--rota-blue-700);
    display: block;
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .08em;
}

.detail-drawer__close {
    align-items: center;
    background: #fff;
    border: 1px solid var(--rota-line);
    border-radius: 7px;
    cursor: pointer;
    display: flex;
    flex: 0 0 32px;
    height: 32px;
    justify-content: center;
    padding: 0;
    width: 32px;
}

.detail-drawer__close:hover {
    background: #f8fafc;
}

.detail-drawer__close span,
.detail-drawer__close span::after {
    background: #667085;
    content: "";
    display: block;
    height: 1.5px;
    transform: rotate(45deg);
    width: 14px;
}

.detail-drawer__close span::after {
    transform: rotate(90deg);
}

.detail-drawer__body {
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
}

.detail-drawer__footer {
    align-items: center;
    background: #fff;
    border-top: 1px solid var(--rota-line);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 14px 20px;
}

.drawer-form-section > .edit-form,
.drawer-form-section form {
    display: grid;
    gap: 16px;
}

.detail-drawer .form-grid {
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-drawer .action-row {
    background: #fff;
    border-top: 1px solid var(--rota-line);
    bottom: -20px;
    margin: 4px -20px -20px;
    padding: 14px 20px;
    position: sticky;
}

.drawer-status-line {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 14px;
}

.drawer-facts {
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-panel);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    overflow: hidden;
}

.drawer-facts > div {
    border-bottom: 1px solid var(--rota-line);
    display: grid;
    gap: 3px;
    padding: 11px 12px;
}

.drawer-facts > div:nth-child(odd) {
    border-right: 1px solid var(--rota-line);
}

.drawer-facts > div:nth-last-child(-n + 2) {
    border-bottom: 0;
}

.drawer-facts dt,
.drawer-progress span,
.drawer-note > span {
    color: var(--rota-muted);
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.drawer-facts dd {
    color: var(--rota-ink-soft);
    font-size: .76rem;
    font-weight: 650;
    margin: 0;
    overflow-wrap: anywhere;
}

.drawer-progress,
.drawer-note {
    background: var(--rota-surface-muted);
    border: 1px solid var(--rota-line);
    border-radius: var(--rota-radius-panel);
    display: grid;
    gap: 8px;
    margin-top: 14px;
    padding: 13px;
}

.drawer-progress strong {
    display: block;
    font-size: .86rem;
}

.drawer-progress small,
.drawer-note p {
    color: var(--rota-muted);
    font-size: .7rem;
    margin: 0;
}

.header-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.compact-filter {
    align-items: center;
    background: #fff;
    border: 1px solid var(--rota-line-strong);
    border-radius: var(--rota-radius-control);
    display: flex;
    gap: 8px;
    min-height: 38px;
    padding: 5px 8px 5px 10px;
}

.compact-filter > span {
    color: var(--rota-muted);
    font-size: .65rem;
    font-weight: 700;
}

.compact-filter select {
    background: transparent;
    border: 0;
    color: #344054;
    font-size: .72rem;
    font-weight: 700;
    outline: 0;
}

.table-wrap,
.pab-table-wrap {
    border: 1px solid var(--rota-line);
    border-radius: 8px;
    overflow: auto;
}

.data-panel > .table-wrap {
    border-bottom: 0;
}

.work-order-progress__bar {
    background: #e9edf3;
    border-radius: 999px;
    height: 5px;
    overflow: hidden;
}

.work-order-progress__bar > span {
    background: var(--rota-blue-600);
    border-radius: inherit;
    display: block;
    height: 100%;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* Authentication */
.login-shell {
    background: #fff;
    grid-template-columns: minmax(360px, .85fr) minmax(420px, 1.15fr);
}

.login-context {
    background: #123e7c;
}

.login-context h1 {
    color: #fff;
    font-size: clamp(3.5rem, 8vw, 6.5rem);
}

.login-card {
    background: #fff;
    border: 1px solid var(--rota-line);
    border-radius: 12px;
    padding: 24px;
}

.login-shell--minimal {
    background:
        radial-gradient(circle at 12% 8%, rgba(1, 113, 129, .09), transparent 30rem),
        radial-gradient(circle at 92% 90%, rgba(12, 35, 64, .07), transparent 28rem),
        #f5f7f9;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 100svh;
    padding: clamp(20px, 4vw, 48px);
    place-items: center;
}

.login-shell--minimal .login-panel {
    display: block;
    min-height: 0;
    padding: 0;
    width: 100%;
}

.login-shell--minimal .login-card {
    border: 1px solid #dce4e8;
    border-radius: 18px;
    box-shadow: 0 20px 55px rgba(12, 35, 64, .10);
    margin: 0 auto;
    padding: clamp(28px, 4vw, 42px);
    width: min(100%, 460px);
}

.login-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.login-brand img {
    display: block;
    height: auto;
    max-width: 100%;
    width: 290px;
}

.login-shell--minimal .login-card header {
    margin-bottom: 26px;
    text-align: center;
}

.login-shell--minimal .login-card header h1 {
    color: #0c2340;
    font-size: clamp(1.55rem, 4vw, 1.9rem);
    letter-spacing: -.025em;
    margin: 0 0 8px;
}

.login-shell--minimal .login-card header p {
    color: #667681;
    font-size: .94rem;
    line-height: 1.5;
    margin: 0;
}

.login-shell--minimal .login-form {
    gap: 18px;
}

.login-shell--minimal .field {
    gap: 7px;
}

.login-shell--minimal .field label {
    color: #263e50;
    font-size: .86rem;
    font-weight: 750;
}

.login-shell--minimal .field input {
    border: 1px solid #b9c8d0;
    border-radius: 8px;
    min-height: 52px;
    padding: 12px 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.login-shell--minimal .field input:focus {
    border-color: #017181;
    box-shadow: 0 0 0 3px rgba(1, 113, 129, .13);
    outline: none;
}

.login-shell--minimal .button--primary {
    background: #0c2340;
    border-color: #0c2340;
    border-radius: 8px;
    justify-content: center;
    min-height: 52px;
    width: 100%;
}

.login-shell--minimal .button--primary:hover {
    background: #017181;
    border-color: #017181;
}

.login-shell--minimal .login-help {
    border-top: 1px solid #e4e9ec;
    color: #687781;
    font-size: .82rem;
    margin: 26px 0 0;
    padding-top: 20px;
    text-align: center;
}

.login-security-note {
    color: #89959c;
    font-size: .72rem;
    line-height: 1.45;
    margin: 10px 0 0;
    text-align: center;
}

@media (max-width: 520px) {
    .login-shell--minimal {
        align-items: start;
        padding: 16px;
    }

    .login-shell--minimal .login-card {
        border-radius: 14px;
        padding: 26px 22px;
    }

    .login-brand {
        margin-bottom: 24px;
    }

    .login-brand img {
        width: 250px;
    }
}

/* Responsive rules target factory terminals first, then compact devices. */
@media (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 210px minmax(0, 1fr);
    }

    .app-header {
        padding-inline: 18px;
    }

    .app-main {
        padding-inline: 18px;
    }

    .header-status,
    .user-area__identity {
        display: none;
    }

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

@media (max-width: 900px) {
    .app-shell,
    .app-shell.sidebar-is-collapsed {
        grid-template:
            "nav header" 64px
            "nav main" minmax(0, 1fr) /
            68px minmax(0, 1fr);
    }

    .app-nav {
        display: grid;
        grid-template-rows: 64px minmax(0, 1fr) auto;
    }

    .app-nav .brand__text,
    .app-nav .nav-label,
    .app-nav .nav-heading,
    .app-nav .nav-footer__content,
    .app-nav .sidebar-toggle {
        display: none;
    }

    .app-nav .sidebar-brand-row,
    .app-nav .nav-footer {
        justify-content: center;
        padding-inline: 8px;
    }

    .app-nav .brand {
        flex: 0 0 34px;
    }

    .app-nav nav {
        padding-inline: 10px;
    }

    .app-nav a,
    .app-nav .nav-link {
        justify-content: center;
        padding-inline: 7px;
    }

    .app-header {
        min-height: 64px;
    }

    .header-context__eyebrow,
    .work-order-notifications__summary > span:nth-child(2) {
        display: none;
    }

    .app-main {
        padding: 16px;
    }

    .executive-dashboard .dashboard-header {
        align-items: stretch;
        gap: 12px;
    }

    .executive-dashboard .dashboard-header__actions {
        align-items: stretch;
    }

    .performance-grid article:nth-child(2n) {
        border-right: 0;
    }

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

    .production-flow::before {
        display: none;
    }

    .production-flow__node {
        background: var(--rota-surface-muted);
        border: 1px solid var(--rota-line);
        border-radius: 8px;
        padding: 10px 8px;
    }

    .ui-mode-excel .frm-eps07-downtime-entry {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .login-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .login-context {
        display: none;
    }

    .login-panel {
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 800px) {
    .ui-mode-excel .operator-flow-shell__header {
        grid-template-columns: minmax(0, 1fr);
    }

    .operator-flow-shell__title,
    .operator-flow-shell__context {
        width: 100%;
    }
}

@media (max-width: 680px) {
    .app-shell,
    .app-shell.sidebar-is-collapsed {
        grid-template:
            "header" 64px
            "main" minmax(0, 1fr) /
            minmax(0, 1fr);
        padding-bottom: calc(76px + env(safe-area-inset-bottom));
    }

    .app-nav {
        background: rgba(255, 255, 255, .98);
        border-right: 0;
        border-top: 1px solid var(--rota-line-strong);
        bottom: 0;
        display: block;
        height: calc(76px + env(safe-area-inset-bottom));
        left: 0;
        padding-bottom: env(safe-area-inset-bottom);
        position: fixed;
        right: 0;
        top: auto;
        z-index: 100;
    }

    .app-nav .sidebar-brand-row,
    .app-nav .nav-footer,
    .app-nav .nav-heading {
        display: none;
    }

    .app-nav nav {
        align-items: stretch;
        display: flex;
        gap: 4px;
        height: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        padding: 7px 8px;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }

    .app-nav nav::-webkit-scrollbar {
        display: none;
    }

    .app-nav a,
    .app-nav .nav-link {
        flex: 0 0 76px;
        flex-direction: column;
        font-size: .68rem;
        gap: 3px;
        justify-content: center;
        margin: 0;
        min-height: 60px;
        padding: 5px 4px;
        scroll-snap-align: start;
        text-align: center;
        white-space: normal;
    }

    .app-nav a > .ui-icon {
        font-size: 1.2rem;
        height: 24px;
        width: 24px;
    }

    .app-nav .nav-label {
        display: -webkit-box;
        font-size: .68rem;
        line-height: 1.1;
        max-width: 100%;
        min-height: 1.5rem;
        overflow: hidden;
        text-overflow: ellipsis;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .header-context {
        display: none;
    }

    .app-header {
        justify-content: flex-end;
        padding-inline: 12px;
        position: sticky;
        top: 0;
        z-index: 90;
    }

    .header-actions {
        gap: 7px;
        justify-content: space-between;
        width: 100%;
    }

    .user-area {
        margin-left: auto;
    }

    .user-area__avatar {
        height: 34px;
        width: 34px;
    }

    .user-area .button--quiet {
        min-height: 34px;
        padding: 5px 8px;
    }

    .app-main {
        padding: 14px 12px 24px;
    }

    .page-header,
    .section-heading,
    .operator-rule,
    .executive-dashboard .dashboard-header,
    .executive-dashboard .dashboard-header__actions {
        align-items: stretch;
        flex-direction: column;
    }

    .station-grid,
    .management-grid,
    .kpi-grid,
    .performance-grid,
    .flow-strip,
    .production-flow {
        grid-template-columns: 1fr;
    }

    .action-row {
        align-items: stretch;
        display: grid;
        grid-template-columns: 1fr;
    }

    .action-row > .button,
    .action-row > button,
    .action-row > a.button {
        min-width: 0;
        width: 100%;
    }

    .table-wrap,
    .pab-table-wrap {
        max-width: calc(100vw - 24px);
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    .production-flow-panel__heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .performance-grid article,
    .performance-grid article:nth-child(2n) {
        border-bottom: 1px solid var(--rota-line);
        border-right: 0;
    }

    .station-card {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .station-card > .tag {
        grid-column: 2;
        justify-self: start;
    }

    .operator-rule strong {
        white-space: normal;
    }

    .detail-drawer,
    .detail-drawer--wide {
        max-width: 100vw;
        width: 100vw;
    }

    .detail-drawer .form-grid,
    .drawer-facts {
        grid-template-columns: 1fr;
    }

    .drawer-facts > div,
    .drawer-facts > div:nth-child(odd),
    .drawer-facts > div:nth-last-child(-n + 2) {
        border-bottom: 1px solid var(--rota-line);
        border-right: 0;
    }

    .drawer-facts > div:last-child {
        border-bottom: 0;
    }

    .ui-mode-excel .frm-eps07-stage__intro,
    .ui-mode-excel .frm-eps07-section-heading,
    .ui-mode-excel .frm-eps07-action-bar,
    .ui-mode-excel .frm-eps07-silo-picker > header,
    .ui-mode-excel .frm-eps07-active-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .ui-mode-excel .frm-eps07-order-row,
    .ui-mode-excel .frm-eps07-downtime-entry {
        grid-template-columns: 1fr;
    }

    .ui-mode-excel .frm-eps07-order-row > label {
        border-bottom: 1px solid var(--rota-line);
        border-right: 0;
    }

    .ui-mode-excel .frm-eps07-action-bar .button {
        width: 100%;
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-context {
        display: none;
    }
}

/* Field-tablet ergonomics.
   Keep the application chrome compact enough for production data while
   preserving 44–48 px touch targets and containing wide industrial sheets
   inside their own horizontal scrollers. */
@media (min-width: 681px) and (max-width: 1180px) {
    html,
    body {
        max-width: 100%;
        overflow-x: clip;
    }

    .app-shell,
    .app-shell.sidebar-is-collapsed {
        grid-template:
            "nav header" 64px
            "nav main" minmax(0, 1fr) /
            84px minmax(0, 1fr);
        max-width: 100%;
        overflow-x: clip;
    }

    .app-nav {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: 64px minmax(0, 1fr) auto;
    }

    .app-nav .brand__text,
    .app-nav .nav-label,
    .app-nav .nav-heading,
    .app-nav .nav-footer__content,
    .app-nav .sidebar-toggle {
        display: none;
    }

    .app-nav .sidebar-brand-row,
    .app-nav .nav-footer {
        justify-content: center;
        padding-inline: 8px;
    }

    .app-nav .brand {
        flex: 0 0 44px;
        min-width: 44px;
    }

    .app-nav .brand__mark {
        height: 44px;
        width: 44px;
    }

    .app-nav nav,
    .sidebar-is-collapsed .app-nav nav {
        padding: 10px 8px 18px;
    }

    .app-nav a,
    .app-nav .nav-link,
    .sidebar-is-collapsed .app-nav a {
        box-sizing: border-box;
        font-size: 0;
        justify-content: center;
        min-height: 48px;
        padding: 8px;
        width: 100%;
    }

    .app-nav a > .ui-icon,
    .sidebar-is-collapsed .app-nav a > .ui-icon {
        font-size: 1.2rem;
        height: 26px;
        width: 26px;
    }

    .app-header,
    .app-main,
    .app-main > *,
    main {
        max-width: 100%;
        min-width: 0;
    }

    .app-header {
        min-height: 64px;
        padding-inline: 16px;
    }

    .app-main {
        overflow-x: clip;
        padding: 16px 18px 30px;
    }

    .button,
    .button--small,
    .user-area .button--quiet,
    .work-order-notifications__summary,
    .trace-section-tabs a,
    .packaging-physical-confirm {
        min-height: 44px;
    }

    .user-area__avatar {
        height: 44px;
        min-width: 44px;
        width: 44px;
    }

    .app-shell .app-main button,
    .app-shell .app-main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    .app-shell .app-main select,
    .app-shell .app-main textarea {
        min-height: 44px;
    }

    .operator-workflow-page .button,
    .operator-workflow-page button,
    .operator-workflow-page input,
    .operator-workflow-page select,
    .packaging-complete-button,
    .dashboard-refresh,
    .period-switch button {
        min-height: 48px;
    }

    .executive-dashboard .dashboard-header__actions,
    .dashboard-header__actions {
        min-width: 0;
        width: min(100%, 24rem);
    }

    .executive-dashboard .attention-item a,
    .attention-item a {
        align-items: center;
        display: inline-flex;
        justify-content: center;
        min-height: 44px !important;
        min-width: 44px;
        padding: .45rem .6rem;
    }

    .executive-dashboard a[href],
    .work-order-notifications__all,
    .app-main summary {
        align-items: center;
        display: inline-flex;
        min-height: 44px !important;
    }

    .executive-dashboard a[href] {
        justify-content: center;
        min-width: 44px;
    }

    .packaging-station,
    .packaging-workbench,
    .packaging-history,
    .packaging-history__table-wrap {
        max-width: 100%;
        min-width: 0;
    }

    .packaging-history {
        overflow: hidden;
    }

    .packaging-history__table-wrap,
    .silo-sheet__scroll {
        max-width: 100%;
        overscroll-behavior-inline: contain;
        touch-action: pan-x pan-y;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    .packaging-history table {
        width: max-content;
    }

    .silo-sheet,
    .silo-sheet__header,
    .silo-sheet__scroll,
    .silo-selection {
        box-sizing: border-box;
        max-width: 100%;
        min-width: 0;
    }

    .silo-sheet {
        overflow: hidden;
    }
}

@media (min-width: 681px) and (max-width: 900px) {
    .silo-page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .silo-page-actions {
        justify-content: flex-start;
    }

    .silo-sheet__header {
        align-items: start;
        grid-template-columns: minmax(0, 1fr);
    }

    .silo-sheet__header dl div {
        grid-template-columns: minmax(64px, auto) minmax(0, 1fr);
    }

    .silo-sheet__header > span {
        justify-self: start;
    }

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

@media (max-width: 680px) {
    html,
    body,
    .app-shell,
    .app-main,
    .app-main > *,
    main {
        max-width: 100%;
        min-width: 0;
    }

    html,
    body,
    .app-shell {
        overflow-x: clip;
    }

    .button,
    .button--small,
    .user-area .button--quiet,
    .work-order-notifications__summary,
    .trace-section-tabs a,
    .packaging-physical-confirm,
    .dashboard-refresh,
    .period-switch button {
        min-height: 48px;
    }

    .app-shell .app-main button,
    .app-shell .app-main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    .app-shell .app-main select,
    .app-shell .app-main textarea {
        min-height: 44px;
    }

    .executive-dashboard .attention-item a,
    .attention-item a {
        align-items: center;
        display: inline-flex;
        justify-content: center;
        min-height: 44px !important;
        min-width: 44px;
        padding: .45rem .6rem;
    }

    .executive-dashboard a[href],
    .work-order-notifications__all,
    .app-main summary {
        align-items: center;
        display: inline-flex;
        min-height: 44px !important;
    }

    .executive-dashboard a[href] {
        justify-content: center;
        min-width: 44px;
    }

    .packaging-history,
    .packaging-history__table-wrap,
    .silo-sheet,
    .silo-sheet__scroll,
    .silo-selection {
        box-sizing: border-box;
        max-width: 100%;
        min-width: 0;
    }

    .packaging-history,
    .silo-sheet {
        overflow: hidden;
    }

    .packaging-history__table-wrap,
    .silo-sheet__scroll {
        overscroll-behavior-inline: contain;
        touch-action: pan-x pan-y;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
