@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&display=swap");

:root {
    --ink: #17202a;
    --muted: #66717f;
    --line: #dce2e7;
    --paper: #f4f6f7;
    --panel: #ffffff;
    --sidebar: #17211f;
    --sidebar-2: #101816;
    --sidebar-text: #dce6e2;
    --accent: #b6752d;
    --accent-dark: #7b4a18;
    --accent-soft: #f4e8d8;
    --green: #247a55;
    --red: #c34d44;
    --blue: #346b8c;
    --shadow: 0 12px 30px rgba(27, 42, 39, .08);
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--ink);
    background: var(--paper);
    font-family: Manrope, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, input, select, textarea { outline: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    box-shadow: 0 0 0 3px rgba(182, 117, 45, .18);
}

.layout {
    display: grid;
    grid-template-columns: 224px minmax(0, 1fr);
    min-height: 100vh;
    transition: grid-template-columns .2s ease;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: 224px;
    padding: 14px 10px 10px;
    display: flex;
    flex-direction: column;
    color: var(--sidebar-text);
    background:
        linear-gradient(180deg, rgba(255,255,255,.025), transparent 28%),
        linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
    border-right: 1px solid rgba(255,255,255,.08);
    box-shadow: 10px 0 30px rgba(13, 23, 20, .12);
    transition: width .2s ease, transform .2s ease;
}

main {
    grid-column: 2;
    min-width: 0;
    transition: margin .2s ease;
}

body.sidebar-collapsed .layout { grid-template-columns: 76px minmax(0, 1fr); }
body.sidebar-collapsed .sidebar { width: 76px; }

.brand {
    min-height: 58px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #fff7ed;
    background: linear-gradient(145deg, #c8873f, #89511d);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 7px 16px rgba(0,0,0,.18);
}

.brand-mark svg { width: 21px; height: 21px; stroke-width: 1.8; }
.brand-copy { min-width: 0; }
.brand h1 {
    margin: 0;
    color: #fff;
    font-size: 14px;
    line-height: 1.15;
    font-weight: 800;
    white-space: nowrap;
}
.brand p {
    margin: 4px 0 0;
    color: #aebdb7;
    font-size: 8px;
    line-height: 1.2;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.nav {
    flex: 1;
    min-height: 0;
    display: grid;
    align-content: start;
    gap: 3px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}

.nav-group {
    margin: 13px 10px 5px;
    color: #788a83;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.nav-item {
    width: 100%;
    min-height: 38px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 14px;
    align-items: center;
    gap: 7px;
    padding: 0 8px;
    border: 0;
    border-radius: 7px;
    color: #c8d4d0;
    background: transparent;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    transition: background .15s ease, color .15s ease;
}

.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(182,117,45,.96), rgba(133,80,26,.95));
    box-shadow: 0 7px 18px rgba(0,0,0,.18);
}

