:root {
    /* --- Base Variables (Shared) --- */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* --- Light Mode (Default) --- */
    --bg-body: #f1f5f9;
    /* Slate-100 */
    --bg-surface: #ffffff;
    /* White */
    --bg-input: #f8fafc;
    /* Slate-50 */

    /* Accents (Light) */
    --primary: #4f46e5;
    /* Indigo-600 */
    --primary-hover: #4338ca;
    /* Indigo-700 */
    --primary-light: rgba(79, 70, 229, 0.1);

    --success: #10b981;
    /* Emerald-500 */
    --success-bg: rgba(16, 185, 129, 0.1);

    --danger: #ef4444;
    /* Red-500 */
    --danger-bg: rgba(239, 68, 68, 0.1);

    --warning: #f59e0b;
    /* Amber-500 */

    /* Text (Light) */
    --text-main: #0f172a;
    /* Slate-900 (High Contrast) */
    --text-secondary: #475569;
    /* Slate-600 */
    --text-tertiary: #94a3b8;
    /* Slate-400 */

    /* Borders & Glass (Light) */
    --border: #e2e8f0;
    /* Slate-200 */
    --border-hover: #cbd5e1;
    /* Slate-300 */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.05);

    /* Shadows (Light) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 15px rgba(79, 70, 229, 0.15);
    /* Component Specific (Light) */
    --track-color: #e2e8f0;
    /* Slate-200 */
    --dropzone-bg: #f8fafc;
    --dropzone-border: #cbd5e1;
    --dropzone-hover-bg: #f1f5f9;
}

/* --- Dark Mode (Premium) --- */
[data-theme="dark"] {
    /* Deep Slate Backgrounds */
    --bg-body: #0f172a;
    /* Slate-950 */
    --bg-surface: #1e293b;
    /* Slate-800 */
    --bg-input: #020617;
    /* Slate-950 */

    /* Accents (Dark) */
    --primary: #6366f1;
    /* Indigo-500 (Brighter for dark mode) */
    --primary-hover: #818cf8;
    /* Indigo-400 */
    --primary-light: rgba(99, 102, 241, 0.15);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);

    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);

    /* Text (Dark) */
    --text-main: #f8fafc;
    /* Slate-50 */
    --text-secondary: #94a3b8;
    /* Slate-400 */
    --text-tertiary: #64748b;
    /* Slate-500 */

    /* Borders & Glass (Dark) */
    --border: rgba(255, 255, 255, 0.08);
    /* White alpha */
    --border-hover: rgba(255, 255, 255, 0.15);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);

    /* Shadows (Dark) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.3);

    /* Component Specific (Dark) */
    --track-color: rgba(255, 255, 255, 0.1);
    --dropzone-bg: rgba(255, 255, 255, 0.02);
    --dropzone-border: rgba(255, 255, 255, 0.2);
    --dropzone-hover-bg: rgba(99, 102, 241, 0.05);
}

/* --- Global Reset & Base --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    /* More breathing room */
    /* Subtle ambient background glow */
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 40%);
}

/* --- Layout --- */
.app-container {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    max-width: 1280px;
    /* Slightly wider */
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    /* Outer glow */
    overflow: hidden;
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    /* Glass effect if BG was transparent */
}

.input-panel {
    width: 440px;
    /* Wider panel */
    min-width: 320px;
    flex: 0 0 440px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
    /* More spacing between sections */
}

/* --- New Tabbed Layout --- */
.tab-navigation {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding: 6px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--bg-surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
}

