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

/* ============================================================
   RC CORBEL DESIGN SUITE — STUDIO WORKSPACE & A4 SHEET STYLES
   SFS-EN 1992-1-1:2004 Annex J.3 Precast Corbel Studio
   ============================================================ */

:root {
    --drawer-width: 350px;
    --color-cct: #d97706;
    --color-ccc: #2563eb;
    --color-strut: #dc2626;
    --color-tie: #059669;
}

/* ============================================================
   WORKSPACE WRAPPER & STUDIO LAYOUT
   ============================================================ */

/* --- 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);
    transition: all 0.15s ease;
}

.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.collapsible {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease;
}

.dock-section-title.collapsible:hover {
    color: var(--color-accent, #0055a3);
}

.dock-section .collapse-icon {
    font-size: 0.70rem;
    color: var(--color-text-secondary);
    transition: transform 0.2s ease;
    display: inline-block;
    line-height: 1;
}

.dock-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.dock-section.collapsed {
    padding-bottom: var(--sp-xs);
}

.dock-section.collapsed .dock-section-title {
    margin-bottom: 0;
}

.dock-section.collapsed .dock-section-body {
    display: none;
}

.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;
}

.scorecard-subtext {
    font-size: 0.68rem;
    color: var(--color-text-secondary);
}
.score-subtext--pass {
    color: #2e7d32;
    font-weight: 600;
}
.score-subtext--warn {
    color: #e65100;
    font-weight: 600;
}
.score-subtext--fail {
    color: #c62828;
    font-weight: 600;
}

/* --- 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;
}

/* Attached Tab Nav */
.app-main-workspace .tab-nav {
    width: 100%;
    box-sizing: border-box;
    border-left: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
}

/* --- 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;
    margin-bottom: 40px;
}

/* Front Page Title Block & Properties Card (Official Drawing Nimiö Style) */
.front-page-container {
    margin-bottom: 16px;
}

/* CAD Nimiö (Official drawing 3-line square perimeter box) */
.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-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
    display: block;
}

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

.title-block-input:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

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

/* Corbel Key Properties & Reinforcement Summary Card (Standard card style directly below nimiö) */
.corbel-properties-summary-card {
    background: #f8fafc;
    border: 1.5px solid var(--color-border);
    border-radius: 6px;
    padding: 12px 16px;
    margin-top: 12px;
    margin-bottom: 16px;
}

.corbel-properties-summary-card strong {
    color: #0f172a;
}

.btn-minimize-front:hover {
    background: var(--color-accent-bg, #f0f7ff) !important;
    border-color: var(--color-accent, #0284c7) !important;
}

/* ============================================================
   CORBEL DIAGRAMS, VISUALIZERS & DRAWINGS
   ============================================================ */

/* Section & Elevation Visualizer Cards */
.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%;
    min-height: 360px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
}

.svg-container--wide {
    max-width: 100%;
    min-height: 420px;
    height: auto;
}

.svg-container svg {
    width: 100%;
    height: auto;
    max-height: 520px;
    display: block;
}

/* Layer controls above SVG */
.svg-layer-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    width: 100%;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--color-border-light);
    position: relative;
    z-index: 10;
}

.layer-btn {
    font-size: 0.72rem;
    padding: 3px 9px;
    border-radius: 3px;
    border: 1px solid var(--color-border);
    background: #ffffff;
    cursor: pointer;
    font-weight: 600;
    color: var(--color-text-secondary);
    transition: all 0.15s;
}

.layer-btn:hover {
    background: #f4f4f2;
    border-color: #d1d5db;
}

