:root {
    --primary: #1a237e;
    --primary-light: #3949ab;
    --primary-dark: #0d1642;
    --secondary: #ff6f00;
    --secondary-light: #ff9100;
    --accent: #00bcd4;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
    --dark: #1a1a2e;
    --light: #f8f9fa;
    --sidebar-width: 280px;
    --header-height: 65px;
    --font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-family);
    background: #f0f2f5;
    color: #333;
    overflow-x: hidden;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #bbb; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #888; }

/* ========== SIDEBAR ========== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    z-index: 1050;
    transition: all 0.3s ease;
    overflow-y: auto;
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
}

.sidebar-brand {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.15);
}

.sidebar-brand h4 {
    color: #fff;
    font-weight: 700;
    margin: 0;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.sidebar-brand small {
    color: var(--secondary-light);
    font-size: 0.75rem;
    display: block;
    margin-top: 4px;
    font-weight: 500;
}

.sidebar-brand .logo-icon {
    font-size: 2.5rem;
    color: var(--secondary);
    margin-bottom: 8px;
    display: block;
}

.sidebar-menu {
    padding: 15px 0;
    list-style: none;
}

.sidebar-menu .menu-header {
    padding: 12px 25px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.4);
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.25s ease;
    border-left: 3px solid transparent;
    gap: 12px;
}

.sidebar-menu a:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
    border-left-color: var(--secondary);
}

.sidebar-menu a.active {
    color: #fff;
    background: rgba(255,255,255,0.12);
    border-left-color: var(--secondary);
    font-weight: 600;
}

.sidebar-menu a i {
    width: 22px;
    text-align: center;
    font-size: 1.05rem;
}

.sidebar-menu .badge {
    margin-left: auto;
    font-size: 0.65rem;
    padding: 3px 8px;
}

/* ========== TOPBAR ========== */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: #fff;
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    transition: left 0.3s ease;
}

.topbar .page-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark);
}

.topbar .topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.topbar .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.topbar .user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--dark);
}

.topbar .user-role {
    font-size: 0.7rem;
    color: #999;
}

#sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--dark);
    padding: 5px;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 30px;
    min-height: calc(100vh - var(--header-height));
    transition: margin-left 0.3s ease;
}

/* ========== STAT CARDS ========== */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(0,0,0,0.04);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.info::before { background: var(--info); }
.stat-card.secondary::before { background: var(--secondary); }

.stat-card .stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 15px;
}

