/* Dashboard Layout - OptiCutter Style Replica */
:root {
    --sidebar-width: 250px;
    --primary-color: #0AA9FF;
    --sidebar-bg: #0AA9FF;
    --sidebar-text: rgba(255, 255, 255, 0.9);
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active-bg: #ffffff;
    --sidebar-active-text: #0AA9FF;
    --header-height: 56px;
    --header-bg: #ffffff;
    --body-bg: #F3F5F9;
    /* User req: lighter grey background */
    --border-color: #E1E6EF;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --text-primary: #4E5155;
    --text-secondary: #8C96A8;
    /* User req: specific grey */
    --text-dark: #2E3440;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: var(--body-bg);
    display: flex;
    flex-direction: column;
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #495057;
    font-size: 14px;
}

/* --- Layout Structure --- */
.layout-inner {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Header / Topbar --- */
.toggle-btn {
    color: #8898aa;
    font-size: 1.2rem;
    padding: 0 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.15s ease;
}

.toggle-btn:hover {
    color: #5e676f;
}

.topbar {
    height: var(--header-height);
    min-height: var(--header-height);
    /* Ensure height is respected */
    flex-shrink: 0;
    /* Prevent shrinking in flex containers */
    background: var(--header-bg);
    box-shadow: 0 0 2rem 0 rgba(136, 152, 170, .15);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 1030;
    position: relative;
    width: 100%;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    /* Add separator */
}

.header-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: #3e444a;
    text-transform: uppercase;
    letter-spacing: .05rem;
    display: flex;
    /* Ensure flex centering for logo content */
    align-items: center;
}

.header-brand:hover {
    text-decoration: none;
    color: #3e444a;
}

.topbar-menu {
    margin-left: auto;
}

.topbar-menu a {
    color: #8898aa;
    padding: 0 10px;
    font-size: 16px;
    text-decoration: none;
}

.topbar-menu a:hover {
    color: #5e676f;
}

/* --- Main Container --- */
.layout-container {
    display: flex;
    flex: 1;
    flex-direction: row;
    position: relative;
}

/* Sidebar - Cyan Theme */
#sidebar {
    width: var(--sidebar-width);
    min-width: 250px;
    max-width: 250px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: all 0.3s;
    min-height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-y: auto;
    z-index: 100;
}

#sidebar .nav-link {
    color: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

#sidebar .nav-link:hover {
    color: #fff;
    background: var(--sidebar-hover);
    text-decoration: none;
}

#sidebar .nav-link.active {
    color: var(--sidebar-active-text);
    background: var(--sidebar-active-bg);
    border-left: 3px solid var(--primary-color);
    font-weight: 600;
    border-radius: 0 8px 8px 0;
    margin-right: 8px;
}

#sidebar .sidebar-header {
    padding: 20px 20px 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
}

/* Sidebar Toggle State (Desktop) */
#sidebar.collapsed {
    width: 70px;
    min-width: 70px;
}

#sidebar.collapsed .sidebar-header,
#sidebar.collapsed .nav-link span,
#sidebar.collapsed .nav-link::after {
    display: none;
}

#sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 10px 0;
}

#sidebar.collapsed .nav-link i {
    margin-right: 0;
    font-size: 1.3rem;
}

#sidebar .nav-link i {
    width: 1.5rem;
    font-size: 1.1rem;
    margin-right: .5rem;
    color: rgba(255, 255, 255, .8);
    text-align: center;
}

#sidebar .nav-link:hover i {
    color: #fff;
}

#sidebar .nav-link.active i {
    color: var(--sidebar-active-text);
}

.nav-tree-menu {
    display: none;
    padding-bottom: .5rem;
}

.nav-tree-menu.open {
    display: block;
}

.nav-tree-menu .nav-link {
    padding-left: 3.5rem;
    padding-top: .5rem;
    padding-bottom: .5rem;
    font-size: .85rem;
}