.layer-btn.active {
    background: var(--color-accent, #0055a3);
    color: #ffffff;
    border-color: var(--color-accent, #0055a3);
}

/* ============================================================
   PARAMETER PROVENANCE & STATUS PILLS
   ============================================================ */

.prov-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 5px;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-left: 6px;
    font-family: var(--font-sans);
}
.prov-normative { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.prov-na { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.prov-product { background: #f3e8ff; color: #6b21a8; border: 1px solid #e9d5ff; }
.prov-model { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }
.prov-default { background: #f3f4f6; color: #4b5563; border: 1px solid #e5e7eb; }
.prov-input { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }

/* Status Badges & Pills */
.badge-status {
    display: inline-block;
    padding: 2px 7px;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 3px;
    text-align: center;
    font-family: var(--font-mono);
}
.badge-status-pass { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.badge-status-warn { background: #fff8e1; color: #e65100; border: 1px solid #ffe082; }
.badge-status-fail { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.badge-status-na { background: #f5f5f5; color: #757575; border: 1px solid #e0e0e0; }

.scorecard-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 0.74rem;
    font-weight: 700;
    font-family: var(--font-mono);
    border-radius: 4px;
    letter-spacing: 0.02em;
}
.scorecard-pill.pill-pass { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.scorecard-pill.pill-warn { background: #fff8e1; color: #e65100; border: 1px solid #ffe082; }
.scorecard-pill.pill-fail { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }

/* Compact Hero Card matching Column Module */
.result-hero--compact {
    padding: var(--sp-md) var(--sp-lg);
    margin-bottom: var(--sp-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    gap: var(--sp-md);
    background: var(--color-surface-offset, #fafaf8);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md, 6px);
}

.result-hero--compact .result-hero-main {
    display: flex;
    flex-direction: column;
}

.result-hero--compact .result-hero-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 2px;
}

.result-hero--compact .result-hero-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--color-primary, #0f172a);
}

.result-hero--compact .result-hero-unit {
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.result-hero--compact .result-hero-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.result-hero--compact .result-hero-sublabel {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
    font-weight: 600;
    margin-bottom: 4px;
}

.result-hero--compact .result-hero-subvalue {
    font-size: 0.85rem;
    font-weight: 700;
}

@media (max-width: 600px) {
    .result-hero--compact {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    .result-hero--compact .result-hero-meta {
        align-items: flex-start;
        text-align: left;
        margin-top: var(--sp-xs);
    }
}

.param-badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
    margin: 10px 0 14px 0;
}

.param-badge-card {
    background: #ffffff;
    border: 1px solid var(--color-border-light);
    border-radius: 4px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
}

.param-badge-label {
    font-size: 0.68rem;
    color: var(--color-text-secondary);
    margin-bottom: 2px;
}

.param-badge-value {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--color-heading);
    font-family: var(--font-mono);
}


/* ============================================================
   MEMBER DRAWER (KONSOLILUETTELO)
   ============================================================ */

.btn-toggle-corbel-drawer {
    background: var(--color-accent, #0055a3);
    color: #ffffff;
    border: 1px solid rgba(0,0,0,0.15);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.15s;
}

.btn-toggle-corbel-drawer:hover {
    background: #004482;
    transform: translateY(-1px);
}

.active-corbel-indicator {
    background: #ffffff;
    border: 1px solid var(--color-border);
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--color-heading);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.active-corbel-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2e7d32;
}

.member-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--drawer-width);
    background: #ffffff;
    border-left: 1px solid var(--color-border);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1050;
}

.member-drawer.open {
    transform: translateX(0);
}

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

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

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

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

.btn-drawer-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

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

.btn-drawer-action {
    flex: 1;
    padding: 5px 8px;
    font-size: 0.73rem;
    font-weight: 600;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--color-text-primary, #1a2744);
    transition: all 0.15s;
}

.btn-drawer-action:hover {
    background: #f5f5f4;
    border-color: #d1d5db;
}

.btn-drawer-action--primary {
    background: var(--color-accent-bg, #e8f0fa);
    color: var(--color-accent, #0055a3);
    border-color: var(--color-accent);
}

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

.drawer-card {
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 10px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.drawer-card:hover {
    border-color: var(--color-accent);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.drawer-card.active {
    border-color: var(--color-accent);
    background: #f0f7ff;
    border-left: 4px solid var(--color-accent);
    box-shadow: 0 0 0 1px var(--color-accent);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.card-tag {
    font-weight: 700;
    font-size: 0.84rem;
    color: var(--color-heading);
    font-family: var(--font-mono);
}

.card-pill {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
}

.pill-pass { background: #e8f5e9; color: #2e7d32; }
.pill-warn { background: #fff8e1; color: #e65100; }
.pill-fail { background: #ffebee; color: #c62828; }

.card-details {
    display: flex;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
    border-top: 1px dashed var(--color-border-light);
    margin-top: 5px;
    padding-top: 4px;
}

.drawer-footer {
    padding: 8px 14px;
    border-top: 1px solid var(--color-border);
    background: #f7f6f3;
    font-size: 0.74rem;
    color: var(--color-text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ============================================================
   REBAR SELECTION TABLES & DETAILS
   ============================================================ */

.rebar-selection-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin-top: 8px;
    background: #ffffff;
    border: 1px solid var(--color-border);
}

.rebar-selection-table th {
    background: #f8fafc;
    color: var(--color-heading);
    font-weight: 700;
    padding: 7px 10px;
    text-align: left;
    border-bottom: 2px solid var(--color-border);
    font-size: 0.74rem;
}

.rebar-selection-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: middle;
}

.rebar-selection-table tr:hover {
    background: #f1f5f9;
}

.rebar-selection-table tr.selected {
    background: #eef6ff;
    font-weight: 500;
}

.rebar-selection-table tr.selected td {
    border-bottom-color: #bfdbfe;
}

.rebar-badge-pass {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.rebar-badge-warn {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.rebar-badge-fail {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

/* ============================================================
   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;
}

.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;
}

/* ============================================================
   RESPONSIVE MEDIA QUERIES
   ============================================================ */

@media (max-width: 1100px) {
    .workspace-wrapper {
        flex-direction: column;
        align-items: center;
        padding: 0 8px;
    }

    .app-sidebar-dock {
        width: 100%;
        max-width: 1000px;
        position: static;
        max-height: none;
        margin-bottom: 16px;
        direction: ltr;
    }

    .app-main-workspace {
        width: 100%;
        max-width: 1000px;
    }
}

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

    .top-hub-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .top-hub-nav-actions {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    .doc-actions-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-main-workspace .page-container {
        padding: 16px;
    }
}

/* ============================================================
   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,
    .btn-calculate,
    .member-drawer,
    .svg-layer-controls,
    .btn-drawer-action,
    .modal-overlay,
    #modal-corbel-print,
    .print-hide {
        display: none !important;
    }

    body {
        background: #ffffff !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 11pt !important;
        line-height: 1.4 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !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: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: #ffffff !important;
    }

    .calc-step,
    .section-visualizer-card {
        box-shadow: none !important;
        border: 1px solid #94a3b8 !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        margin-bottom: 12px !important;
    }

    /* Expand collapsible steps */
    .calc-step .step-body {
        display: block !important;
    }

    /* Clean title block inputs on print */
    .title-block-input,
    input.title-block-input {
        border: none !important;
        background: transparent !important;
        color: #000000 !important;
        box-shadow: none !important;
        font-weight: 600 !important;
        padding: 0 !important;
        margin: 0 !important;
        outline: none !important;
    }

    .title-block-card {
        border: 1px solid #64748b !important;
        background: #ffffff !important;
        padding: 10px 14px !important;
        margin-bottom: 12px !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .corbel-properties-summary-card {
        background: #f8fafc !important;
        border: 1.5px solid #334155 !important;
        border-radius: 4px !important;
        padding: 10px 14px !important;
        margin-bottom: 14px !important;
        page-break-inside: avoid;
        break-inside: avoid;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .corbel-properties-summary-card strong {
        color: #0f172a !important;
    }

    .corbel-properties-summary-card .scorecard-pill {
        border: 1px solid #0f172a !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .svg-container,
    .svg-container--wide {
        height: 220px !important;
        max-width: 100% !important;
    }

    /* Print mode handling: full document vs active tab only */
    body:not(.print-active-tab-only) .tab-panel {
        display: block !important;
        page-break-after: always !important;
        break-after: page !important;
        margin-bottom: 20px !important;
    }

    body:not(.print-active-tab-only) .tab-panel:last-child {
        page-break-after: auto !important;
        break-after: auto !important;
    }

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

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

    /* Selective Section Omission Classes */
    body.print-omit-stm #panel-tab-stm { display: none !important; }
    body.print-omit-rebar #panel-tab-rebar { display: none !important; }
    body.print-omit-bearing #panel-tab-bearing { display: none !important; }
    body.print-omit-fasteners #panel-tab-fasteners { display: none !important; }
    body.print-omit-detailing #panel-tab-detailing { display: none !important; }
    body.print-omit-summary #panel-tab-summary { display: none !important; }
    body.print-omit-diagrams .section-visualizer-card { display: none !important; }

    /* Tables, formulas & matrix formatting */
    table, tr, .matrix-table, .rebar-selection-table {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .katex-display {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        margin: 6px 0 !important;
    }
}

/* ============================================================
   CONCRETE CORBEL MEMBER DRAWER & ACTIVE INDICATOR STYLES
   ============================================================ */

.btn-toggle-corbel-drawer {
    background: var(--color-accent, #0055a3);
    color: #ffffff;
    border: 1px solid rgba(0,0,0,0.15);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.15s ease;
}

.btn-toggle-corbel-drawer:hover {
    background: #004482;
    transform: translateY(-1px);
}

.active-corbel-indicator {
    background: #ffffff;
    border: 1px solid var(--color-border);
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--color-heading);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.active-corbel-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2e7d32;
}

.member-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 350px;
    background: #ffffff;
    border-left: 1px solid var(--color-border);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1050;
}

.member-drawer.open {
    transform: translateX(0);
}

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

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

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

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

.btn-drawer-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

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

.btn-drawer-action {
    flex: 1;
    padding: 5px 8px;
    font-size: 0.73rem;
    font-weight: 600;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--color-text-primary);
    transition: all 0.15s ease;
}

.btn-drawer-action:hover {
    background: #f5f5f4;
    border-color: #d1d5db;
}

.btn-drawer-action--primary {
    background: var(--color-accent-bg, #e8f0fa);
    color: var(--color-accent, #0055a3);
    border-color: var(--color-accent);
}

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

.drawer-card {
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 10px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.drawer-card:hover {
    border-color: var(--color-accent);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.drawer-card.active {
    border-color: var(--color-accent);
    background: #f0f7ff;
    box-shadow: 0 0 0 1px var(--color-accent);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.card-tag {
    font-weight: 700;
    font-size: 0.84rem;
    color: var(--color-heading);
    font-family: var(--font-mono);
}

.card-pill {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
}

.pill-pass { background: #e8f5e9; color: #2e7d32; }
.pill-warn { background: #fff8e1; color: #e65100; }
.pill-fail { background: #ffebee; color: #c62828; }

.suite-badge {
    margin-left: 10px;
}

/* Dock Locked State */
.dock-locked-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 8px 10px;
    border-radius: 4px;
    margin-top: 8px;
    color: #92400e;
    font-size: 0.74rem;
}

.dock-locked-banner .locked-icon {
    font-size: 1.1rem;
}

.dock-locked-banner .locked-text {
    display: flex;
    flex-direction: column;
}

.dock-locked-banner .locked-text strong {
    font-weight: 700;
    color: #78350f;
}

.dock-is-locked input:not(#proj-date),
.dock-is-locked select,
.dock-is-locked button:not(#btn-toggle-project-settings):not(#btn-lock-corbel) {
    pointer-events: none;
    opacity: 0.65;
    background-color: #f1f5f9;
}

.card-pill.locked {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.card-lock-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 1px 4px;
    border-radius: 3px;
    transition: background 0.15s;
}

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

.card-lock-btn.locked {
    color: #b45309;
}

.card-details {
    display: flex;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
    border-top: 1px dashed var(--color-border-light);
    margin-top: 5px;
    padding-top: 4px;
}

.drawer-footer {
    padding: 8px 14px;
    border-top: 1px solid var(--color-border);
    background: #f7f6f3;
    font-size: 0.74rem;
    color: var(--color-text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

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

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

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


