@font-face {
    font-family: DM Sans;
    src: url('/fonts/dm-sans.ttf') format('truetype');
    font-display: swap;
}
:root {
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    color: #382322;
    background: #f7f4f0;
    --ink: #382322;
    --burgundy-dark: #54132a;
    --muted: #66554e;
    --line: #e9ddd2;
    --primary: #85133a;
    --gold: #ba864a;
    --institutional-height: 118px;
    font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.22; letter-spacing: -.025em; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.85rem, 3vw, 2.5rem); font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 800; }
h3 { font-size: 1rem; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #a16026; outline-offset: 3px; }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.muted, .page-heading p { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip-link { position: fixed; top: -100px; left: 12px; padding: 12px; background: white; z-index: 20; }
.skip-link:focus { top: 12px; }

.page-loader {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 20px;
    pointer-events: none;
}
.page-loader-card {
    display: grid;
    justify-items: center;
    gap: 5px;
    text-align: center;
    text-shadow: 0 0 3px #fffaf5, 0 0 6px #fffaf5;
}
.page-loader-atom { display: block; width: 106px; height: 106px; overflow: visible; filter: drop-shadow(0 0 1px #fffaf5); }
.page-loader-orbits, .page-loader-nucleus { transform-origin: 50% 50%; }
.page-loader-orbits { animation: loader-orbits 5s linear infinite; }
.page-loader-nucleus { animation: loader-nucleus 1.6s ease-in-out infinite; }
.page-loader-card strong { color: var(--burgundy-dark); font-size: .76rem; letter-spacing: .13em; }
.page-loader-card p { font-size: .88rem; color: var(--muted); }
@keyframes loader-orbits { to { transform: rotate(360deg); } }
@keyframes loader-nucleus {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(.78); }
}
@media (prefers-reduced-motion: reduce) {
    .page-loader-orbits, .page-loader-nucleus { animation: none; }
}
@media print {
    .page-loader { display: none; }
}

.institutional-header {
    display: grid;
    place-items: center;
    position: sticky;
    top: 0;
    z-index: 7;
    height: var(--institutional-height);
    padding: 9px 24px;
    background: #fff;
    border-bottom: 3px solid var(--gold);
}
.institutional-banner { display: block; width: min(100%, 880px); height: auto; }
.institutional-mobile { display: none; }

.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100dvh - var(--institutional-height)); }
.sidebar { background: var(--burgundy-dark); color: #f3dfdf; display: flex; flex-direction: column; position: sticky; top: var(--institutional-height); height: calc(100dvh - var(--institutional-height)); overflow: auto; }
.brand { display: flex; align-items: center; gap: 12px; color: white; padding: 25px 22px; min-height: 84px; }
.brand:hover { text-decoration: none; }
.brand strong { letter-spacing: .075em; font-size: .96rem; }
.brand small { display: block; color: #f2d4d8; font-size: .78rem; }
.brand-icon { width: 39px; height: 39px; border-radius: 10px; display: grid; place-items: center; background: #85133a; color: #fff6e8; border: 1px solid #cf9d63; flex: none; }
.brand-icon .icon { width: 25px; height: 25px; }
.sidebar .brand { border-bottom: 1px solid #ffffff16; }
.sidebar nav { padding: 15px 14px 26px; }
.nav-heading { color: #edbc88; font-size: .69rem; text-transform: uppercase; font-weight: 800; letter-spacing: .13em; margin: 17px 12px 9px; }
.nav-link { display: flex; align-items: center; gap: 11px; width: 100%; color: #f6e3e4; border: 0; background: none; text-align: left; border-radius: 8px; padding: 11px 12px; margin: 3px 0; font-size: .9rem; }
.nav-link.active { color: #fff; background: #85133a; box-shadow: inset 3px 0 #efbe90; font-weight: 700; }
.nav-link:hover { text-decoration: none; color: #fff; background-color: #6b1934; }
.nav-link .icon { width: 18px; height: 18px; }
.sidebar-foot { padding: 16px 19px; margin-top: auto; border-top: 1px solid #ffffff16; }
.connection { display: flex; align-items: center; gap: 9px; font-size: .78rem; margin: 8px 7px; }
.connection i { width: 8px; height: 8px; border-radius: 50%; background: #68d5a9; }
.offline .connection i { background: #f2b863; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); min-height: 73px; padding: 12px 32px; display: flex; align-items: center; gap: 14px; }
.crumb { display: flex; align-items: center; gap: 10px; flex: 1; color: var(--muted); font-size: .86rem; }
.crumb strong { color: var(--ink); }
.crumb .icon { width: 14px; height: 14px; }
.account { display: flex; align-items: center; gap: 9px; font-size: .84rem; min-width: 0; }
.account small { display: block; color: var(--muted); font-size: .74rem; }
.avatar { background: #f5e4eb; color: #85133a; width: 35px; height: 35px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; }
.content { max-width: 1580px; margin: auto; padding: 31px 32px 44px; }
.mobile-menu { display: none !important; }

.page-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; margin-bottom: 26px; }
.page-heading h1 { color: var(--primary); }
.page-heading p { margin-top: 7px; max-width: 72ch; overflow-wrap: anywhere; }
.actions, .section-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-title { justify-content: space-between; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; min-height: 41px; border-radius: 8px; background: #fff; color: var(--ink); border: 1px solid #ddcaba; font-size: .86rem; font-weight: 750; text-align: center; line-height: 1.3; }
.button .icon { width: 17px; height: 17px; }
.button:hover { background: #f7eceb; text-decoration: none; }
.button.primary { color: #fff; border-color: var(--primary); background: var(--primary); }
.button.primary:hover { background: #690e2c; }
.icon-button { padding: 8px; width: 39px; min-height: 37px; color: #79304a; }
.text-link, .back-link { font-weight: 750; color: #85133a; font-size: .84rem; white-space: nowrap; }
.text-link .icon { width: 16px; height: 16px; margin-left: 2px; }
.back-link { display: inline-block; margin-bottom: 12px; }
.card { background: white; border: 1px solid var(--line); border-radius: 11px; min-width: 0; box-shadow: 0 2px 3px #42152808; }
.padded { padding: 22px; }
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    list-style: none;
    margin: 0 0 24px;
    padding: 5px 0 18px;
    border-bottom: 1px solid var(--line);
}
.stat + .stat { border-inline-start: 1px solid var(--line); }
.stat-metric {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "icon value" "icon label";
    align-items: center;
    column-gap: clamp(8px, 1.2vw, 18px);
    min-height: 74px;
    padding: 6px clamp(10px, 1.45vw, 22px);
}
.stat-metric:hover { text-decoration: none; }
a.stat-metric:hover .stat-label { text-decoration: underline; }
.stat .stat-icon { grid-area: icon; width: clamp(34px, 3.4vw, 50px); height: auto; color: var(--tone); }
.tile { display: inline-grid; place-items: center; border-radius: 9px; width: 39px; height: 39px; flex: none; background: #f3ece5; color: #684f48; }
.burgundy { --tint: #f7e7ee; --tone: #85133a; --bar: #a4214d; }
.gold { --tint: #fbefd9; --tone: #775021; --bar: #bd864a; }
.green { --tint: #e5f5ed; --tone: #187553; --bar: #34a682; }
.amber { --tint: #f9e9e1; --tone: #8a3e26; --bar: #bb6c49; }
.gray { --tint: #f0eae4; --tone: #65544b; --bar: #9d8b81; }
.tile, .badge { color: var(--tone, #684f48); background-color: var(--tint, #f3ece5); }
.stat-label { grid-area: label; font-size: .87rem; color: #604a43; font-weight: 750; }
.stat-label .icon { width: 13px; height: 13px; color: var(--tone); margin-inline-start: 2px; }
.stat-value { grid-area: value; color: var(--burgundy-dark); font-size: clamp(1.7rem, 3vw, 2.55rem); font-variant-numeric: tabular-nums; letter-spacing: -.045em; line-height: 1; }
.circle-link { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; color: #8a4157; }
.circle-link:hover { background: #f6e7eb; }
.circle-link .icon { width: 15px; height: 15px; }
.overview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.panel-title { padding: 19px 21px 15px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.panel-title p { font-size: .81rem; margin-top: 4px; color: var(--muted); }
.panel-title > .icon { color: #916f56; }
.distribution { padding: 0 21px 17px; display: grid; gap: 11px; }
.status-row { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; row-gap: 4px; font-size: .74rem; font-weight: 700; align-items: center; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--bar, currentColor); flex: none; }
.status-row .dot { margin-right: 7px; }
progress { grid-column: 1 / -1; width: 100%; height: 6px; border: 0; border-radius: 20px; appearance: none; background: #f0e9e2; overflow: hidden; }
progress::-webkit-progress-bar { background: #f0e9e2; }
progress::-webkit-progress-value { background: var(--bar); border-radius: 20px; }
progress::-moz-progress-bar { background: var(--bar); border-radius: 20px; }
.activity { padding: 0 21px 9px; }
.activity-item { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); font-size: .83rem; }
.activity-item .tile { width: 33px; height: 33px; }
.activity-item .tile .icon { width: 17px; height: 17px; }
.activity-item > div { min-width: 0; }
.activity-item a, .activity-item time { color: var(--muted); font-size: .73rem; }
.activity-item a { display: block; overflow-wrap: anywhere; }
.activity-item time { margin-left: auto; white-space: nowrap; }
.table-scroll { position: relative; overflow-x: auto; }
table { border-collapse: collapse; text-align: left; width: 100%; min-width: 650px; }
th, td { padding: 11px 17px; border-top: 1px solid var(--line); }
th { text-transform: uppercase; letter-spacing: .055em; font-size: .68rem; color: #685147; background: #fbf7f3; }
td { font-size: .8rem; }
td:last-child { width: 54px; }
tbody tr:hover { background: #fcf8f4; }
.asset-cell { display: flex; align-items: center; gap: 10px; min-width: 185px; }
.asset-cell .tile { width: 32px; height: 32px; }
.asset-cell .icon { width: 17px; height: 17px; }
.asset-cell small { display: block; margin-top: 2px; font-size: .73rem; color: var(--muted); overflow-wrap: anywhere; }
.badge { border-radius: 6px; padding: 4px 8px; font-size: .7rem; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-weight: 800; }
.empty { color: var(--muted); text-align: center; padding: 28px 15px; }
.pagination { padding: 13px 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }

.form-stack { display: flex; flex-direction: column; gap: 15px; }
.asset-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 0 6px; }
.field-mic {
    display: grid;
    place-items: center;
    width: 38px;
    height: 42px;
    margin-top: 21px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--primary);
}
.field-mic .icon { width: 17px; height: 17px; }
.field-mic:not(:disabled):hover, .field-mic[aria-pressed="true"] { background: #f5e4eb; }
.field-mic:disabled { opacity: .45; cursor: default; }
.field-dictation-status:not(:empty) { margin-top: 5px; font-size: .75rem; grid-column: 1 / -1; }
.form-stack > .button { align-self: flex-start; }
.padded > h2 + .form-stack, .padded > h2 + .muted { margin-top: 13px; }
.muted + .form-stack { margin-top: 15px; }
label { display: grid; gap: 5px; font-size: .82rem; color: #544039; font-weight: 750; min-width: 0; }
input, select, textarea { width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid #ddcdc0; border-radius: 7px; color: var(--ink); background: white; font-weight: 500; }
input::placeholder { color: #746158; }
textarea { resize: vertical; }
.form-grid, .fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin-top: 16px; }
.full { grid-column: 1 / -1; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 16px; }
.filter-bar label { flex: 1 1 125px; }
.filter-bar.inline { justify-content: flex-start; padding: 12px 0; }
.filter-bar.inline label { flex: 0 1 230px; }
.report-types { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.report-filters { padding-top: 0; }
.report-filters label { flex-basis: 140px; }
.report-table td { overflow-wrap: anywhere; }
.report-table td:last-child { width: auto; }
.report-table a { color: var(--primary); font-weight: 700; }
.filter-bar .search-field { flex: 2 1 225px; }
.search-field span { position: relative; }
.search-field .icon { position: absolute; top: 11px; left: 11px; color: #846659; width: 17px; }
.search-field input { padding-left: 37px; }
.notice { padding: 12px 15px; color: #176448; border: 1px solid #b8ddca; background: #ecf9f2; border-radius: 8px; margin-bottom: 16px; }
.notice.error { background: #fff0f0; border-color: #ecc4c8; color: #912b36; }
.notice ul { margin: 4px 0 0; padding-left: 22px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; margin-bottom: 18px; }
.workflow-grid, .warehouse-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; align-items: start; }
.warehouse-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.warehouse-card h2 { margin: 12px 0 6px; }
.warehouse-link { display: inline-block; margin-top: 13px; }
.compact-fields { grid-template-columns: 1fr; gap: 9px; }
.compact-fields > div { padding-bottom: 6px; }
.fields > div { border-bottom: 1px solid #f3ece5; padding-bottom: 10px; }
.fields dt { font-weight: 750; font-size: .76rem; color: var(--muted); margin-bottom: 3px; }
.fields dd { overflow-wrap: anywhere; white-space: pre-wrap; }
.qr-card { text-align: center; }
.qr-card canvas { display: block; width: min(100%, 185px); height: auto; margin: 9px auto; image-rendering: pixelated; }
.qr-card .button { margin-top: 11px; }
.qr-card strong { overflow-wrap: anywhere; }
.label-issuer { display: none; }
.event { display: flex; gap: 13px; padding: 14px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.event:first-child { margin-top: 12px; }
.event .muted, .event details { font-size: .81rem; }
.event details { margin-top: 7px; }
.event details ul { padding-left: 20px; }
.event-note { margin-top: 7px; white-space: pre-wrap; }
.event-evidence { display: grid; justify-items: start; gap: 6px; width: fit-content; max-width: 100%; margin-top: 10px; white-space: normal; }
.event-evidence img { display: block; max-width: 100%; object-fit: contain; object-position: left center; }
.narrow { max-width: 720px; }
.import-result, .catalog-details .form-stack { margin-top: 15px; }
.catalog-details { margin-bottom: 15px; }
.catalog-details summary { color: #85133a; font-weight: 750; }
.catalog-details .badge { margin-left: 5px; }
.catalog-options { padding-left: 20px; }
.camera { position: relative; aspect-ratio: 16 / 10; background: #3c2227; border-radius: 10px; color: #e9c3aa; display: grid; place-items: center; overflow: hidden; }
.camera .icon { width: 55px; height: 55px; }
.camera video { width: 100%; height: 100%; object-fit: contain; position: absolute; }
.asset-photo { display: grid; gap: 12px; }
.asset-photo label { max-width: 520px; }
.asset-photo-camera { display: grid; gap: 9px; width: min(100%, 540px); }
.asset-photo-preview { display: block; width: min(100%, 540px); max-height: 360px; object-fit: contain; object-position: left center; border-radius: 7px; }
.asset-photo [data-photo-status] { font-size: .85rem; }
.asset-photo [data-photo-status]:empty { display: none; }
.asset-photo-saved { margin-bottom: 18px; }
.asset-photo-link { display: block; width: fit-content; max-width: 100%; }

.login-shell { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100dvh - var(--institutional-height)); background: white; }
.login-intro {
    color: white;
    background:
        linear-gradient(145deg, transparent 74%, #c78a4a29 74% 74.5%, transparent 74.5% 80%, #b87b4728 80%),
        linear-gradient(145deg, #85133a, #54132a 85%);
    padding: clamp(36px, 6vw, 88px);
    display: grid;
    align-items: center;
}
.login-copy { max-width: 590px; }
.login-seal { display: block; width: clamp(105px, 12vw, 148px); height: auto; border-radius: 50%; margin-bottom: 24px; }
.login-copy h1 { font-size: clamp(2.7rem, 5.5vw, 5.5rem); margin: 10px 0 15px; line-height: 1.05; }
.login-copy p { color: #f6e4e0; max-width: 38ch; }
.login-copy .kicker { color: #f5cc9a; text-transform: uppercase; letter-spacing: .13em; font-size: .74rem; font-weight: 800; }
.login-panel { display: grid; place-items: center; padding: 26px; }
.login-form { max-width: 390px; width: 100%; }
.login-form h2 { color: var(--primary); font-size: 1.9rem; }
.login-form > p { margin: 8px 0 24px; }
.login-form .form-stack .button { width: 100%; justify-content: space-between; }
.install-guest { margin-top: 16px; }
.offline-page { min-height: 100dvh; display: grid; place-items: center; padding: 25px; }
.offline-page section { max-width: 420px; }
.offline-seal { display: block; border-radius: 50%; margin-bottom: 14px; }
.offline-page h1 { color: var(--primary); }
.offline-page p { margin: 12px 0 18px; }

@media (max-width: 1150px) {
    .shell { grid-template-columns: 213px minmax(0, 1fr); }
    .topbar, .content { padding-left: 24px; padding-right: 24px; }
    .warehouse-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    :root { --institutional-height: 75px; }
    .institutional-banner { width: auto; max-width: 100%; max-height: 54px; }
    .shell { display: block; }
    .sidebar { position: fixed; z-index: 5; top: calc(var(--institutional-height) + 65px); bottom: 0; left: 0; width: min(265px, 85vw); height: auto; box-shadow: 12px 0 30px #54132a55; visibility: hidden; }
    .menu-open .sidebar { visibility: visible; }
    .topbar { position: sticky; z-index: 6; top: var(--institutional-height); min-height: 65px; }
    .mobile-menu { display: inline-flex !important; padding: 8px; min-height: 37px; }
}
@media (max-width: 720px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 7px; padding-bottom: 12px; }
    .stat:nth-child(odd) { border-inline-start: 0; }
    .stat-metric { min-height: 62px; }
}
@media (max-width: 640px) {
    :root { --institutional-height: 66px; }
    .institutional-header { justify-items: start; padding: 8px 14px; }
    .institutional-banner { display: none; }
    .institutional-mobile { display: flex; align-items: center; gap: 10px; line-height: 1.25; }
    .institutional-mobile img { border-radius: 50%; }
    .institutional-mobile strong { display: block; color: var(--primary); font-weight: 800; letter-spacing: .055em; }
    .institutional-mobile span { color: var(--muted); font-size: .75rem; }
    .topbar, .content { padding-left: 14px; padding-right: 14px; }
    .content { padding-top: 22px; }
    .topbar { gap: 8px; }
    .crumb > span, .crumb .icon, .account > span:not(.avatar) { display: none; }
    .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 17px; }
    .overview, .workflow-grid, .detail-grid, .warehouse-grid { grid-template-columns: 1fr; gap: 13px; }
    .form-grid, .fields { gap: 12px; }
    .padded { padding: 16px; }
    .panel-title { padding-left: 16px; padding-right: 16px; }
    .login-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .login-intro { padding: 27px 20px; }
    .login-seal { display: none; }
    .login-copy h1 { font-size: 2.5rem; }
    .login-panel { padding: 32px 20px; align-items: start; }
}
@media (max-width: 420px) {
    .form-grid, .fields { grid-template-columns: 1fr; }
    .stat-label { font-size: .8rem; }
}
@media print {
    @page etiqueta-inventario {
        size: 80mm 50mm;
        margin: 0;
    }

    body.print-label { page: etiqueta-inventario; background: #fff; color: #000; }
    body.print-label .institutional-header, body.print-label .sidebar, body.print-label .topbar, body.print-label .skip-link,
    body.print-label .content > :not(.detail-grid), body.print-label .detail-grid > :not(.qr-card),
    body.print-label .qr-card > :not(canvas, .label-identification) { display: none !important; }
    body.print-label .shell, body.print-label .detail-grid { display: block; min-height: 0; margin: 0; }
    body.print-label .content { padding: 0; }
    body.print-label .qr-card {
        display: grid;
        grid-template-columns: 32mm minmax(0, 1fr);
        align-items: center;
        gap: 2mm;
        width: 100%;
        max-width: 80mm;
        min-height: 48mm;
        margin: 0 auto;
        padding: 3mm 4mm;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        text-align: left;
    }
    body.print-label .qr-card canvas { width: 32mm; height: 32mm; margin: 0; }
    body.print-label .label-issuer { display: block; margin-bottom: 2mm; font-size: 9pt; font-weight: 800; }
    body.print-label .label-identification strong {
        display: block;
        font: bold 10pt/1.2 Consolas, "Liberation Mono", monospace;
    }
}