[data-theme="light"] .tab-btn.active {
    background: white;
    /* Clean white for light mode */
    border: 1px solid var(--border);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Result Panel Remains Fixed --- */
.result-panel {
    flex: 1;
    min-width: 350px;
    background-color: var(--bg-body);
    padding: 40px;
    overflow-y: auto;
    transition: background-color 0.3s;
}

[data-theme="dark"] .result-panel {
    background-color: rgba(15, 23, 42, 0.5);
}

/* Prevent text overflow globally */
h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
div,
label {
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}


/* --- Typography & Header --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

header h1 {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
    line-height: 1.2;
}

header h1 span {
    color: var(--primary);
    background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 6px;
}

h3 {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

h3::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
    opacity: 0.5;
}

/* --- Components: Dropzone --- */
.dropzone {
    border: 2px dashed var(--dropzone-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    background: var(--dropzone-bg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.dropzone:hover,
.dropzone.active {
    border-color: var(--primary);
    background: var(--dropzone-hover-bg);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.dropzone .icon {
    /* Legacy icon support */
    font-size: 32px;
    color: var(--text-tertiary);
    transition: transform 0.2s ease, color 0.2s ease;
}

.dropzone:hover .icon {
    transform: scale(1.1);
    color: var(--primary);
}

.dropzone p {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
}

.dropzone p strong {
    color: var(--primary);
    font-weight: 700;
}

/* --- Components: Cards (New Base) --- */
.card {
    background: var(--bg-surface);
    /* Fallback */
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.6) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

/* Special Case: Result Cards */
.result-card,
.result-card.print-info-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 24px;
    display: block;
    /* ensure block layout */
}

/* Info Items (Shared) */
.info-item,
.info-item-styled {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: background 0.2s;
    margin-bottom: 8px;
    /* Spacing */
}

.info-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border);
}

.info-item span:first-child,
.info-item-styled .label {
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    text-transform: none;
    /* Reset uppercase if used elsewhere */
}

.info-item span:last-child {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-main);
    font-size: 14px;
}

/* --- Print Info Card (File Analysis Style) --- */
.result-card.print-info-card {
    background: var(--bg-surface);
    padding: 15px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.result-card.print-info-card h2 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    text-transform: none;
    /* Keep natural case like "Dosya Analizi" */
}

.info-grid-styled {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.info-item-styled .icon {
    font-size: 24px;
    opacity: 0.9;
}

.info-item-styled .meta {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.info-item-styled .label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-tertiary);
    /* Similar to 'SÜRE -' style */
    text-transform: uppercase;
    margin-bottom: 4px;
}

.info-item-styled .input-container {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.clean-input-styled {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0 8px;
    /* Dashed line like placeholder */
    background: transparent;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    padding: 0;
    font-family: 'Inter', sans-serif;
}

.clean-input-styled:focus {
    outline: none;
    border-bottom: 1px solid var(--primary);
    color: var(--primary);
}

.unit-styled {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Hide Spinners */
.clean-input-styled::-webkit-outer-spin-button,
.clean-input-styled::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.clean-input-styled[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* --- Components: Inputs --- */
.form-section {
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.input-group label {
    display: block;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
    letter-spacing: 0.02em;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 16px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    height: 48px;
    /* Comfortable touch target */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light), inset 0 1px 2px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.input-wrapper:hover {
    border-color: var(--border-hover);
}

.input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    height: 100%;
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--text-main);
    outline: none;
    font-weight: 500;
    width: 100%;
}

.input-wrapper .unit {
    font-size: 14px;
    color: var(--text-tertiary);
    font-weight: 500;
    padding-left: 12px;
    user-select: none;
    border-left: 1px solid var(--border);
    margin-left: 8px;
    padding-top: 4px;
    padding-bottom: 4px;
    /* Separator styling */
    line-height: 1;
}

/* Slider Style Fixes */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    /* Standard property */
    width: 100%;
    height: 6px;
    background: var(--track-color);
    border-radius: 4px;
    outline: none;
    margin-top: 12px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 3px solid var(--bg-surface);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: var(--primary-hover);
}

.mini-input {
    width: 50px;
    height: 24px;
    padding: 2px 6px;
    font-size: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-main);
    text-align: center;
}

.mini-input:focus {
    border-color: var(--primary);
    outline: none;
}

/* --- Checkbox Style --- */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.checkbox-wrapper:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.checkbox-wrapper input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-label {
    font-size: 14px;
    /* ... */
    color: var(--text-main);
    font-weight: 500;
}

/* --- Grids --- */
.compact-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.compact-grid.two-col {
    grid-template-columns: 1fr 1fr;
    /* Ensure explicit 2-col */
}

/* Custom Spacing for Proposal Tab */
#tab-proposal .compact-grid {
    gap: 20px 16px;
    /* Row Gap, Col Gap */
}

