:root {
    --brand-navy: #073a59;
    --brand-navy-dark: #052b42;
    --brand-blue: #0b5f86;
    --brand-blue-soft: #eaf3f7;
    --brand-orange: #ef7d00;
    --brand-orange-dark: #d86e00;
    --brand-yellow: #f7b500;
    --surface: #ffffff;
    --surface-soft: #f5f8fa;
    --surface-muted: #edf2f5;
    --border: #d7e0e5;
    --text: #17252f;
    --text-muted: #657681;
    --success: #24835b;
    --success-soft: #e9f6ef;
    --danger: #b33a3a;
    --danger-soft: #fcecec;
    --warning: #a86700;
    --warning-soft: #fff4df;
    --shadow-sm: 0 2px 10px rgba(7, 58, 89, 0.06);
    --shadow-md: 0 12px 30px rgba(7, 58, 89, 0.10);
    --radius-sm: 7px;
    --radius: 12px;
    --radius-lg: 18px;
    font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--surface-soft);
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    background: var(--surface-soft);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

button,
input,
textarea,
select {
    font: inherit;
}

a {
    color: var(--brand-blue);
}

.container {
    width: min(1240px, calc(100% - 48px));
    margin: 0 auto;
}

.topbar {
    background: linear-gradient(105deg, var(--brand-navy-dark), var(--brand-navy));
    border-bottom: 3px solid var(--brand-orange);
    box-shadow: 0 4px 18px rgba(5, 43, 66, 0.18);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-row {
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 30px;
}

.brand {
    min-width: 310px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: white;
}

.brand-logo {
    width: 136px;
    height: auto;
    display: block;
}

.brand-divider {
    width: 1px;
    height: 34px;
    background: rgba(255, 255, 255, 0.28);
}

.brand-product {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.035em;
    white-space: nowrap;
}

.main-nav {
    display: flex;
    align-items: stretch;
    align-self: stretch;
    gap: 2px;
}

.main-nav a {
    display: flex;
    align-items: center;
    padding: 0 15px;
    color: rgba(255, 255, 255, 0.84);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: 0.16s ease;
}

.main-nav a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
    border-bottom-color: var(--brand-orange);
}

.account-nav {
    margin-left: auto;
}

.account-menu,
.account-identity {
    display: flex;
    align-items: center;
}

.account-menu {
    gap: 12px;
}

.account-identity {
    gap: 9px;
    color: white;
}

.account-avatar {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--brand-orange);
    color: white;
    font-weight: 800;
}

.account-name {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    font-size: 14px;
}

