:root {
    --bg: #eef2f6;
    --panel: #ffffff;
    --panel-soft: #f6f9fc;
    --panel-accent: #e8f0f7;
    --text: #17212b;
    --muted: #60707f;
    --line: #d7e0e8;
    --brand: #1d4e77;
    --brand-strong: #123650;
    --accent: #c8781e;
    --success: #1f7a50;
    --warning: #c47b11;
    --danger: #b3403a;
    --shadow: 0 14px 36px rgba(17, 36, 53, 0.08);
}

body {
    background:
        radial-gradient(circle at top left, rgba(29, 78, 119, 0.08), transparent 35%),
        linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
    color: var(--text);
    font-family: "Segoe UI Variable", "Segoe UI", "Trebuchet MS", sans-serif;
    min-height: 100vh;
}

a {
    color: var(--brand);
    text-decoration: none;
}

.app-frame {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 296px;
    background: linear-gradient(180deg, var(--brand-strong) 0%, #102c42 100%);
    color: #fff;
    padding: 1.25rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

.sidebar-brand-wrap {
    padding: 0.2rem 0.25rem 0;
}

.sidebar-brand {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1.05;
}

.sidebar-subtitle {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.92rem;
    margin-top: 0.35rem;
}

.sidebar-search {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 0.85rem;
}

.sidebar-search-label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 700;
}

.sidebar-search .form-control {
    background: rgba(255, 255, 255, 0.96);
    border-color: transparent;
    border-radius: 0.8rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.nav-group {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.nav-group[hidden] {
    display: none;
}

.nav-group-summary {
    cursor: pointer;
    list-style: none;
    padding: 0.9rem 1rem;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid transparent;
}

.nav-group-summary::-webkit-details-marker {
    display: none;
}

.nav-group[open] .nav-group-summary {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.sidebar .nav {
    padding: 0.55rem;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.88);
    border-radius: 0.85rem;
    padding: 0.8rem 0.9rem;
    margin-bottom: 0.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.is-active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    transform: translateX(2px);
}

.nav-badge {
    min-width: 1.9rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 0.74rem;
    text-align: center;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.95rem 0.35rem 0;
}

.app-main {
    flex: 1;
    padding: 1.15rem;
}

.page-shell {
    max-width: 1440px;
    margin: 0 auto;
}

.topbar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(215, 224, 232, 0.92);
    border-radius: 1.35rem;
    padding: 1.15rem 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.topbar-main {
    flex: 1;
}

.topbar-title {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.1;
}

.topbar-subtitle {
    margin-top: 0.35rem;
    color: var(--muted);
    max-width: 60rem;
}

.topbar-side {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.context-chip {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--panel-accent);
    color: var(--brand-strong);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.shortcut-pills {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.shortcut-pill {
    display: inline-flex;
    align-items: center;
    min-height: 2.1rem;
    padding: 0.38rem 0.7rem;
    border-radius: 999px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    color: var(--brand);
    font-size: 0.88rem;
    font-weight: 700;
}

.page-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 1.25rem;
    box-shadow: var(--shadow);
}

.form-card {
    padding: 1.3rem;
}

.metric-card {
    background: linear-gradient(160deg, #ffffff 0%, #f5f8fb 100%);
    border: 1px solid var(--line);
    border-radius: 1.15rem;
    padding: 1rem 1.05rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.metric-value {
    font-size: 1.75rem;
    line-height: 1;
    font-weight: 800;
    color: var(--brand-strong);
}

.metric-label {
    color: var(--muted);
    font-weight: 700;
}

.section-title {
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 0.9rem;
}

.table-shell {
    border: 1px solid var(--line);
    border-radius: 1rem;
    overflow: auto;
    background: #fff;
}

.table {
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 0.88rem 0.85rem;
    vertical-align: middle;
}

.table thead th {
    background: #f7fafc;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    white-space: nowrap;
}

.form-label {
    font-weight: 800;
    color: var(--brand-strong);
}

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

.btn-primary:hover,
.btn-primary:focus {
    background: var(--brand-strong);
    border-color: var(--brand-strong);
}

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

.btn-accent:hover,
.btn-accent:focus {
    background: #a76010;
    border-color: #a76010;
    color: #fff;
}

.btn-mobile {
    min-height: 46px;
    font-weight: 700;
}

.badge-soft {
    border-radius: 999px;
    padding: 0.45rem 0.7rem;
    background: var(--panel-soft);
    color: var(--brand-strong);
    font-weight: 700;
}

.guest-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.guest-card {
    width: min(900px, 100%);
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(215, 224, 232, 0.9);
    border-radius: 1.4rem;
    box-shadow: 0 30px 65px rgba(15, 39, 60, 0.12);
    overflow: hidden;
}

.guest-hero {
    background: linear-gradient(140deg, var(--brand-strong), var(--brand));
    color: #fff;
    padding: 2rem;
    height: 100%;
}

.guest-panel {
    padding: 2rem;
}

.status-list,
.warning-list,
.activity-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.status-list li,
.warning-list li,
.activity-list li {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--line);
}

.status-list li:last-child,
.warning-list li:last-child,
.activity-list li:last-child {
    border-bottom: 0;
}

.search-toolbar {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    flex-wrap: wrap;
}

.form-section {
    background: #fbfdff;
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.mobile-nav-toggle {
    display: none;
}

.quick-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.label-sheet {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.label-card {
    background: #fff;
    border-radius: 0.85rem;
    padding: 1rem;
    box-shadow: inset 0 0 0 1px rgba(21, 32, 43, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.label-card.with-border {
    border: 1px solid var(--brand-strong);
}

.label-company {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
}

.label-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand-strong);
}

.label-subtitle,
.label-meta,
.label-code {
    font-size: 0.86rem;
    color: var(--muted);
}

.barcode-box {
    background: #fff;
    border-radius: 0.7rem;
    overflow: hidden;
}

.barcode-box svg {
    width: 100%;
    height: auto;
    display: block;
}

.label-qr-placeholder {
    align-self: flex-end;
    border: 1px dashed var(--brand-strong);
    border-radius: 0.5rem;
    padding: 0.15rem 0.45rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.location-select {
    min-height: 15rem;
}

.page-hero {
    background: linear-gradient(155deg, rgba(18, 54, 80, 0.98), rgba(29, 78, 119, 0.96));
    color: #fff;
    border-radius: 1.35rem;
    padding: 1.4rem;
    box-shadow: var(--shadow);
}

.page-hero .eyebrow {
    display: inline-flex;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.72);
    margin-bottom: 0.5rem;
}

.page-hero h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.45rem;
}

.page-hero p {
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.82);
    max-width: 56rem;
}

.hero-grid,
.action-grid,
.workspace-grid,
.detail-grid,
.summary-grid,
.type-preset-grid {
    display: grid;
    gap: 1rem;
}

.hero-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
    align-items: stretch;
}

.action-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.workspace-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}

.type-preset-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.hero-summary,
.hero-aside,
.workspace-card,
.action-card,
.soft-card,
.calc-composer,
.compact-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 1.15rem;
    box-shadow: var(--shadow);
}

.hero-summary,
.hero-aside,
.workspace-card,
.action-card,
.soft-card,
.compact-panel {
    padding: 1.15rem;
}

.hero-summary {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: none;
}

.hero-summary .summary-grid {
    margin-top: 1.1rem;
}

.hero-summary .metric-value,
.hero-summary .metric-label {
    color: #fff;
}

.hero-summary .metric-label {
    opacity: 0.75;
}

.hero-aside {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: none;
}

.hero-aside h3,
.hero-aside .section-title {
    color: #fff;
}

.hero-aside .small,
.hero-aside p,
.hero-aside li {
    color: rgba(255, 255, 255, 0.84);
}

.hero-aside ul {
    padding-left: 1rem;
    margin-bottom: 0;
}

.action-card,
.workspace-card {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-height: 100%;
}

.action-card-title,
.workspace-card-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--brand-strong);
}

