:root {
    --bg: #f7f9fc;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --line: #dfe6ef;
    --text: #111827;
    --muted: #53627a;
    --navy: #172f5f;
    --navy-dark: #10244c;
    --blue: #2d86f2;
    --green: #0aa64a;
    --green-soft: #dff6e8;
    --yellow: #f5bd00;
    --red: #ef3333;
    --red-soft: #fde4e4;
    --purple: #7d45db;
    --shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 12px 28px rgba(15, 23, 42, 0.07);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

svg {
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dashboard-header {
    min-height: 82px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--navy-dark), var(--navy));
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset;
}

.brand-block,
.update-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    width: 58px;
    height: 48px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-block h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.05;
    font-weight: 800;
}

.brand-block p {
    margin: 4px 0 0;
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.86);
}

.update-block {
    text-align: right;
}

.update-block span {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.86);
}

.update-block strong {
    display: block;
    margin-top: 2px;
    font-size: 25px;
    line-height: 1;
    font-weight: 850;
    color: #ffffff;
}

.refresh-button {
    width: 46px;
    height: 46px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 7px;
    display: grid;
    place-items: center;
    color: var(--blue);
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

.refresh-button svg {
    width: 21px;
    height: 21px;
}

.refresh-button:hover {
    filter: brightness(0.97);
}

.refresh-button.is-loading svg {
    animation: spin 0.8s linear infinite;
}

.dashboard-shell {
    width: 100%;
    max-width: 1880px;
    margin: 0 auto;
    padding: 34px 22px 18px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 26px;
    margin-bottom: 30px;
}

.kpi-card {
    min-height: 130px;
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    padding: 22px 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.kpi-icon {
    width: 60px;
    height: 60px;
    display: grid;
    place-items: center;
    border-radius: 999px;
}

.kpi-icon svg {
    width: 31px;
    height: 31px;
}

.kpi-green {
    color: var(--green);
    background: var(--green-soft);
}

.kpi-blue {
    color: var(--blue);
    background: #e4f0ff;
}

.kpi-mint {
    color: var(--green);
    background: #e6f7ec;
}

.kpi-purple {
    color: var(--purple);
    background: #efe4ff;
}

.kpi-card span {
    display: block;
    margin-bottom: 5px;
    color: #24344d;
    font-size: 13px;
    font-weight: 850;
    text-transform: uppercase;
}

.kpi-card strong {
    display: block;
    color: var(--green);
    font-size: 33px;
    line-height: 1.05;
    font-weight: 900;
}

.kpi-card:nth-child(2) strong {
    color: var(--blue);
}

.kpi-card:nth-child(4) strong {
    color: var(--purple);
}

.kpi-card small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
}

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

.machine-card {
    position: relative;
    min-height: 446px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.machine-card:hover,
.machine-card:focus-visible {
    border-color: #bfd2ea;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
    transform: translateY(-2px);
    outline: none;
}

.machine-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--green);
}

.machine-card.machine-alarm::before {
    background: var(--red);
}

.machine-card.machine-warning::before,
.machine-card.machine-soft::before {
    background: var(--yellow);
}

.machine-card.machine-pause::before {
    background: var(--blue);
}

.machine-card.machine-offline::before {
    background: #8a98aa;
}

.machine-body {
    flex: 1;
    padding: 20px 26px 18px;
}

.machine-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.machine-title {
    margin: 0;
    font-size: 22px;
    line-height: 1.1;
    font-weight: 850;
}

.machine-lot {
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
}

.status-badge {
    min-width: 112px;
    height: 29px;
    padding: 0 14px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.status-ok {
    color: #008a2f;
    background: var(--green-soft);
}

.status-warning,
.status-soft {
    color: #8a6700;
    background: #fff3c2;
}

.status-pause {
    color: #175f9f;
    background: #e4f0ff;
}

.status-alarm {
    color: var(--red);
    background: var(--red-soft);
}

.status-offline {
    color: #54657a;
    background: #edf1f6;
}

.machine-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 17px;
}