.page-content {
    padding-top: 38px;
    padding-bottom: 72px;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.page-header h1,
h1,
h2,
h3 {
    color: var(--text);
}

.page-header h1 {
    margin: 2px 0 4px;
    font-size: clamp(30px, 3vw, 42px);
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.page-subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 16px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.eyebrow {
    color: var(--brand-orange-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.panel,
.metric-card,
.table-shell {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.panel {
    border-radius: var(--radius);
    padding: 24px;
}

.panel h2,
.panel h3 {
    margin: 4px 0 0;
}

.panel-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.panel-copy {
    margin: 0 0 22px;
    color: var(--text-muted);
    max-width: 720px;
}

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

.metric-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    padding: 22px 22px 20px;
}

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

.metric-card.accent-orange::before { background: var(--brand-orange); }
.metric-card.accent-green::before { background: var(--success); }
.metric-card.accent-slate::before { background: #6b7780; }

.metric-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.055em;
}

.metric-value {
    margin-top: 7px;
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -0.035em;
    color: var(--brand-navy);
}

.metric-note {
    margin-top: 2px;
    color: #87949c;
    font-size: 13px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
    gap: 20px;
}

.workflow-steps {
    display: grid;
    gap: 12px;
    margin: 4px 0 24px;
}

.workflow-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 13px 0;
    border-bottom: 1px solid #edf1f3;
}

.workflow-step:last-child {
    border-bottom: 0;
}

.workflow-step > span {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--brand-blue-soft);
    color: var(--brand-blue);
    font-weight: 800;
}

.workflow-step strong,
.workflow-step small {
    display: block;
}

.workflow-step small {
    margin-top: 2px;
    color: var(--text-muted);
}

.station-placeholder {
    background: linear-gradient(160deg, #ffffff, #f1f7fa);
}

.station-visual {
    min-height: 150px;
    display: flex;
    align-items: center;
    gap: 18px;
    border: 1px dashed #bed0da;
    border-radius: 10px;
    padding: 22px;
}

.station-visual p {
    margin: 4px 0 0;
    color: var(--text-muted);
}

.station-pulse {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 50%;
    background: radial-gradient(circle at center, #9fb1bb 0 28%, #dfe8ec 29% 55%, #eef3f5 56% 100%);
}

.btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 9px 15px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    transition: 0.14s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.btn-primary {
    color: white;
    border-color: var(--brand-orange);
    background: var(--brand-orange);
    box-shadow: 0 4px 12px rgba(239, 125, 0, 0.20);
}

.btn-primary:hover:not(:disabled) {
    background: var(--brand-orange-dark);
    border-color: var(--brand-orange-dark);
}

.btn-secondary {
    color: var(--brand-navy);
    background: white;
    border-color: #aebdc5;
}

.btn-secondary:hover:not(:disabled) {
    background: #f6f9fa;
    border-color: #8497a1;
}

.btn-ghost {
    color: rgba(255, 255, 255, 0.88);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.30);
}

.btn-ghost:hover:not(:disabled) {
    color: white;
    background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
    color: white;
    border-color: var(--danger);
    background: var(--danger);
}

.btn-sm {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
}

.btn-lg {
    min-height: 48px;
    padding: 12px 18px;
    font-size: 15px;
}

.btn-block {
    width: 100%;
}

.table-shell {
    overflow: hidden;
    border-radius: var(--radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 16px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #e7edef;
}

.table th {
    background: #f3f7f9;
    color: #5e707a;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.075em;
    font-weight: 800;
}

.table tbody tr {
    transition: background 0.12s ease;
}

.table tbody tr:hover {
    background: #f8fbfc;
}

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

.table-primary-link {
    color: var(--brand-blue);
    font-weight: 800;
    text-decoration: none;
}

.table-primary-link:hover {
    text-decoration: underline;
}

.status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.025em;
    background: #edf2f4;
    color: #5e707a;
}

.status-registered,
.status-created,
.status-neutral {
    background: var(--brand-blue-soft);
    color: var(--brand-blue);
}

.status-inprogress,
.status-authorizationpending,
.status-authorized,
.status-running {
    background: var(--warning-soft);
    color: var(--warning);
}

.status-completed {
    background: var(--success-soft);
    color: var(--success);
}

.status-cancelled,
.status-aborted,
.status-failed {
    background: var(--danger-soft);
    color: var(--danger);
}

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

.form-section {
    padding: 26px;
}

.form-section-heading {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding-bottom: 20px;
    margin-bottom: 22px;
    border-bottom: 1px solid #e7edef;
}

.form-section-heading h2 {
    margin: 0;
    font-size: 18px;
}

.form-section-heading p {
    margin: 3px 0 0;
    color: var(--text-muted);
}

.section-number {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    border-radius: 8px;
    background: var(--brand-navy);
    color: white;
    font-weight: 800;
    font-size: 12px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    color: #40515b;
    font-size: 13px;
    font-weight: 700;
}

.form-control {
    width: 100%;
    min-height: 42px;
    border: 1px solid #afbec6;
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    color: var(--text);
    background: white;
    outline: none;
    transition: border 0.14s ease, box-shadow 0.14s ease;
}

.form-control:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(11, 95, 134, 0.12);
}

.form-control-lg {
    min-height: 48px;
    padding: 11px 13px;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.field-validation-error,
.validation-summary-errors {
    color: var(--danger);
    font-size: 13px;
}

.validation-summary-errors {
    margin-bottom: 18px;
    padding: 12px 14px;
    background: var(--danger-soft);
    border: 1px solid #efbcbc;
    border-radius: var(--radius-sm);
}

.validation-summary-errors ul {
    margin: 0;
    padding-left: 20px;
}

.form-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.details-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.45fr);
    gap: 20px;
    margin-bottom: 32px;
}

.definition-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 0;
    margin: 0;
}