/* Main Content */
/* Main Content */
#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--body-bg);
    /* Margin removed because Sidebar is now in flow */
    width: 100%;
    transition: margin-left 0.3s;
}

.page-content {
    padding: 1.5rem;
    flex: 1;
}

/* Welcome Section */
.welcome-container {
    text-align: center;
    margin-top: 2rem;
}

.welcome-container h3 {
    font-weight: 300;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: #495057;
}

/* Dashboard Buttons (OptiCutter Style - Simple Flex Buttons) */
.action-grid {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-start-action {
    background: #fff;
    border: 1px solid rgba(24, 28, 33, 0.06);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
    padding: 1.5rem 2rem;
    text-align: center;
    color: #495057;
    text-decoration: none;
    border-radius: .25rem;
    min-width: 200px;
    transition: all .2s;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.btn-start-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, .05);
    text-decoration: none;
    color: var(--primary-color);
}

.btn-start-action i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.btn-start-action span {
    font-size: 1rem;
    font-weight: 600;
}

/* Green Action Button (Calculate) */
.btn-success {
    background-color: #28a745 !important;
    color: white !important;
    border: 1px solid #218838 !important;
}

.btn-success:hover {
    background-color: #218838 !important;
    color: white !important;
}

.btn-success i {
    color: white !important;
}

/* Footer (Sticky at bottom) */
.main-footer {
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, .05);
    padding: 1rem 1.5rem;
    color: #a3a4a6;
    font-size: .85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-links a {
    color: #a3a4a6;
    margin-left: 1rem;
    text-decoration: none;
}

.footer-links a:hover {
    color: #495057;
}

/* Responsive */
@media (max-width: 992px) {
    .layout-container {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: auto;
        display: none;
    }

    #sidebar.active {
        display: flex;
    }

    #main-content {
        margin-left: 0;
    }
}

/* ==========================================
   Panel Detail Page Styles (OptiCutter Clone)
   ========================================== */

/* Page Header with Breadcrumb */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    margin-bottom: 16px;
}

.breadcrumb-section {
    font-size: 18px;
    color: var(--text-primary);
}

.breadcrumb-section strong {
    font-weight: 600;
}

/* Page title (standalone breadcrumb) */
.page-title {
    font-size: 21px;
    font-weight: 700;
    color: rgb(78, 81, 85);
    margin-bottom: 16px;
}

.page-title strong {
    font-weight: 700;
}

/* Action Buttons Bar */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

/* Bordered container for action buttons */
.action-bar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 16px 12px;
    border: 1px solid rgba(24, 28, 33, 0.06);
    border-radius: 0;
    background: transparent;
    /* Transparent background, but keep border */
    margin-bottom: 24px;
}

.action-bar-left,
.action-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Required Stocks Summary Card */
.summary-card {
    display: flex;
    background: white;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 32px;
    overflow: hidden;
}

.summary-left {
    flex: 1;
    padding: 24px;
    border-right: 1px solid var(--border-color);
}

.summary-left h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
}

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

.stock-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.stock-table th:last-child {
    text-align: right;
}

.stock-table td {
    padding: 12px 0;
    font-size: 14px;
    color: var(--text-primary);
}

.stock-table td:last-child {
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
}

.stock-table tfoot td {
    border-top: 1px solid var(--border-color);
    font-weight: 600;
}