.full-width {
    grid-column: span 2;
}

/* --- Proposal Override Section --- */
.proposal-override-section {
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 32px;
    border: 1px dashed var(--border);
}

.proposal-override-section h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: var(--primary);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.toggles-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-input);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.toggle-row:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.03);
}

.toggle-row label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0;
}

/* Mini Input Alignment Fix */
.mini-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mini-input {
    width: 60px;
    height: 32px;
    /* Taller for better hit target */
    padding: 0 8px;
    font-size: 13px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-main);
    text-align: center;
    font-weight: 600;
}

.mini-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
    outline: none;
}


.split-layout {
    display: flex;
    gap: 32px;
}

.split-col {
    flex: 1;
}

@media (max-width: 600px) {
    .split-layout {
        flex-direction: column;
        gap: 24px;
    }

    .input-details-grid {
        grid-template-columns: 1fr;
    }
}

/* refined slider buttons */
.slider-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    line-height: 1;
    padding-bottom: 2px;
}

.slider-btn:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.slider-btn:active {
    transform: scale(0.95);
}

.breakdown-split-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    /* subtle backing */
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.breakdown-split-wrapper .preview-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.breakdown-split-wrapper .preview-container img {
    max-width: 100%;
    height: auto;
    max-height: 180px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    object-fit: contain;
}

.breakdown-split-wrapper .chart-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 !important;
}

/* Responsive: Stack on mobile */
@media (max-width: 600px) {
    .breakdown-split-wrapper {
        flex-direction: column;
        gap: 20px;
    }
}

.slider-container-fancy {
    background: var(--bg-input);
    padding: 10px 16px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-container-fancy input[type=range] {
    flex: 1;
    cursor: pointer;
    margin: 0;
    margin-top: 0;
    /* Override default */
}

/* --- Buttons --- */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    height: 52px;
    /* Taller */
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
    margin-top: 16px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    /* Likely needed for Clear buttons */
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    height: 40px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--text-secondary);
    color: var(--text-main);
    background: var(--track-color);
}

/* --- Analysis Card --- */
.analysis-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

/* --- Tables (Proposal & General) --- */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-surface);
}

.proposal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    color: var(--text-secondary);
}

.proposal-table th,
.proposal-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.proposal-table th {
    background: rgba(0, 0, 0, 0.2);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
}

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

.proposal-table input.prop-input-mini {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-main);
    font-family: var(--font-body);
    font-weight: 500;
    padding: 4px;
    border-radius: 4px;
    width: 100%;
    transition: all 0.2s;
}

.proposal-table input.prop-input-mini:focus,
.proposal-table input.prop-input-mini:hover {
    background: var(--bg-input);
    border-color: var(--border);
    outline: none;
}

.btn-remove-item {
    background: transparent;
    border: none;
    color: var(--danger);
    font-size: 16px;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
    padding: 4px;
    border-radius: 4px;
}

.btn-remove-item:hover {
    opacity: 1;
    background: var(--danger-bg);
}



.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.analysis-header h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.analysis-item .label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}

.analysis-item .value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
}

/* --- Dashboard Layout (New Result Panel) --- */
.dashboard-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