.definition-grid dt,
.definition-grid dd {
    padding: 11px 0;
    border-bottom: 1px solid #edf1f3;
}

.definition-grid dt {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

.definition-grid dd {
    margin: 0;
    font-weight: 600;
}

.definition-grid dt:last-of-type,
.definition-grid dd:last-of-type {
    border-bottom: 0;
}

.trace-panel {
    background: linear-gradient(165deg, var(--brand-navy), var(--brand-navy-dark));
    color: white;
    border: 0;
}

.trace-panel .eyebrow {
    color: #ffb45f;
}

.trace-panel h2 {
    color: white;
    margin-bottom: 20px;
}

.trace-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.trace-item span,
.trace-notes span {
    color: rgba(255, 255, 255, 0.62);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.075em;
    font-weight: 700;
}

.trace-item strong {
    font-size: 14px;
}

.trace-notes {
    padding-top: 16px;
}

.trace-notes p {
    margin-bottom: 0;
}

.title-with-status {
    display: flex;
    align-items: center;
    gap: 13px;
}

.title-with-status h1 {
    margin-right: 2px;
}

.section-heading {
    margin-top: 32px;
    margin-bottom: 14px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.section-heading h2 {
    margin: 2px 0 0;
}

.section-heading .spacer {
    flex: 1;
}

.completion-panel {
    margin-top: 26px;
    display: grid;
    grid-template-columns: 1fr minmax(360px, 0.8fr);
    align-items: center;
    gap: 30px;
}

.completion-panel h2 {
    margin: 3px 0 5px;
}

.completion-panel p {
    margin: 0;
    color: var(--text-muted);
}

.completion-form {
    display: grid;
    justify-items: start;
    gap: 14px;
}

.completion-form small {
    color: var(--text-muted);
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: #41525c;
    cursor: pointer;
}

.check-row input {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    accent-color: var(--brand-orange);
}

.alert {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 20px;
    font-weight: 600;
}

.alert.success {
    background: var(--success-soft);
    border: 1px solid #a7d6bd;
    color: #1e6c4b;
}

.alert.error {
    background: var(--danger-soft);
    border: 1px solid #efbcbc;
    color: #923333;
}

.empty-state {
    text-align: center;
    padding: 58px 28px;
}

.empty-state.compact {
    padding: 34px 24px;
}

.empty-state h2,
.empty-state h3 {
    margin: 12px 0 5px;
}

.empty-state p {
    margin: 0 auto 20px;
    color: var(--text-muted);
    max-width: 620px;
}

.empty-state-icon {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--brand-blue-soft);
    color: var(--brand-blue);
    font-size: 19px;
    font-weight: 900;
}

.muted {
    color: var(--text-muted);
}

/* Authentication ---------------------------------------------------------- */
.auth-page {
    background: white;
}

.auth-main {
    min-height: 100vh;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, 0.95fr) minmax(520px, 1.05fr);
}

.auth-brand-panel {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 64px clamp(46px, 7vw, 110px);
    background:
        radial-gradient(circle at 20% 20%, rgba(239, 125, 0, 0.22), transparent 30%),
        radial-gradient(circle at 85% 82%, rgba(11, 95, 134, 0.55), transparent 34%),
        linear-gradient(150deg, #052b42 0%, #073a59 55%, #0b5677 100%);
    color: white;
}

.auth-brand-panel::after {
    content: "";
    position: absolute;
    width: 430px;
    height: 430px;
    right: -220px;
    top: -180px;
    border: 55px solid rgba(255, 255, 255, 0.035);
    border-radius: 50%;
}

.auth-brand-content {
    position: relative;
    z-index: 2;
    max-width: 650px;
}

.auth-logo {
    display: block;
    height: auto;
}

.auth-logo-white {
    width: min(300px, 70%);
    margin-bottom: 58px;
}

.auth-logo-color {
    width: 190px;
    margin-bottom: 42px;
}

.auth-product-label {
    color: #ffae4c;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.auth-brand-panel h1 {
    color: white;
    margin: 12px 0 18px;
    font-size: clamp(38px, 4.2vw, 62px);
    line-height: 1.06;
    letter-spacing: -0.04em;
    max-width: 760px;
}

.auth-brand-panel p {
    max-width: 650px;
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 17px;
    line-height: 1.7;
}

.auth-feature-list {
    display: grid;
    gap: 12px;
    margin-top: 42px;
    color: rgba(255, 255, 255, 0.90);
    font-weight: 600;
}

.auth-feature-list > div {
    display: flex;
    align-items: center;
    gap: 11px;
}

.auth-feature-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--brand-orange);
    box-shadow: 0 0 0 5px rgba(239, 125, 0, 0.14);
}

