:root {
    --sidebar-width: 248px;
    --sidebar-bg: #0f2a43;
    --sidebar-fg: #c6d3e1;
    --sidebar-active: #1d4f7c;
    --accent: #f5a524;
    --surface: #f4f6f9;
}

html { font-size: 15px; }
body { background: var(--surface); }

/* ---------- App shell ---------- */
.app-shell .sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width);
    background: var(--sidebar-bg); color: var(--sidebar-fg);
    overflow-y: auto; z-index: 1040; transition: transform .2s ease;
}
.sidebar .brand {
    display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.25rem;
    color: #fff; font-weight: 700; text-decoration: none; font-size: 1.05rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand i { color: var(--accent); font-size: 1.4rem; }
.brand-logo { max-height: 32px; max-width: 120px; object-fit: contain; }
.sidebar .nav-link.active { background: rgba(255,255,255,.12); }
.btn-primary { --bs-btn-bg: var(--sidebar-bg); --bs-btn-border-color: var(--sidebar-bg); --bs-btn-hover-bg: color-mix(in srgb, var(--sidebar-bg) 85%, #fff); --bs-btn-hover-border-color: color-mix(in srgb, var(--sidebar-bg) 85%, #fff); --bs-btn-active-bg: color-mix(in srgb, var(--sidebar-bg) 80%, #000); }
.sidebar .nav { padding: .5rem 0 2rem; }
.sidebar .nav-section {
    text-transform: uppercase; font-size: .7rem; letter-spacing: .08em;
    color: #7f95ab; padding: 1rem 1.25rem .35rem;
}
.sidebar .nav-link {
    color: var(--sidebar-fg); padding: .5rem 1.25rem; display: flex; align-items: center; gap: .7rem;
    border-left: 3px solid transparent;
}
.sidebar .nav-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.05); }
.sidebar .nav-link.active { color: #fff; background: var(--sidebar-active); border-left-color: var(--accent); }

.app-shell .main { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 1030; background: #fff;
    display: flex; align-items: center; gap: 1rem; padding: .75rem 1.5rem;
    border-bottom: 1px solid #e3e8ef;
}
.content { padding: 1.5rem; flex: 1; }

@media (max-width: 991.98px) {
    .app-shell .sidebar { transform: translateX(-100%); }
    .app-shell.sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
    .app-shell .main { margin-left: 0; }
    .content { padding: 1rem; }
}

/* ---------- Public pages ---------- */
.public-header { background: var(--sidebar-bg); }
.brand-public { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.15rem; }
.brand-public i { color: var(--accent); }
.hero {
    background: linear-gradient(135deg, var(--sidebar-bg), #1d4f7c); color: #fff;
    border-radius: 1rem; padding: 3rem 2rem;
}

/* ---------- Components ---------- */
.card { border: 1px solid #e3e8ef; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; font-weight: 600; }
.kpi .kpi-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: #6c7a89; }
.kpi .kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.kpi .kpi-icon {
    width: 2.6rem; height: 2.6rem; border-radius: .6rem; display: grid; place-items: center; font-size: 1.25rem;
}
.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #6c7a89; font-weight: 600; background: #f8fafc; }
.table-card { margin-bottom: 0; }
.table-card td, .table-card th { white-space: nowrap; }
.table-card td.wrap { white-space: normal; }
dl.details dt { font-weight: 500; color: #6c7a89; font-size: .85rem; }
dl.details dd { margin-bottom: .6rem; }
.form-label { font-weight: 500; font-size: .9rem; }
.content a:not(.btn), .card a:not(.btn) { text-decoration: none; }
.content a:not(.btn):hover { text-decoration: underline; }
.ref { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 600; }

.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1.1rem 1.6rem; border-left: 2px solid #dfe5ec; margin-left: .45rem; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
    content: ""; position: absolute; left: -.45rem; top: .2rem; width: .8rem; height: .8rem;
    border-radius: 50%; background: #fff; border: 2px solid #1d4f7c;
}
.timeline li:first-child::before { background: var(--accent); border-color: var(--accent); }

.progress-steps { display: flex; gap: .25rem; }
.progress-steps .step { flex: 1; height: .45rem; border-radius: 1rem; background: #dfe5ec; }
.progress-steps .step.done { background: #198754; }
.progress-steps .step.current { background: var(--accent); }

.bar { height: .55rem; background: #e9eef3; border-radius: 1rem; overflow: hidden; }
.bar > span { display: block; height: 100%; background: #1d4f7c; }

/* ---------- Print (waybills, invoices) ---------- */
@media print {
    body { background: #fff; }
    .app-shell .main { margin-left: 0; }
    .content { padding: 0; }
    .card { border: none; box-shadow: none; }
}