.stat-card .stat-icon.primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); }
.stat-card .stat-icon.success { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.stat-card .stat-icon.warning { background: linear-gradient(135deg, #e67e22, #f39c12); }
.stat-card .stat-icon.danger { background: linear-gradient(135deg, #c0392b, #e74c3c); }
.stat-card .stat-icon.info { background: linear-gradient(135deg, #2980b9, #3498db); }
.stat-card .stat-icon.secondary { background: linear-gradient(135deg, #e65100, #ff6f00); }

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #888;
    margin-top: 5px;
    font-weight: 500;
}

/* ========== CARDS ========== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 25px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 18px 24px;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 12px 12px 0 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header i {
    color: var(--primary);
    margin-right: 10px;
}

.card-body { padding: 24px; }

/* ========== TABLE ========== */
.table-custom {
    border-collapse: separate;
    border-spacing: 0;
}

.table-custom thead th {
    background: #f8f9fb;
    border: none;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    padding: 14px 16px;
}

.table-custom tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    font-size: 0.88rem;
}

.table-custom tbody tr:hover {
    background: #f8f9fb;
}

.table-custom tbody tr:last-child td {
    border-bottom: none;
}

/* ========== BUTTONS ========== */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-secondary-custom {
    background: var(--secondary);
    border-color: var(--secondary);
    color: #fff;
}

.btn-secondary-custom:hover {
    background: var(--secondary-light);
    border-color: var(--secondary-light);
    color: #fff;
}

.btn-sm { font-size: 0.78rem; padding: 5px 12px; }

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* ========== 1D STOCK BAR V2 ========== */
.stock-visual-1d { position: relative; }

.stock-bar-v2 {
    position: relative;
    height: 52px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid #dee2e6;
}

.piece-1d-v2 {
    position: absolute;
    top: 2px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    cursor: pointer;
    transition: opacity .2s;
}

.piece-1d-v2:hover { opacity: .8; z-index: 5; }

.piece-1d-label {
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,.4);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 4px;
}

.kerf-mark {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(220,53,69,.5);
    min-width: 1px;
}

.waste-1d {
    position: absolute;
    top: 2px;
    height: 48px;
    background: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(0,0,0,.04) 5px, rgba(0,0,0,.04) 10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .68rem;
    color: #999;
    border-radius: 3px;
}

/* Dimension segments on top of 1D bars */
.dim-line-container-top { position: relative; }

.dim-segment {
    position: absolute;
    top: 0;
    height: 28px;
}

.dim-line-h {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.dim-line-h::before {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 2px;
    right: 2px;
    height: 1px;
    background: #666;
}

.dim-line-h::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 2px;
    width: 1px;
    height: 8px;
    background: #666;
    box-shadow: calc(100% - 6px) 0 0 0 #666;
}

.dim-value {
    position: relative;
    z-index: 1;
    background: #fff;
    padding: 0 4px;
    font-size: .65rem;
    font-weight: 600;
    color: #333;
    line-height: 1;
    margin-bottom: 10px;
}

/* ========== 2D PANEL SVG ========== */
.panel-2d-container { }

.panel-svg-wrapper {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    overflow-x: auto;
    text-align: center;
}

.panel-2d-svg {
    max-width: 100%;
    height: auto;
}

.panel-results-body { padding: 20px; }

/* Legacy support */
.stock-bar {
    position: relative;
    height: 60px;
    background: #e9ecef;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    border: 2px solid #dee2e6;
}

.kerf-line {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: rgba(255,0,0,0.4);
}

/* ========== FORM STYLES ========== */
.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid #dee2e6;
    padding: 10px 15px;
    font-size: 0.88rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}

.form-label {
    font-weight: 600;
    font-size: 0.82rem;
    color: #555;
    margin-bottom: 6px;
}

.input-group-text {
    border-radius: 8px;
    background: #f8f9fb;
    border: 1.5px solid #dee2e6;
    font-size: 0.85rem;
    color: #666;
}

/* ========== ACTIVITY LIST ========== */
.activity-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 12px;
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.activity-content { flex: 1; }
.activity-content .activity-text { font-size: 0.85rem; color: #555; }
.activity-content .activity-time { font-size: 0.72rem; color: #aaa; margin-top: 3px; }

/* ========== PIECES LIST ========== */
.piece-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fb;
    border-radius: 8px;
    margin-bottom: 8px;
    gap: 12px;
    transition: background 0.2s ease;
}

.piece-item:hover { background: #eef0f4; }

.piece-color {
    width: 8px;
    height: 40px;
    border-radius: 4px;
    flex-shrink: 0;
}

.piece-info { flex: 1; }
.piece-info .piece-label { font-weight: 600; font-size: 0.85rem; }
.piece-info .piece-dims { font-size: 0.78rem; color: #888; }

.piece-actions {
    display: flex;
    gap: 5px;
}

/* ========== MODAL ========== */
.modal-header {
    background: var(--primary);
    color: #fff;
    border-radius: 12px 12px 0 0;
}

.modal-header .btn-close { filter: brightness(0) invert(1); }
.modal-content { border-radius: 12px; border: none; }

/* ========== LOADING ========== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== EFFICIENCY METER ========== */
.efficiency-meter {
    width: 120px;
    height: 120px;
    position: relative;
    display: inline-block;
}

.efficiency-meter svg { transform: rotate(-90deg); }

.efficiency-meter .meter-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.efficiency-meter .meter-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark);
    display: block;
}

.efficiency-meter .meter-label {
    font-size: 0.65rem;
    color: #999;
}

/* ========== TOAST ========== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
}

/* ========== AUTH PAGE (Login & Register) ========== */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 70%, rgba(255,111,0,0.1) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(0,188,212,0.08) 0%, transparent 50%);
    animation: bgMove 20s ease infinite;
}

@keyframes bgMove {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-2%, 2%); }
}

.auth-container {
    display: flex;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    overflow: hidden;
    max-width: 960px;
    width: 100%;
    box-shadow: 0 25px 80px rgba(0,0,0,0.35);
    position: relative;
    z-index: 1;
    min-height: 520px;
}

.auth-info {
    flex: 0 0 380px;
    background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 50px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.auth-info::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,.05);
}

.auth-info::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -60px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255,111,0,.1);
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.auth-logo i {
    font-size: 3.5rem;
    color: var(--secondary);
    margin-bottom: 12px;
    display: block;
}

