@import '../shared/document.css';

/* ============================================================
   RC BEAM DESIGN SUITE — STUDIO WORKSPACE & A4 SHEET STYLES
   SFS-EN 1992-1-1:2004 (Beam Flexure, Shear, Anchorage & Cracking)
   Standardized Studio Command Dock & A4 Sheet Architecture
   ============================================================ */

/* --- Workspace Wrapper (Centered Studio for Desktop) --- */
.workspace-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    max-width: 1480px;
    margin: 0 auto;
    padding: 0 16px;
    min-height: 100vh;
    box-sizing: border-box;
}

/* --- Left Sidebar Dock (Left-Hand Scrollbar) --- */
.app-sidebar-dock {
    width: 440px;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: var(--sp-md);
    display: flex;
    flex-direction: column;
    gap: var(--sp-sm);
    flex-shrink: 0;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    z-index: 10;
    box-sizing: border-box;
    margin-bottom: 16px;

    /* Move scrollbar to the left for clean visual boundary */
    direction: rtl;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
}

.app-sidebar-dock > * {
    direction: ltr; /* Reset children to standard LTR text */
}

.app-sidebar-dock::-webkit-scrollbar {
    width: 5px;
}
.app-sidebar-dock::-webkit-scrollbar-track {
    background: transparent;
}
.app-sidebar-dock::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}
.app-sidebar-dock:hover::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.30);
}

/* --- Dock Sections & Elements --- */
.dock-section {
    background: #fafaf8;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    padding: var(--sp-sm) var(--sp-md);
}

.dock-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-heading);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--sp-xs);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dock-section-title .badge-tag {
    font-size: 0.68rem;
    padding: 2px 6px;
    background: #e2e8f0;
    color: #334155;
    border-radius: 3px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
}

/* Input Fields inside Dock */
.dock-meta-field {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 3px;
    margin-bottom: 6px;
    height: 100%;
}

.dock-meta-field label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    line-height: 1.25;
}

.dock-meta-field label .unit {
    font-family: var(--font-mono);
    color: var(--color-text-muted);
    font-size: 0.70rem;
    flex-shrink: 0;
    margin-left: 4px;
}

.dock-meta-field input,
.dock-meta-field select {
    width: 100%;
    margin-top: auto;
    padding: 5px 8px;
    font-size: 0.82rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: #ffffff;
    color: var(--color-heading);
    box-sizing: border-box;
}

.dock-meta-field input:focus,
.dock-meta-field select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent-light);
}

.dock-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 6px;
}

.dock-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    margin-bottom: 6px;
}

/* Preset Selector Dropdown */
.dock-preset-select {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1.5px solid var(--color-accent);
    border-radius: 4px;
    background: var(--color-accent-bg);
    color: var(--color-accent);
    cursor: pointer;
    margin-bottom: 8px;
}

/* --- Utilization HUD / Scorecard in Left Dock --- */
.dock-hud-card {
    background: #ffffff;
    border: 1.5px solid var(--color-border);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 6px;
}

.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border-light);
}

.hud-title {
    font-size: 0.80rem;
    font-weight: 700;
    color: var(--color-heading);
    text-transform: uppercase;
}

.hud-verdict-pill {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.74rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.hud-verdict-pill.pass {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.hud-verdict-pill.fail {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.hud-meter-row {
    margin-bottom: 6px;
}

.hud-meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    margin-bottom: 2px;
}

.hud-meter-name {
    font-weight: 600;
    color: var(--color-heading);
}

.hud-meter-val {
    font-family: var(--font-mono);
    font-weight: 700;
}

.hud-progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.hud-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.2s ease, background-color 0.2s ease;
}

.hud-progress-fill.safe {
    background: #2e7d32;
}
.hud-progress-fill.warning {
    background: #e65100;
}
.hud-progress-fill.danger {
    background: #c62828;
}

/* Singly / Doubly Badge */
.hud-kern-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 8px;
}