/* 1. Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 1100px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

/* Highlight for Sales (Right 2 cards) */
.stat-card.highlight {
    background: linear-gradient(to bottom, var(--bg-surface), #f8fff9);
    border-bottom: 2px solid var(--success);
}

[data-theme="dark"] .stat-card.highlight {
    background: linear-gradient(to bottom, var(--bg-surface), rgba(0, 255, 0, 0.05));
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    text-align: center;
}

.stat-value {
    font-size: 22px;
    /* Readable size */
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.sale-text {
    color: var(--success);
}

/* 2. Middle Grid (Profit & Params) */
.middle-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    /* Profit takes less space */
    gap: 16px;
}

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

.control-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

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

.card-header h3 {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.badge-value {
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

/* Profit Slider Fancy */
.slider-container-fancy {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Print Parameters Row Style */
.params-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

@media (max-width: 600px) {
    .params-row {
        flex-direction: column;
    }
}

.param-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-body);
    padding: 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.p-icon {
    font-size: 20px;
}

.p-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.p-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary);
    margin-bottom: 2px;
}

.p-input {
    border: none;
    background: transparent;
    font-weight: 700;
    color: var(--text-main);
    font-size: 15px;
    width: 100%;
    padding: 0;
    outline: none;
}

.p-input-group {
    display: flex;
    align-items: baseline;
}

.p-input-group .unit {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-left: 2px;
}

/* --- Remove old styles --- */
/* Cost Breakdown Container */
.breakdown-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    text-align: left;
    /* Default text align */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.breakdown-container h3 {
    text-align: center;
    font-size: 18px;
    /* Larger font */
    font-weight: 800;
    margin-bottom: 25px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.breakdown-split-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    /* Reduced gap further */
    margin-bottom: 25px;
    padding: 0;
}

.breakdown-split-wrapper .preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    /* Allow stacking image and text */
    justify-content: center;
    /* Center vertically */
    align-items: center;
    /* Center horizontally */
    padding-right: 5px;
    gap: 8px;
    /* Space between image and text */
}

.preview-filename {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 10px;
}

