:root {
    --bg: #eef4ff;
    --panel: rgba(255,255,255,.82);
    --line: rgba(21,37,74,.08);
    --text: #122033;
    --muted: #617089;
    --primary: #0b57d0;
    --primary-dark: #083ea0;
    --dark: #0f172a;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(11,87,208,.18), transparent 28%),
        radial-gradient(circle at bottom right, rgba(32,201,151,.14), transparent 28%),
        var(--bg);
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card { max-width: 480px; width: 100%; border-radius: 28px; }
.login-logo {
    max-width: 124px;
    max-height: 124px;
    width: auto;
    height: auto;
    object-fit: contain;
}
.login-icon {
    width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--primary), #1f7eff); color: #fff; font-size: 2rem;
    box-shadow: 0 18px 35px rgba(11,87,208,.25);
}

.app-shell { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }
.sidebar {
    background: rgba(8,18,40,.96);
    color: #fff;
    padding: 28px 22px;
    border-right: 1px solid rgba(255,255,255,.08);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.28) transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); border-radius: 999px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.42); }
.brand-box { display: flex; gap: 14px; align-items: center; }
.brand-icon {
    width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center;
    background: linear-gradient(135deg, #1d4ed8, #22c55e); font-size: 1.5rem;
}
.brand-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 18px;
    background: rgba(255,255,255,.95);
    border: 1px solid rgba(255,255,255,.12);
    padding: 6px;
}
.brand-title { font-weight: 800; font-size: 1.2rem; }
.brand-subtitle { color: rgba(255,255,255,.65); font-size: .92rem; }
.sidebar .nav-link {
    color: rgba(255,255,255,.78);
    border-radius: 16px;
    padding: 12px 14px;
    font-weight: 600;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,.1);
}
.sidebar-footer {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 18px;
    padding: 14px;
}

.content-area { padding: 28px; }
.topbar {
    display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap;
    padding: 18px 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 24px;
    backdrop-filter: blur(12px); box-shadow: 0 14px 35px rgba(15,23,42,.08);
}
.page-title { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; }

.card { border: 1px solid var(--line); border-radius: 24px; background: var(--panel); backdrop-filter: blur(12px); }
.panel-card .card-header, .stat-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--line);
    padding: 18px 22px;
    font-weight: 700;
}
.panel-card .card-body, .stat-card .card-body { padding: 22px; }
.stat-card { box-shadow: 0 12px 30px rgba(15,23,42,.06); }
.stat-label { color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; margin-bottom: 10px; }
.quick-action {
    display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text);
    padding: 16px; border-radius: 20px; border: 1px solid var(--line); background: rgba(255,255,255,.7); font-weight: 700;
}
.quick-action i { font-size: 1.25rem; color: var(--primary); }
.quick-action:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(15,23,42,.06); }

.table thead th {
    background: rgba(15,23,42,.03);
    color: var(--muted);
    font-size: .82rem;
    letter-spacing: .03em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line);
    padding: 14px 18px;
}
.table td { padding: 16px 18px; border-color: var(--line); }

.form-control, .form-select {
    min-height: 48px;
    border-radius: 14px;
    border-color: rgba(15,23,42,.12);
    box-shadow: none !important;
}
textarea.form-control { min-height: auto; }
.form-label { font-weight: 700; margin-bottom: 8px; }
.btn {
    border-radius: 14px; font-weight: 700; padding: 10px 16px;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), #2f80ff);
    border: none;
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), #236ae8); }
.btn-dark { background: var(--dark); border-color: var(--dark); }
.badge { border-radius: 999px; padding: 8px 10px; font-weight: 700; }