.action-card p,
.workspace-card p,
.soft-card p,
.support-note {
    color: var(--muted);
    margin-bottom: 0;
}

.action-card .btn,
.workspace-card .btn {
    margin-top: auto;
}

.compact-panel {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.compact-metric {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 0.95rem;
    padding: 0.9rem 1rem;
}

.compact-metric strong {
    font-size: 1.3rem;
    color: var(--brand-strong);
}

.compact-metric span {
    color: var(--muted);
    font-weight: 700;
}

.soft-card {
    padding: 1.1rem;
}

.soft-card-muted {
    background: var(--panel-soft);
}

.calc-composer {
    padding: 1.25rem;
}

.type-preset {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    border: 1px solid var(--line);
    border-radius: 0.95rem;
    background: var(--panel-soft);
    color: var(--brand-strong);
    font-weight: 800;
    text-align: center;
    cursor: pointer;
}

.type-preset:hover,
.type-preset.is-active {
    background: var(--panel-accent);
    border-color: rgba(29, 78, 119, 0.25);
}

.conditional-field[hidden] {
    display: none !important;
}

.advanced-panel {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 1rem;
}

.advanced-panel summary {
    cursor: pointer;
    list-style: none;
    font-weight: 800;
    color: var(--brand-strong);
}

.advanced-panel summary::-webkit-details-marker {
    display: none;
}

.calc-helper {
    background: #f8fbff;
    border: 1px dashed rgba(29, 78, 119, 0.22);
    border-radius: 0.95rem;
    padding: 0.9rem 1rem;
    color: var(--muted);
}

.calc-helper strong {
    color: var(--brand-strong);
}

.barcode-scanner-panel {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 1rem;
    display: grid;
    gap: 0.85rem;
}

.barcode-scanner-video {
    width: 100%;
    min-height: 220px;
    max-height: 50vh;
    object-fit: cover;
    border-radius: 0.9rem;
    background: #0f1d29;
}

.barcode-scanner-status {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.barcode-scanner-panel[hidden] {
    display: none !important;
}

.mobile-cards {
    display: none;
}

@media (max-width: 1199.98px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991.98px) {
    .app-frame {
        display: block;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 1040;
        width: min(88vw, 320px);
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .mobile-nav-toggle {
        display: inline-flex;
    }

    .app-main {
        padding: 0.85rem;
    }

    .topbar {
        padding: 1rem;
        flex-direction: column;
    }

    .topbar-side {
        width: 100%;
        justify-content: flex-start;
    }

    .table-shell {
        display: block;
    }

    .table-shell.table-shell-mobile-hidden {
        display: none;
    }

    .mobile-cards {
        display: grid;
        gap: 0.85rem;
    }

    .quick-actions,
    .shortcut-pills {
        display: grid;
        width: 100%;
    }

    .page-hero h2 {
        font-size: 1.45rem;
    }
}

@media (max-width: 575.98px) {
    .topbar-title {
        font-size: 1.3rem;
    }

    .form-card,
    .calc-composer,
    .hero-summary,
    .hero-aside,
    .soft-card,
    .compact-panel {
        padding: 1rem;
    }

    .metric-value {
        font-size: 1.5rem;
    }
}

@media (min-width: 992px) {
    .mobile-cards {
        display: none;
    }
}
