:root {
    --brand: #1d4ed8;
    --border: #e2e2e2;
    --bg-muted: #f7f7f8;
    --text: #1a1a1a;
    --danger: #b91c1c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background: #fff;
    line-height: 1.5;
}

.wrap {
    width: 80%;
    max-width: 1800px;
    margin: 0 auto;
}

@media (max-width: 700px) {
    .wrap {
        width: 94%;
    }
}

.site-header {
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}

.brand {
    font-weight: 700;
    text-decoration: none;
    color: var(--text);
}

main.wrap {
    padding: 32px 20px 64px;
}

h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.catalog-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border);
    margin: 20px 0 0;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
}

.table-scroll {
    overflow-x: auto;
}

table.quote-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    margin: 20px 0;
    table-layout: fixed;
}

table.quote-table th,
table.quote-table td {
    border-bottom: 1px solid var(--border);
    padding: 12px 10px;
    text-align: left;
    vertical-align: middle;
}

table.quote-table th {
    background: var(--bg-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #555;
    text-align: center;
}

table.quote-table td.num {
    text-align: right;
}

table.quote-table td.line-subtotal {
    text-align: center;
}

table.quote-table th.col-product {
    width: 32%;
}

table.quote-table th.col-qty {
    width: 190px;
}

table.quote-table th.col-discount {
    width: 90px;
}

.product-name {
    font-size: 19px;
    font-weight: 700;
    line-height: 1.3;
    display: block;
}

.product-description {
    font-size: 13px;
    font-weight: 400;
    color: #666;
    margin-top: 5px;
    line-height: 1.4;
    display: block;
}

.product-notes {
    font-size: 13px;
    color: #777;
    font-style: italic;
}

.price-cell {
    font-weight: 700;
}

table.quote-table tr.category-row td {
    background: var(--brand);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 8px 10px;
    border-bottom: none;
}

.qty-control {
    display: flex;
    align-items: stretch;
    gap: 6px;
}

.qty-input {
    width: 56px;
    padding: 6px 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    /* Native up/down spinner replaced by the big .qty-btn buttons below */
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-btn {
    flex: 0 0 auto;
    width: 40px;
    min-height: 40px;
    border: none;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: #1740ad;
}

.qty-btn:active {
    background: #14338a;
}

.badge-mandatory {
    display: inline-block;
    font-size: 11px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    margin-left: 8px;
    color: #555;
}

.badge-max {
    display: inline-block;
    font-size: 11px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 4px;
    padding: 2px 6px;
    margin-left: 8px;
    color: #9a3412;
}

.totals {
    width: 340px;
    margin-left: auto;
    border-collapse: collapse;
}

.totals td {
    padding: 8px;
}

.totals td.num {
    text-align: right;
}

.totals tr.grand-total td {
    border-top: 2px solid var(--text);
    font-size: 16px;
    font-weight: 700;
}

.actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn-secondary {
    background: var(--bg-muted);
}

.btn-link {
    border: none;
    background: none;
    color: var(--brand);
    text-decoration: underline;
    padding: 10px 4px;
}

.save-dialog {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-muted);
    max-width: 420px;
}

.save-dialog label {
    display: block;
    margin-bottom: 12px;
    font-size: 14px;
}

.save-dialog input[type="text"],
.save-dialog input[type="email"] {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.save-confirmation {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.share-link {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.share-link input {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.doc-meta-inline {
    font-size: 13px;
    color: #555;
    margin-bottom: 16px;
}

.admin-form {
    max-width: 360px;
    margin-top: 24px;
}

.admin-form label {
    display: block;
    margin-bottom: 14px;
}

.admin-form input {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
}