.metric-label {
    display: block;
    color: #34465f;
    font-size: 14px;
}

.metric-value {
    display: block;
    margin-top: 4px;
    color: var(--green);
    font-size: 29px;
    line-height: 1.1;
    font-weight: 900;
}

.machine-alarm .metric-value {
    color: var(--red);
}

.machine-pause .metric-value {
    color: var(--blue);
}

.efficiency-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 7px;
    color: #34465f;
    font-size: 14px;
}

.progress-track {
    height: 7px;
    border-radius: 999px;
    overflow: hidden;
    background: #e8edf3;
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--green);
}

.progress-fill.warning {
    background: var(--yellow);
}

.progress-fill.pause {
    background: var(--blue);
}

.progress-fill.alarm {
    background: var(--red);
}

.machine-details {
    margin-top: 22px;
    padding: 14px 15px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fbfcfe;
}

.detail-row {
    min-height: 26px;
    display: grid;
    grid-template-columns: minmax(118px, 1fr) minmax(0, 1.2fr);
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
}

.detail-row strong {
    min-width: 0;
    color: #172033;
    text-align: right;
    font-size: 14px;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.detail-row-pause {
    margin-top: 7px;
    padding-top: 9px;
    border-top: 1px solid #dce7f5;
}

.detail-row-pause strong {
    color: var(--blue);
}

.operator-icon {
    width: 14px;
    height: 14px;
    display: inline-block;
    margin-right: 5px;
    vertical-align: -2px;
    color: #1b3355;
}

.machine-foot {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 22px 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    background: #fbfcfe;
    font-size: 14px;
}

.machine-foot strong {
    display: block;
    margin-top: 3px;
    color: var(--green);
    font-size: 15px;
    font-weight: 850;
}

.machine-foot .duration-alarm {
    color: var(--red);
}

.machine-foot .duration-pause {
    color: var(--blue);
}

.machine-foot .last-value {
    color: #1c2b45;
    text-align: right;
}

.summary-panel {
    margin-top: 30px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.summary-panel h2 {
    margin: 0;
    padding: 19px 20px;
    border-bottom: 1px solid var(--line);
    color: #3a4a64;
    font-size: 17px;
    font-weight: 900;
    text-transform: uppercase;
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 1360px;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

th {
    color: #33435c;
    background: #fbfcfe;
    font-size: 13px;
    font-weight: 700;
}

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

tbody tr:hover {
    background: #f8fbff;
}

.machine-table-row {
    cursor: pointer;
}

.machine-table-row:focus-visible {
    outline: 2px solid rgba(45, 134, 242, 0.45);
    outline-offset: -2px;
}

.table-machine {
    font-weight: 850;
}

.table-number {
    color: var(--green);
    font-weight: 850;
}

.table-number.alarm,
.table-duration.alarm {
    color: var(--red);
}

.table-duration.pause {
    color: var(--blue);
    font-weight: 850;
}

.table-operator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.table-actions {
    text-align: right;
}

.table-production-button {
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid #1f68b2;
    border-radius: 7px;
    color: #ffffff;
    background: linear-gradient(#2d86f2, #175f9f);
    font: inherit;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.table-production-button:hover,
.table-production-button:focus-visible {
    filter: brightness(0.97);
    outline: none;
}

.snapshot-detail-button {
    min-height: 30px;
    padding: 0 11px;
    border: 1px solid #c7d4e5;
    border-radius: 7px;
    color: #172033;
    background: linear-gradient(#ffffff, #eef3f8);
    font: inherit;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
}

.snapshot-detail-button:hover,
.snapshot-detail-button:focus-visible {
    filter: brightness(0.98);
    outline: none;
}

.production-note-cell {
    min-width: 150px;
}

.production-note-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.production-note-content span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.production-note-button {
    width: 27px;
    height: 27px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 1px solid #c7d4e5;
    border-radius: 7px;
    color: #1f5d9e;
    background: #ffffff;
    font: inherit;
    font-size: 17px;
    line-height: 1;
    font-weight: 900;
    cursor: pointer;
}

.production-note-button.has-note {
    border-color: #1f68b2;
    color: #ffffff;
    background: #2d86f2;
}

.production-note-button:hover,
.production-note-button:focus-visible {
    filter: brightness(0.97);
    outline: none;
}

.production-note-button.is-saving {
    opacity: 0.65;
    cursor: wait;
}

.production-note-editor {
    display: grid;
    gap: 6px;
}

.production-note-editor textarea {
    width: 100%;
    min-width: 170px;
    resize: vertical;
    padding: 7px 8px;
    border: 1px solid #cfd8e6;
    border-radius: 7px;
    color: var(--text);
    background: #ffffff;
    font: inherit;
    font-size: 12px;
}

.production-note-editor textarea:focus {
    border-color: #2d86f2;
    outline: none;
    box-shadow: 0 0 0 2px rgba(45, 134, 242, 0.12);
}

.production-note-editor-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.production-note-save,
.production-note-cancel {
    min-height: 27px;
    padding: 0 9px;
    border: 1px solid #c7d4e5;
    border-radius: 7px;
    background: #ffffff;
    font: inherit;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
}

.production-note-save {
    border-color: #1f68b2;
    color: #ffffff;
    background: #2d86f2;
}

.production-note-status {
    min-height: 14px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.dashboard-footer {
    padding: 16px 20px 28px;
    color: #7a8799;
    text-align: center;
    font-size: 14px;
}

.dashboard-footer span,
.official-site-link {
    display: block;
}

.official-site-link {
    width: fit-content;
    margin: 7px auto 0;
    color: var(--navy);
    font-weight: 800;
    text-decoration: none;
}

.official-site-link:hover,
.official-site-link:focus-visible {
    color: var(--blue);
    text-decoration: underline;
}

body.modal-open {
    overflow: hidden;
}

.detail-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
}

.detail-modal.open {
    display: block;
}

.detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(5px);
}

.detail-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(1380px, calc(100vw - 36px));
    max-height: calc(100vh - 42px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.34);
    transform: translate(-50%, -50%);
}

.detail-modal.is-productions .detail-dialog {
    width: min(1760px, calc(100vw - 16px));
    max-height: calc(100vh - 16px);
}

.detail-modal.is-productions .detail-header {
    padding: 18px 24px 15px;
    padding-right: 78px;
}

.detail-modal.is-productions .detail-header .status-badge {
    margin-bottom: 10px;
}

.detail-modal.is-productions .detail-header h2 {
    font-size: 26px;
}

.detail-modal.is-productions .detail-body {
    padding: 18px 22px 24px;
}

.detail-header {
    position: relative;
    padding: 22px 26px 18px;
    padding-right: 82px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--navy-dark), var(--navy));
}

.detail-header .status-badge {
    margin-bottom: 12px;
}

.detail-header h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.08;
    font-weight: 900;
}

.detail-header p {
    margin: 7px 0 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 15px;
    overflow-wrap: anywhere;
}

.detail-close {
    position: absolute;
    top: 20px;
    right: 26px;
    z-index: 3;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 8px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.detail-close svg {
    width: 22px;
    height: 22px;
}

.detail-close:hover {
    background: rgba(255, 255, 255, 0.18);
}

.detail-body {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 26px 28px;
}

.detail-loading,
.detail-error {
    min-height: 220px;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 700;
}

.detail-error {
    color: var(--red);
}

.detail-overview {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.detail-metric {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.detail-metric span,
.detail-info-grid span,
.detail-rules span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.detail-metric strong {
    display: block;
    margin-top: 5px;
    color: var(--green);
    font-size: 25px;
    line-height: 1.1;
    font-weight: 900;
}

.detail-metric.is-alarm strong {
    color: var(--red);
}

.detail-metric.is-pause strong {
    color: var(--blue);
}

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

.detail-info-grid div {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.detail-info-grid strong {
    display: block;
    margin-top: 5px;
    color: #172033;
    font-size: 15px;
    overflow-wrap: anywhere;
}

.pause-panel {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
    padding: 15px 16px;
    border: 1px solid #cfe0f4;
    border-radius: 8px;
    background: #f7fbff;
}

.pause-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.pause-panel-head span,
.pause-accounting span,
.pause-schedule span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.pause-panel-head strong {
    display: block;
    margin-top: 3px;
    color: #172033;
    font-size: 16px;
    font-weight: 900;
}

.pause-panel-head em {
    flex: 0 0 auto;
    padding: 5px 10px;
    border-radius: 999px;
    color: #175f9f;
    background: #e4f0ff;
    font-size: 12px;
    font-style: normal;
    font-weight: 900;
    text-transform: uppercase;
}

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

.pause-accounting div,
.pause-schedule div {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #dce7f5;
    border-radius: 8px;
    background: #ffffff;
}

.pause-accounting strong,
.pause-schedule strong {
    display: block;
    margin-top: 4px;
    color: var(--blue);
    font-size: 18px;
    line-height: 1.1;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.pause-schedule {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
}

.pause-schedule em {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    font-weight: 750;
}

.pause-schedule .is-active {
    border-color: rgba(45, 134, 242, 0.48);
    box-shadow: 0 0 0 2px rgba(45, 134, 242, 0.1);
}

.day-context-panel {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
    padding: 15px 16px;
    border: 1px solid #d7e3f1;
    border-radius: 8px;
    background: #f8fbff;
}

.day-context-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.day-context-head span,
.day-context-grid span,
.day-lot-list span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.day-context-head strong {
    display: block;
    margin-top: 3px;
    color: #172033;
    font-size: 16px;
    font-weight: 900;
}

.day-context-head em {
    flex: 0 0 auto;
    padding: 5px 10px;
    border-radius: 999px;
    color: #175f9f;
    background: #e4f0ff;
    font-size: 12px;
    font-style: normal;
    font-weight: 900;
    text-transform: uppercase;
}

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

.day-context-grid div,
.day-lot-list div {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #dce7f5;
    border-radius: 8px;
    background: #ffffff;
}

.day-context-grid strong,
.day-lot-list strong {
    display: block;
    margin-top: 4px;
    color: var(--blue);
    font-size: 18px;
    line-height: 1.1;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.day-lot-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.day-lot-list em {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    font-weight: 750;
}

.detail-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid #dce7f5;
    border-radius: 8px;
    background: #f7fbff;
}

.detail-actions span {
    color: var(--muted);
    font-size: 14px;
}

.detail-action-button {
    min-height: 38px;
    padding: 0 15px;
    border: 1px solid #c7d4e5;
    border-radius: 7px;
    color: #172033;
    background: linear-gradient(#ffffff, #eef3f8);
    font: inherit;
    font-size: 14px;
    font-weight: 850;
    cursor: pointer;
}

.detail-action-button.primary {
    border-color: #1f68b2;
    color: #ffffff;
    background: linear-gradient(#2d86f2, #175f9f);
}

.detail-action-button:hover {
    filter: brightness(0.98);
}

.productions-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-bottom: 16px;
}

.production-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.production-period-filter {
    display: grid;
    gap: 5px;
    min-width: 190px;
}

.production-period-filter label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.production-period-filter select {
    height: 40px;
    padding: 0 11px;
    border: 1px solid #cfd8e6;
    border-radius: 7px;
    color: #172033;
    background: #ffffff;
    font: inherit;
    font-size: 14px;
    font-weight: 750;
}

.production-search {
    width: min(560px, 100%);
}

.production-search input {
    width: 100%;
    height: 40px;
    padding: 0 13px;
    border: 1px solid #cfd8e6;
    border-radius: 7px;
    color: var(--text);
    background: #ffffff;
    font: inherit;
}

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

.production-chip {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.production-chip span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.production-chip strong {
    display: block;
    margin-top: 5px;
    color: var(--navy);
    font-size: 22px;
    line-height: 1.1;
    font-weight: 900;
}

.production-tree {
    display: grid;
    gap: 10px;
}

.production-node {
    border: 1px solid #d5deea;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}

.production-node summary {
    min-height: 44px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 13px;
    list-style: none;
    cursor: pointer;
}

.production-node summary::-webkit-details-marker {
    display: none;
}

.tree-toggle {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.16);
    font-size: 17px;
    font-weight: 900;
}

.tree-toggle::before {
    content: "+";
}

.production-node[open] > summary .tree-toggle::before {
    content: "-";
}

.tree-main {
    min-width: 0;
}

.tree-main span,
.tree-main em {
    display: block;
    font-style: normal;
    font-size: 12px;
    font-weight: 800;
    opacity: 0.78;
    text-transform: uppercase;
}

.tree-main strong {
    display: block;
    margin-top: 1px;
    font-size: 15px;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.work-tree-main strong {
    font-size: 17px;
}

.work-node-meta {
    display: flex;
    gap: 8px 16px;
    flex-wrap: wrap;
    margin-top: 5px;
}

.work-node-meta em {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    color: inherit;
    font-size: 13px;
    opacity: 0.94;
    text-transform: none;
}

.work-node-meta b {
    color: inherit;
    font-size: 11px;
    letter-spacing: 0;
    text-transform: uppercase;
}

.work-node-meta small {
    color: inherit;
    font-size: 12px;
    font-weight: 800;
    opacity: 0.78;
}

.tree-stats {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    flex-wrap: wrap;
}

.tree-stats span {
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}

.part-node > summary,
.work-node > summary {
    color: #ffffff;
    background: #253d5a;
}

.part-node > summary .tree-stats span,
.work-node > summary .tree-stats span {
    background: rgba(255, 255, 255, 0.16);
}

.article-node {
    border-color: #cdd9e8;
}

.article-node > summary {
    color: #ffffff;
    background: #3b5d7c;
}

.article-node > summary .tree-stats span {
    background: rgba(255, 255, 255, 0.16);
}

.operation-node > summary {
    color: #172033;
    background: #eef5fb;
}

.operation-node > summary .tree-toggle {
    color: #ffffff;
    background: var(--blue);
}

.operation-node > summary .tree-stats span {
    color: #2e415d;
    background: #ffffff;
}

.lot-node {
    border-color: #d7e3f1;
}

.lot-node > summary {
    color: #172033;
    background: #f8fbff;
}

.lot-node > summary .tree-toggle {
    color: #ffffff;
    background: #3b5d7c;
}

.lot-node > summary .tree-stats span {
    color: #2e415d;
    background: #ffffff;
}

.production-children {
    display: grid;
    gap: 9px;
    padding: 10px;
    background: #f7f9fc;
}

.production-table-scroll {
    overflow-x: auto;
    border-top: 1px solid var(--line);
}

.production-table {
    min-width: 1480px;
    font-size: 13px;
}

.production-table th,
.production-table td {
    padding: 11px 12px;
}

.production-table th {
    color: #1f5d9e;
}

.detail-modal.is-productions .production-summary {
    gap: 10px;
    margin-bottom: 14px;
}

.detail-modal.is-productions .production-chip {
    padding: 12px 14px;
}

.detail-modal.is-productions .production-chip strong {
    font-size: 20px;
}

.detail-modal.is-productions .production-node summary {
    min-height: 40px;
    gap: 10px;
    padding: 8px 11px;
}

.detail-modal.is-productions .tree-toggle {
    width: 20px;
    height: 20px;
    font-size: 15px;
}

.detail-modal.is-productions .tree-main span,
.detail-modal.is-productions .tree-main em {
    font-size: 11px;
}

.detail-modal.is-productions .work-tree-main strong {
    font-size: 16px;
}

.detail-modal.is-productions .work-node-meta {
    gap: 5px 14px;
    margin-top: 4px;
}

.detail-modal.is-productions .work-node-meta em {
    font-size: 12px;
}

.detail-modal.is-productions .tree-stats {
    gap: 5px;
}

.detail-modal.is-productions .tree-stats span {
    padding: 3px 8px;
    font-size: 11px;
}

.detail-modal.is-productions .production-children {
    gap: 7px;
    padding: 8px;
}

.detail-modal.is-productions .production-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 11px;
}

.detail-modal.is-productions .production-table th,
.detail-modal.is-productions .production-table td {
    padding: 7px 6px;
    overflow-wrap: anywhere;
    white-space: normal;
    vertical-align: top;
}

.detail-modal.is-productions .snapshot-detail-button {
    min-height: 27px;
    padding: 0 7px;
    font-size: 11px;
}

.detail-modal.is-productions .production-note-cell {
    min-width: 0;
}

.detail-modal.is-productions .production-note-button {
    width: 24px;
    height: 24px;
    font-size: 15px;
}

.detail-modal.is-productions .production-note-editor textarea {
    min-width: 0;
}

.production-table tbody tr:nth-child(even) {
    background: #fbfcfe;
}

.production-node.is-hidden {
    display: none;
}

.detail-rules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.detail-rules div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    border: 1px solid #dce7f5;
    border-radius: 8px;
    background: #f7fbff;
}

.detail-rules strong {
    color: var(--blue);
    font-size: 22px;
    line-height: 1;
    font-weight: 900;
}

.timeline {
    position: relative;
    display: grid;
    gap: 14px;
}

.timeline::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 88px;
    width: 2px;
    background: #dce7f5;
}

.timeline-event {
    position: relative;
    display: grid;
    grid-template-columns: 72px 34px minmax(0, 1fr);
    gap: 14px;
    align-items: flex-start;
}

.event-time {
    padding-top: 11px;
    color: #33435c;
    font-size: 14px;
    font-weight: 850;
    text-align: right;
}

.event-marker {
    position: relative;
    z-index: 1;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 2px solid #ffffff;
    border-radius: 999px;
    color: #ffffff;
    background: var(--blue);
    box-shadow: 0 6px 14px rgba(45, 134, 242, 0.24);
    font-size: 14px;
    font-weight: 900;
}

.event-stop_threshold .event-marker {
    background: var(--red);
    box-shadow: 0 6px 14px rgba(239, 51, 51, 0.22);
}

.event-machine_on .event-marker {
    background: var(--green);
    box-shadow: 0 6px 14px rgba(10, 166, 74, 0.22);
    font-size: 11px;
}

.event-machine_off .event-marker {
    background: #667085;
    box-shadow: 0 6px 14px rgba(102, 112, 133, 0.22);
    font-size: 10px;
}

.event-production_start .event-marker {
    background: #0f75bc;
    box-shadow: 0 6px 14px rgba(15, 117, 188, 0.24);
}

.event-snapshot_day .event-marker {
    background: var(--navy);
    box-shadow: 0 6px 14px rgba(23, 47, 95, 0.22);
}

.event-lot_change .event-marker,
.event-order_change .event-marker,
.event-operator_change .event-marker,
.event-part_number_change .event-marker {
    background: var(--purple);
    box-shadow: 0 6px 14px rgba(125, 69, 219, 0.2);
}

.event-card {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.event-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 5px;
}

.event-topline strong {
    color: #172033;
    font-size: 15px;
}

.event-topline span {
    flex: 0 0 auto;
    padding: 3px 8px;
    border-radius: 999px;
    color: #40516a;
    background: #eef3f9;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.event-card p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.event-cause {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin: 8px 0 10px;
    padding: 10px 12px;
    border: 1px solid #f2c2c2;
    border-radius: 8px;
    color: #7f1d1d;
    background: #fff5f5;
}

.event-cause span,
.event-cause em {
    font-size: 12px;
    font-style: normal;
    font-weight: 850;
    text-transform: uppercase;
}

.event-cause strong {
    min-width: 0;
    color: #b42323;
    font-size: 15px;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.stop-cause-control {
    display: grid;
    grid-template-columns: auto minmax(220px, 360px) minmax(120px, auto);
    align-items: center;
    gap: 10px;
    margin: 8px 0 10px;
    padding: 10px 12px;
    border: 1px solid #d7e3f1;
    border-radius: 8px;
    background: #f8fbff;
}

.stop-cause-control label {
    color: #33435c;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.stop-cause-control select {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid #c7d4e5;
    border-radius: 7px;
    color: #172033;
    background: #ffffff;
    font: inherit;
    font-size: 14px;
    font-weight: 750;
}

.stop-cause-control span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.event-card dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 12px 0 0;
}

.event-card dl div {
    padding: 9px 10px;
    border-radius: 7px;
    background: #f8fafc;
}

.event-card dt {
    color: var(--muted);
    font-size: 12px;
}

.event-card dd {
    margin: 3px 0 0;
    color: #172033;
    font-size: 13px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

@media (max-width: 760px) {
    .dashboard-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 17px 16px;
    }

    .brand-block h1 {
        font-size: 24px;
    }

    .brand-icon {
        width: 50px;
        height: 42px;
    }

    .brand-block p {
        font-size: 14px;
    }

    .update-block {
        width: 100%;
        justify-content: space-between;
        text-align: left;
    }

    .dashboard-shell {
        padding: 18px 14px;
    }

    .kpi-grid,
    .machines-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .kpi-card {
        min-height: 106px;
        grid-template-columns: 54px minmax(0, 1fr);
        padding: 18px;
    }

    .kpi-icon {
        width: 52px;
        height: 52px;
    }

    .kpi-card strong {
        font-size: 28px;
    }

    .machine-body {
        padding: 18px;
    }

    .machine-head {
        align-items: stretch;
        flex-direction: column;
    }

    .status-badge {
        width: fit-content;
    }

    .machine-metrics,
    .detail-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .detail-row strong {
        text-align: left;
    }

    .machine-foot {
        padding: 15px 18px;
    }

    .detail-dialog {
        inset: 0;
        top: 0;
        left: 0;
        width: 100vw;
        max-width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
        transform: none;
    }

    .detail-modal.is-productions .detail-dialog {
        inset: 0;
        width: 100vw;
        max-width: 100vw;
        max-height: 100dvh;
    }

    .detail-modal.is-productions .detail-header {
        padding: 18px;
        padding-right: 74px;
    }

    .detail-modal.is-productions .detail-body {
        padding: 16px;
    }

    .detail-header {
        padding: 18px;
        padding-right: 74px;
    }

    .detail-close {
        top: 18px;
        right: auto;
        left: min(330px, calc(100vw - 60px));
    }

    .detail-header h2 {
        font-size: 23px;
    }

    .detail-body {
        padding: 18px;
    }

    .detail-overview,
    .detail-info-grid,
    .detail-rules,
    .production-summary {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    .detail-metric,
    .detail-info-grid div,
    .detail-rules div,
    .production-chip,
    .event-card {
        min-width: 0;
    }

    .detail-actions,
    .productions-toolbar,
    .production-controls,
    .pause-panel-head,
    .day-context-head {
        align-items: stretch;
        flex-direction: column;
    }

    .pause-accounting,
    .pause-schedule,
    .day-context-grid,
    .day-lot-list {
        grid-template-columns: 1fr;
    }

    .detail-actions span {
        font-size: 13px;
    }

    .production-search {
        width: 100%;
    }

    .production-node summary {
        grid-template-columns: 28px minmax(0, 1fr);
    }

    .tree-stats {
        grid-column: 2;
        justify-content: flex-start;
    }

    .production-children {
        padding: 8px;
    }

    .detail-rules div {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .timeline::before {
        left: 16px;
    }

    .timeline-event {
        grid-template-columns: 34px minmax(0, 1fr);
        gap: 12px;
    }

    .event-time {
        grid-column: 2;
        padding-top: 0;
        text-align: left;
    }

    .event-marker {
        grid-row: 1 / span 2;
    }

    .event-card {
        grid-column: 2;
    }

    .event-topline {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .event-cause {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .stop-cause-control {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .event-card dl {
        grid-template-columns: 1fr;
    }

    th,
    td {
        padding: 12px 14px;
    }
}