.summary-right {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.stat-item .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.stat-item .stat-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Cutting Layouts Section */
.layouts-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.layouts-section-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.layout-settings-btn {
    height: 32px;
    border-radius: 0;
    /* User requirement: NO rounded corners (was 16px) */
    border: 1px solid var(--border-color);
    background: white;
    padding: 0 12px;
    font-size: 13px;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

/* Layout Card */
.layout-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.layout-header {
    background: #F7F9FC;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 32px;
    border-bottom: 1px solid var(--border-color);
}

.layout-header-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.layout-header-item .label {
    font-size: 12px;
    text-transform: uppercase;
    color: rgb(163, 164, 166);
    letter-spacing: 0.3px;
}

.layout-header-item .value {
    font-size: 14px;
    color: rgb(78, 81, 85);
    font-weight: 400;
}

.layout-id-badge {
    font-size: 24px;
    font-weight: 400;
    color: rgb(78, 81, 85);
    min-width: 40px;
}

.processed-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: rgb(163, 164, 166);
    cursor: pointer;
}

.processed-icon i {
    font-size: 14px;
}

.stock-badge {
    display: inline-block;
    background: var(--text-primary);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.layout-body {
    display: flex;
    min-height: 450px;
}

.layout-viz {
    flex: 7;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FAFBFC;
    border: 1px solid #f1f1f2;
}

.layout-viz canvas {
    width: 100%;
    height: 100%;
    max-width: 100%;
    min-height: 400px;
}

.layout-panels {
    flex: 3;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.panel-list-header {
    display: flex;
    padding: 10px 16px;
    font-size: 14px;
    color: rgb(78, 81, 85);
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.03);
}

.panel-list-header span:first-child {
    flex: 1;
}

.panel-list-header span:last-child {
    width: 40px;
    text-align: right;
}

.panel-list {
    flex: 1;
    overflow-y: auto;
    max-height: 250px;
}

.panel-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgb(241, 241, 242);
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: background 0.15s;
}

.panel-item:hover {
    background: #F7F9FC;
}

.panel-item.selected {
    background: #EBF7FF;
}

.panel-color-dot {
    display: none;
}

.panel-dims {
    flex: 1;
    font-size: 14px;
    color: rgb(78, 81, 85);
}

.panel-qty {
    width: 40px;
    text-align: right;
    font-size: 14px;
    font-weight: 400;
    color: rgb(78, 81, 85);
}

/* Refined Stats Section (New Standard) */
.layout-stats {
    background: white;
    border-top: none;
    margin-top: 20px;
}

.stat-header {
    background: #f5f5f5;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-dark);
    border-bottom: 1px solid #E1E6EF;
}

.stat-rows-container {
    background: white;
    padding: 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 32px;
    padding: 0 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid #f1f1f2;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-value {
    font-weight: 400;
    color: var(--text-dark);
    font-size: 14px;
}

.layout-stat-row .stat-value {
    font-weight: 400;
    color: rgb(78, 81, 85);
}

/* Yield Badge */
.yield-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: #28a745;
    margin-top: 4px;
}

/* Material Label */
.material-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Responsive for Layout Cards */
@media (max-width: 1024px) {
    .layout-body {
        flex-direction: column;
    }

    .layout-viz {
        flex: none;
    }

    .layout-panels {
        flex: none;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .summary-section {
        flex-direction: column;
    }

    .summary-left {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

/* ============================================
   Configuration Tab Styles (OptiCutter Match)
   ============================================ */

.config-card {
    background: white;
    border: 1px solid rgba(24, 28, 33, 0.06);
    border-radius: 0;
    /* User Req: No rounded corners */
    padding: 24px;
}

.config-row {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
}

.config-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}


.config-field-small {
    flex: 0 0 180px;
}

/* ============================================
   Redesigned Solution Tab (White Block Style)
   ============================================ */

/* The main white block container */
.solution-card {
    background: white;
    border: 1px solid rgba(24, 28, 33, 0.06);
    border-radius: 0;
    box-shadow: var(--card-shadow);
    padding: 24px;
    margin-bottom: 32px;
}

/* Summary Section (Internal to Solution Card) */
.summary-section {
    display: flex;
    /* Removed background/shadow/radius from old summary-card */
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
    margin-bottom: 24px;
}

/* Modify Layout Card to be a grid item inside the white block */
.layout-card {
    background: white;
    border: 1px solid var(--border-color);
    /* Add border */
    border-radius: 0;
    /* Slightly smaller radius */
    box-shadow: none;
    /* Remove shadow */
    margin-bottom: 0;
    /* Remove margin (use grid gap) */
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.layout-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    /* Subtle hover effect */
    border-color: #cdd3e0;
}

/* Grid container for layouts */
#layoutsContainer {
    display: grid;
    grid-template-columns: 1fr;
    /* Stack vertically by default */
    gap: 24px;
    /* Space between layouts */
}

/* User req: One layout per row always */
@media (min-width: 1400px) {
    #layoutsContainer {
        grid-template-columns: 1fr;
    }
}

