:root {
    --bg: #f3f4f1;
    --surface: #ffffff;
    --surface-soft: #f8f8f5;
    --ink: #171a1c;
    --muted: #697076;
    --line: #dde0dc;
    --brand: #e95d28;
    --brand-dark: #c74719;
    --brand-soft: #fff0e9;
    --teal: #087f75;
    --teal-soft: #e7f7f4;
    --amber: #8b5a08;
    --amber-soft: #fff5d9;
    --danger: #bd2d34;
    --shadow: 0 12px 30px rgba(28, 31, 30, .07);
    --radius: 18px;
    --radius-sm: 11px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
.shell { width: min(1220px, calc(100% - 40px)); margin-inline: auto; }
.page-shell { min-height: calc(100vh - 150px); padding-block: 40px 64px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.site-header { position: sticky; top: 0; z-index: 50; background: rgba(22,26,29,.96); color: #fff; backdrop-filter: blur(12px); box-shadow: 0 1px 0 rgba(255,255,255,.08); }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; padding-block: 4px; color: #fff; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--brand); font-size: 14px; font-weight: 900; letter-spacing: -.4px; transform: rotate(-3deg); }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.05; }
.brand strong { font-size: 18px; letter-spacing: -.4px; }
.brand small { color: #aeb4b7; font-size: 11px; margin-top: 4px; text-transform: uppercase; letter-spacing: 1px; }
.main-nav { display: flex; align-items: center; gap: 6px; }
.main-nav > a:not(.button) { color: #c6cbcd; text-decoration: none; padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.main-nav > a:not(.button):hover, .main-nav > a.active:not(.button) { color: #fff; background: rgba(255,255,255,.08); }
.nav-add { margin-left: 8px; }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 11px; padding: 10px 17px; text-decoration: none; font-weight: 700; font-size: 14px; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--brand); box-shadow: 0 7px 16px rgba(233,93,40,.2); }
.button-primary:hover { background: var(--brand-dark); }
.button-secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.button-secondary:hover { border-color: #b9beb8; background: var(--surface-soft); }
.button-ghost { background: transparent; color: var(--muted); }
.button-danger { color: #fff; background: var(--danger); }
.button-danger-outline { background: #fff; color: var(--danger); border-color: #e3aeb1; }
.button-small { min-height: 38px; padding: 7px 13px; }
.button-full { width: 100%; }

.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin: 2px 0 4px; font-size: clamp(32px, 4vw, 46px); line-height: 1.1; letter-spacing: -1.8px; }
.page-heading p { margin: 0; color: var(--muted); }
.compact-heading { align-items: start; margin-bottom: 24px; }
.compact-heading h1 { font-size: clamp(30px, 4vw, 40px); margin-top: 8px; }
.eyebrow { display: block; color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; }
.back-link { min-height: 40px; display: inline-flex; align-items: center; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 650; }
.back-link:hover { color: var(--brand); }

.flash-stack { display: grid; gap: 9px; margin-bottom: 22px; }
.flash { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; border-radius: 12px; border: 1px solid; font-weight: 600; }
.flash-success { color: #17683f; background: #eaf7ef; border-color: #bfe5cd; }
.flash-error { color: #94252c; background: #fff0f0; border-color: #efc5c7; }
.flash-close { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 22px; line-height: 1; }

.filter-bar { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(170px, .28fr) minmax(190px, .32fr); gap: 10px; padding: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.78); border-radius: 16px; box-shadow: 0 8px 24px rgba(25,28,27,.035); margin-bottom: 25px; }
.filter-bar input, .filter-bar select { width: 100%; height: 46px; border: 1px solid transparent; border-radius: 10px; color: var(--ink); background: #f1f2ef; padding: 0 13px; outline: none; }
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--brand-soft); }
.search-field { position: relative; }
.search-field svg { position: absolute; z-index: 1; left: 14px; top: 14px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search-field input { padding-left: 42px; }

.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.project-card { min-width: 0; overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 16px rgba(26,30,28,.035); transition: box-shadow .18s, transform .18s; }
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-image-wrap { position: relative; display: block; aspect-ratio: 4/3; overflow: hidden; background: #e7e9e5; }
.card-image { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .3s; }
.project-card:hover .card-image { transform: scale(1.025); }
.image-placeholder { width: 100%; height: 100%; min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #7b827e; background: radial-gradient(circle at 30% 20%, #f8f8f5 0, #e5e8e4 58%, #dcdeda 100%); }
.image-placeholder span { display: grid; place-items: center; width: 70px; height: 70px; border: 2px dashed #aeb4af; border-radius: 19px; font-weight: 900; font-size: 22px; transform: rotate(-4deg); }
.image-placeholder small { margin-top: 12px; font-weight: 650; }
.category-chip { position: absolute; left: 14px; top: 14px; max-width: calc(100% - 28px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 10px; border-radius: 99px; color: #fff; background: rgba(20,24,25,.75); backdrop-filter: blur(8px); font-size: 11px; font-weight: 750; letter-spacing: .2px; }
.category-chip.static { position: static; display: inline-flex; color: var(--brand-dark); background: var(--brand-soft); backdrop-filter: none; }
.card-body { flex: 1; display: flex; flex-direction: column; padding: 18px; }
.card-heading { display: flex; justify-content: space-between; align-items: start; gap: 10px; margin-bottom: 15px; }
.card-heading h2 { min-width: 0; margin: 0; font-size: 19px; line-height: 1.25; letter-spacing: -.45px; }
.card-heading h2 a { text-decoration: none; }
.card-heading .muted { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.card-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; margin: 0 0 17px; border: 1px solid var(--line); border-radius: 11px; background: var(--line); }
.card-metrics div { min-width: 0; padding: 10px 11px; background: var(--surface-soft); }
.card-metrics dt { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .35px; text-transform: uppercase; }
.card-metrics dd { overflow: hidden; margin: 2px 0 0; font-weight: 760; text-overflow: ellipsis; white-space: nowrap; }
.card-metrics .filament-metric { background: var(--teal-soft); }
.card-metrics .filament-metric dd { color: var(--teal); }
.card-metrics .recommended-metric { background: var(--brand-soft); }
.card-metrics .recommended-metric dd { color: var(--brand-dark); }
.card-metrics .minimum-metric { background: var(--amber-soft); }
.card-metrics .minimum-metric dd { color: var(--amber); }
.card-actions { display: flex; align-items: center; gap: 7px; margin-top: auto; }
.card-actions .button { flex: 1; }
.card-actions form { display: contents; }
.icon-button { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: #555d60; background: #fff; text-decoration: none; font-size: 18px; cursor: pointer; }
.icon-button:hover { color: var(--ink); background: var(--surface-soft); }
.icon-button.danger:hover { color: var(--danger); border-color: #e6b7ba; background: #fff4f4; }

.empty-state { max-width: 580px; margin: 70px auto; text-align: center; }
.empty-icon { width: 76px; height: 76px; display: grid; place-items: center; margin: 0 auto 20px; border: 2px dashed #aab0aa; border-radius: 23px; color: var(--brand); background: #fff; font-size: 23px; font-weight: 900; transform: rotate(-3deg); }
.empty-state h2, .empty-state h1 { margin: 0 0 8px; letter-spacing: -.7px; }
.empty-state p { color: var(--muted); margin: 0 0 22px; }

.form-section { margin-bottom: 20px; padding: 25px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 4px 14px rgba(30,33,31,.025); }
.project-form { display: flex; flex-direction: column; }
.parts-section { order: 0; }
.calculation-results { order: 1; }
.live-total { order: 1; }
.real-cost-section { order: 2; }
.project-info { order: 3; }
.optional-links { order: 4; }
.form-actions { order: 5; }
.optional-links summary { cursor: pointer; font-weight: 700; }
.optional-links[open] summary { margin-bottom: 16px; }
.kg-price { max-width: 330px; margin-bottom: 18px; }
.kg-price small { color: var(--muted); }
.results-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.results-heading h2 { margin: 0 0 4px; font-size: 21px; }
.results-heading p, .results-note { margin: 0; color: var(--muted); font-size: 13px; }
.results-heading a { font-size: 13px; font-weight: 700; }
.result-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.result-card { min-width: 0; display: flex; flex-direction: column; gap: 7px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.result-card span { font-size: 13px; font-weight: 750; }
.result-card strong { font-size: 25px; overflow-wrap: anywhere; }
.result-card small { color: var(--muted); font-size: 12px; }
.result-recommended { border-color: #b8dcd5; background: #e9f7f3; }
.result-recommended strong { color: #11665f; }
.result-minimum { background: #fff8e7; border-color: #f0dfb5; }
.result-cost strong { color: var(--brand-dark); }
.price-warning { margin: 14px 0 0; padding: 11px 14px; border-radius: 9px; background: #fff1e4; color: #963600; font-weight: 700; font-size: 13px; }
.price-warning[hidden] { display: none; }
.calculation-results > .results-note { margin-top: 14px; }
.calculation-details { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.calculation-details summary { color: var(--teal); cursor: pointer; font-size: 14px; font-weight: 750; }
.calculation-details h3 { margin: 18px 0 6px; font-size: 15px; }
.calculation-details .cost-breakdown { margin-top: 12px; }
@media (max-width: 640px) { .result-cards { grid-template-columns: 1fr; } .result-card { padding: 14px; } }
.section-title { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 23px; }
.section-title h2 { margin: 0 0 2px; font-size: 21px; letter-spacing: -.4px; }
.section-title p { margin: 0; color: var(--muted); font-size: 14px; }
.section-title-action { align-items: center; }
.section-title-action .button { margin-left: auto; }
.step-number { width: 31px; height: 31px; flex: 0 0 31px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: var(--ink); font-size: 13px; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: 1fr 320px; gap: 19px 24px; align-items: start; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 7px; color: #3e4547; font-size: 13px; font-weight: 700; }
.field > span b { color: var(--brand); }
.field input:not([type=file]), .field textarea, .field select { width: 100%; min-height: 46px; border: 1px solid #cfd3cf; border-radius: 10px; padding: 10px 12px; outline: none; color: var(--ink); background: #fff; font-weight: 500; }
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field > small { color: var(--muted); font-weight: 500; }
.field-wide { grid-column: 1; }
.image-field { grid-column: 2; grid-row: 1 / span 3; }
.image-drop { position: relative; min-height: 260px; overflow: hidden; display: grid; place-items: center; border: 1.5px dashed #b9bfba; border-radius: 14px; color: var(--muted); background: var(--surface-soft); cursor: pointer; text-align: center; }
.image-drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.image-drop:focus-visible { border-color: var(--brand); outline: 3px solid var(--brand-soft); }
.image-drop input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.image-drop img { width: 100%; height: 260px; object-fit: cover; }
.image-drop > span { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; flex-direction: column; padding: 9px; border-radius: 9px; color: #fff; background: rgba(23,26,28,.74); font-size: 13px; }
.image-drop img[hidden] + span { position: static; color: var(--ink); background: transparent; }
.image-drop span small { color: inherit; font-weight: 500; }
.repeater-list { display: grid; gap: 11px; }
.link-row { display: grid; grid-template-columns: minmax(150px, .35fr) minmax(240px, 1fr) 42px; align-items: end; gap: 10px; }
.remove-row { width: 42px; height: 46px; display: grid; place-items: center; border: 1px solid #e2c5c7; border-radius: 10px; color: var(--danger); background: #fff7f7; font-size: 21px; cursor: pointer; }
.remove-row:hover { background: #ffeaea; }
.parts-editor-list { display: grid; gap: 14px; }
.part-editor { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfa; }
.part-editor-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); color: var(--muted); background: #f1f3ef; }
.part-editor-head .remove-row { width: 34px; height: 34px; margin-left: auto; border: 0; background: transparent; }
.drag-hint { letter-spacing: 1px; color: #acb1ad; }
.part-number { color: #4b5254; font-size: 12px; text-transform: uppercase; letter-spacing: .7px; }
.part-fields { display: grid; grid-template-columns: minmax(210px, 1.6fr) repeat(4, minmax(78px, .42fr)); gap: 12px; padding: 15px; }
.part-note { grid-column: 1 / -1; }
.part-live-cost { display: none; }
.part-live-cost > span { min-width: 0; display: flex; flex-direction: column; padding: 10px 13px; background: #fff; }
.part-live-cost small { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.part-live-cost b { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.part-live-cost .filament { background: var(--teal-soft); }
.part-live-cost .filament b { color: var(--teal); }
.part-live-cost .recommended { background: var(--brand-soft); }
.part-live-cost .recommended b { color: var(--brand-dark); }
.part-live-cost .minimum { background: var(--amber-soft); }
.part-live-cost .minimum b { color: var(--amber); }
.live-total { position: relative; overflow: hidden; display: grid; grid-template-columns: repeat(6, 1fr); margin: 24px 0; border-radius: 16px; color: #fff; background: #22272a; box-shadow: 0 12px 25px rgba(17,20,21,.14); }
.live-total > div { min-width: 0; display: flex; flex-direction: column; padding: 18px; border-right: 1px solid rgba(255,255,255,.09); }
.live-total span { color: #aeb5b7; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.live-total strong { margin-top: 3px; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-total .highlight-filament { background: #11665f; }
.live-total .highlight-filament span, .live-total .highlight-recommended span, .live-total .highlight-minimum span { color: rgba(255,255,255,.7); }
.live-total .highlight-recommended { background: var(--brand-dark); }
.live-total .highlight-minimum { background: #7d570f; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }

.detail-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 19px; }
.detail-actions { display: flex; gap: 8px; }
.detail-actions form { display: contents; }
.project-hero { display: grid; grid-template-columns: minmax(340px, .9fr) minmax(380px, 1.1fr); gap: 36px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.detail-image-wrap { overflow: hidden; min-height: 390px; border-radius: 14px; background: #e5e7e3; }
.image-zoom { position: relative; width: 100%; height: 100%; min-height: 390px; display: block; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.image-zoom img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.image-zoom > span { position: absolute; right: 13px; bottom: 13px; padding: 7px 10px; border-radius: 8px; color: #fff; background: rgba(20,23,24,.75); font-size: 12px; font-weight: 700; }
.detail-placeholder { min-height: 390px; }
.detail-intro { align-self: center; padding: 10px 14px 10px 0; }
.detail-intro h1 { margin: 12px 0 9px; font-size: clamp(32px, 5vw, 52px); line-height: 1.08; letter-spacing: -2px; }
.date-row { display: flex; flex-wrap: wrap; gap: 7px 18px; color: var(--muted); font-size: 12px; }
.project-notes, .project-links { margin-top: 25px; }
.project-notes h2, .project-links h2 { margin: 0 0 7px; font-size: 13px; text-transform: uppercase; letter-spacing: .8px; }
.project-notes p { margin: 0; color: #4e5658; white-space: pre-wrap; }
.project-links > div { display: flex; flex-wrap: wrap; gap: 8px; }
.project-links a { padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; color: #3c4649; background: var(--surface-soft); text-decoration: none; font-size: 13px; font-weight: 650; }
.project-links a:hover { border-color: var(--brand); color: var(--brand-dark); }
.summary-panel { display: grid; grid-template-columns: repeat(6, 1fr); overflow: hidden; margin: 20px 0 35px; border-radius: 16px; color: #fff; background: #24292c; box-shadow: 0 10px 25px rgba(20,23,24,.12); }
.summary-panel > div { min-width: 0; padding: 18px; border-right: 1px solid rgba(255,255,255,.09); }
.summary-panel span { display: block; color: #b4babc; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.summary-panel strong { display: block; margin-top: 4px; overflow: hidden; font-size: 19px; text-overflow: ellipsis; white-space: nowrap; }
.summary-panel .summary-filament { background: #11665f; }
.summary-panel .summary-recommended { background: var(--brand-dark); }
.summary-panel .summary-minimum { background: #7d570f; }
.summary-panel .summary-filament span, .summary-panel .summary-recommended span, .summary-panel .summary-minimum span { color: rgba(255,255,255,.72); }
.detail-section { margin-top: 30px; }
.detail-section-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 14px; }
.detail-section-head h2 { margin: 2px 0 0; font-size: 28px; letter-spacing: -.8px; }
.rate-note { color: var(--muted); font-size: 13px; }
.parts-table-wrap { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.parts-table { width: 100%; border-collapse: collapse; }
.parts-table th { padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--muted); background: #f3f5f1; font-size: 10px; letter-spacing: .5px; text-align: right; text-transform: uppercase; white-space: nowrap; }
.parts-table th:first-child { text-align: left; }
.parts-table td { padding: 15px 14px; border-bottom: 1px solid #eceeeb; text-align: right; font-size: 14px; white-space: nowrap; }
.parts-table tr:last-child td { border-bottom: 0; }
.parts-table td:first-child { max-width: 290px; text-align: left; white-space: normal; }
.parts-table td:first-child strong, .parts-table td:first-child small { display: block; }
.parts-table td:first-child small { margin-top: 3px; color: var(--muted); }
.parts-table .cost-filament { color: var(--teal); font-weight: 750; background: #f5fbfa; }
.parts-table .cost-recommended { color: var(--brand-dark); font-weight: 800; background: #fff8f4; }
.parts-table .cost-minimum { color: var(--amber); font-weight: 800; background: #fffaf0; }
.empty-inline { padding: 24px; border: 1px dashed #bdc2bd; border-radius: 13px; color: var(--muted); background: #fff; }
.empty-inline a { color: var(--brand-dark); font-weight: 700; }
.image-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 30px; background: rgba(8,10,10,.9); }
.image-modal[hidden] { display: none; }
.image-modal img { max-width: min(1100px, 95vw); max-height: 90vh; object-fit: contain; border-radius: 12px; }
.image-modal button { position: fixed; right: 20px; top: 17px; width: 48px; height: 48px; border: 0; border-radius: 50%; color: #fff; background: rgba(255,255,255,.15); font-size: 30px; cursor: pointer; }

.settings-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-card { padding: 25px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.settings-card-head { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 20px; margin-bottom: 21px; border-bottom: 1px solid var(--line); }
.settings-icon { width: 43px; height: 43px; flex: 0 0 43px; display: grid; place-items: center; border-radius: 12px; color: var(--brand-dark); background: var(--brand-soft); font-size: 20px; font-weight: 800; }
.settings-icon.backup-icon { color: var(--teal); background: var(--teal-soft); }
.settings-card h2 { margin: 0 0 3px; font-size: 20px; }
.settings-card p { margin: 0; color: var(--muted); font-size: 13px; }
.settings-form { display: grid; gap: 17px; }
.settings-form .button { justify-self: start; }
.toggle-field { display: flex; align-items: center; gap: 10px; min-height: 44px; color: #3e4547; font-size: 14px; font-weight: 650; cursor: pointer; }
.toggle-field input { width: 19px; height: 19px; accent-color: var(--brand); }
.cost-layout { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(420px, 1.2fr); gap: 20px; align-items: start; }
.cost-layout .settings-card { min-width: 0; }
.cost-source { margin: 0 0 20px; }
.cost-assumptions { margin-top: 20px; }
.cost-assumptions a { color: var(--teal); font-weight: 750; }
.cost-table-wrap { width: 100%; overflow-x: auto; }
.cost-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cost-table th, .cost-table td { padding: 11px 9px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.cost-table th:first-child { text-align: left; }
.cost-table thead th { color: var(--muted); background: var(--surface-soft); font-size: 11px; }
.cost-table tbody th { font-weight: 650; }
.cost-table .cost-subtotal { color: var(--teal); background: var(--teal-soft); font-weight: 750; }
.cost-table .cost-grand { color: var(--brand-dark); background: var(--brand-soft); font-size: 15px; font-weight: 800; }
.cost-table .cost-grand th { font-weight: 800; }
.cost-note { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.cost-table-wrap + .cost-note { margin: 14px 0 0; }
.cost-placeholder { padding: 22px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); background: var(--surface-soft); }
.project-cost-section { padding: 23px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.cost-breakdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; gap: 1px; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.cost-breakdown > div { min-width: 0; display: flex; flex-direction: column; padding: 14px; background: var(--surface-soft); }
.cost-breakdown span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.cost-breakdown strong { overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.cost-breakdown .cost-breakdown-machine { background: var(--teal-soft); }
.cost-breakdown .cost-breakdown-machine strong { color: var(--teal); }
.cost-breakdown .cost-breakdown-grand { grid-column: span 2; background: var(--brand-soft); }
.cost-breakdown .cost-breakdown-grand strong { color: var(--brand-dark); font-size: 21px; }
.input-suffix { display: flex; align-items: center; overflow: hidden; border: 1px solid #cfd3cf; border-radius: 10px; background: #f4f5f2; }
.field .input-suffix input { border: 0; border-radius: 0; box-shadow: none; }
.input-suffix > span { padding: 0 12px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.input-suffix:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.backup-actions { display: grid; gap: 17px; }
.divider { display: flex; align-items: center; gap: 10px; color: #9da3a0; font-size: 11px; text-transform: uppercase; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.backup-actions form { display: grid; gap: 14px; }
.field input[type=file] { width: 100%; padding: 9px; border: 1px dashed #bfc4bf; border-radius: 10px; color: var(--muted); background: var(--surface-soft); font-weight: 500; }
.field input[type=file]::file-selector-button { min-height: 34px; margin-right: 10px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font-weight: 650; cursor: pointer; }
.info-banner { display: flex; gap: 12px; align-items: center; margin-top: 20px; padding: 16px 18px; border: 1px solid #cbdedb; border-radius: 13px; color: #305854; background: #f0f9f7; font-size: 13px; }
.info-banner code { color: #175f58; background: #dff1ed; padding: 2px 5px; border-radius: 4px; }
.site-footer { padding: 25px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; text-align: center; }

@media (max-width: 1000px) {
    .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: 1fr 280px; }
    .part-fields { grid-template-columns: minmax(200px, 1fr) repeat(4, minmax(70px, .4fr)); }
    .part-live-cost, .live-total, .summary-panel { grid-template-columns: repeat(3, 1fr); }
    .project-hero { grid-template-columns: 1fr 1fr; gap: 24px; }
    .settings-layout { grid-template-columns: 1fr; }
    .cost-layout { grid-template-columns: 1fr; }
    .cost-breakdown { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .shell { width: min(100% - 24px, 620px); }
    .page-shell { padding-block: 24px 48px; }
    .header-inner { min-height: 64px; }
    .brand small { display: none; }
    .main-nav > a:not(.button) { display: none; }
    .main-nav > a.nav-cost:not(.button) { display: inline-flex; align-items: center; min-height: 40px; padding: 8px; color: #fff; font-size: 12px; }
    .main-nav > a.nav-cost:not(.button)::after { content: ""; }
    .nav-add { min-height: 40px; padding: 8px 12px; margin: 0; }
    .page-heading { align-items: start; margin-bottom: 20px; }
    .page-heading h1 { font-size: 34px; }
    .home-heading .desktop-action { display: none; }
    .filter-bar { grid-template-columns: 1fr 1fr; padding: 9px; gap: 8px; }
    .search-field { grid-column: 1 / -1; }
    .filter-bar input, .filter-bar select { height: 48px; font-size: 16px; }
    .project-grid { grid-template-columns: 1fr; gap: 16px; }
    .card-image-wrap { aspect-ratio: 16 / 10; }
    .project-card:hover { transform: none; }
    .form-section { padding: 18px 14px; border-radius: 15px; }
    .section-title { margin-bottom: 18px; }
    .section-title-action { flex-wrap: wrap; }
    .section-title-action .button { width: 100%; margin: 6px 0 0; }
    .section-title-action .button { min-height: 44px; }
    .form-grid { grid-template-columns: 1fr; }
    .field-wide, .image-field { grid-column: 1; }
    .image-field { grid-row: auto; }
    .image-drop, .image-drop img { min-height: 220px; height: 220px; }
    .field input:not([type=file]), .field textarea, .field select { min-height: 48px; font-size: 16px; }
    .link-row { grid-template-columns: 1fr 46px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
    .link-row .field { grid-column: 1; }
    .link-row .remove-row { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
    .part-fields { grid-template-columns: 1fr 1fr; padding: 13px; }
    .part-name, .part-note { grid-column: 1 / -1; }
    .part-editor-head .remove-row { width: 42px; height: 42px; }
    .part-fields .numeric:last-of-type { grid-column: 1 / -1; }
    .part-live-cost { grid-template-columns: 1fr 1fr; }
    .part-live-cost > span { padding: 10px; }
    .live-total { grid-template-columns: 1fr 1fr; }
    .live-total > div { padding: 14px; }
    .sticky-actions { position: sticky; z-index: 20; bottom: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.94); box-shadow: 0 8px 24px rgba(20,23,21,.16); backdrop-filter: blur(10px); }
    .sticky-actions .button-primary { flex: 1; }
    .detail-topbar { align-items: flex-start; gap: 10px; }
    .detail-actions { flex-wrap: wrap; justify-content: flex-end; }
    .detail-actions .button { min-height: 40px; padding: 7px 11px; }
    .project-hero { grid-template-columns: 1fr; padding: 14px; gap: 20px; }
    .detail-image-wrap, .image-zoom, .detail-placeholder { min-height: 290px; }
    .detail-intro { padding: 0 5px 10px; }
    .detail-intro h1 { font-size: 36px; letter-spacing: -1.2px; }
    .summary-panel { grid-template-columns: 1fr 1fr; }
    .summary-panel > div { padding: 14px; }
    .detail-section-head { align-items: flex-start; flex-direction: column; gap: 5px; }
    .parts-table-wrap { overflow: visible; border: 0; background: transparent; }
    .parts-table, .parts-table tbody { display: block; }
    .parts-table thead { display: none; }
    .parts-table tr { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; margin-bottom: 13px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
    .parts-table td, .parts-table td:first-child { max-width: none; display: flex; flex-direction: column; align-items: flex-start; padding: 10px 12px; border-bottom: 1px solid #eceeeb; text-align: left; white-space: normal; }
    .parts-table td::before { content: attr(data-label); margin-bottom: 2px; color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }
    .parts-table td:first-child { grid-column: 1 / -1; padding: 14px 12px; background: #f4f5f2; }
    .parts-table .cost-recommended, .parts-table .cost-minimum { grid-column: auto; }
    .settings-card { padding: 18px; }
    .cost-layout { grid-template-columns: 1fr; }
    .cost-table { font-size: 12px; }
    .cost-table th, .cost-table td { padding: 10px 5px; }
    .project-cost-section { padding: 17px 13px; }
    .project-cost-section .detail-section-head { flex-direction: column; align-items: flex-start; }
    .cost-breakdown { grid-template-columns: 1fr 1fr; }
    .cost-breakdown > div { padding: 12px; }
    .cost-breakdown strong { font-size: 15px; }
    .cost-breakdown .cost-breakdown-grand { grid-column: 1 / -1; }
    .info-banner { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 390px) {
    .filter-bar { grid-template-columns: 1fr; }
    .search-field { grid-column: 1; }
    .card-actions { flex-wrap: wrap; }
    .card-actions .button { flex-basis: 100%; }
    .part-fields { gap: 10px; }
    .detail-actions .button-danger { width: 42px; overflow: hidden; padding-inline: 9px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}


/* Giriş ve çıkış */
.logout-form { margin: 0; }
.logout-button { color: #c6cbcd; background: transparent; border: 1px solid rgba(255,255,255,.16); padding: 9px 12px; border-radius: 10px; font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; }
.logout-button:hover { color: #fff; background: rgba(255,255,255,.08); }
.login-card { max-width: 380px; margin: 48px auto; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 6px; font-size: 24px; }
.login-note { margin: 0 0 18px; color: var(--muted); }
.login-form { display: grid; gap: 10px; }
.login-form label { font-weight: 600; font-size: 14px; }
.login-form input { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; font-size: 16px; }
.login-form input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.login-form .button { margin-top: 6px; justify-content: center; }