:root {
    color-scheme: light;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    --hero-min-height: 420px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top, rgba(59, 130, 246, 0.25), transparent 45%), #0f172a;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.layout {
    width: min(1400px, 95vw);
    margin: 0 auto;
}

.glass {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 28px;
    padding: clamp(1.5rem, 4vw, 3rem);
    align-items: flex-start;
    box-shadow: 0 25px 80px rgba(15, 23, 42, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.hero {
    align-self: flex-start;
    height: calc(100vh - 220px);
    text-align: center;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 0.5rem;
}
.hero p {
    margin: 0;
    min-height: var(--hero-min-height);
    height: 100%;
}


.form-grid {
    display: grid;
    overflow: auto;
    padding-bottom: 0.25rem;
}
label {
    display: flex;
    flex-direction: column;
    text-align: left;
    font-weight: 600;
    color: #475569;
    gap: 0.35rem;
}

input,
select,
textarea {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    color: #0f172a;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

select {
    appearance: none;
    background-image: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(124, 58, 237, 0.12)), url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="%232563eb" viewBox="0 0 20 20"><path d="M5.23 7.21a.75.75 0 0 1 1.06.02L10 10.21l3.71-2.98a.75.75 0 1 1 .94 1.17l-4.24 3.4a.75.75 0 0 1-.94 0l-4.24-3.4a.75.75 0 0 1 .02-1.19z"/></svg>');
    background-repeat: no-repeat;
    background-position: calc(100% - 12px) center;
    background-size: 16px;
    padding-right: 2.5rem;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.btn {
    border: none;
    border-radius: 999px;
    padding: 0.85rem 1.75rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    box-shadow: 0 15px 30px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.btn-link {
    background: transparent;
    color: #2563eb;
}
.btn.danger,
.btn-danger,
button.danger {
    background: rgba(239, 68, 68, 0.12);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-link.small {
    font-size: 0.85rem;
    padding: 0.35rem 0.85rem;
}
.btn-link.active {
    color: #0f172a;
    background: rgba(37, 99, 235, 0.12);
    border-radius: 999px;
    padding-inline: 1rem;
}

.card-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.stat-card {
    border-radius: 20px;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 23, 42, 0.05);
    box-shadow: 0 15px 45px rgba(15, 23, 42, 0.12);
}

.stat-card h3 {
    margin: 0;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}

.stat-card p {
    margin: 0.5rem 0 0;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    color: #0f172a;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.navbar nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
    font-weight: 600;
    font-size: 0.9rem;
}

.hidden {
    display: none !important;
}

pre {
    background: rgba(15, 23, 42, 0.04);
    border-radius: 16px;
    padding: 1rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    white-space: pre-wrap;
    word-break: break-word;
}

.filter-bar {
    display: block;
    margin-bottom: 1.5rem;
}

.filter-bar.pinned {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0.35rem 0;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(6px);
}

.filter-bar input,
.filter-bar select {
    border-radius: 1000px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
    min-width: 180px;
}

.filter-bar .btn {
    margin-left: 0;
    margin-top: 0.75rem;
}

.list-layout {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 1.5rem;
}

.list-panel {
    display: block;
    align-self: flex-start;
}

.list-card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 20px;
    padding: 1.25rem 1.25rem 0.75rem;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 360px;
    position: relative;
}

.table-scroll {
    overflow: auto;
    max-height: calc(100vh - 320px);
    padding-bottom: 0.25rem;
}

.section-card {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 20px;
    padding: 1rem 1rem 0.75rem;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
    display: grid;
    gap: 0.85rem;
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.section-title-row {
    display: grid;
    grid-template-columns: 1.4fr 0.6fr;
    gap: 0.75rem;
    width: 100%;
}

.section-title-row input[type="text"] {
    font-size: 1.05rem;
    font-weight: 600;
}

.section-notes label {
    font-weight: 600;
}

.section-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.section-table-wrap {
    overflow-x: auto;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.9rem;
    border-radius: 12px;
    border: 1px dashed rgba(37, 99, 235, 0.35);
    color: #2563eb;
    font-weight: 600;
    cursor: pointer;
    background: rgba(37, 99, 235, 0.06);
    transition: border-color 0.2s, background 0.2s;
    width: fit-content;
}

.upload-btn:hover {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.12);
}

.detail-panel {
    background: rgba(15, 23, 42, 0.04);
    border-radius: 24px;
    padding: 1.5rem;
    border: 1px solid rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-left: 1.5rem;
}

.customer-card,
.quote-card {
    border-radius: 20px;
    padding: 1.25rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.customer-card:hover,
.quote-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}

.customer-card h3,
.quote-card h3 {
    margin: 0 0 0.35rem;
}

.chip {
    display: inline-flex;
    padding: 0.15rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(15, 23, 42, 0.07);
    color: #0f172a;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    text-align: left;
    padding: 0.85rem 0.5rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    vertical-align: top;
}

.table thead th {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.98);
    z-index: 1;
}

.table .stacked {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.table input[data-line="quantity"],
.table input[data-line="unit_price"] {
    max-width: 120px;
    padding: 0.45rem 0.6rem;
}

.line-description {
    margin: 0.2rem 0 0;
    color: #64748b;
    font-size: 0.95rem;
}

.line-image-preview {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    border: 1px dashed rgba(15, 23, 42, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.02);
    overflow: hidden;
}

.line-image-preview.inline {
    margin-top: 0.5rem;
    display: inline-flex;
}

.line-image-preview img,
.line-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.status-badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 0.25rem 0.85rem;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.status-pending {
    background: rgba(251, 191, 36, 0.2);
    color: #92400e;
}
.status-approved {
    background: rgba(34, 197, 94, 0.2);
    color: #166534;
}
.status-rejected {
    background: rgba(239, 68, 68, 0.2);
    color: #7f1d1d;
}
.status-draft {
    background: rgba(148, 163, 184, 0.3);
    color: #0f172a;
}
.status-sent {
    background: rgba(14, 165, 233, 0.2);
    color: #0c4a6e;
}
.status-changes {
    background: rgba(249, 115, 22, 0.2);
    color: #7c2d12;
}
.status-changes-requested {
    background: rgba(249, 115, 22, 0.2);
    color: #7c2d12;
}
.status-sent {
    background: rgba(59, 130, 246, 0.2);
    color: #1d4ed8;
}
.status-draft {
    background: rgba(148, 163, 184, 0.3);
    color: #0f172a;
}

.contact-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.contact-pill {
    border-radius: 14px;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(15, 23, 42, 0.05);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.template-card {
    border-radius: 18px;
    padding: 1.25rem;
    border: 1px solid rgba(15, 23, 42, 0.07);
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.template-card textarea {
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    padding: 0.75rem;
    resize: vertical;
    min-height: 100px;
}

.template-card footer {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.totals-card {
    border-radius: 24px;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.totals-card > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.totals-card > div strong {
    text-align: right;
    min-width: 120px;
}

.column {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    width: min(540px, 100%);
    background: #fff;
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.35);
}

.modal header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 2000;
}

.toast {
    min-width: 220px;
    padding: 0.85rem 1.1rem;
    border-radius: 14px;
    box-shadow: 0 15px 30px rgba(15, 23, 42, 0.2);
    background: rgba(15, 23, 42, 0.9);
    color: #fff;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.toast-success {
    background: rgba(16, 185, 129, 0.95);
}

.toast.toast-error {
    background: rgba(239, 68, 68, 0.95);
}

.toast.toast-info {
    background: rgba(37, 99, 235, 0.95);
}

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

@media (max-width: 768px) {
    body {
        padding: 1.5rem 1rem;
    }

    .glass {
        padding: 1.5rem;
    }
}