.preview-details {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.preview-details span {
    background: var(--bg-input);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.breakdown-split-wrapper .preview-container img {
    max-width: 100%;
    height: auto;
    max-height: 220px;
    /* Slightly larger max height */
    border-radius: 12px;
    box-shadow: none;
    /* Removed shadow for cleaner look integration */
    object-fit: contain;
    background: transparent;
}

.breakdown-split-wrapper .chart-wrapper {
    flex: 1;
    display: flex;
    justify-content: flex-start;
    /* Push chart to left (towards image) */
    align-items: center;
    margin: 0 !important;
    padding-left: 5px;
}

/* Ensure chart inside wrapper scales */
.breakdown-split-wrapper .chart-wrapper canvas {
    max-width: 100% !important;
    max-height: 220px !important;
    width: auto !important;
    height: auto !important;
}

.chart-wrapper {
    height: 200px;
    margin-bottom: 24px;
    position: relative;
}

.breakdown-list {
    list-style: none;
}

.breakdown-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

.breakdown-list li:last-child {
    border-bottom: none;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.dot.material {
    background-color: #1976D2;
}

.dot.energy {
    background-color: #2E7D32;
}

.dot.wear {
    background-color: #757575;
}

.dot.base {
    background-color: #E0E0E0;
}

/* --- Theme Toggle --- */
.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-toggle-btn:hover {
    background: var(--bg-input);
    border-color: var(--text-tertiary);
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
        max-width: 100%;
        border-radius: 0;
        border: none;
        box-shadow: none;
        height: auto !important;
        /* Force auto height */
    }

    .input-panel {
        width: 100%;
        min-width: 0;
        flex: none;
        /* Reset flex basis */
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 24px 20px;
        overflow: visible;
    }

    .result-panel {
        width: 100%;
        min-width: 0;
        padding: 24px 20px;
        overflow: visible;
    }
}

/* More aggressive breakage for inner grids */
@media (max-width: 900px) {

    .input-details-grid,
    .details-grid,
    .calculators-wrapper,
    .analysis-grid,
    .settings-grid,
    .reverse-input-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        /* Use auto-fit instead of forcing 1fr immediately */
        gap: 16px;
    }

    /* If screen is very small, force single column */
    .split-layout {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    body {
        padding: 0;
    }

    /* Force true single column */
    .input-details-grid,
    .details-grid,
    .calculators-wrapper,
    .analysis-grid,
    .settings-grid,
    .reverse-input-grid {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 20px;
    }

    .subtitle {
        font-size: 12px;
    }

    .input-panel,
    .result-panel {
        padding: 16px;
    }

    .input-group label {
        font-size: 11px;
        /* Smaller labels */
    }

    /* Ensure no horizontal scroll caused by long words */
    .result-card .price {
        font-size: 22px;
    }

    .input-wrapper {
        width: 100%;
        /* Ensure inputs don't overflow */
    }

    /* Fix table overflow in print/general */
    .report-table {
        display: block;
        overflow-x: auto;
    }
}


/* --- PRINT STYLES (Preserved & Optimized) --- */
#printable-report {
    display: none;
}

@media print {
    @page {
        margin: 0;
        size: A4;
    }

    body {
        background: white;
        margin: 0;
        padding: 0;
        display: block;
    }

    .app-container {
        display: none !important;
    }

    #printable-report {
        display: block;
        width: 210mm;
        min-height: 297mm;
        padding: 10mm 15mm;
        background: white;
        color: #333;
        font-family: var(--font-sans);
        border-top: 8px solid var(--primary);
    }

    .report-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        /* Changed from flex-end to center */
        padding-bottom: 20px;
        border-bottom: 3px solid var(--primary);
        /* Thicker border */
        margin-bottom: 30px;
    }

    /* Unused .report-logo h1/span removed or ignored */

    .report-meta-left h1 {
        font-size: 38px;
        color: #D4AF37;
        /* GOLD COLOR */
        font-weight: 900;
        margin: 0 0 15px 0;
        text-transform: uppercase;
        letter-spacing: -1px;
        line-height: 1;
    }

    .report-meta {
        text-align: left;
        /* Changed from right to left */
        font-size: 11px;
        color: #555;
        margin-top: 5px;
    }

    .meta-row {
        margin-bottom: 4px;
    }

    .meta-row strong {
        color: #000;
        margin-left: 5px;
    }

    .report-recipient h3 {
        font-size: 16px;
        color: #333;
        margin-bottom: 5px;
    }

    .report-recipient p {
        font-size: 13px;
        color: #666;
        margin: 0;
    }

    .report-table {
        width: 100%;
        border-collapse: collapse;
        margin: 20px 0;
    }

    .report-table th {
        background: var(--primary);
        color: white;
        text-transform: uppercase;
        font-size: 10px;
        padding: 8px 12px;
        text-align: left;
    }

    .report-table td {
        padding: 10px 12px;
        border-bottom: 1px solid #eee;
        font-size: 12px;
        color: #444;
    }

    .report-table tbody tr:nth-child(even) {
        background-color: #f9f9f9;
        print-color-adjust: exact;
    }

    .final-row td {
        font-size: 16px !important;
        font-weight: 800;
        color: var(--primary);
        border-top: 2px solid #333;
        padding-top: 15px;
    }

    .report-tech-grid {
        display: flex;
        gap: 10px;
        background: #f8f9fa;
        padding: 15px;
        border-radius: 8px;
        margin-bottom: 30px;
        border: 1px solid #eee;
    }

    .tech-box {
        flex: 1;
        text-align: center;
        border-right: 1px solid #eee;
    }

    .tech-box:last-child {
        border-right: none;
    }

    .tech-label {
        font-size: 9px;
        color: #999;
        text-transform: uppercase;
        display: block;
        margin-bottom: 4px;
    }

    .tech-value {
        font-size: 12px;
        font-weight: 700;
        color: #333;
    }

    /* Icons */
    .tech-box:nth-child(1) .tech-label::before {
        content: "⏱️ ";
    }

    .tech-box:nth-child(2) .tech-label::before {
        content: "⚖️ ";
    }

    .tech-box:nth-child(3) .tech-label::before {
        content: "🧬 ";
    }

    .tech-box:nth-child(4) .tech-label::before {
        content: "📏 ";
    }

    .report-bottom-grid {
        display: flex;
        gap: 30px;
        margin-top: 20px;
        page-break-inside: avoid;
    }

    .bottom-left {
        flex: 1.5;
    }

    .bottom-right {
        flex: 1;
    }

    .report-bank {
        background: #f0f7ff;
        border-left: 4px solid var(--primary);
        padding: 12px;
        font-size: 11px;
        color: #555;
        border-radius: 4px;
        print-color-adjust: exact;
    }

    .report-bank h4 {
        color: var(--primary);
        margin: 0 0 5px 0;
        font-size: 11px;
    }

    .signatures {
        margin-top: 10px;
        display: flex;
        flex-direction: column;
        gap: 30px;
        text-align: center;
    }

    .sig-title {
        font-size: 10px;
        font-weight: bold;
        text-transform: uppercase;
        margin-bottom: 30px;
        color: #333;
    }

    .sig-space {
        border-bottom: 1px solid #ccc;
        width: 100%;
        margin-bottom: 4px;
    }

    .report-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        text-align: center;
        font-size: 9px;
        color: #ccc;
        border-top: 1px solid #eee;
        padding: 10px 0;
    }

    .text-right {
        text-align: right !important;
    }

    .text-center {
        text-align: center !important;
    }
}