.hud-kern-badge.in-kern {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.hud-kern-badge.out-kern {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

/* --- Right Side Main Workspace --- */
.app-main-workspace {
    flex: 1;
    min-width: 0;
    max-width: 1020px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Attached Hub Nav Bar */
.app-main-workspace .top-hub-nav {
    width: 100%;
    background: #e9e6df;
    border: 1px solid var(--color-border);
    border-top: none;
    border-bottom: 1px solid var(--color-border);
    padding: 8px 16px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Attached Export Bar */
.app-main-workspace .doc-actions-bar {
    width: 100%;
    background: #fcfbfa;
    border-left: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    border-top: none;
    border-bottom: 1px solid var(--color-border-light);
    padding: 8px 16px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-md);
    flex-wrap: wrap;
}

/* --- True A4 Printable Document Sheet --- */
.app-main-workspace .page-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    background: #fafaf8;
    border: 1px solid var(--color-border);
    border-top: none;
    box-shadow: 0 4px 16px var(--color-paper-shadow);
    padding: 24px 32px;
    box-sizing: border-box;
}

/* Interactive Beam Visualizer Card inside Sheet */
.beam-visualizer-card {
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: var(--sp-md);
    margin: var(--sp-sm) 0 var(--sp-md) 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.beam-visualizer-card .visualizer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-sm);
    padding-bottom: var(--sp-xs);
    border-bottom: 1px solid var(--color-border-light);
}

.beam-visualizer-card .visualizer-title {
    font-family: var(--font-serif);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-heading);
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.beam-visualizer-card .visualizer-view-toggle {
    display: flex;
    gap: 4px;
    background: var(--color-surface-sunken, #f1f3f5);
    padding: 3px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

.beam-visualizer-card .view-toggle-btn {
    border: none;
    background: transparent;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
}

.beam-visualizer-card .view-toggle-btn:hover {
    color: var(--color-heading);
}

.beam-visualizer-card .view-toggle-btn.active {
    background: #ffffff;
    color: var(--color-primary, #0055a3);
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.beam-svg-container {
    width: 100%;
    height: 250px;
    border: 1px solid var(--color-border-light);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.beam-svg-container svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Cross section & Elevation SVG visualizer in Tab 5 */
.section-visualizer-card {
    background: #fdfdfc;
    border: 1px solid var(--color-border);
    padding: var(--sp-md);
    margin-bottom: var(--sp-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.visualizer-title {
    font-family: var(--font-serif);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-heading);
    margin-bottom: var(--sp-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: 100%;
    border-bottom: 1px solid var(--color-border-light);
    padding-bottom: 4px;
}

.svg-container {
    width: 100%;
    max-width: 100%;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.svg-container--wide {
    max-width: 100%;
    height: 250px;
}

.svg-container svg {
    width: 100%;
    height: 100%;
}

/* Rebar & Stirrup selection table */
.rebar-selection-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin-top: var(--sp-sm);
    border: 1px solid var(--color-border);
}

.rebar-selection-table th {
    background: #f5f4f0;
    padding: 6px 10px;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--color-border);
    border-right: 1px solid var(--color-border-light);
    text-align: center;
}

.rebar-selection-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--color-border-light);
    border-right: 1px solid var(--color-border-light);
    text-align: center;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: background 0.15s;
}

.rebar-selection-table tr:hover td {
    background: var(--color-accent-light);
}

.rebar-selection-table tr.selected td {
    background: #e1edf8;
    font-weight: 700;
    color: var(--color-accent);
}

.rebar-badge-pass {
    display: inline-block;
    padding: 2px 6px;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 2px;
}

.rebar-badge-fail {
    display: inline-block;
    padding: 2px 6px;
    background: #ffebee;
    color: #c62828;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 2px;
}

/* Utilization ratio gauge bar */
.utilization-wrapper {
    margin: var(--sp-md) 0;
}

.utilization-bar-container {
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--color-border);
}

.utilization-bar-fill {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease-out, background-color 0.3s;
    background-color: var(--color-success);
}

.utilization-bar-fill.warning {
    background-color: var(--color-warning);
}

.utilization-bar-fill.danger {
    background-color: var(--color-error);
}

.utilization-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    margin-top: 4px;
    font-family: var(--font-mono);
}

/* Multi-drawing grid on Summary Tab */
.drawings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-md);
    margin-bottom: var(--sp-lg);
}

@media (max-width: 768px) {
    .drawings-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   ACTIVE ANCHORAGE / REBAR SOLUTION CARD
   ============================================================ */
.active-solution-card {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-left: 4px solid var(--color-primary, #0284c7);
    border-radius: var(--border-radius, 4px);
    padding: 0.85rem 1rem;
    margin: 1rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.active-solution-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.active-solution-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-heading, #0f172a);
}

.active-solution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem 1rem;
    font-size: 0.82rem;
    color: var(--color-text, #334155);
}

.active-solution-grid span {
    color: var(--color-text-secondary, #64748b);
}

/* ============================================================
   CUSTOM REBAR & DETAILING MODAL
   ============================================================ */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.modal-dialog {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-heading, #0f172a);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    padding: 0 0.25rem;
    border-radius: 4px;
}

.modal-close-btn:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.modal-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.modal-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem;
}

.modal-subtitle {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-primary, #0284c7);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.modal-preview-box {
    margin-top: 0.5rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 0.75rem 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.btn-cancel {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-cancel:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.btn-primary-action {
    background: #0284c7;
    color: #ffffff;
    border: 1px solid #0369a1;
    padding: 0.5rem 1.15rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-primary-action:hover {
    background: #0369a1;
}

/* ============================================================
   STRICT PRINT STYLING (A4 SHEET ONLY)
   ============================================================ */
@media print {
    /* Hide all workspace non-printable chrome */
    .app-sidebar-dock,
    .top-hub-nav,
    .doc-actions-bar,
    .tab-nav,
    .visualizer-view-toggle,
    .btn-calculate,
    .modal-backdrop,
    #modal-custom-rebar,
    #btn-open-custom-rebar-modal,
    .print-hide {
        display: none !important;
    }

    body {
        background: #ffffff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .workspace-wrapper {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .app-main-workspace {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .app-main-workspace .page-container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 10mm 12mm !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: #ffffff !important;
    }

    .calc-step,
    .beam-visualizer-card,
    .section-visualizer-card {
        box-shadow: none !important;
        border: 1px solid #bbb !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .beam-svg-container,
    .svg-container {
        height: 210px !important;
        border: 1px solid #ccc !important;
    }

    /* Print mode handling: full document vs active tab only */
    body:not(.print-active-tab-only) .tab-panel {
        display: block !important;
    }

    body.print-active-tab-only .tab-panel.active {
        display: block !important;
    }

    body.print-active-tab-only .tab-panel:not(.active) {
        display: none !important;
    }

    .print-page-break {
        page-break-before: always !important;
        break-before: page !important;
    }
}

/* ============================================================
   TOP HUB NAV CONTROLS & ACTIVE MEMBER BADGE
   ============================================================ */
.top-hub-nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.active-member-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #c8e6c9;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono, monospace);
}

.active-member-indicator .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2e7d32;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(46, 125, 50, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 125, 50, 0); }
}

.btn-toggle-drawer {
    background: var(--color-accent-bg, #e8f0fa);
    border: 1px solid var(--color-accent-border, #bcd3ed);
    color: var(--color-accent, #0055a3);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}
.btn-toggle-drawer:hover {
    background: var(--color-accent, #0055a3);
    color: #ffffff;
}

/* ============================================================
   COLLAPSIBLE MEMBER DRAWER
   ============================================================ */
.col-member-drawer,
.member-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 340px;
    max-width: 90vw;
    background: #ffffff;
    border-left: 1px solid var(--color-border, #e2e8f0);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1050;
}
.col-member-drawer.open,
.member-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
    background: #f7f6f3;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-heading-block {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.drawer-heading {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--color-heading, #1e293b);
    display: flex;
    align-items: center;
    gap: 6px;
}

.drawer-subheading {
    font-size: 0.72rem;
    color: var(--color-text-secondary, #64748b);
}

.btn-drawer-close {
    background: transparent;
    border: none;
    color: var(--color-text-muted, #94a3b8);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: all 0.15s;
}
.btn-drawer-close:hover {
    background: #e9e6df;
    color: var(--color-heading, #1e293b);
}

.drawer-toolbar {
    padding: 8px 12px;
    background: #fafaf8;
    border-bottom: 1px solid var(--color-border-light, #e2e8f0);
    display: flex;
    gap: 6px;
}

.btn-drawer-action {
    background: #ffffff;
    border: 1px solid var(--color-border, #cbd5e1);
    color: var(--color-text, #334155);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.12s;
}
.btn-drawer-action:hover {
    background: #f0ede8;
    border-color: var(--color-accent, #0055a3);
}
.btn-drawer-action--primary {
    background: var(--color-accent-bg, #e8f0fa);
    border-color: var(--color-accent-border, #bcd3ed);
    color: var(--color-accent, #0055a3);
}
.btn-drawer-action--primary:hover {
    background: var(--color-accent, #0055a3);
    color: #ffffff;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drawer-card {
    background: #fafaf8;
    border: 1px solid var(--color-border-light, #e2e8f0);
    border-radius: 5px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 3px;
    position: relative;
}
.drawer-card:hover {
    border-color: var(--color-accent, #0055a3);
    background: #f4f7fb;
    transform: translateY(-1px);
}
.drawer-card.active {
    background: #f0f7ff;
    border-color: var(--color-accent, #0055a3);
    box-shadow: 0 0 0 2px var(--color-accent-border, #bcd3ed);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-tag {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--color-heading, #1e293b);
}
.card-pill {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    text-transform: uppercase;
}
.pill-pass { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.pill-fail { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.pill-stale { background: #fff8e1; color: #b78103; border: 1px solid #ffe082; }

.card-details {
    font-size: 0.74rem;
    color: #4b5563;
    font-family: var(--font-mono, monospace);
    line-height: 1.35;
    background: #f3f1ec;
    padding: 3px 6px;
    border-radius: 3px;
    margin: 2px 0;
    display: flex;
    justify-content: space-between;
    gap: 4px;
}

.drawer-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--color-border, #e2e8f0);
    background: #f7f6f3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--color-text-secondary, #64748b);
}

/* ============================================================
   LINKED MODE HUD & LOAD BREAKDOWN STYLES
   ============================================================ */
.beam-linked-banner {
    background: #f0f9ff;
    border: 1.5px solid #bae6fd;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 8px;
}

.linked-banner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.linked-banner-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.btn-linked-action {
    flex: 1;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid #0284c7;
    background: #ffffff;
    color: #0369a1;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-linked-action:hover {
    background: #e0f2fe;
}

.btn-linked-action.detach {
    border-color: #cbd5e1;
    color: #64748b;
}

.btn-linked-action.detach:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.load-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.load-breakdown-table th,
.load-breakdown-table td {
    padding: 6px 8px;
    border: 1px solid var(--color-border-light, #e2e8f0);
}

.load-breakdown-table th {
    background: #f8fafc;
    color: var(--color-heading, #1e293b);
    font-weight: 700;
}

.load-breakdown-table tbody tr:nth-child(even) {
    background: #fafaf9;
}

/* Collapsible Step Styles */
.step-header.collapsible {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.step-header.collapsible:hover {
    background-color: #f8fafc;
}

.calc-step.collapsed .step-body {
    display: none !important;
}

@media print {
    .print-omit-loads #print-sec-load-breakdown {
        display: none !important;
    }
    .print-omit-signoff #print-signoff-block {
        display: none !important;
    }
    .print-omit-flexure #panel-flexure {
        display: none !important;
    }
    .print-omit-shear #panel-shear {
        display: none !important;
    }
    .print-omit-anchorage #panel-anchorage {
        display: none !important;
    }
    .print-omit-cracking #panel-cracking {
        display: none !important;
    }
    .print-omit-summary #panel-summary {
        display: none !important;
    }
    .print-omit-diagrams .beam-visualizer-card {
        display: none !important;
    }
}

/* ============================================================
   ENGINEERING TITLE BLOCK & NIMIÖ (Unified Standard)
   ============================================================ */
.front-page-container {
    margin-bottom: var(--sp-md);
}

.engineering-title-block,
.title-block-card {
    background: #ffffff;
    border: 2px solid #0f172a;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    box-sizing: border-box;
    margin-bottom: 0;
}

.engineering-title-block .title-block-main,
.title-block-card .title-block-main {
    padding: 10px 14px 8px 14px;
    border-bottom: 1.5px solid #0f172a;
    margin: 0;
    box-sizing: border-box;
}

.engineering-title-block.is-minimized,
.title-block-card.is-minimized {
    margin-bottom: 12px;
}

.engineering-title-block.is-minimized .title-block-main,
.title-block-card.is-minimized .title-block-main {
    border-bottom: none !important;
}

.engineering-title-block.is-minimized .title-block-grid,
.title-block-card.is-minimized .title-block-grid {
    display: none !important;
}

.engineering-title-block .title-block-grid,
.title-block-card .title-block-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-sizing: border-box;
}

.engineering-title-block .title-block-cell,
.title-block-card .title-block-cell {
    padding: 6px 10px;
    border-right: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
    background: #ffffff;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.engineering-title-block .title-block-cell:nth-child(4n),
.title-block-card .title-block-cell:nth-child(4n) {
    border-right: none;
}

.engineering-title-block .title-block-cell:nth-last-child(-n+4),
.title-block-card .title-block-cell:nth-last-child(-n+4) {
    border-bottom: none;
}

.title-block-input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-heading);
    padding: 2px 4px;
    border-radius: 3px;
    box-sizing: border-box;
    transition: all 0.15s ease;
}

.title-block-input:hover {
    border-color: var(--color-border);
    background: #ffffff;
}

.title-block-input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: #ffffff;
    box-shadow: 0 0 0 2px var(--color-accent-light);
}

.front-page-collapsible-content {
    transition: all 0.25s ease;
    overflow: hidden;
}

.front-page-collapsible-content.minimized {
    display: none !important;
}

.beam-properties-summary-card {
    transition: all 0.2s ease;
}

/* ============================================================
   PRINT CONFIGURATOR MODAL & WIREFRAME PREVIEW
   ============================================================ */
.modal-print-card {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.print-modal-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 16px;
    padding: 16px;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .print-modal-grid {
        grid-template-columns: 1fr;
    }
}

.btn-print-preset {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #334155;
}

.btn-print-preset:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.btn-print-preset.active {
    background: #0284c7;
    border-color: #0369a1;
    color: #ffffff;
}

.print-sections-checklist {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 8px 12px;
}

.print-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    cursor: pointer;
    padding: 2px 0;
}

.print-check-row input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* Live Wireframe Preview Panel */
.print-modal-preview {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
}

.print-preview-wireframe {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    max-height: 380px;
    padding-right: 4px;
}

.preview-page-sheet {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    font-size: 0.70rem;
}

.preview-sheet-header {
    border-bottom: 1.5px solid #0284c7;
    padding-bottom: 4px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    color: #0f172a;
}

.preview-sheet-badge {
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 2px;
}

.preview-section-item {
    background: #f8fafc;
    border-left: 3px solid #0284c7;
    padding: 4px 6px;
    margin-bottom: 4px;
    border-radius: 2px;
    font-size: 0.68rem;
    color: #334155;
    display: flex;
    justify-content: space-between;
}

/* ============================================================
   SIGNOFF BLOCK FOR PRINTS
   ============================================================ */
.print-signoff-block {
    margin-top: 24px;
    border-top: 1.5px solid var(--color-border, #e2e8f0);
    padding-top: 14px;
    break-inside: avoid;
    page-break-inside: avoid;
}

.signoff-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    font-size: 0.76rem;
}

.signoff-cell {
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 4px;
    padding: 8px 12px;
    background: #fafaf8;
}

.signoff-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    font-weight: 700;
    margin-bottom: 4px;
}

.signoff-line {
    border-bottom: 1px solid #94a3b8;
    margin-top: 22px;
    margin-bottom: 4px;
}

/* Suite Badge Spacing Standard */
.suite-badge {
    margin-left: 10px;
}

/* Dock & Drawer Member Locking Standard */
.dock-locked-banner {
    display: none;
    align-items: center;
    gap: 6px;
    background: #fff8e6;
    border: 1px solid #ffe082;
    padding: 7px 10px;
    border-radius: 4px;
    margin-top: 8px;
    font-size: 0.74rem;
    color: #856404;
    font-weight: 600;
}

.dock-is-locked {
    border-left: 4px solid #f59e0b !important;
}

.card-lock-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 4px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    line-height: 1;
}

.card-lock-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.card-pill.locked {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    font-weight: 700;
}

/* Dock Rebar Summary Status Pills */
.dock-rebar-summary {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-left: 3px solid #0284c7;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 0.72rem;
    font-family: var(--font-mono, monospace);
    color: #1e293b;
    margin-top: 4px;
    margin-bottom: 6px;
    line-height: 1.35;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.dock-rebar-summary.pass {
    border-left-color: #16a34a;
    background: #f0fdf4;
}
.dock-rebar-summary.fail {
    border-left-color: #dc2626;
    background: #fef2f2;
}
.dock-rebar-summary .badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    white-space: nowrap;
}
.dock-rebar-summary .badge.ok {
    background: #dcfce7;
    color: #166534;
}
.dock-rebar-summary .badge.fail {
    background: #fee2e2;
    color: #991b1b;
}