/* ... existing code ... */

/* Layout Body Grid */
/* User req: Side-by-side (viz left, info right) */
.layout-body {
    display: flex;
    flex-wrap: nowrap;
    /* Prevent wrapping so it stays side-by-side */
    border-top: 1px solid var(--border-color);
    /* Separation from header */
}

.layout-viz-container {
    flex: 1;
    min-width: 0;
    /* Allow shrinking if needed, but flex=1 takes remaining space */
    padding: 24px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Align top */
    background: white;
    /* Ensure white background inside */
    border-right: 1px solid var(--border-color);
}

.config-label {
    font-size: 13px;
    font-weight: 500;
    color: rgb(78, 81, 85);
}

.config-input {
    background: rgb(241, 241, 242);
    border: 1px solid rgba(24, 28, 33, 0.1);
    border-radius: 4px;
    padding: 7px 14px;
    font-size: 14px;
    color: rgb(78, 81, 85);
    outline: none;
}

.config-input:focus {
    border-color: rgb(38, 180, 255);
}

/* Toggle Switches */
.config-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 32px;
    margin-bottom: 20px;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-label {
    font-size: 13px;
    color: rgb(78, 81, 85);
}

.toggle-switch {
    width: 48px;
    height: 24px;
    background: rgb(163, 164, 166);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-switch.active {
    background: rgb(38, 180, 255);
}

.toggle-slider {
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.toggle-switch.active .toggle-slider {
    transform: translateX(24px);
}

/* Config Section */
.config-section {
    margin-top: 24px;
}

.config-section-title {
    font-size: 16px;
    font-weight: 600;
    color: rgb(78, 81, 85);
    margin: 0 0 12px 0;
}

/* Config Tables */
.config-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid rgba(24, 28, 33, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.config-table thead {
    background: rgba(0, 0, 0, 0.03);
}

.config-table th {
    font-size: 13px;
    font-weight: 500;
    color: rgb(78, 81, 85);
    text-align: left;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(24, 28, 33, 0.1);
}

.config-table td {
    padding: 10px 16px;
    font-size: 14px;
    color: rgb(78, 81, 85);
    border-bottom: 1px solid rgb(241, 241, 242);
}

.config-table tr:last-child td {
    border-bottom: none;
}

.config-table .table-input {
    width: 100%;
    background: rgb(241, 241, 242);
    border: 1px solid rgba(24, 28, 33, 0.1);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 14px;
    color: rgb(78, 81, 85);
}

/* ============================================
   Refined Layout Card Styles (User Request)
   ============================================*/
/* Layout Settings Toolbar */
.layouts-section-header {
    margin-bottom: 0;
    /* Clear margin as toolbar might sit below */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
}

.layout-settings-toolbar {
    display: none;
    background: #fff;
    border: 1px solid #29b6f6;
    /* Full border as per typical container look */
    /* border-top: 1px solid #29b6f6; */
    /* border-bottom: 1px solid #29b6f6; */
    padding: 16px 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Evenly distributed */
    /* gap: 0; Let space-between handle spacing */
}

.layout-settings-toolbar.visible {
    display: flex !important;
}

/* Toolbar Controls */
.toolbar-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    /* Left align text */
}

.toolbar-label {
    font-size: 13px;
    font-weight: 700;
    /* Bolder text */
    color: #555;
}

/* IOS Toggle Switch - Refined */
.ios-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    /* Slightly smaller width */
    height: 22px;
    /* Slightly smaller height */
}

.ios-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #f0f0f0;
    /* Light gray off state */
    transition: .2s;
    border-radius: 24px;
    border: 1px solid #e0e0e0;
    /* Subtle border */
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

input:checked+.slider {
    background-color: #29b6f6;
    border-color: #29b6f6;
}

input:focus+.slider {
    box-shadow: 0 0 1px #29b6f6;
}

input:checked+.slider:before {
    transform: translateX(18px);
    /* Adjust for new width */
}

/* Dropdown style */
.settings-select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    outline: none;
    background: #fff;
    min-width: 120px;
    height: 30px;
    /* specific height */
}