.total-card { border-radius: 24px; }
.accent-card {
    background: linear-gradient(135deg, #0b57d0, #0b3ea0);
    color: #fff;
    border: none;
    box-shadow: 0 20px 35px rgba(11,87,208,.24);
}
.accent-card .form-control { border: none; }
.section-bar {
    display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
}
.section-title-sm { font-size: 1.1rem; font-weight: 800; }
.metric-box {
    border: 1px solid var(--line);
    background: rgba(255,255,255,.72);
    border-radius: 20px;
    padding: 18px;
}
.metric-label { color: var(--muted); font-size: .86rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.metric-value { font-size: 1.5rem; font-weight: 800; margin-top: 8px; }
.print-sheet {
    background: rgba(255,255,255,.92);
    border-radius: 28px;
    border: 1px solid var(--line);
    box-shadow: 0 24px 60px rgba(15,23,42,.08);
}
.print-header {
    border-bottom: 2px solid rgba(15,23,42,.08);
    padding-bottom: 16px;
    margin-bottom: 22px;
}
.order-document {
    font-size: 12pt;
    line-height: 1.45;
}
.order-document .card-header,
.order-document .card-body,
.order-document .table,
.order-document .table td,
.order-document .table th,
.order-document .small,
.order-document .text-secondary,
.order-document .badge,
.order-document div,
.order-document span,
.order-document strong,
.order-document p {
    font-size: 12pt;
}
.order-document .h3 { font-size: 18pt; }
.order-document .h4 { font-size: 14pt; }
.order-document .display-6 { font-size: 18pt; }
.order-document .card-header {
    font-weight: 700;
}
.signature-box {
    border-top: 1px solid rgba(15,23,42,.16);
    padding-top: 8px;
    margin-top: 42px;
}
.timeline-item {
    border-left: 3px solid rgba(11,87,208,.2);
    padding-left: 16px;
    margin-left: 8px;
}
.timeline-item + .timeline-item { margin-top: 18px; }

.branding-preview {
    border: 1px dashed var(--line);
    border-radius: 24px;
    background: rgba(255,255,255,.7);
}
.settings-logo-preview {
    max-width: 220px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 10px;
}
.settings-logo-small {
    max-width: 72px;
    max-height: 72px;
    padding: 8px;
}

@media (max-width: 991.98px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: relative;
        top: 0;
        height: auto;
        max-height: none;
        overflow: visible;
    }
    .content-area { padding: 18px; }
}

@media print {
    @page {
        size: auto;
        margin: 12mm;
    }
    html,
    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 12pt !important;
        line-height: 1.45 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    body,
    body * {
        font-size: 12pt !important;
        line-height: 1.45 !important;
    }
    .app-shell {
        display: block;
        min-height: auto;
    }
    .content-area {
        padding: 0 !important;
    }
    .no-print,
    .sidebar,
    .topbar,
    footer,
    .offcanvas,
    .btn,
    .alert,
    .chart-area,
    .dropdown,
    .pagination,
    .form-actions {
        display: none !important;
    }
    .card,
    .panel-card,
    .print-sheet,
    .table-responsive {
        background: #fff !important;
        box-shadow: none !important;
        border: 1px solid #d9d9d9 !important;
        border-radius: 0 !important;
        backdrop-filter: none !important;
    }
    .print-sheet,
    .print-sheet *,
    .order-document,
    .order-document *,
    .card,
    .card *,
    .table,
    .table *,
    p,
    span,
    strong,
    small,
    label,
    li,
    td,
    th,
    div {
        font-size: 12pt !important;
        line-height: 1.45 !important;
    }
    .small,
    small,
    .text-muted,
    .text-secondary,
    .badge,
    .form-text {
        font-size: 12pt !important;
    }
    h1,
    .h1 { font-size: 20pt !important; }
    h2,
    .h2,
    .display-6,
    .order-document .h3 { font-size: 18pt !important; }
    h3,
    .h3,
    h4,
    .h4,
    .order-document .h4 { font-size: 14pt !important; }
    h5,
    .h5,
    h6,
    .h6,
    .page-title,
    .section-title-sm,
    .metric-label,
    .metric-value { font-size: 12pt !important; }
    .table thead th {
        background: #f2f2f2 !important;
        color: #000 !important;
        font-weight: 700 !important;
    }
    .table td,
    .table th {
        padding: 8px !important;
        vertical-align: top !important;
        font-size: 12pt !important;
    }
    .accent-card {
        color: #000 !important;
        background: #fff !important;
        border: 1px solid #d9d9d9 !important;
    }
    .badge {
        border: 1px solid #777 !important;
        color: #000 !important;
        background: transparent !important;
        padding: 3px 8px !important;
    }
    a[href]:after {
        content: none !important;
    }
    .page-break {
        page-break-before: always;
    }
}

.check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.85);
    border-radius: 16px;
    padding: 14px 16px;
    font-weight: 600;
    cursor: pointer;
}
.check-item input {
    width: 18px;
    height: 18px;
}
.check-view {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,.72);
    color: var(--muted);
    font-weight: 600;
}
.check-view.active {
    background: rgba(34,197,94,.10);
    color: #166534;
    border-color: rgba(34,197,94,.25);
}
.signature-pad {
    width: 100%;
    max-width: 100%;
    height: 160px;
    border: 1px dashed rgba(15,23,42,.18);
    border-radius: 18px;
    background: #fff;
    touch-action: none;
}
.signature-image {
    width: 100%;
    max-width: 320px;
    height: 130px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 10px;
}