/* --- Compact Input Panel Optimizations --- */
.compact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.compact-grid .input-group {
    margin-bottom: 0;
}

.compact-grid .input-group input {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    font-size: 13px;
    color: var(--text-main);
    width: 100%;
}

.compact-grid .input-group label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: block;
}

.unit-price-badge {
    margin-top: 10px;
    background: var(--bg-body);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px dashed var(--border);
}

.extras-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.extra-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: background 0.2s;
}

.extra-row:hover {
    background: var(--bg-body);
}

.extra-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-main);
    cursor: pointer;
    margin: 0;
}

.extra-row .checkbox-group {
    margin: 0;
}

/* Custom Checkbox (Small) */
.custom-checkbox.small .checkmark {
    height: 16px;
    width: 16px;
}

.custom-checkbox.small .checkmark:after {
    left: 4px;
    top: 1px;
    width: 4px;
    height: 9px;
}

.mini-input-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mini-input-wrapper input {
    width: 50px;
    padding: 4px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-body);
    color: var(--text-main);
    text-align: right;
}

.mini-input-wrapper span {
    font-size: 11px;
    color: var(--text-tertiary);
}

/* Report Payment Status (Manual Checkboxes) */
.report-payment-status {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #eee;
}

.report-payment-status h4 {
    font-size: 11px;
    color: var(--primary);
    margin: 0 0 5px 0;
}

.payment-check-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 11px;
    color: #555;
    page-break-inside: avoid;
}

.pay-check-box {
    width: 14px;
    height: 14px;
    border: 1px solid #999;
    background: white;
    border-radius: 3px;
}

/* --- Main Profit Slider in Card --- */
.profit-control-row {
    flex-direction: column;
    gap: 8px;
    padding: 10px 15px !important;
}