.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px;
    background: #f8fafb;
}

.auth-card {
    width: min(100%, 480px);
    padding: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: white;
    box-shadow: var(--shadow-md);
}

.auth-card-heading {
    margin-bottom: 28px;
}

.auth-card-heading h2 {
    margin: 4px 0 7px;
    font-size: 30px;
    letter-spacing: -0.025em;
}

.auth-card-heading p {
    margin: 0;
    color: var(--text-muted);
}

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

.auth-secondary-action {
    margin-top: 25px;
    padding-top: 22px;
    border-top: 1px solid #e8edef;
    color: var(--text-muted);
    font-size: 13px;
}

.auth-secondary-action a {
    margin-left: 5px;
    font-weight: 700;
    text-decoration: none;
}

.auth-secondary-action a:hover {
    text-decoration: underline;
}

@media (max-width: 1050px) {
    .brand {
        min-width: auto;
    }

    .brand-product,
    .brand-divider {
        display: none;
    }

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

    .dashboard-grid,
    .details-grid,
    .completion-panel {
        grid-template-columns: 1fr;
    }

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

    .auth-brand-panel {
        min-height: 360px;
    }

    .auth-brand-panel h1 {
        font-size: 40px;
    }

    .auth-feature-list {
        display: none;
    }

    .auth-logo-white {
        margin-bottom: 30px;
    }
}