.auth-logo h3 {
    font-weight: 800;
    margin: 0;
    font-size: 1.3rem;
    letter-spacing: 1px;
}

.auth-subtitle {
    color: rgba(255,255,255,.7);
    font-size: .85rem;
    margin-top: 4px;
}

.auth-features {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    z-index: 1;
}

.auth-feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    font-size: .88rem;
    color: rgba(255,255,255,.9);
}

.auth-feature-item i {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    color: var(--secondary-light);
    flex-shrink: 0;
}

.auth-info-footer {
    margin-top: auto;
    padding-top: 30px;
    text-align: center;
    font-size: .75rem;
    color: rgba(255,255,255,.4);
    position: relative;
    z-index: 1;
}

.auth-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.auth-form-wrapper {
    width: 100%;
    max-width: 360px;
}

.auth-form-wrapper h4 {
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.auth-form-wrapper p {
    color: #888;
    font-size: .88rem;
    margin-bottom: 28px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    font-size: .8rem;
    color: #aaa;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

/* Register-specific */
.register-container {
    max-width: 1100px;
}

.register-container .auth-form-wrapper {
    max-width: 520px;
}

.free-package-info {
    background: linear-gradient(135deg, #f0f7ff, #e8f0fe);
    border: 1px solid #b3d4fc;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.free-badge {
    background: var(--success);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}

.mini-package-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    transition: all .2s ease;
}

.mini-package-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(26,35,126,.1);
}

.mini-pkg-name {
    font-weight: 700;
    font-size: .85rem;
    color: var(--dark);
}

.mini-pkg-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    margin: 4px 0;
}

.mini-pkg-limit {
    font-size: .72rem;
    color: #999;
}

/* ========== PRICING PAGE ========== */
.pricing-page {
    min-height: 100vh;
    background: #f0f2f5;
}

.pricing-hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 80px 0 60px;
    text-align: center;
    color: #fff;
}

.pricing-hero h1 {
    font-weight: 800;
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.pricing-hero p {
    color: rgba(255,255,255,.7);
    font-size: 1.1rem;
}

.pricing-cards-wrapper {
    margin-top: -40px;
    position: relative;
    z-index: 1;
}

.pricing-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    transition: transform .3s ease, box-shadow .3s ease;
    border: 2px solid transparent;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pricing-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 35px rgba(0,0,0,.12);
}

.pricing-card.popular {
    border-color: var(--secondary);
    box-shadow: 0 8px 30px rgba(255,111,0,.15);
}

.pricing-card.current {
    border-color: var(--success);
}

.popular-badge {
    background: var(--secondary);
    color: #fff;
    text-align: center;
    padding: 6px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.current-badge {
    background: var(--success);
    color: #fff;
    text-align: center;
    padding: 6px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pricing-card-header {
    padding: 28px 24px;
    text-align: center;
}

.pricing-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    margin: 0 auto 14px;
}

.pricing-name {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--dark);
}

.pricing-price {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin: 8px 0 4px;
}

.pricing-price small {
    font-size: .85rem;
    font-weight: 400;
    color: #999;
}

.pricing-desc {
    font-size: .82rem;
    color: #888;
}

.pricing-features-list {
    list-style: none;
    padding: 0 24px;
    margin: 0;
    flex: 1;
}

.pricing-features-list li {
    padding: 8px 0;
    font-size: .85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #f5f5f5;
    color: #555;
}

.pricing-features-list li:last-child { border-bottom: none; }