.layout-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    margin-bottom: 24px;
    overflow: hidden;
    border: none;
}

.layout-header {
    background: #F7F9FC;
    padding: 16px 24px;
    display: flex;
    align-items: flex-start;
    gap: 32px;
    border-bottom: 1px solid var(--border-color);
}

.header-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.header-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-value {
    font-size: 14px;
    color: var(--text-dark);
}

.header-value-large {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.checkbox-value {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-dark);
}

.header-checkbox {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #ccc;
    background: white;
    border-radius: 3px;
    position: relative;
}

.header-checkbox:checked {
    background: cyan;
    border-color: cyan;
}

.header-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.dimension-capsule {
    background: #4A5162;
    color: white;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
}

.stock-material {
    font-size: 12px;
    color: #8C96A8;
    margin-top: 2px;
}

/* Layout Body Grid */
.layout-body {
    display: flex;
    flex-wrap: nowrap;
    /* User Req: Force side-by-side */
    min-height: 400px;
}

.layout-viz-container {
    flex: 1;
    min-width: 0;
    /* Allow shrink */
    padding: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-right: 1px solid var(--border-color);
}

.layout-viz-container canvas {
    border: 1px solid #DADFE6;
    max-width: 100%;
    /* internal padding managed by canvas logic */
}

.layout-right-panel {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 16px;
    /* User Req: Reduced by 1/3 (24->16) */
    gap: 16px;
    /* User Req: Reduced by 1/3 (24->16) */
}

/* User Req: Independent Grids -> Bordered blocks */
.layout-info-group,
.layout-stats {
    border: 1px solid var(--border-color);
    background: white;
    /* Ensure distinct block */
    border-radius: 0;
    /* User Req: No rounded corners */
}

/* Fix Panel List inside the group */
.panel-list-header {
    display: flex;
    justify-content: space-between;
    padding: 8px 16px;
    background: #f5f5f5;
    color: var(--text-dark);
    font-size: 13px;
    font-weight: 400;
    border-bottom: 1px solid #E1E6EF;
}

.panel-list {
    overflow-y: auto;
    max-height: 400px;
    background: white;
    min-height: 50px;
}

/* Existing stat styles ... */
.layout-stats {
    background: white;
    border-top: 1px solid var(--border-color);
    /* Was separate, now uniform border */
    margin-top: 0;
    /* Gap handled by parent */
}

.stat-header {
    background: #f5f5f5;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-dark);
    border-bottom: 1px solid #E1E6EF;
}

/* ... rest ... */
.panel-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    position: relative;
    border: 2px solid transparent;
    /* Prepare for colored border */
    margin-bottom: 0;
    /* No gap */
}

/* 
   User image shows a red border box around the item.
   We abuse the 'color' style set in JS to define border color.
   Wait, JS sets 'style="color: rgb..."'. 
   We want border color to be that.
*/
.panel-list-item.has-strip {
    border-color: currentColor;
    /* Inherit color from JS style="color:..." */
    background: white;
    /* Ensure bg is white */
}

/* Remove the old strip pseudo-element */
.panel-list-item.has-strip::before {
    display: none;
}

.panel-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-dim {
    font-size: 14px;
    color: var(--text-dark);
}