@media (max-width: 760px) {
    .container {
        width: min(100% - 28px, 1240px);
    }

    .nav-row {
        min-height: auto;
        flex-wrap: wrap;
        gap: 8px 14px;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .brand-logo {
        width: 112px;
    }

    .main-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
    }

    .main-nav a {
        min-height: 42px;
        padding: 0 12px;
        white-space: nowrap;
    }

    .account-name {
        display: none;
    }

    .page-content {
        padding-top: 26px;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-header-actions,
    .page-header-actions .btn {
        width: 100%;
    }

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

    .definition-grid {
        grid-template-columns: 1fr;
    }

    .definition-grid dt {
        padding-bottom: 3px;
        border-bottom: 0;
    }

    .definition-grid dd {
        padding-top: 0;
    }

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

    .table {
        min-width: 780px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-heading .spacer {
        display: none;
    }

    .auth-brand-panel {
        min-height: 270px;
        padding: 40px 28px;
    }

    .auth-logo-white {
        width: 200px;
        margin-bottom: 25px;
    }

    .auth-brand-panel h1 {
        font-size: 32px;
    }

    .auth-brand-panel p {
        font-size: 15px;
    }

    .auth-form-panel {
        padding: 28px 18px 40px;
    }

    .auth-card {
        padding: 28px 22px;
        box-shadow: none;
    }

    .auth-logo-color {
        width: 160px;
        margin-bottom: 28px;
    }
}

/* Gestione anagrafiche e amministrazione --------------------------------- */
.account-link {
    text-decoration: none;
}

.account-link:hover .account-name {
    text-decoration: underline;
}

.narrow-panel {
    width: min(100%, 720px);
    margin: 0 auto;
}

.field-help {
    color: var(--text-muted);
    font-size: 12px;
}

.field-help a {
    font-weight: 700;
    text-decoration: none;
}

.table-actions {
    white-space: nowrap;
}

.table-actions .btn + .btn {
    margin-left: 6px;
}

.alert.warning {
    background: var(--warning-soft);
    border: 1px solid #e9c77e;
    color: #7c5000;
}

.alert.security {
    background: var(--brand-blue-soft);
    border: 1px solid #b6d4e1;
    color: var(--brand-navy);
}

.alert a {
    color: inherit;
    font-weight: 800;
}

.auth-security-note {
    margin-top: 24px;
    padding: 13px 14px;
    border-radius: var(--radius-sm);
    background: #f1f6f8;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.management-danger-zone {
    margin-top: 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.management-danger-zone h2 {
    margin: 3px 0 4px;
}

.management-danger-zone p {
    margin: 0;
    color: var(--text-muted);
}

.compact-station-visual {
    min-height: 120px;
    margin-top: 18px;
}

select.form-control {
    appearance: auto;
}

@media (max-width: 1180px) {
    .nav-row {
        gap: 18px;
    }

    .brand {
        min-width: 250px;
    }

    .main-nav a {
        padding-left: 11px;
        padding-right: 11px;
        font-size: 14px;
    }
}

@media (max-width: 760px) {
    .management-danger-zone {
        align-items: flex-start;
        flex-direction: column;
    }

    .management-danger-zone form,
    .management-danger-zone .btn {
        width: 100%;
    }
}

.reopen-form {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: min(100%, 520px);
}

.reopen-form .form-control {
    flex: 1;
}

@media (max-width: 760px) {
    .reopen-form {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
}

/* PLC RUN_RESULT details */
.analysis-result-row td {
    padding: 0;
    background: #f8fafb;
}

.analysis-result-details {
    border-top: 1px solid #e3eaee;
}

.analysis-result-details > summary {
    cursor: pointer;
    padding: 12px 16px;
    color: var(--brand-blue);
    font-weight: 800;
    list-style-position: inside;
}

.analysis-result-content {
    padding: 0 16px 18px;
}

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

.analysis-result-meta > div {
    padding: 10px 12px;
    border: 1px solid #e3eaee;
    border-radius: var(--radius-sm);
    background: white;
}

.analysis-result-meta span {
    display: block;
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.analysis-result-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.analysis-result-grid > section {
    border: 1px solid #e3eaee;
    border-radius: var(--radius-sm);
    background: white;
    overflow: hidden;
}

.analysis-result-grid h4 {
    margin: 0;
    padding: 11px 12px;
    border-bottom: 1px solid #e3eaee;
    font-size: 14px;
}

.result-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.result-mini-table th,
.result-mini-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #edf1f3;
    text-align: left;
}

.result-mini-table th:last-child,
.result-mini-table td:last-child {
    text-align: right;
}

.result-total-row td {
    font-weight: 800;
    border-bottom: 0;
}

.pressure-result-card dl {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0;
    margin: 0;
    padding: 4px 12px 10px;
}

.pressure-result-card dt,
.pressure-result-card dd {
    margin: 0;
    padding: 7px 0;
    border-bottom: 1px solid #edf1f3;
}

.pressure-result-card dt {
    color: var(--text-muted);
    font-weight: 700;
}

.pressure-result-card dd {
    text-align: right;
    font-weight: 800;
}

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

    .analysis-result-grid {
        grid-template-columns: 1fr;
    }
}

/* PLC authorization actions */
.analysis-action-cell {
    min-width: 190px;
}

.analysis-authorize-form {
    display: flex;
    align-items: end;
    gap: 8px;
    flex-wrap: wrap;
}

.analysis-authorize-form label {
    display: grid;
    gap: 3px;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.analysis-authorize-form input[type="number"] {
    width: 78px;
    min-height: 34px;
    padding: 6px 8px;
    border: 1px solid #cbd8de;
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text-main);
}

.btn-small {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 12px;
}

.analysis-action-note {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.analysis-message-row td {
    padding: 0 12px 10px;
    background: #fffaf3;
}

.analysis-message {
    padding: 9px 11px;
    border-left: 3px solid #d97706;
    background: #fff7ed;
    color: #7c2d12;
    font-size: 12px;
    font-weight: 700;
}


/* Login page: single centered card ----------------------------------------- */
/*
   The original authentication layout had two columns (brand panel + form).
   The Login view now contains only the card, so make the unauthenticated shell
   a true viewport-centered layout instead of leaving an empty grid column.
*/
.auth-page {
    background: var(--surface-soft);
}

.auth-main {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.auth-shell {
    width: 100%;
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: min(100%, 480px);
    margin: 0 auto;
}

@media (max-width: 760px) {
    .auth-main {
        padding: 20px 14px;
    }
}