.slider-label-group {
    display: flex;
    width: 100%;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.slider-label-group .val {
    color: var(--primary);
    font-weight: 700;
}

.slider-wrapper.mini {
    height: 30px;
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 8px;
    width: 100%;
}

.slider-wrapper.mini .slider-btn {
    width: 24px;
    height: 24px;
    font-size: 14px;
    padding: 0;
}

/* Gold Highlight - Theme Aware */
.highlight-gold {
    color: #D69E2E !important;
    /* Darker Gold for Light theme readability */
    font-weight: 800;
}

[data-theme="dark"] .highlight-gold {
    color: #FFD700 !important;
    /* Brighter Gold for Dark theme */
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

/* Proposal List Styles */
.proposal-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
}

.proposal-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.proposal-item:last-child {
    border-bottom: none;
}

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

.prop-item-inputs {
    display: flex;
    gap: 5px;
}

.prop-input-mini {
    background: var(--bg-body);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 11px;
}

.btn-sm-remove {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.7;
}

.btn-sm-remove:hover {
    opacity: 1;
}

/* Secondary Button */
.btn-secondary {
    background: var(--secondary);
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-secondary:hover {
    filter: brightness(1.1);
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-danger-outline:hover {
    background: var(--danger);
    color: #fff;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(14px);
}

.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

/* --- Saved Costs Tab --- */
.saved-costs-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 10px;
}

.saved-cost-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.saved-cost-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--border-hover);
}

.saved-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.saved-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.saved-body span {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-input);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.saved-body span strong {
    color: var(--text-main);
    font-weight: 600;
}

/* --- Success Button --- */
.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
    font-family: var(--font-body);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:active {
    transform: translateY(0);
}

/* Accordion */
.saved-costs-accordion summary {
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    list-style: none; /* Hide default arrow in some browsers */
    display: flex;
    align-items: center;
    justify-content: space-between;
    outline: none;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: background 0.2s, box-shadow 0.2s;
    user-select: none;
}

.saved-costs-accordion summary::-webkit-details-marker {
    display: none;
}

.saved-costs-accordion summary::after {
    content: '▼';
    font-size: 0.8em;
    color: var(--primary);
    transition: transform 0.3s ease;
}

.saved-costs-accordion:hover summary {
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    border-color: var(--border-hover);
}

.saved-costs-accordion[open] summary {
    border-bottom: 2px solid var(--primary);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.saved-costs-accordion[open] summary::after {
    transform: rotate(180deg);
}

.saved-costs-accordion[open] .saved-costs-list {
    border: 1px solid var(--border);
    border-top: none;
    padding: 16px;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    margin-top: 0;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.saved-cost-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.saved-cost-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.saved-header {
    background: rgba(var(--primary-rgb), 0.05);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.saved-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 12px;
}

.saved-body {
    padding: 14px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.saved-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.saved-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.saved-info {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 16px;
}

.saved-info span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.saved-info span strong {
    color: var(--text-primary);
}

@media (max-width: 640px) {
    .saved-info {
        grid-template-columns: 1fr;
    }
    
    .saved-body {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .saved-image {
        width: 120px;
        height: 120px;
    }
}

/* Auth / Login Overlay */
.auth-hidden {
    display: none !important;
}

.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(20, 20, 30, 0.95), #0a0a0f);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeInScale 0.4s ease-out;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.login-logo {
    text-align: center;
    margin-bottom: 35px;
}

.login-logo img {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    object-fit: cover;
    margin-bottom: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.login-logo h2 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 800;
}

/* Form Alignment Fixes */
.login-card .form-group {
    margin-bottom: 20px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.login-card .form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: 2px;
}

.login-card .form-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box; /* Ensure inputs don't overflow */
}

.login-card .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
    background: var(--bg-surface);
    transform: translateY(-1px);
}

.login-error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 12px;
    border-radius: var(--radius-md);
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Saved Costs Optimization */
.saved-costs-search {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}

.saved-costs-search input {
    width: 100%;
    padding: 10px 15px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.saved-costs-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.load-more-container {
    padding: 20px;
    border-top: 1px solid var(--border);
}

#loadMoreBtn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-weight: 600;
    transition: all 0.2s;
}

#loadMoreBtn:hover {
    background: var(--border);
    color: var(--text-primary);
    transform: translateY(-1px);
}

#loadMoreBtn:active {
    transform: translateY(0);
}