.nav-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    color: #b7c6c0;
}
.nav-item.active .nav-icon { color: #fff; background: rgba(255,255,255,.12); }
.nav-icon svg { width: 16px; height: 16px; stroke-width: 1.9; }
.nav-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nav-arrow { width: 14px; height: 14px; color: #778981; }
.nav-item.active .nav-arrow { color: #fff; }

.sidebar-card {
    min-height: 66px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    margin: 10px 2px;
    padding: 10px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    background: rgba(255,255,255,.04);
}
.sidebar-card > svg { width: 22px; color: #d69b56; }
.sidebar-card strong { display: block; color: #f8fbfa; font-size: 10px; }
.sidebar-card span { display: block; margin-top: 3px; color: #91a29b; font-size: 8px; line-height: 1.35; }

.collapse {
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    border: 0;
    border-top: 1px solid rgba(255,255,255,.09);
    color: #aab8b3;
    background: transparent;
    font-size: 10px;
    font-weight: 700;
}
.collapse:hover { color: #fff; }
.collapse svg { width: 17px; height: 17px; }

body.sidebar-collapsed .brand { grid-template-columns: 38px; padding: 8px 9px; }
body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-arrow,
body.sidebar-collapsed .nav-group,
body.sidebar-collapsed .sidebar-card div,
body.sidebar-collapsed .collapse span { display: none; }
body.sidebar-collapsed .nav-item { grid-template-columns: 1fr; padding: 5px; justify-items: center; }
body.sidebar-collapsed .nav-icon { width: 32px; height: 30px; }
body.sidebar-collapsed .sidebar-card { grid-template-columns: 1fr; justify-items: center; padding: 8px; }
body.sidebar-collapsed .collapse { justify-content: center; padding: 0; }
body.sidebar-collapsed .collapse svg { transform: rotate(180deg); }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: 64px;
    display: grid;
    grid-template-columns: 38px minmax(280px, 540px) 1fr;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
    color: #edf3f1;
    background: rgba(24, 35, 39, .96);
    border-bottom: 1px solid rgba(255,255,255,.09);
    box-shadow: 0 8px 24px rgba(30, 45, 49, .15);
    backdrop-filter: blur(16px);
}

.icon-button {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px;
    color: #dbe5e2;
    background: rgba(255,255,255,.055);
}
.icon-button:hover { color: #fff; background: rgba(255,255,255,.1); }
.icon-button svg { width: 18px; height: 18px; stroke-width: 1.9; }

.search-wrap { position: relative; }
.search-wrap > svg {
    position: absolute;
    left: 13px;
    top: 50%;
    width: 17px;
    height: 17px;
    color: #91a2ac;
    transform: translateY(-50%);
    pointer-events: none;
}
.search {
    width: 100%;
    height: 40px;
    padding: 0 62px 0 40px;
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 8px;
    color: #eef4f2;
    background: #101a20;
    font-size: 11px;
    font-weight: 600;
}
.search::placeholder { color: #8f9da4; }
.keycap {
    position: absolute;
    right: 8px;
    top: 50%;
    min-width: 42px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 6px;
    color: #9eabb1;
    background: rgba(255,255,255,.05);
    font-size: 8px;
    font-weight: 800;
    transform: translateY(-50%);
}

.top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.top-icon { position: relative; }
.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 15px;
    height: 15px;
    display: grid;
    place-items: center;
    padding: 0 4px;
    border-radius: 999px;
    color: #fff;
    background: var(--accent);
    border: 2px solid #182327;
    font-size: 7px;
    font-weight: 800;
}
.admin {
    min-width: 178px;
    height: 42px;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 14px;
    align-items: center;
    gap: 8px;
    padding: 4px 9px 4px 5px;
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 8px;
    background: rgba(255,255,255,.055);
}
.admin-photo {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    color: #513113;
    background: #e8c79f;
    font-size: 11px;
    font-weight: 800;
}
.admin-copy { min-width: 0; }
.admin strong, .admin span { display: block; white-space: nowrap; }
.admin strong { color: #fff; font-size: 10px; }
.admin span { margin-top: 2px; color: #98a8a2; font-size: 8px; font-weight: 600; }
.admin-chevron { width: 13px; color: #90a09b; }

.page {
    width: 100%;
    max-width: 1680px;
    margin: 0 auto;
    padding: 22px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}
.page-head h2 { margin: 0; font-size: 22px; line-height: 1.2; }
.page-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.btn {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: #34404b;
    background: #fff;
    font-size: 10px;
    font-weight: 800;
}
.btn:hover { border-color: #bdc7ce; background: #fafbfb; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { color: #fff; border-color: var(--accent-dark); background: linear-gradient(145deg, var(--accent), var(--accent-dark)); }
.btn.dark { color: #fff; border-color: #1c2b2a; background: #1c2b2a; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 30px; padding: 0 9px; }

.date-filter {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: #3d4954;
    background: #fff;
    font-size: 10px;
    font-weight: 700;
}
.date-filter svg { width: 14px; }

.kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}
.kpi {
    min-height: 92px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 11px;
    padding: 14px;
}
.kpi-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: var(--accent-dark);
    background: var(--accent-soft);
}
.kpi-icon svg { width: 19px; height: 19px; }
.kpi small, .quick-card small { color: var(--muted); font-size: 9px; font-weight: 700; }
.kpi strong { display: block; margin-top: 4px; font-size: 18px; line-height: 1.15; }
.change { margin-top: 4px; color: var(--green); font-size: 8px; font-weight: 800; }
.change.down { color: var(--red); }

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(300px, .8fr);
    gap: 12px;
}
.dashboard-column { display: grid; gap: 12px; align-content: start; }
.panel { padding: 15px; min-width: 0; }
.panel-head {
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 11px;
}
.panel h3 { margin: 0; font-size: 13px; }
.panel-subtitle { margin: -5px 0 12px; color: var(--muted); font-size: 9px; }
.panel-link { border: 0; color: var(--accent-dark); background: transparent; font-size: 9px; font-weight: 800; }

.production-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}
.stage {
    min-height: 116px;
    padding: 11px;
    border: 1px solid #e3e7ea;
    border-radius: 7px;
    background: #f8f9f9;
}
.stage-head { display: flex; justify-content: space-between; gap: 8px; color: #4d5b63; font-size: 9px; font-weight: 800; }
.stage-head b { color: var(--accent-dark); }
.stage strong { display: block; margin-top: 12px; font-size: 13px; }
.stage span { display: block; margin-top: 5px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.progress { height: 5px; margin-top: 13px; overflow: hidden; border-radius: 99px; background: #e2e6e8; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #d2a46c); }

.order-list, .activity-list, .stock-list, .template-list { display: grid; gap: 7px; }
.order-row, .activity-row, .stock-row, .template-row {
    min-height: 48px;
    display: grid;
    align-items: center;
    gap: 9px;
    padding: 8px 0;
    border-bottom: 1px solid #edf0f1;
}
.order-row { grid-template-columns: 34px minmax(0, 1fr) auto; }
.activity-row { grid-template-columns: 30px minmax(0, 1fr) auto; }
.stock-row { grid-template-columns: minmax(0, 1fr) auto; }
.order-row:last-child, .activity-row:last-child, .stock-row:last-child, .template-row:last-child { border-bottom: 0; }
.row-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    color: var(--accent-dark);
    background: var(--accent-soft);
}
.row-icon svg { width: 15px; height: 15px; }
.row-copy { min-width: 0; }
.row-copy strong { display: block; font-size: 10px; }
.row-copy span { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.row-value { color: #34424a; font-size: 9px; font-weight: 800; white-space: nowrap; }

.status {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    color: var(--green);
    background: #e7f3ed;
    font-size: 8px;
    font-weight: 800;
    white-space: nowrap;
}
.status.warn { color: #9b5c16; background: #f8ecdc; }
.status.danger { color: #a53e37; background: #f8e4e2; }
.status.info { color: #2e6785; background: #e5f0f5; }

.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 12px;
}
.quick-card { min-height: 74px; padding: 13px; }
.quick-card strong { display: block; margin-top: 7px; font-size: 17px; }

.module-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr);
    gap: 12px;
}
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.data-table th, .data-table td { padding: 10px 9px; border-bottom: 1px solid #edf0f1; text-align: left; white-space: nowrap; }
.data-table th { color: #697681; background: #f8f9fa; font-size: 8px; text-transform: uppercase; }
.data-table tr:last-child td { border-bottom: 0; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { color: #4b5862; font-size: 9px; font-weight: 800; }
.field input, .field select, .field textarea {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink);
    background: #fff;
    font-size: 10px;
}
.field textarea { min-height: 82px; padding-top: 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #bb884d; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.signature-section {
    margin-top: 16px;
    padding-top: 15px;
    border-top: 1px solid #e7eaec;
}
.signature-section .panel-head { margin-bottom: 9px; }
.signature-section .panel-subtitle { margin: 3px 0 0; }
.signature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}
.signature-upload {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 126px;
    gap: 9px 12px;
    align-items: center;
    padding: 11px;
    border: 1px dashed #cfd6da;
    border-radius: 7px;
    background: #fafbfb;
}
.signature-copy {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}
.signature-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    color: var(--accent-dark);
    background: var(--accent-soft);
}
.signature-icon svg { width: 16px; height: 16px; }
.signature-copy strong { display: block; font-size: 9px; }
.signature-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 7px; line-height: 1.35; }
.signature-preview {
    height: 54px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid #e0e4e6;
    border-radius: 6px;
    color: #939da3;
    background: #fff;
    font-size: 7px;
    text-align: center;
}
.signature-preview img {
    width: 100%;
    height: 100%;
    padding: 4px;
    object-fit: contain;
}
.signature-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 7px;
}
.signature-actions label { cursor: pointer; }
.signature-file {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}
.signature-remove:disabled { cursor: not-allowed; opacity: .45; }

.quotation-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(310px, .75fr);
    gap: 12px;
}
.quote-form { padding: 16px; }
.quote-lines { margin-top: 14px; }
.quote-line {
    display: grid;
    grid-template-columns: 1.4fr repeat(4, .65fr) 30px;
    gap: 7px;
    align-items: end;
    padding: 10px 0;
    border-bottom: 1px solid #edf0f1;
}
.quote-line:first-child { border-top: 1px solid #edf0f1; }
.quote-line .remove-line { width: 30px; height: 36px; color: var(--red); border: 0; background: transparent; }
.quote-line .remove-line svg { width: 15px; }
.quote-summary { padding: 16px; align-self: start; position: sticky; top: 80px; }
.quote-brand { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.quote-brand strong { display: block; font-size: 15px; }
.quote-brand span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; color: #56636d; font-size: 10px; }
.summary-row.total { margin-top: 5px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 800; }
.quote-note { margin: 12px 0; padding: 10px; border-radius: 7px; color: #74501f; background: #faf1e5; font-size: 8px; line-height: 1.5; }

.mail-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 12px; }
.mail-library, .mail-editor { padding: 15px; }
.template-row {
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 9px;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
}
.template-row:hover, .template-row.active { border-color: #d8c2a8; background: #fbf5ed; }
.template-row svg { width: 16px; color: var(--accent-dark); }
.template-row strong { display: block; font-size: 10px; }
.template-row span { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.mail-editor .field + .field { margin-top: 10px; }
.mail-body { min-height: 260px !important; line-height: 1.65; }

.spec-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.spec-card { padding: 14px; }
.spec-card svg { width: 19px; color: var(--accent-dark); }
.spec-card h3 { margin: 10px 0 5px; font-size: 12px; }
.spec-card p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.spec-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 11px; }
.spec-meta span { padding: 4px 7px; border-radius: 5px; color: #78501f; background: #f7ecdf; font-size: 8px; font-weight: 700; }

.empty-state { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty-state svg { width: 32px; height: 32px; color: #a6b0b7; }
.empty-state strong { display: block; margin-top: 10px; color: var(--ink); }

.print-quotation { display: none; }

footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
    padding: 0 4px;
    color: #879198;
    font-size: 8px;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 100;
    max-width: 320px;
    padding: 11px 14px;
    border-radius: 7px;
    color: #fff;
    background: #172622;
    box-shadow: 0 16px 38px rgba(0,0,0,.22);
    font-size: 10px;
    font-weight: 700;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.mobile-scrim { display: none; }

@media (max-width: 1180px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .production-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .module-grid, .quotation-layout { grid-template-columns: 1fr; }
    .quote-summary { position: static; }
}

@media (max-width: 900px) {
    .layout, body.sidebar-collapsed .layout { grid-template-columns: 1fr; }
    .sidebar, body.sidebar-collapsed .sidebar {
        width: 224px;
        transform: translateX(-100%);
    }
    body.mobile-nav-open .sidebar { transform: translateX(0); }
    main { grid-column: 1; }
    body.sidebar-collapsed .brand { grid-template-columns: 38px minmax(0, 1fr); padding: 8px; }
    body.sidebar-collapsed .brand-copy,
    body.sidebar-collapsed .nav-label,
    body.sidebar-collapsed .nav-arrow,
    body.sidebar-collapsed .nav-group,
    body.sidebar-collapsed .sidebar-card div,
    body.sidebar-collapsed .collapse span { display: block; }
    body.sidebar-collapsed .nav-item { grid-template-columns: 30px minmax(0, 1fr) 14px; padding: 0 8px; justify-items: stretch; }
    body.sidebar-collapsed .sidebar-card { grid-template-columns: 30px minmax(0, 1fr); justify-items: stretch; padding: 10px; }
    body.sidebar-collapsed .collapse { justify-content: flex-start; padding: 0 10px; }
    body.sidebar-collapsed .collapse svg { transform: none; }
    .mobile-scrim {
        position: fixed;
        inset: 0;
        z-index: 35;
        background: rgba(4,12,10,.5);
    }
    body.mobile-nav-open .mobile-scrim { display: block; }
    .topbar { grid-template-columns: 38px minmax(180px, 1fr) auto; padding: 0 12px; }
    .top-icon { display: none; }
    .admin { min-width: 42px; width: 42px; padding: 4px; grid-template-columns: 32px; }
    .admin-copy, .admin-chevron { display: none; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .mail-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .page { padding: 16px 12px; }
    .topbar { grid-template-columns: 38px minmax(0, 1fr); }
    .top-actions { display: none; }
    .keycap { display: none; }
    .search { padding-right: 10px; }
    .page-head { align-items: flex-start; flex-direction: column; }
    .page-actions { width: 100%; }
    .kpis, .quick-grid, .production-board, .spec-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .signature-grid { grid-template-columns: 1fr; }
    .signature-upload { grid-template-columns: minmax(0, 1fr) 108px; }
    .field.full { grid-column: auto; }
    .quote-line { grid-template-columns: 1fr 1fr; }
    .quote-line .field:first-child { grid-column: 1 / -1; }
    .quote-line .remove-line { align-self: end; }
    footer { flex-direction: column; }
}

@page {
    size: A4 portrait;
    margin: 10mm;
}

@media print {
    html, body {
        width: 210mm !important;
        min-width: 210mm !important;
        min-height: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        color: #1d252b !important;
        background: #fff !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    body * { visibility: hidden !important; }

    .print-quotation,
    .print-quotation * {
        visibility: visible !important;
    }

    .sidebar,
    .topbar,
    .quotation-layout,
    .page-head,
    .page > footer,
    .toast,
    .mobile-scrim {
        display: none !important;
    }

    .layout,
    body.sidebar-collapsed .layout,
    main,
    .page {
        display: block !important;
        width: auto !important;
        max-width: none !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .print-quotation {
        position: absolute;
        top: 0;
        left: 0;
        display: block !important;
        width: 190mm;
        min-height: 272mm;
        padding: 12mm 12mm 10mm;
        overflow: hidden;
        color: #1d252b;
        background: #fff;
        border: .35mm solid #d8cec1;
        font-family: Manrope, Arial, sans-serif;
    }

    .print-quotation::after {
        content: "";
        position: absolute;
        right: 0;
        bottom: 0;
        width: 54mm;
        height: 9mm;
        background: #9a5e20;
        clip-path: polygon(18% 0, 100% 0, 100% 100%, 0 100%);
    }

    .print-quote-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10mm;
    }

    .print-brand {
        display: flex;
        align-items: center;
        gap: 4mm;
    }

    .print-brand-mark {
        width: 15mm;
        height: 15mm;
        display: grid;
        place-items: center;
        border-radius: 3mm;
        color: #fff;
        background: #9a5e20;
    }

    .print-brand-mark svg {
        width: 8mm;
        height: 8mm;
        stroke-width: 1.7;
    }

    .print-brand strong {
        display: block;
        color: #192321;
        font-size: 18pt;
        line-height: 1;
        font-weight: 800;
    }

    .print-brand span {
        display: block;
        margin-top: 2mm;
        color: #83613d;
        font-size: 7pt;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .8pt;
    }

    .print-company {
        max-width: 72mm;
        text-align: right;
    }

    .print-company b {
        display: block;
        color: #9a5e20;
        font-size: 20pt;
        line-height: 1;
        letter-spacing: 1.4pt;
    }

    .print-company span {
        display: block;
        margin-top: 2mm;
        color: #67716e;
        font-size: 7pt;
    }

    .print-accent-line {
        height: 1.2mm;
        margin: 6mm 0;
        background: linear-gradient(90deg, #9a5e20 0 31%, #1d2b28 31% 100%);
    }

    .print-quote-meta {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 72mm;
        gap: 10mm;
        padding: 5mm;
        border: .3mm solid #ded8d1;
        background: #faf8f5;
    }

    .print-quote-meta small {
        display: block;
        color: #8a7155;
        font-size: 7pt;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .5pt;
    }

    .print-quote-meta strong {
        display: block;
        margin-top: 2mm;
        color: #1d2926;
        font-size: 11pt;
    }

    .print-quote-meta > div > span {
        display: block;
        margin-top: 1.5mm;
        color: #58635f;
        font-size: 8pt;
    }

    .print-quote-meta dl { margin: 0; }
    .print-quote-meta dl div {
        display: grid;
        grid-template-columns: 30mm 1fr;
        gap: 4mm;
        padding: 1.5mm 0;
        border-bottom: .2mm solid #e4ded7;
    }
    .print-quote-meta dl div:last-child { border-bottom: 0; }
    .print-quote-meta dt { color: #7b8581; font-size: 7pt; }
    .print-quote-meta dd { margin: 0; text-align: right; font-size: 7.5pt; font-weight: 800; }

    .print-intro {
        margin: 5mm 0 4mm;
        color: #56605d;
        font-size: 7.5pt;
        line-height: 1.6;
    }

    .print-items {
        width: 100%;
        border-collapse: collapse;
        table-layout: fixed;
        font-size: 7.5pt;
    }

    .print-items th {
        padding: 3mm 2.3mm;
        color: #fff;
        background: #1d2b28;
        text-align: right;
        font-size: 6.8pt;
        text-transform: uppercase;
    }

    .print-items th:nth-child(1),
    .print-items td:nth-child(1) { width: 8mm; text-align: center; }
    .print-items th:nth-child(2),
    .print-items td:nth-child(2) { width: auto; text-align: left; }
    .print-items th:nth-child(3),
    .print-items td:nth-child(3) { width: 19mm; }
    .print-items th:nth-child(4),
    .print-items td:nth-child(4),
    .print-items th:nth-child(5),
    .print-items td:nth-child(5) { width: 23mm; }
    .print-items th:nth-child(6),
    .print-items td:nth-child(6) { width: 30mm; }

    .print-items td {
        padding: 3.3mm 2.3mm;
        border-right: .2mm solid #e2ddd6;
        border-bottom: .2mm solid #e2ddd6;
        text-align: right;
        vertical-align: top;
        line-height: 1.45;
    }

    .print-items td:first-child { border-left: .2mm solid #e2ddd6; }
    .print-items tbody tr:nth-child(even) { background: #fbf9f6; }

    .print-bottom-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 68mm;
        gap: 8mm;
        margin-top: 5mm;
    }

    .print-terms,
    .print-totals {
        padding: 4mm;
        border: .3mm solid #ded8d1;
    }

    .print-terms h3,
    .print-notes h3 {
        margin: 0 0 2.5mm;
        color: #9a5e20;
        font-size: 8pt;
        text-transform: uppercase;
        letter-spacing: .5pt;
    }

    .print-terms div,
    .print-totals div {
        display: flex;
        justify-content: space-between;
        gap: 5mm;
        padding: 1.4mm 0;
        color: #65706c;
        font-size: 7pt;
    }

    .print-terms b,
    .print-totals b {
        color: #26312e;
        text-align: right;
        font-weight: 800;
    }

    .print-totals .grand {
        align-items: center;
        margin: 2mm -4mm -4mm;
        padding: 3mm 4mm;
        color: #fff;
        background: #9a5e20;
        font-size: 9pt;
        font-weight: 800;
    }

    .print-totals .grand b { color: #fff; font-size: 11pt; }
    .print-totals i { font-style: normal; font-size: 6.5pt; }

    .print-notes {
        margin-top: 5mm;
        padding: 4mm;
        border-left: 1.2mm solid #9a5e20;
        background: #faf6f0;
    }

    .print-notes p {
        margin: 0;
        color: #5c6662;
        font-size: 7pt;
        line-height: 1.6;
    }

    .print-quote-footer {
        position: absolute;
        right: 12mm;
        bottom: 14mm;
        left: 12mm;
        display: flex !important;
        align-items: flex-end;
        justify-content: space-between;
        gap: 10mm;
        padding-top: 5mm;
        border-top: .3mm solid #d8d2ca;
        color: #68726e;
    }

    .print-quote-footer strong {
        display: block;
        color: #1d2926;
        font-size: 8pt;
    }

    .print-quote-footer span {
        display: block;
        margin-top: 1mm;
        font-size: 6.5pt;
    }

    .print-signature {
        min-width: 45mm;
        text-align: center;
    }

    .print-signature-image {
        height: 14mm;
        display: grid;
        place-items: end center;
        margin-bottom: 1.5mm;
        border-bottom: .3mm solid #6d7672;
    }

    .print-signature-image img {
        display: block;
        width: 38mm;
        height: 13mm;
        object-fit: contain;
    }

    .print-signature-image span {
        padding-bottom: 1.5mm;
        color: #a0a7a4;
        font-size: 6pt;
    }

    .print-signature b {
        display: block;
        margin-top: 1mm;
        color: #26312e;
        font-size: 7pt;
    }
}