.pricing-features-list li.included i { color: var(--success); }
.pricing-features-list li.excluded {
    color: #ccc;
    text-decoration: line-through;
}
.pricing-features-list li.excluded i { color: #ddd; }

.pricing-card-footer {
    padding: 20px 24px;
    text-align: center;
}

/* ========== USAGE BAR ========== */
.usage-bar {
    background: #fff;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,.05);
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    border: 1px solid rgba(0,0,0,.04);
}

.usage-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    flex-shrink: 0;
}

/* ========== OPTIMIZER TABS & OPTIONS ========== */
.optimizer-tabs .nav-link {
    font-weight: 600;
    font-size: .9rem;
    padding: 10px 20px;
    border-radius: 10px 10px 0 0;
    color: #666;
    transition: all .2s;
}

.optimizer-tabs .nav-link.active {
    color: var(--primary);
    background: #fff;
    border-color: #dee2e6 #dee2e6 #fff;
}

.optimizer-tabs .nav-link i { margin-right: 6px; }

.optimizer-options { margin-bottom: 20px; }

.optimizer-settings-card {
    background: #f8f9fb;
    border-radius: 10px;
    padding: 16px;
    border: 1px solid #e8e8e8;
}

/* ========== EDGE BUTTON TOGGLES ========== */
.edge-btn {
    width: 34px;
    height: 34px;
    border: 2px solid #dee2e6;
    background: #fff;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s;
    font-size: .75rem;
    color: #aaa;
}

.edge-btn:hover {
    border-color: var(--warning);
    color: var(--warning);
}

.edge-btn.active {
    background: var(--warning);
    border-color: var(--warning);
    color: #fff;
}

.edge-grain-row {
    display: none;
}

/* ========== PIECE LIST SCROLLABLE ========== */
.piece-list-scrollable {
    max-height: 350px;
    overflow-y: auto;
    padding-right: 4px;
}

/* ========== RESULT STAT CARDS ========== */
.result-stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    border: 1px solid rgba(0,0,0,.04);
}

.result-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
}

.result-stat-label {
    font-size: .72rem;
    color: #888;
    margin-top: 2px;
    font-weight: 500;
}

/* ========== PIECE COLOR DOT ========== */
.piece-color-dot {
    width: 8px;
    height: 36px;
    border-radius: 4px;
    flex-shrink: 0;
}

.piece-color-dot-sm {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
}

.edge-indicators i {
    font-size: .55rem;
    margin-left: 2px;
}

/* ========== FORM SWITCH SMALL ========== */
.form-check-label { font-size: .85rem; }

/* ========== RESPONSIVE ========== */
@media (max-width: 992px) {
    .sidebar { left: calc(-1 * var(--sidebar-width)); }
    .sidebar.show { left: 0; }
    .topbar { left: 0; }
    .main-content { margin-left: 0; }
    .auth-container { flex-direction: column; max-width: 480px; }
    .auth-info { flex: none; padding: 30px; }
    .auth-features { display: none; }
}

@media (max-width: 576px) {
    .auth-form-panel { padding: 24px; }
    .pricing-hero h1 { font-size: 1.5rem; }
    .pricing-price { font-size: 1.5rem; }
    .result-stat-value { font-size: 1.1rem; }
}

/* ========== PRINT ========== */
@media print {
    .sidebar, .topbar, .btn, .no-print { display: none !important; }
    .main-content { margin: 0 !important; padding: 10px !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ========== ANIMATIONS ========== */
.fade-in {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #aaa;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 15px;
    display: block;
    opacity: 0.3;
}

.empty-state h5 { color: #888; margin-bottom: 8px; }
.empty-state p { font-size: 0.85rem; }

/* ========== COLOR SWATCH ========== */
.color-swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: inline-block;
    border: 1px solid rgba(0,0,0,0.1);
    vertical-align: middle;
    margin-right: 6px;
}

/* ========== QUICK ADD ROW ========== */
.quick-add-row {
    background: #f0f7ff;
    border: 2px dashed #b3d4fc;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    transition: border-color 0.2s ease;
}

.quick-add-row:focus-within {
    border-color: var(--primary);
}