.panel-qty {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

/* Refined Stats Section */
.layout-stats {
    background: white;
    /* Container white ? No, distinct. */
    border-top: 1px solid var(--border-color);
    /* Actually header is grey, rows are white */
}

.stat-header {
    background: #f5f5f5;
    /* Grey header */
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-dark);
    /* Title case handled in text manually, here just style */
    border-bottom: 1px solid #E1E6EF;
}

.stat-rows-container {
    background: white;
    padding: 0;
    /* Align with header */
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 32px;
    padding: 0 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid #f1f1f2;
    /* Faint divider */
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-value {
    font-weight: 400;
    /* OptiCutter image shows normal weight for 15,018? User said bold. Image 1 15,018 looks normal? Let's stick to user request or image?
    User said "compare differences". Image 1 15,018 looks dark but not super bold. 8 is bold. 
    Let's keep text-dark but maybe font-weight: 400 or 500. */
    color: var(--text-dark);
    font-size: 14px;
}

/* =========================================
   Linear Detail Page Replication (OptiCutter)
   ========================================= */

/* Header & Breadcrumb */
.page-header {
    background: transparent;
    padding: 0 0 15px 0;
    margin-bottom: 0;
}

.breadcrumb-section {
    font-size: 20px;
    display: flex;
    align-items: center;
}

/* Action Bar */
.action-bar-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.action-bar-left,
.action-bar-right {
    display: flex;
    gap: 10px;
}

/* Action Button Styles */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #3498db;
    color: #3498db;
    background: transparent;
    /* Changed from white for transparent look */
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-action:hover {
    background: #f0f7fd;
    text-decoration: none;
    color: #2980b9;
}

.btn-lock {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #f1c40f;
    background: transparent;
    /* Changed from #fff */
    color: #333;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.btn-print {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    color: #555;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

/* Tabs - Unified Style */
.detail-tabs {
    display: flex;
    margin-bottom: -1px;
    /* Overlap content border */
    padding-left: 0;
    /* Align with content */
    border-bottom: none;
    /* Removed bottom border from tabs wrapper */
    position: relative;
    z-index: 2;
    /* Above content border */
}

.tab-item {
    padding: 12px 24px;
    margin-right: 4px;
    background: transparent;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    border-bottom: none;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    /* Rounded top */
}

.tab-item.active {
    background: white;
    color: #333;
    font-weight: 600;
    border: 1px solid #ddd;
    border-bottom: 1px solid white;
    /* Merge with container */
    margin-bottom: 0;
    /* Wrapper handles overlap */
    position: relative;
    z-index: 3;
}

.tab-item:hover {
    text-decoration: none;
    color: #333;
    background: rgba(0, 0, 0, 0.02);
}

.tab-item.active:hover {
    background: white;
}

/* Results Content - Unified Container */
.tab-content-container {
    background: white;
    border: 1px solid #ddd;
    border-top: 1px solid #ddd;
    /* Explicit top border to form the line */
    /* Merged with tabs (handled by tab overlap, but container itself implies border) 
                       Actually, if we rely on overlap, container needs top border. 
                       Bootstrap/Standard tab logic: Tabs have border-bottom. Content has border-top? 
                       No, usually Tabs have border-bottom line. Active tab hides that line. 
                       Content has border all around, or just background. */
    border-radius: 0 4px 4px 4px;
    /* Corner radius except top-left */
    padding: 24px;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

/* If User says "One Large White Block", we assume the whole page content (Summary + Layouts) is inside this. */

/* Summary Internal Styling (No external card) */
/* Summary Internal Styling (No external card) */
.summary-internal-grid {
    display: flex;
    gap: 0;
    /* Border separation */
    border-bottom: 1px solid #eee;
    /* Intersects with vertical divider */
    overflow: visible;
    margin-bottom: 30px;
}

.summary-left {
    flex: 0 0 55%;
}

.summary-right {
    flex: 1;
    background: white;
    /* Changed from #f9f9f9 to white or transparent? Opticutter looks cleaner. */
    /* Opticutter right stats has no background container visible? */
    /* Let's try white with no padding/radius to see if it blends better */
    background: transparent;
    padding: 0;
    /* Remove grid, use flex col */
    display: block;
}

.summary-left h4,
.layouts-section-header h4 {
    font-size: 18px;
    /* Larger */
    font-weight: 400;
    /* Lighter weight */
    color: #333;
    margin-bottom: 15px;
    text-transform: none;
    /* Sentence case */
    letter-spacing: normal;
}

.stock-table th {
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #eee;
    /* Stronger line */
    background: white;
    /* Ensure white */
    text-transform: uppercase;
    font-size: 12px;
    padding-bottom: 12px;
}

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

.stock-table th {
    text-align: left;
    font-weight: 600;
    color: #777;
    border-bottom: 1px solid #ddd;
    padding: 8px 0;
    font-size: 13px;
}

.stock-table td {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    color: #333;
}

.stock-table .total-row td {
    border-top: 2px solid #ddd;
    border-bottom: none;
    padding-top: 12px;
    font-size: 16px;
}

.stat-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.stat-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.stat-label {
    font-size: 14px;
    color: #666;
}

.stat-value {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    text-align: right;
}

.yield-badge {
    display: inline-block;
    background: #27ae60;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    width: fit-content;
}

/* Layout Cards */
.layout-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    /* Softer border */
    border-radius: 12px;
    /* Matched OptiCutter 12px */
    margin-bottom: 24px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    /* Softer shadow */
}

/* New Layout Card Styles */
.layout-info-section {
    display: flex;
    border-bottom: 1px solid #eee;
}

.layout-grid {
    flex: 0 0 50%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 20px;
    padding: 20px 24px;
    border-right: 1px solid #eee;
}

.grid-item {
    display: flex;
    flex-direction: column;
}

.grid-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    font-weight: 700;
    margin-bottom: 4px;
}

.grid-value {
    font-size: 14px;
    color: #333;
}

.grid-value-large {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

.checkbox-val {
    display: flex;
    align-items: center;
    gap: 8px;
}

.layout-parts-table-container {
    flex: 1;
    padding: 20px 24px;
}

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

.layout-parts-table th {
    text-align: left;
    font-size: 12px;
    color: #888;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.layout-parts-table td {
    font-size: 14px;
    color: #333;
    padding: 6px 0;
    border-bottom: 1px solid #f9f9f9;
}

.layout-visual-footer {
    padding: 20px 24px;
    background: #fff;
}

.visual-bar-container {
    display: flex;
    height: 48px;
    background: #f1f3f5;
    border-radius: 2px;
    overflow: hidden;
}

.bar-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    /* Changed from variable to white */
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.segment-part {
    background: #3498db;
    /* OptiCutter blueish */
    color: white;
}

.segment-waste {
    background: #f1f3f5;
    color: #888;
    border-right: none;
}


.header-value-large {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.stock-badge {
    font-size: 14px;
    font-weight: 600;
    color: #444;
}

.btn-calculate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #28a745;
    background: #28a745;
    color: white;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-calculate:hover {
    background: #218838;
    border-color: #1e7e34;
    text-decoration: none;
    color: white;
}

/* Force removal of border-radius and box-shadow for all layout related cards */
.layout-card,
.layout-info-group,
.layout-stats,
.solution-card,
.config-card {
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* ============================================
   Layout Settings Popover
   ============================================ */
.layouts-section-header {
    position: relative;
    /* Anchor for popover */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.layout-settings-btn {
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.layout-settings-btn:hover,
.layout-settings-btn.active {
    background: #f0f0f0;
    color: #333;
    border-color: #ccc;
}

.layout-settings-popover {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    /* Use mild radius for popover, distinct from layout grids */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 12px;
    width: 200px;
    z-index: 100;
    display: none;
    /* Hidden by default */
}

.layout-settings-popover.visible {
    display: block;
}

.settings-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
}

.settings-option:last-child {
    margin-bottom: 0;
}

.settings-option input[type="checkbox"] {
    cursor: pointer;
}