:root {
    --hg-primary: #2E7D32;
    --hg-primary-light: #43A047;
    --hg-accent: #7CB342;
    --hg-bg: #F5F6FA;
    --hg-surface: #FFFFFF;
    --hg-text: #1A1A2E;
    --hg-text-muted: #6B7280;
    --hg-border: #E5E7EB;
    --hg-success: #16A34A;
    --hg-warning: #D97706;
    --hg-danger: #DC2626;
    --hg-nav-height: 68px;
    --bs-primary: #2E7D32;
    --bs-primary-rgb: 46, 125, 50;
    --bs-link-color: #2E7D32;
    --bs-link-hover-color: #1B5E20;
    color-scheme: light;
}

.hg-db-env-page {
    max-width: 1220px;
    margin: 0 auto;
    display: grid;
    gap: 18px;
}

.hg-db-current {
    display: grid;
    gap: 6px;
    padding: 18px 20px;
    border: 1px solid var(--hg-border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--hg-primary) 5%, var(--hg-surface));
}

.hg-db-current span,
.hg-db-env-head span {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--hg-text-muted);
    font-weight: 900;
}

.hg-db-current strong {
    color: var(--hg-text);
    font-size: 20px;
    line-height: 1.2;
}

.hg-db-current small {
    color: var(--hg-text-muted);
    font-weight: 700;
}

.hg-db-current-prod {
    border-color: rgba(127, 29, 29, .28);
    background: rgba(127, 29, 29, .07);
}

.hg-db-current-prod strong {
    color: #7F1D1D;
}

.hg-db-env-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
}

.hg-db-env-card {
    display: grid;
    grid-template-rows: auto auto 1fr auto auto;
    gap: 12px;
    min-width: 0;
    margin: 0;
    padding: 18px;
    border: 1px solid var(--hg-border);
    border-radius: 16px;
    box-shadow: 0 8px 26px rgba(15, 23, 42, .06);
    overflow: visible;
}

.hg-db-env-card-active {
    border-color: color-mix(in srgb, var(--hg-primary) 48%, var(--hg-border));
    box-shadow: 0 12px 30px rgba(46, 125, 50, .12);
}

.hg-db-env-card-prod {
    border-color: rgba(127, 29, 29, .20);
}

.hg-db-env-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.hg-db-env-head span {
    color: var(--hg-text);
    font-size: 14px;
    letter-spacing: 0;
    text-transform: none;
}

.hg-db-env-head strong {
    flex: 0 0 auto;
    color: var(--hg-primary);
    background: color-mix(in srgb, var(--hg-primary) 12%, transparent);
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 11px;
    text-transform: uppercase;
}

.hg-db-env-card p {
    margin: 0;
    color: var(--hg-text-muted);
    font-weight: 700;
    font-size: 13px;
    line-height: 1.35;
}

.hg-db-env-card dl {
    margin: 0;
    display: grid;
    gap: 10px;
}

.hg-db-env-card dl > div {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 10px;
    align-items: baseline;
}

.hg-db-env-card dt {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--hg-text-muted);
    font-weight: 900;
}

.hg-db-env-card dd {
    margin: 0;
    color: var(--hg-text);
    font-weight: 800;
    font-size: 13px;
    line-height: 1.25;
    word-break: break-word;
}

.hg-db-prod-warning {
    color: #7F1D1D;
    background: rgba(127, 29, 29, .07);
    border: 1px solid rgba(127, 29, 29, .20);
    border-radius: 12px;
    padding: 9px 10px;
    font-size: 13px;
    font-weight: 900;
}

.hg-db-env-card .hg-primary-action {
    width: 100%;
    min-height: 44px;
}

:root[data-theme="dark"] .hg-db-current-prod strong,
:root[data-theme="dark"] .hg-db-prod-warning {
    color: #FCA5A5;
}

:root[data-theme="dark"] .hg-db-current-prod,
:root[data-theme="dark"] .hg-db-prod-warning {
    border-color: rgba(248, 113, 113, .22);
    background: rgba(127, 29, 29, .18);
}

@media (max-width: 980px) {
    .hg-db-env-grid {
        grid-template-columns: 1fr;
    }
}


:root[data-theme="dark"] {
    --hg-primary: #2F8F46;
    --hg-primary-light: #3FAE5A;
    --hg-accent: #86EFAC;
    --hg-bg: #101114;
    --hg-surface: rgba(29,30,34,.88);
    --hg-text: #F5F5F7;
    --hg-text-muted: #A1A1AA;
    --hg-border: rgba(255,255,255,.11);
    --hg-success: #4ADE80;
    --hg-warning: #FBBF24;
    --hg-danger: #F87171;
    --bs-primary: #2F8F46;
    --bs-primary-rgb: 47, 143, 70;
    --bs-link-color: #86EFAC;
    --bs-link-hover-color: #BBF7D0;
    color-scheme: dark;
}

.btn-primary {
    --bs-btn-bg: var(--hg-primary);
    --bs-btn-border-color: var(--hg-primary);
    --bs-btn-hover-bg: var(--hg-primary-light);
    --bs-btn-hover-border-color: var(--hg-primary-light);
    --bs-btn-active-bg: var(--hg-primary);
    --bs-btn-active-border-color: var(--hg-primary);
    --bs-btn-disabled-bg: var(--hg-primary);
    --bs-btn-disabled-border-color: var(--hg-primary);
}

:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .hg-primary-action,
:root[data-theme="dark"] .hg-action-bar a,
:root[data-theme="dark"] .hg-action-bar button {
    background: #2F8F46;
    border-color: #2F8F46;
    color: #FFFFFF;
}

:root[data-theme="dark"] .btn-primary:hover,
:root[data-theme="dark"] .hg-primary-action:hover,
:root[data-theme="dark"] .hg-action-bar a:hover,
:root[data-theme="dark"] .hg-action-bar button:hover {
    background: #3FAE5A;
    border-color: #3FAE5A;
    color: #FFFFFF;
}

:root[data-theme="dark"] a:not(.hg-primary-action):not(.hg-secondary-action):not(.hg-row-action):not(.hg-nav-item):not(.hg-list-item):not(.hg-list-main-link) {
    color: #86EFAC;
}

:root[data-theme="dark"] a:not(.hg-primary-action):not(.hg-secondary-action):not(.hg-row-action):not(.hg-nav-item):not(.hg-list-item):not(.hg-list-main-link):hover {
    color: #BBF7D0;
}

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

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--hg-bg);
    color: var(--hg-text);
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

body,
.hg-header,
.hg-card,
.hg-list,
.hg-search,
.hg-tabs,
.hg-action-bar,
.hg-shell-sidebar,
.hg-bottom-nav,
.hg-input,
.hg-nav-item,
.hg-env-footer {
    transition: background-color .22s ease, color .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.hg-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.hg-main {
    flex: 1;
    padding-bottom: calc(var(--hg-nav-height) + 8px);
    overflow-y: auto;
}

/* ---- BOTTOM NAV ---- */
.hg-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    height: var(--hg-nav-height);
    background: var(--hg-surface);
    border-top: 1px solid var(--hg-border);
    display: flex;
    align-items: stretch;
    box-shadow: 0 -2px 12px rgba(0,0,0,.08);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.hg-bottom-nav::-webkit-scrollbar { display: none; }

.hg-nav-sections {
    display: flex;
    align-items: stretch;
    min-width: max-content;
}

.hg-nav-group {
    display: flex;
    align-items: stretch;
}

.hg-nav-group-title {
    display: none;
}

.hg-nav-item {
    flex: 0 0 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--hg-text-muted);
    text-decoration: none;
    font-size: 9px;
    font-weight: 500;
    transition: color .15s;
    padding: 8px 3px;
}

.hg-nav-item svg { width: 21px; height: 21px; }

.hg-nav-item.active, .hg-nav-item:hover { color: var(--hg-primary); }

.hg-nav-disabled {
    display: none;
}

.hg-mobile-nav-primary,
.hg-mobile-menu-toggle,
.hg-mobile-menu-backdrop,
.hg-mobile-menu-sheet {
    display: none;
}

/* ---- HEADER ---- */
.hg-header {
    background: var(--hg-primary);
    color: white;
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.hg-header h1 { font-size: 18px; font-weight: 600; }
.hg-header .subtitle { font-size: 12px; opacity: .8; margin-top: 2px; }
.hg-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.hg-page-header-main {
    min-width: 0;
    flex: 1;
    width: 100%;
}
.hg-page-header-title {
    min-width: 0;
    text-align: left;
    width: 100%;
}
.hg-page-header-title h1 {
    overflow-wrap: anywhere;
}
.hg-page-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 50%;
}
.hg-page-header-actions .hg-primary-action,
.hg-page-header-actions .hg-secondary-action,
.hg-page-header-actions a,
.hg-page-header-actions button {
    min-height: 36px;
    padding: 8px 12px;
}
.hg-brand-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
.hg-brand-header img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 10px;
    background: rgba(255,255,255,.94);
    padding: 4px;
}

/* ---- SEARCH ---- */
.hg-search {
    background: white;
    padding: 10px 16px;
    border-bottom: 1px solid var(--hg-border);
    position: sticky;
    top: 60px;
    z-index: 40;
}
.hg-search input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--hg-border);
    border-radius: 10px;
    font-size: 15px;
    background: var(--hg-bg);
    outline: none;
}
.hg-search input:focus { border-color: var(--hg-primary-light); }
.hg-filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--hg-border);
    background: var(--hg-surface);
}
.hg-check-inline {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--hg-text-muted);
    font-size: 13px;
    font-weight: 750;
}
.hg-check-inline input {
    width: 16px;
    height: 16px;
    accent-color: var(--hg-primary);
}
.hg-alertas-filters {
    justify-content: flex-start;
    flex-wrap: wrap;
}
.hg-check-inline input.hg-small-number,
.hg-small-number {
    width: 76px;
    height: auto;
    min-height: 34px;
    padding: 7px 9px;
    border: 1px solid var(--hg-border);
    border-radius: 10px;
    background: var(--hg-bg);
    color: var(--hg-text);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
}
.hg-lotes-page .hg-filter-row {
    max-width: 1220px;
    margin-left: auto;
    margin-right: auto;
}
.hg-list-page .hg-filter-row {
    max-width: 1220px;
    margin-left: auto;
    margin-right: auto;
}

/* ---- ACTION BAR ---- */
.hg-action-bar {
    background: white;
    padding: 10px 16px;
    border-bottom: 1px solid var(--hg-border);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.hg-action-bar a,
.hg-action-bar button {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 9px 13px;
    border-radius: 12px;
    background: var(--hg-primary);
    color: white;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
}
.hg-action-bar button {
    border: 0;
}
.hg-detail-actions {
    gap: 10px;
}
.hg-detail-actions a,
.hg-detail-actions button {
    min-width: 144px;
    justify-content: center;
}
.hg-action-bar .hg-danger-action {
    background: #FFF1F2;
    color: var(--hg-danger);
    border: 1px solid #FECDD3;
}

/* ---- TABS ---- */
.hg-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: white;
    padding: 10px 16px 0;
    border-bottom: 1px solid var(--hg-border);
    position: sticky;
    top: 58px;
    z-index: 45;
}
.hg-tabs.hg-tabs-three { grid-template-columns: 1fr 1fr 1fr; }
.hg-tabs button {
    border: 1px solid var(--hg-border);
    background: var(--hg-bg);
    color: var(--hg-text-muted);
    border-radius: 10px 10px 0 0;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}
.hg-tabs button.active {
    background: var(--hg-primary);
    border-color: var(--hg-primary);
    color: white;
}
.hg-tabs + .hg-search { top: 108px; }

/* ---- LIST ITEMS ---- */
.hg-list { background: var(--hg-surface); }

.hg-list-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--hg-border);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background .1s;
}
.hg-list-item:active { background: var(--hg-bg); }
.hg-list-item-actionable {
    gap: 12px;
}
.hg-list-item-actions {
    cursor: default;
    gap: 10px;
}
.hg-list-main-link {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
    color: inherit;
    text-decoration: none;
}
.hg-row-button {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.hg-plain-button {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    font: inherit;
    text-align: left;
}
.hg-list-side-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.hg-list-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--hg-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
    margin-right: 14px;
}

.hg-list-body { flex: 1; min-width: 0; }
.hg-list-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hg-list-sub { font-size: 12px; color: var(--hg-text-muted); margin-top: 2px; }
.hg-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--hg-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    flex-shrink: 0;
    margin-right: 14px;
}
.hg-avatar-danger {
    background: var(--hg-danger);
}
.hg-avatar-warning {
    background: var(--hg-warning);
}
.hg-list-side {
    flex-shrink: 0;
    margin-left: 12px;
    text-align: right;
    color: var(--hg-text-muted);
}
.hg-list-side strong {
    display: block;
    color: var(--hg-primary);
    font-size: 18px;
    line-height: 1;
}
.hg-list-side span {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    font-weight: 700;
}
.hg-list-right { text-align: right; flex-shrink: 0; margin-left: 10px; }
.hg-list-right .amount { font-size: 15px; font-weight: 700; color: var(--hg-primary); }
.hg-list-right .date { font-size: 11px; color: var(--hg-text-muted); }

.hg-list-chevron { color: var(--hg-text-muted); margin-left: 6px; }
.hg-list-side-actions .hg-list-chevron {
    text-decoration: none;
    font-size: 22px;
    line-height: 1;
}

/* ---- DETAIL / CARDS ---- */
.hg-page { padding: 16px; }

.hg-card {
    background: var(--hg-surface);
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    margin-bottom: 14px;
    overflow: hidden;
}
.hg-card-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--hg-text-muted);
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--hg-border);
}
.hg-card-title-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}
.hg-field {
    display: flex;
    padding: 12px 16px;
    border-bottom: 1px solid var(--hg-border);
    align-items: baseline;
    gap: 8px;
}
.hg-field:last-child { border-bottom: none; }
.hg-field label { font-size: 12px; color: var(--hg-text-muted); min-width: 100px; flex-shrink: 0; }
.hg-field span { font-size: 15px; font-weight: 500; word-break: break-word; }
.hg-inline-link {
    color: var(--hg-primary);
    font-weight: 700;
    text-decoration: none;
}
.hg-inline-link:active,
.hg-inline-link:hover { text-decoration: underline; }

/* ---- BADGES ---- */
.hg-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}
.hg-badge-green { background: #DCFCE7; color: #15803D; }
.hg-badge-yellow { background: #FEF9C3; color: #A16207; }
.hg-badge-gray { background: #F3F4F6; color: #6B7280; }
.hg-badge-blue { background: #DCFCE7; color: #166534; }
.hg-badge-orange { background: #FFEDD5; color: #C2410C; }
.hg-badge-pink { background: #FCE7F3; color: #BE185D; }
.hg-badge-red,
.hg-badge-danger { background: #FEE2E2; color: #B91C1C; }
.hg-badge-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

/* ---- BACK BUTTON ---- */
.hg-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    color: currentColor;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-bottom: 4px;
    opacity: .9;
}
.hg-back-btn-standard {
    min-height: 28px;
    max-width: 100%;
    line-height: 1.1;
}
.hg-back-btn-standard span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hg-primary-action,
.hg-secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
}
.hg-primary-action {
    background: var(--hg-primary);
    color: white;
}
.hg-header .hg-primary-action {
    float: right;
    background: rgba(255,255,255,.18);
    color: white;
    border-color: rgba(255,255,255,.3);
    margin-top: -4px;
}
.hg-secondary-action {
    background: white;
    color: var(--hg-primary);
    border-color: var(--hg-border);
}
.hg-danger-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    background: white;
    color: var(--hg-danger);
    border: 1px solid #FECACA;
}
.hg-primary-action:disabled,
.hg-secondary-action:disabled,
.hg-danger-action:disabled {
    opacity: .55;
    cursor: default;
}
.hg-danger-zone {
    border-color: #FECDD3;
    background: linear-gradient(180deg, var(--hg-card), #FFF7F7);
}
.hg-invoice-preview {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.hg-invoice-preview .hg-card {
    align-self: start;
}
.hg-invoice-preview .hg-card:has(.hg-table) {
    grid-column: 1 / -1;
}
.hg-invoice-preview-total {
    color: var(--hg-primary);
    font-size: 20px !important;
    font-weight: 800 !important;
}
.hg-lote-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}
.hg-lote-chip {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 8px;
    align-items: center;
    color: var(--hg-text-muted);
    font-size: 12px;
    line-height: 1.35;
}
.hg-lote-chip strong {
    color: var(--hg-primary-dark);
    font-weight: 700;
}
.hg-lote-chip span {
    white-space: nowrap;
}
.hg-lote-warning {
    margin-top: 6px;
    color: var(--hg-danger);
    font-size: 12px;
    font-weight: 700;
}
.hg-lotes-facturacion-modal {
    max-height: min(82vh, 760px);
    overflow: auto;
}
.hg-lote-cantidad-input {
    width: 110px;
    text-align: right;
}
.hg-lotes-editor-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 14px 16px 16px;
    border-top: 1px solid var(--hg-border);
}
.hg-lotes-editor-summary .hg-actions-bar {
    padding: 0;
    margin: 0;
}
.hg-confirm-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 14px 16px 0;
    color: var(--hg-text);
    font-size: 14px;
    line-height: 1.35;
}
.hg-confirm-check input {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}
@media (max-width: 780px) {
    .hg-invoice-preview {
        grid-template-columns: 1fr;
    }
    .hg-invoice-preview .hg-card:has(.hg-table) {
        grid-column: auto;
    }
    .hg-lotes-editor-summary {
        align-items: stretch;
        flex-direction: column;
    }
    .hg-lotes-editor-summary .hg-actions-bar {
        justify-content: flex-start;
    }
}
.hg-form-page {
    display: block;
}
.hg-wide-card {
    padding-bottom: 14px;
}
.hg-form-row,
.hg-form-grid {
    padding: 14px 16px 0;
}
.hg-form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
}
.hg-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}
.hg-form-grid-2,
.hg-form-grid-3,
.hg-form-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.hg-form-grid label,
.hg-total-bar label {
    display: grid;
    gap: 6px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 700;
}
.hg-full-field {
    grid-column: 1 / -1;
}
.hg-form-button-slot {
    align-self: end;
}
.hg-input {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--hg-border);
    border-radius: 12px;
    background: #fff;
    padding: 10px 12px;
    color: var(--hg-text);
    font: inherit;
    outline: none;
}
.hg-input:focus {
    border-color: var(--hg-primary-light);
    box-shadow: 0 0 0 3px rgba(30,136,229,.12);
}
textarea.hg-input {
    resize: vertical;
    min-height: 76px;
}
.hg-afip-log {
    min-height: 180px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.5;
}
.hg-hint,
.hg-alert {
    margin: 12px 16px 0;
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 13px;
}
.hg-hint {
    background: #EEF6FF;
    color: #1E3A8A;
}
.hg-alert {
    background: #FFF7ED;
    color: #9A3412;
    border: 1px solid #FED7AA;
}
.hg-alert-danger {
    background: #FEF2F2;
    color: var(--hg-danger);
    border-color: #FECACA;
}

.hg-oc-page {
    display: grid;
    gap: 16px;
}
.hg-oc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.hg-oc-client-shell {
    display: grid;
    gap: 14px;
    padding: 14px 16px 16px;
}
.hg-oc-client-search label,
.hg-oc-meta-grid label,
.hg-provider-search label {
    display: grid;
    gap: 6px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 800;
}
.hg-provider-search {
    padding: 14px 16px 0;
}
.hg-oc-meta-grid {
    display: grid;
    grid-template-columns: minmax(160px, .8fr) minmax(170px, 1fr) 110px minmax(150px, .9fr);
    gap: 12px;
    align-items: end;
}
.hg-oc-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.hg-oc-check-card {
    min-height: 42px;
    border: 1px solid var(--hg-border);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--hg-surface);
}
.hg-picker-list {
    margin: 10px 0 0;
    border: 1px solid var(--hg-border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--hg-card);
}
.hg-picker-list button {
    width: 100%;
    display: grid;
    gap: 3px;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid var(--hg-border);
    background: transparent;
    color: var(--hg-text);
    text-align: left;
    font: inherit;
    cursor: pointer;
}
.hg-picker-list button:last-child {
    border-bottom: 0;
}
.hg-picker-list button:hover {
    background: rgba(45, 122, 74, .09);
}
.hg-formula-total-heading {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
}
.hg-formula-total-heading strong {
    color: var(--hg-text);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: none;
}
.hg-picker-list span,
.hg-selected-strip span,
.hg-quick-entry span,
.hg-oc-items-table td span {
    color: var(--hg-text-muted);
    font-size: 12px;
}
.hg-selected-strip {
    margin: 10px 0 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border: 1px solid rgba(45, 122, 74, .22);
    background: rgba(45, 122, 74, .08);
    border-radius: 14px;
    padding: 13px 14px;
}
.hg-selected-strip strong {
    display: block;
    font-size: 16px;
    line-height: 1.25;
}
.hg-selected-strip span {
    display: block;
    margin-top: 3px;
}
.hg-quick-entry {
    margin: 14px 16px 0;
    border: 1px solid rgba(45, 122, 74, .22);
    background: linear-gradient(180deg, rgba(45, 122, 74, .09), rgba(45, 122, 74, .04));
    border-radius: 16px;
    padding: 14px;
    display: grid;
    gap: 12px;
}
.hg-quick-entry-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}
.hg-inline-ok,
.hg-inline-error {
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 13px;
    font-weight: 700;
}
.hg-inline-ok {
    background: rgba(34, 197, 94, .12);
    color: #166534;
}
.hg-inline-error {
    background: rgba(239, 68, 68, .11);
    color: #B91C1C;
}
.hg-oc-add-bar {
    margin-top: 10px;
}
.hg-oc-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
}
.hg-oc-summary .hg-primary-action {
    margin: 0;
    min-width: 150px;
}
.hg-oc-summary-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(92px, 1fr));
    gap: 6px;
}
.hg-oc-summary-grid div {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.hg-oc-summary-grid label {
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.hg-oc-summary-grid strong {
    color: var(--hg-text);
    font-size: 13px;
    font-weight: 850;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hg-oc-summary-total strong {
    color: var(--hg-primary);
    font-size: 18px;
    font-weight: 950;
}
.hg-empty-compact {
    padding: 18px;
}
.hg-oc-items-table table {
    table-layout: fixed;
}
.hg-oc-items-table {
    max-height: min(52vh, 620px);
    overflow: auto;
}
.hg-oc-items-table th,
.hg-oc-items-table td {
    padding: 7px 10px;
    vertical-align: middle;
}
.hg-oc-items-table th:nth-child(2),
.hg-oc-items-table td:nth-child(2) {
    width: 82px;
}
.hg-oc-items-table th:nth-child(3),
.hg-oc-items-table td:nth-child(3) {
    width: 118px;
}
.hg-oc-items-table th:nth-child(4),
.hg-oc-items-table td:nth-child(4) {
    width: 126px;
}
.hg-oc-items-table th:nth-child(5),
.hg-oc-items-table td:nth-child(5) {
    width: 78px;
}
.hg-oc-items-table .hg-input {
    min-height: 32px;
    max-width: none;
    border-radius: 9px;
    padding: 5px 8px;
    text-align: right;
}
.hg-oc-product-cell {
    min-width: 220px;
}
.hg-oc-product-cell strong,
.hg-oc-product-cell span {
    display: block;
}
.hg-oc-product-cell strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hg-oc-item-total {
    text-align: right;
    font-weight: 800;
    color: var(--hg-primary);
    white-space: nowrap;
}
.hg-oc-remove-cell {
    text-align: right;
}
.hg-oc-remove-cell .hg-plain-button {
    min-height: 30px;
    padding: 5px 9px;
    border-radius: 9px;
    font-size: 12px;
}

:root[data-theme="dark"] .hg-picker-list button:hover,
:root[data-theme="dark"] .hg-selected-strip,
:root[data-theme="dark"] .hg-quick-entry {
    background: rgba(117, 226, 154, .10);
}

:root[data-theme="dark"] .hg-oc-check-card {
    background: rgba(255,255,255,.04);
}

:root[data-theme="dark"] .hg-inline-ok {
    color: #BBF7D0;
}

:root[data-theme="dark"] .hg-inline-error {
    color: #FECACA;
}

.hg-oc-workflow {
    gap: 18px;
}
.hg-oc-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.hg-oc-main {
    display: grid;
    gap: 16px;
    min-width: 0;
}
.hg-oc-client-card,
.hg-oc-product-card,
.hg-oc-items-card {
    overflow: visible;
}
.hg-oc-client-input {
    min-height: 46px;
    font-size: 16px;
    font-weight: 750;
}
.hg-oc-floating-picker {
    position: relative;
    z-index: 20;
}
.hg-oc-client-profile {
    margin: 12px 0 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid rgba(45, 122, 74, .22);
    background: linear-gradient(180deg, rgba(45, 122, 74, .10), rgba(45, 122, 74, .045));
    border-radius: 16px;
    padding: 14px;
}
.hg-oc-client-profile .hg-plain-button {
    min-height: 34px;
    border: 1px solid rgba(45, 122, 74, .18);
    background: var(--hg-surface);
    color: var(--hg-primary);
}
.hg-oc-kicker {
    display: block;
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.hg-oc-client-profile strong {
    display: block;
    font-size: 18px;
    line-height: 1.2;
}
.hg-oc-client-profile span:last-child {
    display: block;
    color: var(--hg-text-muted);
    font-size: 13px;
    margin-top: 3px;
}
.hg-oc-manual-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px auto;
    gap: 10px;
    align-items: end;
    padding: 14px 16px 16px;
}
.hg-oc-manual-entry label {
    display: grid;
    gap: 6px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 800;
}
.hg-oc-disabled-shell {
    position: relative;
}
.hg-oc-step-empty {
    margin: 14px 16px 0;
    border: 1px dashed rgba(107,114,128,.35);
    border-radius: 16px;
    padding: 14px;
    display: grid;
    gap: 4px;
    background: rgba(107,114,128,.045);
}
.hg-oc-step-empty strong,
.hg-oc-items-empty strong {
    font-size: 15px;
}
.hg-oc-step-empty span,
.hg-oc-items-empty span {
    color: var(--hg-text-muted);
    font-size: 13px;
}
.hg-oc-items-empty {
    min-height: 150px;
    display: grid;
    place-items: center;
    gap: 4px;
    text-align: center;
    padding: 22px;
    color: var(--hg-text-muted);
}
.hg-oc-items-empty strong {
    color: var(--hg-text);
}
.hg-oc-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: stretch;
    padding: 16px;
}
.hg-oc-summary-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.hg-oc-summary-head span {
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.hg-oc-summary-head strong {
    border: 1px solid var(--hg-border);
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 12px;
}
.hg-oc-summary-total {
    display: grid;
    gap: 3px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(45, 122, 74, .08);
}
.hg-oc-summary-total label {
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.hg-oc-summary-total strong {
    color: var(--hg-primary);
    font-size: 30px;
    line-height: 1.05;
    font-weight: 950;
    overflow-wrap: anywhere;
}
.hg-oc-summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.hg-oc-summary-grid div {
    border: 1px solid var(--hg-border);
    border-radius: 14px;
    padding: 10px;
    background: var(--hg-surface);
}
.hg-oc-summary-note {
    border-radius: 12px;
    padding: 10px 11px;
    background: #EEF6FF;
    color: #1E3A8A;
    font-size: 13px;
    font-weight: 800;
}
.hg-oc-summary .hg-primary-action {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
}

@media (max-width: 900px) {
    .hg-oc-layout,
    .hg-oc-meta-grid {
        grid-template-columns: 1fr;
    }

    .hg-oc-client-profile,
    .hg-oc-manual-entry {
        grid-template-columns: 1fr;
    }

    .hg-oc-manual-entry .hg-secondary-action {
        width: 100%;
    }

    .hg-oc-summary {
        position: static;
        grid-template-columns: 1fr;
        order: 2;
    }

    .hg-oc-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hg-oc-summary-total {
        grid-column: 1 / -1;
    }

    .hg-oc-summary .hg-primary-action {
        width: 100%;
    }

    .hg-quick-entry-row {
        grid-template-columns: 1fr;
    }

    .hg-oc-items-table table {
        display: block;
    }

    .hg-oc-items-table thead {
        display: none;
    }

    .hg-oc-items-table tbody {
        display: grid;
    }

    .hg-oc-items-table tr {
        display: grid;
        grid-template-columns: 72px 96px minmax(86px, 1fr) auto;
        gap: 7px 8px;
        border-top: 1px solid var(--hg-border);
        padding: 9px 10px;
    }

    .hg-oc-items-table td {
        display: block;
        border-top: 0;
        padding: 0;
    }

    .hg-oc-product-cell {
        grid-column: 1 / -1;
        min-width: 0;
    }

    .hg-oc-qty-cell {
        grid-column: 1;
        grid-row: 2;
    }

    .hg-oc-price-cell {
        grid-column: 2;
        grid-row: 2;
    }

    .hg-oc-item-total {
        grid-column: 3;
        grid-row: 2;
        align-self: center;
        font-size: 13px;
    }

    .hg-oc-remove-cell {
        grid-column: 4;
        grid-row: 2;
        align-self: center;
        text-align: right;
    }

    .hg-oc-items-table .hg-input {
        width: 100%;
        min-height: 32px;
    }
}
.hg-choice-list {
    display: grid;
    gap: 8px;
    padding: 12px 16px 0;
}

/* ---- SECURITY ---- */
.hg-security-page {
    gap: 16px;
    max-width: 1220px;
    margin-left: auto;
    margin-right: auto;
}
.hg-security-users {
    display: grid;
    gap: 8px;
    padding: 12px;
}
.hg-security-user {
    width: 100%;
    border: 1px solid var(--hg-border);
    background: #fff;
    color: var(--hg-text);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
    cursor: pointer;
}
.hg-security-user strong,
.hg-security-user small {
    display: block;
}
.hg-security-user small {
    color: var(--hg-text-muted);
    margin-top: 3px;
}
.hg-security-user.active {
    border-color: rgba(46,125,50,.36);
    background: rgba(46,125,50,.08);
}
.hg-security-checks {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 40px;
    color: var(--hg-text);
    font-size: 14px;
    font-weight: 700;
}
.hg-security-checks label,
.hg-security-permissions label {
    display: flex;
    align-items: center;
    gap: 8px;
}
.hg-password-field {
    display: flex;
    align-items: stretch;
    gap: 8px;
}
.hg-password-field .hg-input {
    min-width: 0;
}
.hg-password-toggle {
    border: 1px solid var(--hg-border);
    background: rgba(46,125,50,.08);
    color: var(--hg-primary);
    border-radius: 12px;
    padding: 0 14px;
    min-width: 78px;
    font-weight: 850;
    cursor: pointer;
}
.hg-password-toggle:hover {
    background: rgba(46,125,50,.14);
}
.hg-field-note {
    display: block;
    margin-top: 6px;
    color: var(--hg-text-muted);
    font-size: 12px;
    line-height: 1.35;
}
.hg-security-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 14px 16px 0;
    flex-wrap: wrap;
}
.hg-security-toolbar .hg-input {
    max-width: 240px;
}
.hg-security-permissions {
    display: grid;
    gap: 14px;
    padding: 14px 16px;
}
.hg-security-permissions section {
    border: 1px solid var(--hg-border);
    border-radius: 14px;
    padding: 12px;
    background: rgba(255,255,255,.45);
}
.hg-security-permissions h2 {
    font-size: 12px;
    color: var(--hg-text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
}
.hg-security-permissions label {
    justify-content: flex-start;
    padding: 8px 0;
    color: var(--hg-text);
    font-size: 14px;
}
.hg-security-permissions label + label {
    border-top: 1px solid var(--hg-border);
}
.hg-security-permissions small {
    margin-left: auto;
    color: var(--hg-text-muted);
    font-size: 11px;
}
.hg-choice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    width: 100%;
    border: 1px solid var(--hg-border);
    border-radius: 12px;
    background: white;
    padding: 11px 12px;
    color: var(--hg-text);
    cursor: pointer;
    text-align: left;
}
.hg-choice span {
    font-weight: 800;
}
.hg-choice small {
    color: var(--hg-text-muted);
}
.hg-choice.selected {
    border-color: var(--hg-primary);
    box-shadow: 0 0 0 3px rgba(46,125,50,.12);
}
.hg-split-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 16px 0;
}
.hg-check {
    display: inline-flex !important;
    align-items: center;
    gap: 8px !important;
    min-height: 40px;
    color: var(--hg-text) !important;
    font-size: 14px !important;
}
.hg-inline-note {
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 700;
}
.hg-total-bar {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: end;
    margin: 14px 16px 0;
    padding-top: 12px;
    border-top: 1px solid var(--hg-border);
}
.hg-total-bar span {
    font-size: 18px;
    font-weight: 850;
    color: var(--hg-primary);
}
.hg-actions-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}
.hg-form-actions {
    align-items: center;
    gap: 10px;
    padding: 0 16px 16px;
    margin: 14px 0 0;
}
.hg-form-actions .hg-primary-action {
    min-width: 140px;
}
.hg-actions-bar-spaced {
    gap: 10px;
    padding: 0 16px 16px;
    margin: 14px 0 0;
}
.hg-form-stack {
    display: grid;
    gap: 10px;
    padding: 16px;
}
.hg-print-comment-input {
    min-height: 150px;
    resize: vertical;
    line-height: 1.45;
}
.hg-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 16px 0;
}
.hg-section-head.compact {
    padding: 0;
    margin-bottom: 14px;
}
.hg-section-head h2 {
    margin: 0;
    color: var(--hg-text);
    font-size: 19px;
    line-height: 1.2;
    font-weight: 900;
}
.hg-section-head .hg-secondary-action {
    flex: 0 0 auto;
}
.hg-section-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.hg-section-actions .hg-secondary-action {
    flex: 0 0 auto;
}
.hg-hidden-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.hg-qr-camera-action {
    border-color: rgba(46,125,50,.32);
    background: color-mix(in srgb, var(--hg-primary) 8%, var(--hg-surface));
    cursor: pointer;
    user-select: none;
}
.hg-qr-camera-hint {
    margin-bottom: 0;
}
.hg-purchase-page {
    gap: 18px;
}
.hg-purchase-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.hg-purchase-main {
    display: grid;
    gap: 16px;
    min-width: 0;
}
.hg-purchase-main > .hg-card,
.hg-purchase-summary {
    overflow: visible;
}
.hg-purchase-qr-input {
    margin: 14px 16px 16px;
    width: calc(100% - 32px);
    min-height: 74px;
    resize: vertical;
}
.hg-purchase-qr-result {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 0 16px 16px;
}
.hg-purchase-qr-result div,
.hg-purchase-summary-facts div {
    border: 1px solid var(--hg-border);
    border-radius: 14px;
    padding: 10px;
    background: var(--hg-surface);
}
.hg-purchase-qr-result label,
.hg-purchase-summary-facts label {
    display: block;
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.hg-purchase-qr-result strong,
.hg-purchase-summary-facts span {
    display: block;
    min-width: 0;
    color: var(--hg-text);
    font-size: 13px;
    font-weight: 850;
    overflow-wrap: anywhere;
}
.hg-purchase-provider-search {
    display: grid;
    gap: 6px;
    padding: 14px 16px 0;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 850;
}
.hg-purchase-provider-input {
    min-height: 46px;
    font-size: 16px;
    font-weight: 750;
}
.hg-purchase-provider-profile {
    margin: 12px 16px 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid rgba(45, 122, 74, .22);
    background: linear-gradient(180deg, rgba(45, 122, 74, .10), rgba(45, 122, 74, .045));
    border-radius: 16px;
    padding: 14px;
}
.hg-purchase-provider-profile strong {
    display: block;
    font-size: 18px;
    line-height: 1.2;
}
.hg-purchase-provider-profile span:last-child {
    display: block;
    color: var(--hg-text-muted);
    font-size: 13px;
    margin-top: 3px;
}
.hg-purchase-provider-profile .hg-plain-button {
    min-height: 34px;
    border: 1px solid rgba(45, 122, 74, .18);
    background: var(--hg-surface);
    color: var(--hg-primary);
}
.hg-purchase-empty-action {
    display: grid;
    gap: 12px;
    margin: 14px 16px 0;
    border: 1px dashed rgba(107,114,128,.35);
    border-radius: 16px;
    padding: 14px;
    background: rgba(107,114,128,.045);
}
.hg-purchase-empty-action strong {
    font-size: 14px;
}
.hg-purchase-new-provider {
    margin: 16px;
    padding: 16px;
    border: 1px solid var(--hg-border);
    border-radius: 16px;
    background: rgba(45, 122, 74, .045);
}
.hg-purchase-voucher-card > .hg-form-grid {
    padding: 14px 16px 0;
}
.hg-purchase-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px 16px;
}
.hg-purchase-flags .hg-check-inline {
    border: 1px solid var(--hg-border);
    border-radius: 12px;
    padding: 9px 11px;
    background: var(--hg-surface);
}
.hg-purchase-amounts {
    display: grid;
    gap: 16px;
    padding: 16px;
}
.hg-tax-rate-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.hg-tax-rate-card {
    border: 1px solid var(--hg-border);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(46,125,50,.035), rgba(255,255,255,.72));
    padding: 14px;
}
.hg-tax-rate-card.emphasized {
    border-color: rgba(46,125,50,.28);
    background: linear-gradient(180deg, rgba(46,125,50,.09), rgba(255,255,255,.78));
}
.hg-tax-rate-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
}
.hg-tax-rate-head span,
.hg-subsection-title,
.hg-purchase-total-bar small {
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.hg-tax-rate-head strong {
    color: var(--hg-primary);
    font-size: 20px;
    font-weight: 900;
}
.hg-tax-rate-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.hg-tax-rate-fields label {
    display: grid;
    gap: 6px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 800;
}
.hg-amount-subsection {
    border-top: 1px solid var(--hg-border);
    padding-top: 14px;
}
.hg-subsection-title {
    margin-bottom: 10px;
}
.hg-purchase-total-bar {
    align-items: center;
    margin-top: 0;
}
.hg-purchase-total-bar > div {
    display: grid;
    gap: 2px;
}
.hg-purchase-total-bar label {
    min-width: min(100%, 260px);
}
.hg-purchase-total-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
    gap: 14px;
    align-items: end;
    border-top: 1px solid var(--hg-border);
    padding-top: 14px;
}
.hg-purchase-total-input > div {
    display: grid;
    gap: 3px;
    border-radius: 16px;
    padding: 14px;
    background: rgba(45, 122, 74, .08);
}
.hg-purchase-total-input span {
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.hg-purchase-total-input strong {
    color: var(--hg-primary);
    font-size: 24px;
    font-weight: 950;
}
.hg-purchase-total-input label {
    display: grid;
    gap: 6px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 850;
}
.hg-purchase-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: stretch;
    padding: 16px;
}
.hg-purchase-summary-facts {
    display: grid;
    gap: 10px;
}
.hg-purchase-summary .hg-primary-action {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
}
.hg-purchase-difference {
    border-radius: 12px;
    padding: 10px 11px;
    font-size: 13px;
    font-weight: 850;
}
.hg-purchase-difference.positive {
    background: #EEF6FF;
    color: #1E3A8A;
}
.hg-purchase-difference.negative {
    background: #FEF2F2;
    color: #991B1B;
}
.hg-product-config-page {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    width: 100%;
    max-width: none;
}
.hg-product-config-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: end;
    padding: 16px;
}
.hg-product-config-filters label:first-child {
    display: grid;
    gap: 6px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 850;
}
.hg-product-config-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.hg-product-config-list,
.hg-product-config-editor {
    overflow: visible;
}
.hg-product-config-items {
    display: grid;
    max-height: 62vh;
    overflow: auto;
}
.hg-product-config-item {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 4px 12px;
    width: 100%;
    border: 0;
    border-top: 1px solid var(--hg-border);
    background: var(--hg-surface);
    color: var(--hg-text);
    text-align: left;
    padding: 12px 16px;
    cursor: pointer;
}
.hg-product-config-item:hover,
.hg-product-config-item.selected {
    background: rgba(45, 122, 74, .075);
}
.hg-product-config-item.inactive {
    color: var(--hg-text-muted);
}
.hg-product-config-item.inactive .hg-product-config-name {
    color: #991B1B;
}
:root[data-theme="dark"] .hg-product-config-item.inactive .hg-product-config-name {
    color: #FCA5A5;
}
.hg-product-config-item.suggested {
    box-shadow: inset 3px 0 0 #2563EB;
}
.hg-product-config-code {
    grid-row: 1 / span 2;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 900;
    align-self: start;
    overflow-wrap: anywhere;
}
.hg-product-config-name {
    min-width: 0;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hg-product-config-sub {
    color: var(--hg-text-muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hg-product-config-empty {
    min-height: 260px;
    display: grid;
    place-items: center;
    gap: 4px;
    padding: 24px;
    text-align: center;
}
.hg-product-config-empty strong {
    font-size: 18px;
}
.hg-product-config-empty span {
    color: var(--hg-text-muted);
}
.hg-product-config-editor {
    display: grid;
    gap: 16px;
    padding: 16px;
}
.hg-product-config-editor-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.hg-product-config-editor-head h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.15;
    font-weight: 950;
}
.hg-product-config-editor-head p {
    margin: 5px 0 0;
    color: var(--hg-text-muted);
    font-weight: 800;
}
.hg-product-config-facts {
    display: grid;
    gap: 10px;
}
.hg-product-config-facts div {
    border: 1px solid var(--hg-border);
    border-radius: 14px;
    padding: 10px;
    background: var(--hg-surface);
}
.hg-product-config-facts label {
    display: block;
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.hg-product-config-facts span {
    font-weight: 850;
    overflow-wrap: anywhere;
}
.hg-product-config-suggestion {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid rgba(37, 99, 235, .24);
    border-radius: 16px;
    padding: 14px;
    background: #EEF6FF;
    color: #1E3A8A;
}
.hg-product-config-suggestion span {
    display: block;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.hg-product-config-suggestion strong {
    display: block;
    margin-top: 4px;
}
.hg-product-config-form {
    display: grid;
    gap: 12px;
}
.hg-product-config-section-title {
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding-top: 4px;
}
.hg-product-config-two {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}
.hg-product-config-two > label {
    display: grid;
    gap: 6px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 850;
}
.hg-product-config-form > label:not(.hg-check-inline) {
    display: grid;
    gap: 6px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 850;
}
.hg-product-config-active {
    border: 1px solid var(--hg-border);
    border-radius: 14px;
    padding: 12px;
    background: var(--hg-surface);
}
.hg-product-config-price-lists {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.hg-product-config-price-lists .hg-check-inline {
    border: 1px solid var(--hg-border);
    border-radius: 12px;
    padding: 10px;
    background: var(--hg-surface);
    min-width: 0;
}
.hg-product-config-price-lists .hg-check-inline span {
    min-width: 0;
    overflow-wrap: anywhere;
}
.hg-product-config-muted {
    color: var(--hg-text-muted);
    font-size: 13px;
    font-weight: 800;
}

.hg-product-composition-page > .hg-product-composition-top-actions,
.hg-product-composition-top-actions,
.hg-product-composition-bottom-actions {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    justify-content: flex-start !important;
    text-align: left;
}

.hg-product-composition-add-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 140px 140px auto;
    gap: 12px;
    align-items: end;
    padding: 16px;
}
.hg-product-composition-add-grid label {
    display: grid;
    gap: 6px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 850;
}
.hg-product-composition-component-search {
    position: relative;
}
.hg-product-composition-picker {
    position: static;
    margin-top: 2px;
    z-index: 1;
    max-height: 260px;
    overflow: auto;
}
.hg-table-input {
    min-width: 110px;
}
.hgl-store-config-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.hgl-store-config-grid label {
    display: grid;
    gap: 6px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 850;
}
.hg-product-config-actions {
    display: flex;
    justify-content: flex-start !important;
    gap: 10px;
    flex-wrap: wrap;
    text-align: left;
}
.hg-row-action {
    border: 1px solid var(--hg-border);
    background: #fff;
    color: var(--hg-text);
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.hg-row-action:hover {
    border-color: rgba(46,125,50,.28);
    color: var(--hg-primary);
}
.hg-row-action.danger {
    border-color: #FECACA;
    color: var(--hg-danger);
}
.hg-row-menu {
    position: relative;
    flex-shrink: 0;
    align-self: center;
}
.hg-row-menu[open] {
    z-index: 30;
}
.hg-row-menu-button {
    width: 34px;
    height: 34px;
    border: 1px solid var(--hg-border);
    border-radius: 999px;
    background: var(--hg-surface);
    color: var(--hg-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    list-style: none;
}
.hg-row-menu-button::-webkit-details-marker {
    display: none;
}
.hg-row-menu-button::marker {
    content: "";
}
.hg-row-menu-button:hover {
    border-color: rgba(46,125,50,.28);
    color: var(--hg-primary);
    background: rgba(46,125,50,.06);
}
.hg-row-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 188px;
    padding: 6px;
    border: 1px solid var(--hg-border);
    border-radius: 12px;
    background: var(--hg-surface);
    box-shadow: 0 16px 42px rgba(15,23,42,.18);
}
.hg-row-menu-item {
    width: 100%;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--hg-text);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 11px;
    text-align: left;
    text-decoration: none;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}
.hg-row-menu-item:hover {
    background: rgba(46,125,50,.08);
    color: var(--hg-primary);
}
.hg-row-menu-item.danger {
    color: var(--hg-danger);
}
.hg-row-menu-item.danger:hover {
    background: rgba(220,38,38,.08);
    color: var(--hg-danger);
}
.hg-row-action-ready {
    border-color: rgba(22,163,74,.25);
    background: rgba(22,163,74,.10);
    color: #15803D;
}
.hg-row-action-empty {
    border-color: rgba(107,114,128,.18);
    background: rgba(107,114,128,.06);
    color: var(--hg-text-muted);
}
.hg-print-action {
    align-self: center;
    white-space: nowrap;
}
:root[data-theme="dark"] .hg-row-action-ready {
    border-color: rgba(74,222,128,.26);
    background: rgba(74,222,128,.12);
    color: #86EFAC;
}
:root[data-theme="dark"] .hg-row-action-empty {
    border-color: rgba(255,255,255,.09);
    background: rgba(255,255,255,.035);
    color: var(--hg-text-muted);
}
.hg-table-actions {
    text-align: right;
    white-space: nowrap;
}
.hg-row-action.selected {
    border-color: var(--hg-primary);
    color: var(--hg-primary);
    background: rgba(46,125,50,.10);
}
.hg-table-muted {
    display: block;
    color: var(--hg-text-muted);
    font-size: 11px;
    margin-top: 4px;
}
.hg-audit-actions {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.hg-audit-missing-trace {
    color: var(--hg-text-muted);
}
.hg-audit-missing-trace td {
    background: rgba(107,114,128,.04);
}
:root[data-theme="dark"] .hg-audit-missing-trace td {
    background: rgba(255,255,255,.025);
}
.hg-protocol-preview {
    padding: 18px 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
}
.hg-protocol-title {
    grid-column: 1 / -1;
    font-size: 18px;
    font-weight: 850;
    color: var(--hg-text);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--hg-border);
}
.hg-protocol-preview strong,
.hg-protocol-preview span {
    display: block;
}
.hg-protocol-preview strong {
    color: var(--hg-text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 4px;
}
.hg-protocol-preview span {
    font-weight: 700;
}
@media (max-width: 680px) {
    .hg-protocol-preview {
        grid-template-columns: 1fr;
    }
    .hg-pending-selection {
        align-items: stretch;
        flex-direction: column;
    }
    .hg-pending-selection .hg-primary-action {
        width: 100%;
    }
    .hg-mp-status {
        align-items: stretch;
        flex-direction: column;
    }
    .hg-mp-status .hg-primary-action {
        width: 100%;
    }
}

/* ---- LOADING ---- */
.hg-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--hg-text-muted);
    gap: 14px;
}
.hg-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--hg-border);
    border-top-color: var(--hg-primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- EMPTY ---- */
.hg-empty { text-align: center; padding: 60px 20px; color: var(--hg-text-muted); }
.hg-empty svg { width: 56px; height: 56px; opacity: .3; margin-bottom: 12px; }
.hg-empty p { font-size: 15px; }
.hg-empty-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* ---- LOGIN ---- */
.hg-login {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(46,125,50,.12), transparent 32rem),
        linear-gradient(180deg, #FBFBFD 0%, #F5F5F7 100%);
}
.hg-login-card {
    background: rgba(255,255,255,.84);
    border: 1px solid rgba(0,0,0,.07);
    border-radius: 28px;
    padding: 34px 28px;
    width: 100%;
    max-width: 390px;
    box-shadow: 0 24px 70px rgba(0,0,0,.10);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}
.hg-login-logo { text-align: center; margin-bottom: 28px; }
.hg-login-logo img {
    width: 82px;
    height: 82px;
    object-fit: contain;
    display: block;
    margin: 0 auto 12px;
    opacity: .96;
}
.hg-login-logo h1 { font-size: 26px; font-weight: 800; color: var(--hg-text); }
.hg-login-logo p { font-size: 13px; color: var(--hg-text-muted); margin-top: 4px; }
.hg-login-field { margin-bottom: 16px; }
.hg-login-field label { display: block; font-size: 12px; font-weight: 600; color: var(--hg-text-muted); margin-bottom: 6px; }
.hg-login-field input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(0,0,0,.10);
    border-radius: 14px;
    font-size: 16px;
    outline: none;
    transition: border-color .15s;
    background: rgba(255,255,255,.9);
    color: #1A1A2E;
    -webkit-text-fill-color: #1A1A2E;
    caret-color: #2E7D32;
    color-scheme: light;
}
.hg-login-field input::placeholder {
    color: #8A8A93;
    opacity: 1;
}
.hg-login-field input:focus {
    border-color: var(--hg-primary-light);
    box-shadow: 0 0 0 4px rgba(46,125,50,.12);
}
.hg-login-field input:-webkit-autofill,
.hg-login-field input:-webkit-autofill:hover,
.hg-login-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: #1A1A2E;
    box-shadow: 0 0 0 1000px #FFFFFF inset;
    caret-color: #2E7D32;
}
.hg-login-remember {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--hg-text-muted);
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 14px;
    cursor: pointer;
    user-select: none;
}
.hg-login-remember input {
    width: 17px;
    height: 17px;
    accent-color: var(--hg-primary);
    cursor: pointer;
}
.hg-login-btn {
    width: 100%;
    padding: 14px;
    background: #1D1D1F;
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: background .15s;
}
.hg-login-btn:hover { background: #2C2C2E; }
.hg-error-msg { background: #FEE2E2; color: var(--hg-danger); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }

/* ---- DASHBOARD ---- */
.hg-dashboard { padding: 16px; }
.hg-dashboard-greeting { padding: 16px 0 8px; }
.hg-dashboard-greeting h2 { font-size: 22px; font-weight: 700; }
.hg-dashboard-greeting p { font-size: 13px; color: var(--hg-text-muted); }
.hg-month-picker {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.88);
    border: 1px solid rgba(229,231,235,.95);
    border-radius: 20px;
    padding: 8px;
    margin: 6px 0 12px;
    box-shadow: 0 6px 18px rgba(20,40,80,.07);
}
.hg-month-picker button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 15px;
    background: var(--hg-bg);
    color: var(--hg-primary);
    font-size: 28px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
}
.hg-month-picker div {
    text-align: center;
    min-width: 0;
}
.hg-month-picker span {
    display: block;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--hg-text-muted);
}
.hg-month-picker strong {
    display: block;
    font-size: 16px;
    margin-top: 2px;
    text-transform: capitalize;
}

:root[data-theme="dark"] .hg-month-picker {
    background: linear-gradient(180deg, rgba(33,35,41,.96), rgba(24,25,30,.96));
    border-color: rgba(255,255,255,.12);
    box-shadow: 0 18px 44px rgba(0,0,0,.26);
}

:root[data-theme="dark"] .hg-month-picker button {
    background: rgba(134,239,172,.14);
    color: var(--hg-primary-light);
}

:root[data-theme="dark"] .hg-month-picker span {
    color: rgba(245,245,247,.58);
}

:root[data-theme="dark"] .hg-month-picker strong {
    color: var(--hg-text);
}

.hg-today-chip {
    width: 100%;
    border: none;
    border-radius: 16px;
    background: #E0F2FE;
    color: #0369A1;
    padding: 11px 14px;
    font-size: 13px;
    font-weight: 800;
    margin: -2px 0 12px;
    cursor: pointer;
}
.hg-dashboard-loading {
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(255,255,255,.86);
    border-radius: 18px;
    padding: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--hg-text-muted);
    box-shadow: 0 8px 22px rgba(20,40,80,.08);
}
.hg-dashboard-loading .hg-spinner { width: 24px; height: 24px; }
.hg-kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}
.hg-kpi-card {
    min-height: 132px;
    border-radius: 22px;
    padding: 16px;
    color: white;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 12px 26px rgba(20,40,80,.16);
    position: relative;
    overflow: hidden;
}
.hg-kpi-card::after {
    content: "";
    position: absolute;
    width: 120px;
    height: 120px;
    right: -48px;
    top: -48px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
}
.hg-kpi-primary { background: linear-gradient(145deg, #2E7D32, #7CB342); }
.hg-kpi-warn { background: linear-gradient(145deg, #D97706, #EF4444); }
.hg-kpi-green { background: linear-gradient(145deg, #059669, #20B486); }
.hg-kpi-rose { background: linear-gradient(145deg, #7C3AED, #E11D48); }
.hg-kpi-label {
    font-size: 12px;
    font-weight: 700;
    opacity: .86;
    letter-spacing: .02em;
}
.hg-kpi-value {
    font-size: 27px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: 0;
    margin-top: 16px;
}
.hg-kpi-sub {
    font-size: 11px;
    line-height: 1.25;
    opacity: .86;
    margin-top: 10px;
}
.hg-insight-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}
.hg-insight-strip > div {
    background: rgba(255,255,255,.86);
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 18px;
    padding: 13px 14px;
    box-shadow: 0 4px 14px rgba(20,40,80,.06);
}
.hg-insight-strip span,
.hg-insight-strip small {
    display: block;
    font-size: 11px;
    color: var(--hg-text-muted);
}
.hg-insight-strip strong {
    display: block;
    font-size: 18px;
    margin: 3px 0;
    color: var(--hg-text);
}
.hg-mini-panel {
    background: rgba(255,255,255,.9);
    border: 1px solid rgba(229,231,235,.95);
    border-radius: 20px;
    margin-top: 14px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(20,40,80,.07);
}
.hg-mini-title {
    padding: 13px 15px 8px;
    font-size: 12px;
    font-weight: 800;
    color: var(--hg-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.hg-mini-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 46px;
    padding: 10px 15px;
    border-top: 1px solid var(--hg-border);
    color: inherit;
    text-decoration: none;
}
.hg-mini-row span {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
}
.hg-mini-row strong {
    flex-shrink: 0;
    color: var(--hg-primary);
    font-size: 13px;
}
.hg-section-label {
    margin: 20px 2px 10px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.hg-modules { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.hg-module-card {
    background: var(--hg-surface);
    border-radius: 16px;
    padding: 20px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    transition: box-shadow .15s, transform .1s;
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: left;
}
.hg-module-card:active { transform: scale(.97); }
.hg-module-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.hg-module-icon svg { width: 24px; height: 24px; color: white; }
.hg-module-label { font-size: 14px; font-weight: 600; }

/* ---- TABLE (items) ---- */
.hg-table { width: 100%; overflow-x: auto; }
.hg-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hg-table.hg-pack-table { border-collapse: collapse; font-size: 13px; }
.hg-table.hg-pack-table th,
.hg-table.hg-pack-table td { padding: 10px 12px; border-top: 1px solid var(--hg-border); text-align: left; }
.hg-table.hg-pack-table th { background: var(--hg-bg); color: var(--hg-text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.hg-table.hg-pack-table td span { display: block; color: var(--hg-text-muted); font-size: 12px; margin-top: 2px; }
.hg-table th { background: var(--hg-bg); color: var(--hg-text-muted); font-weight: 600; padding: 8px 12px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.hg-table td { padding: 10px 12px; border-top: 1px solid var(--hg-border); }
.hg-table tr:last-child td { border-bottom: none; }
.hg-table .num,
.hg-pack-table .num { text-align: right; white-space: nowrap; }
.hg-table-wrap { width: 100%; overflow-x: auto; }
.hg-pending-selection {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 14px 16px 16px;
    padding: 14px;
    border: 1px solid rgba(46,125,50,.28);
    border-radius: 14px;
    background: rgba(46,125,50,.08);
}
.hg-pending-selection-top {
    margin-top: 0;
    margin-bottom: 12px;
}
.hg-pending-selection div {
    display: grid;
    gap: 3px;
}
.hg-pending-selection strong {
    color: var(--hg-text);
}
.hg-pending-selection span {
    color: var(--hg-text-muted);
    font-size: 13px;
}
.hg-mp-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    padding: 15px 16px;
    border: 1px solid var(--hg-border);
    border-radius: 18px;
    background: var(--hg-card);
    box-shadow: 0 12px 34px rgba(0,0,0,.06);
}
.hg-mp-status div {
    display: grid;
    gap: 4px;
}
.hg-mp-status strong {
    color: var(--hg-text);
    font-size: 15px;
}
.hg-mp-status span {
    color: var(--hg-text-muted);
    font-size: 13px;
}
.hg-mp-status.required {
    border-color: rgba(46,125,50,.28);
    background: rgba(46,125,50,.08);
}
.hg-mp-status.complete {
    border-color: rgba(46,125,50,.22);
    background: rgba(46,125,50,.06);
}
.hg-caja-input { min-width: 120px; }
.hg-action-row { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 16px 16px; justify-content: flex-end; }
.packing-sheet .invoice-letter div { font-size: 20px; }
.packing-items th:first-child,
.packing-items td:first-child { width: 90px; }

/* ---- MODALS ---- */
.hg-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.hg-modal-panel {
    width: min(920px, 100%);
    max-height: min(760px, calc(100vh - 40px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--hg-border);
    border-radius: 20px;
    background: var(--hg-surface);
    box-shadow: 0 30px 90px rgba(15, 23, 42, .28);
}
.hg-modal-panel-wide {
    width: min(1040px, 100%);
}
.hg-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--hg-border);
}
.hg-modal-header h2 {
    font-size: 20px;
    margin: 0;
}
.hg-modal-header p {
    margin-top: 4px;
    color: var(--hg-text-muted);
    font-size: 13px;
}
.hg-modal-panel .hg-table {
    overflow: auto;
}
.hg-icon-button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--hg-border);
    border-radius: 999px;
    background: var(--hg-bg);
    color: var(--hg-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}
.hg-icon-button:hover {
    border-color: rgba(46,125,50,.28);
    color: var(--hg-primary);
}
.hg-link-button {
    border: 0;
    background: transparent;
    color: var(--hg-primary);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    padding: 0;
}
.hg-link-button:hover {
    color: var(--hg-primary-light);
}

/* ---- BLAZOR ERROR ---- */
#blazor-error-ui {
    background: #FEF3C7;
    border: 1px solid #F59E0B;
    border-radius: 8px;
    bottom: calc(var(--hg-nav-height) + 8px);
    position: fixed;
    left: 8px; right: 8px;
    padding: 12px 40px 12px 16px;
    font-size: 13px;
    display: none;
    z-index: 200;
}
#blazor-error-ui .reload { font-weight: 600; color: var(--hg-primary); margin-left: 8px; }
#blazor-error-ui .dismiss { position: absolute; right: 12px; top: 12px; cursor: pointer; }

/* ---- RESPONSIVE ERP SHELL ---- */
:root {
    --hg-primary: #2E7D32;
    --hg-primary-light: #43A047;
    --hg-accent: #7CB342;
    --hg-bg: #F5F5F7;
    --hg-surface: rgba(255,255,255,.86);
    --hg-text: #1D1D1F;
    --hg-text-muted: #6E6E73;
    --hg-border: rgba(0,0,0,.09);
    --bs-primary: #2E7D32;
    --bs-primary-rgb: 46, 125, 50;
    --bs-link-color: #2E7D32;
    --bs-link-hover-color: #1B5E20;
}

body {
    background:
        radial-gradient(circle at top left, rgba(46,125,50,.08), transparent 32rem),
        linear-gradient(180deg, #FBFBFD 0%, #F5F5F7 100%);
}

:root[data-theme="dark"] body {
    background:
        radial-gradient(circle at top left, rgba(134,239,172,.14), transparent 34rem),
        linear-gradient(180deg, #15161A 0%, #101114 100%);
}

.hg-app {
    min-height: 100vh;
    max-width: none;
    width: 100%;
    margin: 0;
    display: flex;
}

.hg-shell-sidebar {
    display: contents;
}

.hg-shell-brand {
    display: none;
}

.hg-shell-brand img {
    width: 42px;
    height: 42px;
    max-width: 42px;
    max-height: 42px;
    object-fit: contain;
}

.hg-shell-user {
    display: none;
}

.hg-shell-content {
    width: 100%;
    min-width: 0;
}

.hg-main {
    width: 100%;
}

.hg-header {
    background: rgba(255,255,255,.78);
    color: var(--hg-text);
    border-bottom: 1px solid var(--hg-border);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}

.hg-header h1 {
    font-size: 22px;
    letter-spacing: 0;
}

.hg-header .subtitle {
    color: var(--hg-text-muted);
    opacity: 1;
}

.hg-brand-header img {
    background: white;
    box-shadow: 0 1px 8px rgba(0,0,0,.08);
}

.hg-search,
.hg-tabs {
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.hg-search input {
    border-radius: 14px;
    background: rgba(245,245,247,.95);
    border-color: transparent;
}

.hg-search input:focus {
    background: white;
    box-shadow: 0 0 0 4px rgba(46,125,50,.12);
}

:root[data-theme="dark"] .hg-search input,
:root[data-theme="dark"] .hg-input {
    background: rgba(255,255,255,.07);
    color: var(--hg-text);
    border-color: rgba(255,255,255,.10);
}

:root[data-theme="dark"] .hg-search input:focus,
:root[data-theme="dark"] .hg-input:focus {
    background: rgba(255,255,255,.10);
    box-shadow: 0 0 0 4px rgba(134,239,172,.15);
}

.hg-tabs button {
    border-radius: 14px;
    background: rgba(245,245,247,.9);
    border-color: transparent;
}

.hg-tabs button.active {
    background: #1D1D1F;
    border-color: #1D1D1F;
}

.hg-list,
.hg-card,
.hg-mini-panel,
.hg-module-card,
.hg-insight-strip > div,
.hg-dashboard-loading {
    background: rgba(255,255,255,.86);
    border: 1px solid rgba(0,0,0,.06);
    box-shadow: 0 10px 30px rgba(0,0,0,.05);
}

:root[data-theme="dark"] .hg-list,
:root[data-theme="dark"] .hg-card,
:root[data-theme="dark"] .hg-mini-panel,
:root[data-theme="dark"] .hg-module-card,
:root[data-theme="dark"] .hg-insight-strip > div,
:root[data-theme="dark"] .hg-dashboard-loading {
    background: rgba(29,30,34,.88);
    border-color: rgba(255,255,255,.10);
    box-shadow: 0 18px 44px rgba(0,0,0,.24);
}

:root[data-theme="dark"] .hg-header,
:root[data-theme="dark"] .hg-search,
:root[data-theme="dark"] .hg-tabs,
:root[data-theme="dark"] .hg-action-bar,
:root[data-theme="dark"] .hg-shell-sidebar {
    background: rgba(24,25,29,.78);
    border-color: rgba(255,255,255,.10);
}

:root[data-theme="dark"] .hg-brand-header img,
:root[data-theme="dark"] .hg-shell-brand img {
    background: rgba(255,255,255,.92);
}

:root[data-theme="dark"] .hg-tabs button,
:root[data-theme="dark"] .hg-choice,
:root[data-theme="dark"] .hg-row-action,
:root[data-theme="dark"] .hg-row-menu-button {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.10);
    color: var(--hg-text);
}

:root[data-theme="dark"] .hg-row-menu-panel {
    background: rgba(29,30,34,.98);
    border-color: rgba(255,255,255,.12);
    box-shadow: 0 18px 50px rgba(0,0,0,.42);
}

:root[data-theme="dark"] .hg-row-menu-item {
    color: var(--hg-text);
}

:root[data-theme="dark"] .hg-row-menu-button:hover,
:root[data-theme="dark"] .hg-row-menu-item:hover {
    background: rgba(134,239,172,.13);
    color: #BBF7D0;
}

:root[data-theme="dark"] .hg-secondary-action,
:root[data-theme="dark"] .hg-security-user,
:root[data-theme="dark"] .hg-security-permissions section {
    background: rgba(255,255,255,.055);
    border-color: rgba(255,255,255,.10);
    color: var(--hg-text);
}

:root[data-theme="dark"] .hg-security-user.active {
    background: rgba(134,239,172,.15);
    border-color: rgba(134,239,172,.34);
}

:root[data-theme="dark"] .hg-security-user strong,
:root[data-theme="dark"] .hg-security-user small,
:root[data-theme="dark"] .hg-security-permissions small {
    color: var(--hg-text-muted);
}

:root[data-theme="dark"] .hg-security-user strong {
    color: var(--hg-text);
}

:root[data-theme="dark"] .hg-hint {
    background: rgba(134,239,172,.12);
    border: 1px solid rgba(134,239,172,.20);
    color: #BBF7D0;
}

:root[data-theme="dark"] .hg-alert {
    background: rgba(251,191,36,.12);
    border-color: rgba(251,191,36,.24);
    color: #FDE68A;
}

:root[data-theme="dark"] .hg-tax-rate-card {
    background: linear-gradient(180deg, rgba(134,239,172,.08), rgba(255,255,255,.035));
    border-color: rgba(255,255,255,.10);
}

:root[data-theme="dark"] .hg-tax-rate-card.emphasized {
    background: linear-gradient(180deg, rgba(134,239,172,.14), rgba(255,255,255,.045));
    border-color: rgba(134,239,172,.28);
}

:root[data-theme="dark"] .hg-alert-danger,
:root[data-theme="dark"] .hg-error-msg {
    background: rgba(248,113,113,.13);
    border: 1px solid rgba(248,113,113,.24);
    color: #FCA5A5;
}

:root[data-theme="dark"] .hg-danger-zone {
    background: rgba(248,113,113,.08);
    border-color: rgba(248,113,113,.20);
}

:root[data-theme="dark"] .hg-danger-action,
:root[data-theme="dark"] .hg-row-action.danger {
    background: rgba(248,113,113,.10);
    border-color: rgba(248,113,113,.28);
    color: #FCA5A5;
}

:root[data-theme="dark"] .hg-badge-green { background: rgba(74,222,128,.14); color: #86EFAC; }
:root[data-theme="dark"] .hg-badge-yellow { background: rgba(251,191,36,.15); color: #FDE68A; }
:root[data-theme="dark"] .hg-badge-gray { background: rgba(255,255,255,.08); color: #D4D4D8; }
:root[data-theme="dark"] .hg-badge-blue { background: rgba(134,239,172,.16); color: #BBF7D0; }
:root[data-theme="dark"] .hg-badge-orange { background: rgba(251,146,60,.16); color: #FDBA74; }
:root[data-theme="dark"] .hg-badge-pink { background: rgba(244,114,182,.16); color: #F9A8D4; }
:root[data-theme="dark"] .hg-badge-red,
:root[data-theme="dark"] .hg-badge-danger { background: rgba(248,113,113,.14); color: #FCA5A5; }

:root[data-theme="dark"] .hg-tabs button.active {
    background: #F5F5F7;
    border-color: #F5F5F7;
    color: #1D1D1F;
}

:root[data-theme="dark"] .hg-list-item:hover,
:root[data-theme="dark"] .hg-nav-item:hover {
    background: rgba(255,255,255,.06);
}

:root[data-theme="dark"] .hg-list-item,
:root[data-theme="dark"] .hg-list-main-link,
:root[data-theme="dark"] .hg-list-item:hover,
:root[data-theme="dark"] .hg-list-main-link:hover,
:root[data-theme="dark"] .hg-list-item:visited,
:root[data-theme="dark"] .hg-list-main-link:visited {
    color: var(--hg-text);
}

:root[data-theme="dark"] .hg-list-item:hover .hg-list-title,
:root[data-theme="dark"] .hg-list-main-link:hover .hg-list-title {
    color: #BBF7D0;
}

.hg-env-footer {
    color: var(--hg-text-muted);
    font-size: 11px;
    padding: 0 16px calc(var(--hg-nav-height) + 12px);
}

.hg-env-footer-inner {
    width: 100%;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 0 0;
    border-top: 1px solid var(--hg-border);
}

.hg-env-footer span {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    border: 1px solid var(--hg-border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--hg-surface) 78%, transparent);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hg-env-footer strong {
    color: var(--hg-text);
    font-weight: 800;
}

.hg-env-footer span.hg-env-prod {
    border-color: rgba(127, 29, 29, .28);
    background: rgba(127, 29, 29, .08);
    color: #7F1D1D;
}

.hg-env-footer span.hg-env-prod strong {
    color: #7F1D1D;
}

:root[data-theme="dark"] .hg-env-footer span.hg-env-prod {
    border-color: rgba(248, 113, 113, .28);
    background: rgba(127, 29, 29, .24);
    color: #FCA5A5;
}

:root[data-theme="dark"] .hg-env-footer span.hg-env-prod strong {
    color: #FCA5A5;
}

.hg-theme-toggle {
    border: 1px solid var(--hg-border);
    background: var(--hg-surface);
    color: var(--hg-text);
    border-radius: 999px;
    min-height: 30px;
    padding: 6px 10px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    margin-left: auto;
}

.hg-theme-toggle .hg-theme-toggle-dark {
    display: none;
}

:root[data-theme="dark"] .hg-theme-toggle .hg-theme-toggle-light {
    display: none;
}

:root[data-theme="dark"] .hg-theme-toggle .hg-theme-toggle-dark {
    display: inline;
}

.hg-form-page .hg-hint,
.hg-form-page .hg-alert {
    margin: 16px 20px 0;
}

.hg-form-page > .hg-page-message {
    margin: 0;
}

.hg-presentaciones-page {
    gap: 18px;
}

.hg-presentaciones-page > .hg-card,
.hg-presentaciones-page > .hg-presentaciones-grid {
    width: 100%;
}

.hg-presentaciones-page .hg-page-header {
    align-items: center;
}

.hg-presentaciones-page .hg-page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.hg-presentaciones-new-card .hg-form-grid {
    align-items: end;
    grid-template-columns: 150px minmax(180px, 1fr) minmax(130px, .5fr) 150px;
}

.hg-presentaciones-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.hg-presentaciones-picker-grid {
    grid-template-columns: minmax(320px, .9fr) minmax(380px, 1.1fr);
}

.hg-presentaciones-bottom-grid {
    grid-template-columns: minmax(360px, .9fr) minmax(460px, 1.1fr);
}

.hg-presentaciones-page .hg-card {
    overflow: hidden;
}

.hg-presentaciones-page .hg-table-wrap {
    overflow: auto;
}

.hg-presentaciones-picker-grid .hg-table-wrap {
    max-height: 310px;
}

.hg-presentaciones-bottom-grid .hg-table-wrap {
    max-height: 410px;
}

.hg-presentaciones-page .hg-table tr {
    cursor: pointer;
}

.hg-presentaciones-page .hg-table tr.selected td {
    background: rgba(67, 160, 71, .13);
}

.hg-presentaciones-page .hg-table th,
.hg-presentaciones-page .hg-table td {
    vertical-align: middle;
}

.hg-presentaciones-page > .hg-card .hg-total-bar {
    align-items: center;
    gap: 14px;
}

.hg-presentaciones-page .hg-total-bar {
    flex-wrap: wrap;
}

.hg-presentaciones-page .hg-total-bar > span {
    min-width: 220px;
}

.hg-presentaciones-page .hg-split-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 1100px) {
    .hg-presentaciones-grid,
    .hg-presentaciones-picker-grid,
    .hg-presentaciones-bottom-grid {
        grid-template-columns: 1fr;
    }

    .hg-presentaciones-new-card .hg-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .hg-env-footer {
        padding-bottom: 14px;
    }
}

.hg-card,
.hg-mini-panel,
.hg-module-card,
.hg-insight-strip > div,
.hg-dashboard-loading {
    border-radius: 18px;
}

.hg-list {
    margin: 16px;
    border-radius: 18px;
    overflow: hidden;
}

.hg-list-item:hover {
    background: rgba(46,125,50,.045);
}

.hg-kpi-card {
    border-radius: 20px;
}

.hg-kpi-primary { background: linear-gradient(145deg, #166534, #65A30D); }
.hg-kpi-warn { background: linear-gradient(145deg, #FF9F0A, #FF453A); }
.hg-kpi-green { background: linear-gradient(145deg, #30D158, #34C759); }
.hg-kpi-rose { background: linear-gradient(145deg, #5856D6, #AF52DE); }

@media (min-width: 900px) {
    :root {
        --hg-nav-height: 0px;
    }

    .hg-app {
        display: grid;
        grid-template-columns: 300px minmax(0, 1fr);
    }

    .hg-shell-sidebar {
        display: flex;
        position: sticky;
        top: 0;
        height: 100vh;
        flex-direction: column;
        padding: 18px 14px;
        background: rgba(255,255,255,.72);
        border-right: 1px solid var(--hg-border);
        backdrop-filter: blur(28px);
        -webkit-backdrop-filter: blur(28px);
        overflow-y: auto;
        scrollbar-width: thin;
    }

    .hg-shell-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        color: var(--hg-text);
        text-decoration: none;
        padding: 10px 10px 18px;
        margin-bottom: 4px;
    }

    .hg-shell-brand img {
        width: 42px;
        height: 42px;
        object-fit: contain;
        border-radius: 12px;
        background: white;
        box-shadow: 0 4px 16px rgba(0,0,0,.08);
        padding: 4px;
    }

    .hg-shell-brand strong,
    .hg-shell-brand small {
        display: block;
        line-height: 1.15;
    }

    .hg-shell-brand strong {
        font-size: 15px;
        letter-spacing: .01em;
    }

    .hg-shell-brand small {
        color: var(--hg-text-muted);
        font-size: 12px;
        margin-top: 2px;
    }

    .hg-shell-user {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        margin-top: auto;
        padding: 14px 10px 4px;
        border-top: 1px solid var(--hg-border);
    }

    .hg-shell-user strong,
    .hg-shell-user small {
        display: block;
        line-height: 1.2;
    }

    .hg-shell-user strong {
        font-size: 13px;
        color: var(--hg-text);
    }

    .hg-shell-user small {
        margin-top: 2px;
        color: var(--hg-text-muted);
        font-size: 11px;
    }

    .hg-shell-user button {
        border: 1px solid var(--hg-border);
        background: rgba(255,255,255,.58);
        color: var(--hg-text);
        border-radius: 10px;
        padding: 8px 10px;
        font-weight: 800;
        cursor: pointer;
    }

    .hg-bottom-nav {
        position: static;
        transform: none;
        width: 100%;
        max-width: none;
        height: auto;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
        overflow: visible;
    }

    .hg-nav-sections {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .hg-nav-group {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 3px;
        padding: 10px 8px;
        border: 1px solid rgba(0,0,0,.045);
        border-radius: 18px;
        background: rgba(255,255,255,.38);
    }

    .hg-nav-group-title {
        display: block;
        padding: 2px 8px 7px;
        color: var(--hg-text-muted);
        font-size: 11px;
        font-weight: 800;
        text-transform: uppercase;
    }

    .hg-nav-item {
        min-height: 46px;
        flex: 0 0 auto;
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        padding: 11px 12px;
        border-radius: 14px;
        font-size: 14px;
        font-weight: 650;
    }

    .hg-nav-item svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .hg-nav-item.active {
        color: var(--hg-text);
        background: rgba(46,125,50,.12);
    }

    .hg-nav-item:hover {
        color: var(--hg-text);
        background: rgba(0,0,0,.045);
    }

    .hg-nav-disabled {
        display: flex;
        cursor: default;
        opacity: .42;
    }

    .hg-nav-disabled:hover {
        color: var(--hg-text-muted);
        background: transparent;
    }

    :root[data-theme="dark"] .hg-nav-group {
        background: rgba(255,255,255,.045);
        border-color: rgba(255,255,255,.075);
        box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
    }

    :root[data-theme="dark"] .hg-nav-group-title {
        color: rgba(245,245,247,.52);
    }

    :root[data-theme="dark"] .hg-nav-item {
        color: rgba(245,245,247,.72);
    }

:root[data-theme="dark"] .hg-nav-item.active {
    color: #F8FAFC;
    background: rgba(47,143,70,.42);
}

    :root[data-theme="dark"] .hg-nav-item:hover {
        color: #F8FAFC;
        background: rgba(255,255,255,.07);
    }

    :root[data-theme="dark"] .hg-nav-disabled {
        color: rgba(245,245,247,.46);
        opacity: 1;
    }

    :root[data-theme="dark"] .hg-nav-disabled svg {
        color: rgba(245,245,247,.35);
    }

    :root[data-theme="dark"] .hg-nav-disabled:hover {
        color: rgba(245,245,247,.46);
        background: transparent;
    }

    .hg-shell-content {
        min-height: 100vh;
    }

    .hg-main {
        padding: 28px;
        padding-bottom: 22px;
    }

    .hg-header {
        position: static;
        border: 1px solid rgba(0,0,0,.06);
        border-radius: 24px;
        padding: 24px 28px;
        margin: 0 auto 16px;
        max-width: 1220px;
        box-shadow: 0 12px 36px rgba(0,0,0,.045);
    }

    .hg-header h1 {
        font-size: 30px;
        font-weight: 760;
    }

    .hg-search,
    .hg-tabs,
    .hg-action-bar {
        position: static;
        max-width: 1220px;
        margin-left: auto;
        margin-right: auto;
        border: 1px solid rgba(0,0,0,.06);
        box-shadow: 0 10px 28px rgba(0,0,0,.04);
    }

    .hg-action-bar {
        border-radius: 18px 18px 0 0;
        padding: 12px 14px;
        border-bottom: 0;
    }

    .hg-tabs {
        border-radius: 18px 18px 0 0;
        padding: 12px 14px 0;
    }

    .hg-search {
        border-radius: 0 0 18px 18px;
        padding: 12px 14px;
    }

    .hg-tabs + .hg-search {
        top: auto;
    }

    .hg-list,
    .hg-page,
    .hg-dashboard {
        max-width: 1220px;
        margin-left: auto;
        margin-right: auto;
    }

    .hg-list {
        margin-top: 18px;
    }

    .hg-page {
        padding: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 22px;
        align-items: start;
    }

    .hg-security-page {
        grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
        gap: 22px;
    }

    .hg-security-page > .hg-card {
        min-width: 0;
        overflow: hidden;
    }

    .hg-security-page > .hg-card:first-child {
        position: sticky;
        top: 28px;
    }

    .hg-security-page .hg-actions-bar {
        margin: 0;
        justify-content: flex-end;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
        box-shadow: none;
    }

    .hg-security-page .hg-security-permissions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hg-list-page,
    .hg-lotes-page {
        display: block;
        max-width: 1220px;
        margin-left: auto;
        margin-right: auto;
    }

    .hg-lotes-page {
        width: 100%;
        max-width: none;
    }

    .hg-list-page .hg-header,
    .hg-list-page .hg-search,
    .hg-list-page .hg-filter-row,
    .hg-list-page .hg-action-bar,
    .hg-list-page .hg-list,
    .hg-lotes-page .hg-header,
    .hg-lotes-page .hg-search,
    .hg-lotes-page .hg-filter-row,
    .hg-lotes-page .hg-action-bar,
    .hg-lotes-page .hg-list {
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    .hg-list-page .hg-header,
    .hg-lotes-page .hg-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 18px;
    }

    .hg-list-page .hg-search,
    .hg-lotes-page .hg-search {
        border-radius: 18px;
        border-bottom: 0;
    }

    .hg-list-page .hg-search:has(+ .hg-filter-row),
    .hg-list-page .hg-search:has(+ .hg-action-bar),
    .hg-lotes-page .hg-search:has(+ .hg-filter-row),
    .hg-lotes-page .hg-search:has(+ .hg-action-bar) {
        border-radius: 18px 18px 0 0;
    }

    .hg-list-page .hg-filter-row,
    .hg-lotes-page .hg-filter-row {
        border: 1px solid rgba(0,0,0,.06);
        border-top: 0;
        border-radius: 0 0 18px 18px;
        box-shadow: 0 10px 28px rgba(0,0,0,.04);
    }

    .hg-list-page .hg-action-bar {
        border-radius: 0;
        border-top: 0;
    }

    .hg-list-page .hg-search + .hg-action-bar {
        border-radius: 0 0 18px 18px;
    }

    .hg-lotes-new-bar {
        border-radius: 18px;
        border-bottom: 1px solid rgba(0,0,0,.06);
        margin-bottom: 12px;
    }

    .hg-list-page .hg-action-bar + .hg-list {
        margin-top: 18px;
    }

    .hg-list-page .hg-list,
    .hg-lotes-page .hg-list {
        margin-top: 18px;
        overflow: hidden;
    }

    .hg-list-page .hg-list-main-link,
    .hg-lotes-page .hg-list-main-link {
        min-width: 280px;
    }

    .hg-list-page .hg-list-side-actions,
    .hg-lotes-page .hg-list-side-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
        max-width: 520px;
    }

    .hg-list-page 
.production-orders-toolbar {
    display: grid;
    gap: 14px;
    padding: 16px;
}

.production-order-filters {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(190px, .35fr) auto;
    gap: 12px;
    align-items: end;
}

.production-order-filters label {
    display: grid;
    gap: 6px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 850;
}

.production-order-filters button {
    min-height: 42px;
    border: 1px solid rgba(46,125,50,.28);
    border-radius: 12px;
    background: var(--hg-surface);
    color: var(--hg-primary);
    padding: 9px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.production-order-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--hg-border);
    border-radius: 14px;
    overflow: hidden;
}

.production-order-stats div {
    padding: 10px 12px;
    border-right: 1px solid var(--hg-border);
    background: color-mix(in srgb, var(--hg-bg) 55%, var(--hg-surface));
}

.production-order-stats div:last-child {
    border-right: 0;
}

.production-order-stats span,
.production-order-stats strong {
    display: block;
}

.production-order-stats span {
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.production-order-stats strong {
    margin-top: 3px;
    color: var(--hg-text);
    font-size: 18px;
    font-weight: 850;
}

.production-selection-bar {
    justify-content: flex-start;
}

.production-selection-bar .hg-primary-action {
    background: var(--hg-primary);
    color: #fff;
    border-color: var(--hg-primary);
}

.production-selected-panel {
    display: grid;
    grid-template-columns: minmax(220px, .28fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    border: 1px solid rgba(46,125,50,.20);
    border-radius: 16px;
    background: rgba(46,125,50,.055);
    padding: 12px 14px;
}

.production-selected-panel > div:first-child strong,
.production-selected-panel > div:first-child span {
    display: block;
}

.production-selected-panel > div:first-child strong {
    color: var(--hg-text);
    font-size: 14px;
    font-weight: 850;
}

.production-selected-panel > div:first-child span {
    margin-top: 3px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 750;
}

.production-selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.production-selected-list button {
    display: grid;
    gap: 2px;
    max-width: 260px;
    border: 1px solid rgba(46,125,50,.20);
    border-radius: 12px;
    background: var(--hg-surface);
    color: var(--hg-text);
    padding: 8px 10px;
    text-align: left;
    cursor: pointer;
}

.production-selected-list button strong,
.production-selected-list button span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.production-selected-list button strong {
    color: var(--hg-primary);
    font-size: 12px;
    font-weight: 850;
}

.production-selected-list button span {
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 700;
}

.production-order-row.selected {
    background: rgba(46,125,50,.08);
    box-shadow: inset 4px 0 0 var(--hg-primary);
}

.hg-selection-bar {
        position: static;
        justify-content: flex-end;
        border-radius: 0 0 18px 18px;
        border-top: 0;
    }

    .hg-materia-prima-page .hg-card {
        margin-top: 18px;
        overflow: hidden;
    }

    .hg-materia-prima-page .hg-card .hg-list {
        margin-top: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .hg-page > .hg-card,
    .hg-page > .hg-empty {
        margin-bottom: 0;
    }

    .hg-page > .hg-card:has(.hg-table),
    .hg-page > .hg-empty {
        grid-column: 1 / -1;
    }

    .hg-dashboard {
        padding: 0;
    }

    .hg-kpi-grid,
    .hg-modules {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .hg-insight-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hg-table table {
        font-size: 14px;
    }

    .hg-form-page {
        display: grid;
        grid-template-columns: 1fr;
        gap: 22px;
        max-width: none;
        margin-left: auto;
        margin-right: auto;
    }

    .hg-form-page > .hg-page-header {
        width: 100%;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    .hg-form-page > .hg-card,
    .hg-form-page > .hg-actions-bar {
        margin-bottom: 0;
    }

    .hg-form-page .hg-card {
        box-shadow: 0 14px 36px rgba(0,0,0,.06);
    }

    .hg-form-page .hg-card-title {
        padding-top: 16px;
        padding-bottom: 12px;
    }

    .hg-form-page .hg-form-row,
    .hg-form-page .hg-form-grid {
        padding: 18px 20px 0;
    }

.hg-form-page .hg-total-bar {
        margin: 18px 20px 0;
        padding-top: 16px;
    }

    .hg-oc-workspace {
        grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
        gap: 22px;
        align-items: start;
    }

    .hg-oc-summary {
        position: sticky;
        top: 28px;
    }

    .hg-oc-meta-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hg-oc-items-table {
        max-height: 46vh;
    }

    .hg-purchase-workspace {
        grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
        gap: 22px;
        align-items: start;
    }

    .hg-purchase-summary {
        position: sticky;
        top: 28px;
    }

    .hg-product-config-workspace {
        grid-template-columns: minmax(520px, 1fr) minmax(360px, 460px);
        gap: 22px;
    }

    .hg-product-config-page {
        display: grid;
        grid-template-columns: 1fr;
        max-width: none;
        width: 100%;
    }

    .hg-product-config-filters,
    .hg-product-config-workspace {
        grid-column: 1 / -1;
    }

    .hg-product-config-editor {
        position: sticky;
        top: 28px;
    }

    .hg-env-footer {
        padding: 0 28px 22px;
    }

    .hg-env-footer-inner {
        max-width: 1220px;
        margin: 0 auto;
        padding-top: 14px;
    }

    .hg-form-grid-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hg-form-grid-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .hg-table th,
    .hg-table td {
        padding: 12px 14px;
    }
}

@media (max-width: 899.98px) {
    .hg-app {
        max-width: none;
        width: 100%;
    }

    .hg-app {
        display: flex;
        flex-direction: column;
    }

    .hg-main {
        padding-bottom: calc(84px + env(safe-area-inset-bottom));
    }

    .hg-bottom-nav {
        max-width: none;
        height: calc(72px + env(safe-area-inset-bottom));
        justify-content: center;
        padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
        overflow: visible;
        background: rgba(255,255,255,.86);
        backdrop-filter: blur(22px);
        -webkit-backdrop-filter: blur(22px);
    }

    :root[data-theme="dark"] .hg-bottom-nav {
        background: rgba(22,23,26,.86);
    }

    .hg-desktop-home,
    .hg-bottom-nav > .hg-nav-sections {
        display: none;
    }

    .hg-mobile-nav-primary {
        width: min(100%, 520px);
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 4px;
    }

    .hg-nav-item {
        flex: none;
        min-width: 0;
        width: 100%;
        border-radius: 16px;
        font-size: 10px;
        font-weight: 700;
        padding: 7px 3px;
        line-height: 1.1;
    }

    .hg-nav-home {
        min-width: 0;
    }

    .hg-nav-item svg {
        width: 19px;
        height: 19px;
    }

    .hg-nav-item.active {
        background: rgba(46,125,50,.10);
        color: var(--hg-primary);
    }

    .hg-mobile-more {
        cursor: pointer;
    }

    .hg-mobile-menu-toggle:checked ~ .hg-mobile-menu-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.26);
        z-index: 140;
    }

    .hg-mobile-menu-sheet {
        display: block;
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(82px + env(safe-area-inset-bottom));
        max-height: min(72vh, 620px);
        overflow-y: auto;
        padding: 14px;
        border: 1px solid var(--hg-border);
        border-radius: 22px;
        background: var(--hg-surface);
        box-shadow: 0 28px 90px rgba(0,0,0,.28);
        transform: translateY(18px);
        opacity: 0;
        pointer-events: none;
        transition: transform .18s ease, opacity .18s ease;
        z-index: 150;
    }

    .hg-mobile-menu-toggle:checked ~ .hg-mobile-menu-sheet {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .hg-mobile-menu-title {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 4px 4px 12px;
    }

    .hg-mobile-menu-title strong {
        font-size: 18px;
        font-weight: 850;
    }

    .hg-mobile-menu-title label {
        color: var(--hg-primary);
        font-size: 13px;
        font-weight: 800;
        cursor: pointer;
    }

    .hg-mobile-menu-group {
        padding: 10px 0;
        border-top: 1px solid var(--hg-border);
    }

    .hg-mobile-menu-group .hg-nav-group-title {
        display: block;
        padding: 0 4px 8px;
        color: var(--hg-text-muted);
        font-size: 11px;
        font-weight: 850;
        text-transform: uppercase;
        letter-spacing: .04em;
    }

    .hg-mobile-menu-group .hg-nav-item {
        width: 100%;
        min-height: 44px;
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        padding: 10px 9px;
        font-size: 14px;
        color: var(--hg-text);
    }

    .hg-mobile-menu-group .hg-nav-item svg {
        width: 20px;
        height: 20px;
        color: var(--hg-text-muted);
        flex-shrink: 0;
    }

    .hg-mobile-menu-user {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-top: 8px;
        padding: 14px 4px 2px;
        border-top: 1px solid var(--hg-border);
    }

    .hg-mobile-menu-user strong,
    .hg-mobile-menu-user small {
        display: block;
        line-height: 1.2;
    }

    .hg-mobile-menu-user strong {
        color: var(--hg-text);
        font-size: 14px;
    }

    .hg-mobile-menu-user small {
        color: var(--hg-text-muted);
        font-size: 12px;
        margin-top: 2px;
    }

    .hg-mobile-menu-user button {
        border: 1px solid var(--hg-border);
        background: var(--hg-primary);
        color: #fff;
        border-radius: 14px;
        padding: 10px 14px;
        font-weight: 850;
        cursor: pointer;
    }

    .hg-mobile-menu-user .hg-mobile-theme-toggle {
        width: auto;
        min-height: 40px;
        margin-left: auto;
        background: var(--hg-bg);
        color: var(--hg-text);
        border-color: var(--hg-border);
    }

    .hg-header {
        top: 0;
        padding: 14px 16px 10px;
        border-bottom: 0;
    }

    .hg-header h1 {
        font-size: 22px;
        line-height: 1.1;
        font-weight: 850;
    }

    .hg-header .subtitle {
        font-size: 12px;
        margin-top: 4px;
    }

    .hg-list-page .hg-header .hg-primary-action,
    .hg-lotes-page .hg-header .hg-primary-action {
        float: none;
        display: inline-flex;
        width: fit-content;
        margin-top: 14px;
        background: var(--hg-primary);
        color: white;
        border-color: transparent;
    }

    .hg-action-bar {
        padding: 8px 16px 10px;
        border-bottom: 0;
        background: rgba(255,255,255,.82);
    }

    .hg-action-bar a,
    .hg-action-bar button {
        min-height: 36px;
        border-radius: 13px;
        padding: 8px 12px;
        font-size: 13px;
    }

    .hg-search {
        top: 48px;
        padding: 8px 16px 12px;
        border-bottom: 0;
    }

    .hg-tabs + .hg-search {
        top: 92px;
    }

    .hg-search input {
        min-height: 42px;
        padding: 9px 13px;
        border-radius: 14px;
        font-size: 14px;
    }

    .hg-list {
        margin: 10px 12px 18px;
        border-radius: 18px;
        border: 0;
        background: transparent;
        box-shadow: none;
        display: grid;
        gap: 10px;
        overflow: visible;
    }

    .hg-list-item {
        border: 1px solid var(--hg-border);
        border-radius: 17px;
        padding: 12px 12px;
        background: var(--hg-surface);
        box-shadow: 0 8px 24px rgba(0,0,0,.045);
    }

    :root[data-theme="dark"] .hg-list-item {
        background: var(--hg-surface);
        box-shadow: none;
    }

    .hg-list-title {
        font-size: 15px;
        line-height: 1.22;
        font-weight: 800;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .hg-list-sub {
        font-size: 12px;
        line-height: 1.35;
    }

    .hg-list-right {
        margin-left: 8px;
        min-width: 86px;
    }

    .hg-list-right .amount {
        font-size: 16px;
        line-height: 1.15;
        font-weight: 850;
    }

    .hg-badge {
        font-size: 11px;
        padding: 4px 8px;
    }

    .hg-form-row,
    .hg-form-grid,
    .hg-form-grid-2,
    .hg-form-grid-3,
    .hg-form-grid-4 {
        grid-template-columns: 1fr;
    }

    .hg-total-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .hg-tax-rate-grid,
    .hg-tax-rate-fields {
        grid-template-columns: 1fr;
    }

    .hg-section-head,
    .hg-purchase-provider-profile,
    .hg-purchase-total-input {
        grid-template-columns: 1fr;
    }

    .hg-section-head,
    .hg-purchase-provider-profile {
        display: grid;
    }

    .hg-section-head .hg-secondary-action,
    .hg-section-actions,
    .hg-section-actions .hg-secondary-action,
    .hg-purchase-provider-profile .hg-plain-button {
        width: 100%;
    }

    .hg-section-actions {
        justify-content: stretch;
    }

    .hg-purchase-qr-result {
        grid-template-columns: 1fr;
    }

    .hg-product-config-filters,
    .hg-product-config-item,
    .hg-product-config-editor-head,
    .hg-product-config-suggestion,
    .hg-product-config-two,
    .hg-product-config-price-lists,
    .hg-product-composition-add-grid,
    .hgl-store-config-grid {
        grid-template-columns: 1fr;
    }

    .hg-product-config-editor-head {
        display: grid;
    }

    .hg-product-config-items {
        max-height: none;
    }

    .hg-product-config-code {
        grid-row: auto;
    }

    .hg-product-config-name,
    .hg-product-config-sub {
        white-space: normal;
    }

    .hg-product-config-actions .hg-primary-action,
    .hg-product-config-actions .hg-secondary-action,
    .hg-product-config-suggestion .hg-secondary-action {
        width: 100%;
    }

    .hg-purchase-amounts {
        padding: 14px;
        gap: 14px;
    }

    .hg-list-item-actionable {
        align-items: stretch;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
    }

    .hg-list-main-link {
        align-items: flex-start;
        min-width: 0;
    }

    .hg-list-side-actions {
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
    }

    .hg-list-side-actions .hg-list-chevron {
        display: none;
    }

    .hg-list-item-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        gap: 8px 10px;
    }

    .hg-list-item-actions .hg-list-main-link {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
    }

    .hg-list-item-actions .hg-row-menu {
        grid-column: 2;
        grid-row: 1;
        align-self: start;
        justify-self: end;
    }

    .hg-row-action {
        border-radius: 999px;
        min-height: 30px;
        padding: 6px 9px;
        font-size: 11px;
    }

    .hg-row-menu-button {
        width: 36px;
        height: 36px;
    }

    .hg-row-menu[open] .hg-row-menu-panel {
        position: fixed;
        left: 12px;
        right: 12px;
        top: auto;
        bottom: calc(env(safe-area-inset-bottom) + 80px);
        min-width: 0;
        padding: 8px;
        border-radius: 18px;
        box-shadow: 0 24px 70px rgba(0,0,0,.28);
        z-index: 90;
    }

    .hg-row-menu-item {
        min-height: 44px;
        font-size: 15px;
    }

    .hg-env-footer {
        font-size: 10px;
    }

.hg-theme-toggle {
    width: 100%;
    margin-left: 0;
    justify-content: center;
}
}

/* ---- PRINTABLE SALES INVOICE ---- */
.invoice-toolbar {
    max-width: 900px;
    margin: 0 auto 18px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.invoice-page {
    min-height: 100%;
    padding: 0 16px 32px;
}
.invoice-sheet {
    width: min(100%, 210mm);
    min-height: 297mm;
    margin: 0 auto 18px;
    padding: 14mm;
    background: #fff;
    color: #111827;
    border: 1px solid #D1D5DB;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
    font-size: 12px;
    display: flex;
    flex-direction: column;
}
.invoice-page-body {
    flex: 1 1 auto;
}
.invoice-top {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 80px 1fr;
    gap: 18px;
    min-height: 148px;
    border: 1px solid #111827;
    padding: 16px;
}
.invoice-brand {
    line-height: 1.45;
}
.invoice-brand-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.invoice-logo {
    width: 82px;
    height: 82px;
    object-fit: contain;
    flex: 0 0 auto;
}
.invoice-brand-name {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0;
    margin-bottom: 2px;
}
.invoice-brand-subtitle {
    color: #4B5563;
    font-weight: 700;
}
.invoice-letter {
    justify-self: center;
    align-self: start;
    width: 56px;
    height: 64px;
    border: 2px solid #111827;
    background: #fff;
    display: grid;
    place-items: center;
    text-align: center;
    font-weight: 900;
}
.invoice-letter div {
    font-size: 34px;
    line-height: 1;
}
.invoice-letter span {
    font-size: 9px;
    font-weight: 700;
}
.invoice-number {
    text-align: right;
    font-size: 13px;
    line-height: 1.48;
}
.invoice-type {
    font-size: 22px;
    font-weight: 900;
}
.invoice-numero {
    font-size: 17px;
    font-weight: 800;
}
.invoice-registry {
    border-left: 1px solid #111827;
    border-right: 1px solid #111827;
    border-bottom: 1px solid #111827;
    padding: 8px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    font-size: 11px;
}
.invoice-client {
    border: 1px solid #111827;
    border-top: 0;
    padding: 12px 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px 24px;
}
.invoice-client div:nth-child(4),
.invoice-client div:nth-child(5) {
    grid-column: 1 / -1;
}
.invoice-items {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
}
.invoice-items th {
    background: #F3F4F6;
    border: 1px solid #111827;
    padding: 8px 7px;
    font-size: 11px;
    text-align: left;
}
.invoice-items td {
    border-left: 1px solid #D1D5DB;
    border-right: 1px solid #D1D5DB;
    border-bottom: 1px solid #E5E7EB;
    padding: 7px;
    vertical-align: top;
}
.invoice-auth {
    margin-top: 18px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.invoice-auth div {
    border: 1px solid #111827;
    padding: 10px 12px;
    min-height: 54px;
}
.invoice-auth div:last-child {
    grid-column: 1 / -1;
}
.invoice-auth span {
    display: block;
    color: #4B5563;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}
.invoice-auth strong {
    display: block;
    margin-top: 4px;
    font-size: 14px;
    word-break: break-word;
}
.invoice-items .num,
.invoice-totals .num {
    text-align: right;
}
.invoice-summary {
    display: grid;
    grid-template-columns: 1fr 270px;
    gap: 20px;
    margin-top: 18px;
}
.invoice-notes {
    border: 1px solid #D1D5DB;
    min-height: 120px;
    padding: 12px;
    line-height: 1.45;
}
.invoice-notes p {
    margin: 10px 0 0;
}
.invoice-manual-text {
    white-space: pre-line;
}
.invoice-qr-block {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}
.invoice-qr {
    width: 86px;
    height: 86px;
    flex: 0 0 86px;
}
.invoice-qr svg {
    display: block;
    width: 100%;
    height: 100%;
}
.invoice-qr-block span {
    display: block;
    margin-top: 4px;
    color: #4B5563;
    font-size: 10.5px;
    line-height: 1.3;
}
.invoice-totals {
    border: 1px solid #111827;
    align-self: start;
}
.invoice-totals div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 12px;
    border-bottom: 1px solid #D1D5DB;
}
.invoice-totals div:last-child {
    border-bottom: 0;
}
.invoice-total {
    background: #F3F4F6;
    font-size: 17px;
    font-weight: 900;
}
.invoice-continues {
    margin-top: 18px;
    border: 1px dashed #9CA3AF;
    padding: 10px 12px;
    color: #4B5563;
    font-weight: 800;
    text-align: right;
}
.invoice-footer {
    margin-top: auto;
    border-top: 2px solid #111827;
    padding-top: 12px;
    display: flex;
    justify-content: space-between;
    gap: 18px;
}

@media (max-width: 700px) {
    .invoice-toolbar {
        position: sticky;
        top: 0;
        z-index: 10;
        width: 100%;
        max-width: none;
        margin: 0;
        padding: calc(env(safe-area-inset-top) + 10px) 10px 10px;
        justify-content: space-between;
        background: rgba(248, 250, 252, .94);
        border-bottom: 1px solid #d1d5db;
        backdrop-filter: blur(12px);
    }

    .invoice-toolbar button,
    .invoice-toolbar .hg-primary-action,
    .invoice-toolbar .hg-secondary-action {
        min-height: 40px;
        padding: 0 14px;
        border-radius: 12px;
        font-size: 13px;
    }

    .invoice-page {
        min-height: 100dvh;
        padding: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        background: var(--hg-bg);
    }

    .invoice-sheet {
        width: 210mm;
        min-width: 210mm;
        margin: 0 0 14px;
        padding: 12mm;
        box-shadow: 0 16px 46px rgba(0,0,0,.16);
        transform-origin: top left;
    }
}


.production-orders-toolbar {
    display: grid;
    gap: 14px;
    padding: 16px;
}

.production-order-filters {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(190px, .35fr) auto;
    gap: 12px;
    align-items: end;
}

.production-order-filters label {
    display: grid;
    gap: 6px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 850;
}

.production-order-filters button {
    min-height: 42px;
    border: 1px solid rgba(46,125,50,.28);
    border-radius: 12px;
    background: var(--hg-surface);
    color: var(--hg-primary);
    padding: 9px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.production-order-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--hg-border);
    border-radius: 14px;
    overflow: hidden;
}

.production-order-stats div {
    padding: 10px 12px;
    border-right: 1px solid var(--hg-border);
    background: color-mix(in srgb, var(--hg-bg) 55%, var(--hg-surface));
}

.production-order-stats div:last-child {
    border-right: 0;
}

.production-order-stats span,
.production-order-stats strong {
    display: block;
}

.production-order-stats span {
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.production-order-stats strong {
    margin-top: 3px;
    color: var(--hg-text);
    font-size: 18px;
    font-weight: 850;
}

.production-selection-bar {
    justify-content: flex-start;
}

.production-selection-bar .hg-primary-action {
    background: var(--hg-primary);
    color: #fff;
    border-color: var(--hg-primary);
}

.production-selected-panel {
    display: grid;
    grid-template-columns: minmax(220px, .28fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    border: 1px solid rgba(46,125,50,.20);
    border-radius: 16px;
    background: rgba(46,125,50,.055);
    padding: 12px 14px;
}

.production-selected-panel > div:first-child strong,
.production-selected-panel > div:first-child span {
    display: block;
}

.production-selected-panel > div:first-child strong {
    color: var(--hg-text);
    font-size: 14px;
    font-weight: 850;
}

.production-selected-panel > div:first-child span {
    margin-top: 3px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 750;
}

.production-selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.production-selected-list button {
    display: grid;
    gap: 2px;
    max-width: 260px;
    border: 1px solid rgba(46,125,50,.20);
    border-radius: 12px;
    background: var(--hg-surface);
    color: var(--hg-text);
    padding: 8px 10px;
    text-align: left;
    cursor: pointer;
}

.production-selected-list button strong,
.production-selected-list button span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.production-selected-list button strong {
    color: var(--hg-primary);
    font-size: 12px;
    font-weight: 850;
}

.production-selected-list button span {
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 700;
}

.production-order-row.selected {
    background: rgba(46,125,50,.08);
    box-shadow: inset 4px 0 0 var(--hg-primary);
}

.hg-selection-bar {
    position: sticky;
    top: 108px;
    z-index: 42;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.hg-selection-bar button:disabled {
    cursor: default;
    opacity: .52;
}

.hg-selection-bar .hg-secondary-action {
    background: var(--hg-bg);
    color: var(--hg-text);
    border: 1px solid var(--hg-border);
}

.production-selection-summary {
    color: var(--hg-muted);
    font-size: 13px;
    font-weight: 750;
    margin-left: auto;
}

.hg-select-check {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 34px;
    height: 44px;
}

.hg-select-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--hg-primary);
}

@media (max-width: 700px) {
    .production-order-stats {
        display: none !important;
    }

    .production-selection-bar {
        position: static;
        display: flex;
        padding: 10px 0;
        background: transparent;
        box-shadow: none;
    }

    .production-selection-bar .hg-primary-action,
    .production-selection-bar .hg-secondary-action {
        min-height: 38px;
        padding: 8px 12px;
        font-size: 12px;
    }

    .production-selected-panel {
        display: none;
    }

    .production-order-row.hg-list-item-actionable {
        grid-template-columns: 28px minmax(0, 1fr);
        align-items: start;
        gap: 8px 10px;
    }

    .production-order-row > .hg-select-check {
        grid-column: 1;
        grid-row: 1;
        width: 24px;
        height: 30px;
        justify-self: start;
        align-self: start;
        margin-top: 1px;
    }

    .production-order-row > .hg-list-main-link {
        grid-column: 2;
        grid-row: 1 / span 2;
        display: block;
        min-width: 0;
        padding-left: 0;
    }

    .production-order-row > .hg-row-menu {
        grid-column: 1;
        grid-row: 2;
        justify-self: start;
        align-self: end;
        margin-top: 8px;
    }

    .production-order-row .hg-list-title,
    .production-order-row .hg-list-sub {
        min-width: 0;
    }
}

.production-print-page {
    min-height: 100dvh;
    background: var(--hg-bg);
    padding: 18px;
    color: #111827;
    overflow-x: auto;
}

.production-sheet {
    width: min(100%, 920px);
    min-height: min(1180px, calc(100dvh - 36px));
    margin: 0 auto;
    padding: 42px;
    background: #fff;
    border: 1px solid #d1d5db;
    box-shadow: 0 18px 60px rgba(0,0,0,.16);
    display: flex;
    flex-direction: column;
}

.production-print-header {
    display: grid;
    grid-template-columns: 150px 1fr 150px;
    align-items: center;
    gap: 28px;
    border-bottom: 2px solid #111827;
    padding-bottom: 26px;
}

.production-print-header img {
    width: 132px;
    height: 56px;
    object-fit: contain;
}

.production-title {
    text-align: center;
}

.production-title h1 {
    font-size: 30px;
    margin: 0 0 12px;
    letter-spacing: 0;
}

.production-title strong,
.production-date {
    font-size: 18px;
    font-weight: 700;
}

.production-date {
    text-align: right;
}

.production-client {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 10px 28px;
    border-bottom: 1px solid #d1d5db;
    padding: 26px 0;
    font-size: 15px;
}

.production-client-name {
    grid-column: 1 / -1;
    font-size: 19px;
    font-weight: 800;
}

.production-batch-summary {
    display: grid;
    grid-template-columns: 1.8fr 1fr 1fr;
    gap: 16px;
    border-bottom: 1px solid #d1d5db;
    padding: 24px 0;
}

.production-batch-summary div {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 14px 16px;
    background: #f9fafb;
}

.production-batch-summary span {
    display: block;
    color: #6b7280;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.production-batch-summary strong {
    display: block;
    font-size: 16px;
    line-height: 1.35;
}

.production-batch-orders {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
    padding: 18px 0 22px;
    border-bottom: 1px solid #d1d5db;
}

.production-batch-orders-title {
    grid-column: 1 / -1;
    color: #6b7280;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.production-batch-order {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 10px;
    align-items: baseline;
    font-size: 14px;
}

.production-batch-order strong {
    color: #2E7D32;
}

.production-batch-order span {
    min-width: 0;
}

.production-items {
    width: 100%;
    border-collapse: collapse;
    margin-top: 26px;
    font-size: 15px;
}

.production-items th,
.production-items td {
    border-bottom: 1px solid #d1d5db;
    padding: 14px 12px;
    text-align: left;
    vertical-align: top;
}

.production-items th {
    background: #f3f4f6;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .04em;
}

.production-items .num {
    text-align: right;
    width: 110px;
    font-weight: 800;
}

.production-order-id {
    width: 90px;
    font-weight: 800;
    color: #2E7D32;
}

.production-footer {
    margin-top: auto;
    border-top: 2px solid #111827;
    padding-top: 28px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

.production-footer div {
    min-height: 70px;
    border-bottom: 1px solid #111827;
}

.production-footer span {
    display: block;
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 800;
    margin-bottom: 10px;
}

.production-footer strong {
    font-size: 22px;
}

@media (max-width: 760px) {
    .production-order-filters,
    .production-order-stats,
    .production-selected-panel {
        grid-template-columns: 1fr;
    }

    .production-order-stats div {
        border-right: 0;
        border-bottom: 1px solid var(--hg-border);
    }

    .production-order-stats div:last-child {
        border-bottom: 0;
    }
}

@media (max-width: 700px) {
    .production-print-page {
        padding: 10px;
    }

    .production-sheet {
        width: 920px;
        padding: 36px;
    }

    .production-batch-summary {
        grid-template-columns: 1fr;
    }

    .production-batch-orders {
        grid-template-columns: 1fr;
    }
}

/* ---- HGL.LA WEB ADMIN ---- */
.hgl-admin-page {
    display: grid;
    gap: 22px;
    max-width: 1500px;
    margin: 0 auto;
}

.hgl-admin-top {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: start;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.hgl-panel {
    background: var(--hg-surface);
    border: 1px solid var(--hg-border);
    border-radius: 12px;
    box-shadow: 0 3px 14px rgba(0,0,0,.04);
}

.hgl-admin-title,
.hgl-admin-filters {
    background: var(--hg-surface);
    border: 1px solid var(--hg-border);
    box-shadow: 0 18px 44px rgba(0,0,0,.055);
}

.hgl-admin-title {
    min-width: 0;
    border-radius: 24px;
    padding: 28px 32px;
}

.hgl-admin-title span {
    display: block;
    color: var(--hg-primary);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.hgl-admin-title h1 {
    margin: 0 0 8px;
    color: var(--hg-text);
    font-size: 38px;
    font-weight: 850;
    line-height: 1.08;
}

.hgl-admin-title p {
    margin: 0;
    color: var(--hg-text-muted);
    font-size: 16px;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.hgl-admin-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    align-items: end;
    align-content: start;
    border-radius: 18px;
    padding: 18px 22px;
}

.hgl-admin-filters button {
    justify-self: start;
    min-width: 140px;
    min-height: 40px;
    border: 1px solid rgba(46,125,50,.24);
    border-radius: 11px;
    background: var(--hg-surface);
    color: var(--hg-primary);
    font: inherit;
    font-weight: 850;
    cursor: pointer;
}

.hgl-admin-filters button:hover {
    background: rgba(46,125,50,.07);
}

.hgl-admin-filters button:disabled {
    cursor: default;
    opacity: .62;
}

.hgl-admin-filters label,
.hgl-editor label:not(.hg-check-inline) {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 800;
}

.hgl-admin-filters .hg-input,
.hgl-admin-filters input,
.hgl-admin-filters select {
    width: 100%;
    min-width: 0;
}

.hgl-workspace {
    display: grid;
    grid-template-columns: minmax(360px, .85fr) minmax(480px, 1.15fr);
    gap: 14px;
    align-items: start;
}

.hgl-panel {
    overflow: hidden;
}

.hgl-panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--hg-border);
    background: color-mix(in srgb, var(--hg-bg) 56%, var(--hg-surface));
}

.hgl-panel-title strong {
    color: var(--hg-text);
    font-size: 13px;
    font-weight: 850;
}

.hgl-panel-title span {
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 750;
}

.hgl-product-list {
    max-height: calc(100vh - 178px);
    overflow: auto;
}

.hgl-product-row {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--hg-border);
    background: transparent;
    color: var(--hg-text);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(90px, auto);
    gap: 10px;
    align-items: center;
    min-height: 54px;
    padding: 8px 12px;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.hgl-product-row:hover {
    background: rgba(46,125,50,.045);
}

.hgl-product-row.selected {
    background: rgba(46,125,50,.10);
    box-shadow: inset 3px 0 0 var(--hg-primary);
}

.hgl-row-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 4px;
}

.hgl-row-actions button {
    min-height: 30px;
    border: 1px solid rgba(46,125,50,.24);
    border-radius: 999px;
    background: var(--hg-surface);
    color: var(--hg-primary);
    padding: 5px 10px;
    font: inherit;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
}

.hgl-row-actions button:first-child {
    background: var(--hg-primary);
    color: #fff;
}

.hgl-row-actions button:disabled {
    cursor: default;
    opacity: .6;
}

.hgl-product-main {
    min-width: 0;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.hgl-product-id {
    width: 34px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(46,125,50,.11);
    color: var(--hg-primary);
    font-size: 12px;
    font-weight: 850;
}

.hgl-product-main strong,
.hgl-product-main span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hgl-product-main strong {
    font-size: 14px;
    font-weight: 760;
    line-height: 1.2;
}

.hgl-product-main span {
    color: var(--hg-text-muted);
    font-size: 12px;
    margin-top: 2px;
}

.hgl-product-meta {
    display: grid;
    justify-items: end;
    gap: 4px;
    min-width: 0;
}

.hgl-product-meta span {
    max-width: 190px;
    color: var(--hg-text-muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hgl-status-on,
.hgl-status-off,
.hgl-status-warn {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-style: normal;
    font-weight: 850;
}

.hgl-status-on {
    background: rgba(34,197,94,.12);
    color: #166534;
}

.hgl-status-off {
    background: #FEF3C7;
    color: #92400E;
}

.hgl-status-warn {
    background: rgba(59,130,246,.12);
    color: #1D4ED8;
}

.hgl-origin-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-style: normal;
    font-weight: 850;
}

.hgl-origin-web {
    background: rgba(46,125,50,.12);
    color: var(--hg-primary);
}

.hgl-origin-legacy {
    background: rgba(100,116,139,.13);
    color: #475569;
}

.hgl-status-pending {
    background: #DBEAFE;
    color: #1D4ED8;
}

.hgl-status-error {
    background: #FEE2E2;
    color: #B91C1C;
}

.hgl-client-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    border-bottom: 1px solid var(--hg-border);
}

.hgl-client-summary div {
    min-width: 0;
    padding: 10px 12px;
    border-right: 1px solid var(--hg-border);
}

.hgl-client-summary div:last-child {
    border-right: 0;
}

.hgl-client-summary span,
.hgl-client-summary strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hgl-client-summary span {
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.hgl-client-summary strong {
    margin-top: 3px;
    color: var(--hg-text);
    font-size: 13px;
    font-weight: 760;
}

.hgl-sync-message {
    grid-column: 1 / -1;
    border: 1px solid #FECACA;
    border-radius: 10px;
    background: #FEF2F2;
    color: #991B1B;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 700;
}

.hgl-mapping-workspace {
    grid-template-columns: minmax(430px, .95fr) minmax(520px, 1.05fr);
}

.hgl-mapping-row.mapped:not(.selected) {
    background: rgba(34,197,94,.055);
}

.hgl-filter-check {
    align-self: end;
    min-height: 40px;
}

.hgl-mapping-summary {
    grid-template-columns: 1fr 1fr 1fr 110px;
}

.hgl-erp-selected {
    grid-column: 1 / -1;
    border: 1px solid rgba(46,125,50,.22);
    border-radius: 10px;
    background: rgba(46,125,50,.06);
    padding: 10px 12px;
}

.hgl-erp-selected span,
.hgl-erp-selected strong {
    display: block;
}

.hgl-erp-selected span {
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.hgl-erp-selected strong {
    margin-top: 3px;
    color: var(--hg-text);
    font-size: 13px;
    font-weight: 800;
}

.hgl-erp-results {
    margin: 10px 16px 0;
    border: 1px solid var(--hg-border);
    border-radius: 12px;
    overflow: hidden;
    max-height: 310px;
    overflow-y: auto;
}

.hgl-erp-row {
    width: 100%;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 46px;
    border: 0;
    border-bottom: 1px solid var(--hg-border);
    background: transparent;
    color: var(--hg-text);
    padding: 8px 10px;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.hgl-erp-row:last-child {
    border-bottom: 0;
}

.hgl-erp-row:hover,
.hgl-erp-row.selected {
    background: rgba(46,125,50,.09);
}

.hgl-erp-row > span {
    color: var(--hg-primary);
    font-size: 12px;
    font-weight: 850;
}

.hgl-erp-row strong,
.hgl-erp-row small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hgl-erp-row strong {
    font-size: 13px;
    font-weight: 800;
}

.hgl-erp-row small {
    color: var(--hg-text-muted);
    font-size: 12px;
}

.hgl-inline-loading {
    margin: 0;
    padding: 16px;
}

.hgl-empty-compact {
    margin: 0;
    padding: 18px;
}

.hgl-editor-panel {
    position: sticky;
    top: 22px;
}

.hgl-editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--hg-border);
    background: color-mix(in srgb, var(--hg-bg) 58%, var(--hg-surface));
}

.hgl-editor-head span {
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.hgl-editor-head h2 {
    margin: 2px 0 0;
    color: var(--hg-text);
    font-size: 18px;
    font-weight: 820;
    line-height: 1.2;
}

.hgl-detail-badges {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.hgl-editor {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 14px 16px 4px;
}

.hgl-editor label:nth-of-type(3),
.hgl-editor label:nth-of-type(4),
.hgl-editor label:nth-of-type(5),
.hgl-editor label:nth-of-type(6),
.hgl-editor .hg-list-sub {
    grid-column: 1 / -1;
}

.hgl-textarea {
    line-height: 1.45;
}

.hgl-desc {
    min-height: 132px;
}

.hgl-active-check {
    justify-content: flex-start;
    min-height: 32px;
    padding: 2px 0;
}

.hgl-editor-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px 16px;
}

.hgl-editor-actions button,
.hgl-editor-action-link {
    align-items: center;
    min-height: 38px;
    border: 1px solid var(--hg-primary);
    border-radius: 10px;
    background: var(--hg-primary);
    color: white;
    display: inline-flex;
    justify-content: center;
    padding: 8px 13px;
    font: inherit;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
}

.hgl-editor-action-link:hover {
    color: white;
    filter: brightness(.96);
    text-decoration: none;
}

.hgl-editor-actions button:disabled {
    cursor: default;
    opacity: .6;
}

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

.hgl-coupon-filters button {
    justify-self: start;
    min-width: 140px;
    min-height: 40px;
    border: 1px solid var(--hg-primary);
    border-radius: 10px;
    background: var(--hg-primary);
    color: #fff;
    padding: 8px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

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

.hgl-filter-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: end;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.hgl-filter-actions button {
    min-height: 40px;
    border: 1px solid rgba(46,125,50,.28);
    border-radius: 10px;
    background: var(--hg-surface);
    color: var(--hg-primary);
    padding: 8px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.hgl-filter-actions .hg-primary-action {
    border-color: var(--hg-primary);
    background: var(--hg-primary);
    color: #fff;
}

.hgl-filter-actions .hg-danger-soft-action {
    border-color: #FECDD3;
    background: #FFF1F2;
    color: var(--hg-danger);
}

.hgl-filter-actions button:disabled {
    cursor: default;
    opacity: .6;
}

.hgl-price-workspace {
    grid-template-columns: minmax(420px, .95fr) minmax(500px, 1.05fr);
}

.hgl-price-grid-workspace {
    grid-template-columns: minmax(720px, 1fr) minmax(360px, .42fr);
}

.hgl-price-grid-panel {
    max-height: calc(100vh - 178px);
    overflow: hidden;
}

.hgl-price-table-wrap {
    max-height: calc(100vh - 221px);
    overflow: auto;
}

.hgl-price-table {
    width: 100%;
    min-width: 980px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.hgl-price-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    height: 36px;
    border-bottom: 1px solid var(--hg-border);
    background: color-mix(in srgb, var(--hg-bg) 72%, var(--hg-surface));
    color: var(--hg-text-muted);
    padding: 7px 8px;
    font-size: 11px;
    font-weight: 850;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.hgl-price-table td {
    height: 42px;
    border-bottom: 1px solid var(--hg-border);
    color: var(--hg-text);
    padding: 6px 8px;
    font-size: 12px;
    vertical-align: middle;
}

.hgl-price-table tbody tr {
    cursor: pointer;
}

.hgl-price-table tbody tr:hover {
    background: rgba(46,125,50,.045);
}

.hgl-price-table tbody tr.selected {
    background: rgba(46,125,50,.10);
    box-shadow: inset 3px 0 0 var(--hg-primary);
}

.hgl-price-table tbody tr.publish:not(.selected) {
    background: rgba(34,197,94,.05);
}

.hgl-price-table .check {
    width: 44px;
    text-align: center;
}

.hgl-price-table .id {
    width: 52px;
    color: var(--hg-primary);
    font-weight: 850;
}

.hgl-price-table .producto {
    width: 230px;
}

.hgl-price-table .erp {
    width: 160px;
}

.hgl-price-table .money {
    width: 96px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.hgl-price-table .money.edit {
    width: 112px;
}

.hgl-price-table .estado {
    width: 112px;
    text-align: right;
}

.hgl-price-table .positive {
    color: #166534;
}

.hgl-price-table .negative {
    color: #B91C1C;
}

.hgl-price-table strong,
.hgl-price-table span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hgl-price-table strong {
    color: var(--hg-text);
    font-size: 12px;
    font-weight: 800;
}

.hgl-price-table span {
    color: var(--hg-text-muted);
    font-size: 11px;
    margin-top: 2px;
}

.hgl-price-cell-input {
    width: 100%;
    min-height: 30px;
    padding: 4px 7px;
    text-align: right;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.hgl-price-meta span {
    max-width: 250px;
}

.hgl-price-detail .hgl-editor {
    padding-bottom: 10px;
}

.hgl-price-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.hgl-price-actions button:not(:last-child) {
    border-color: rgba(46,125,50,.28);
    background: var(--hg-surface);
    color: var(--hg-primary);
}

.hgl-coupon-row:not(.selected):has(.hgl-status-on) {
    background: rgba(34,197,94,.045);
}

.hgl-coupon-workspace {
    grid-template-columns: minmax(380px, .8fr) minmax(520px, 1.2fr);
}

.hgl-coupon-workspace .hgl-detail-drawer.hgl-editor-panel {
    background: var(--hg-surface);
}

.hgl-coupon-summary {
    grid-template-columns: 120px minmax(0, 1fr) 140px 70px;
}

.hgl-coupon-editor label:nth-of-type(3),
.hgl-coupon-editor label:nth-of-type(4),
.hgl-coupon-editor label:nth-of-type(5),
.hgl-coupon-editor label:nth-of-type(6),
.hgl-coupon-editor label:nth-of-type(7),
.hgl-coupon-editor label:nth-of-type(8) {
    grid-column: auto;
}

.hgl-coupon-editor label:nth-of-type(12),
.hgl-coupon-editor label:nth-of-type(13) {
    grid-column: 1 / -1;
}

.hgl-coupon-new-action {
    justify-self: start;
    min-width: 150px;
}

.hgl-coupon-editor {
    align-items: start;
}

.hgl-coupon-editor .hg-input {
    background: var(--hg-surface);
}

.hgl-coupon-pro-selector {
    grid-column: 1 / -1;
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(46,125,50,.16);
    border-radius: 13px;
    background: color-mix(in srgb, var(--hg-surface) 92%, rgba(46,125,50,.08));
}

.hgl-coupon-pro-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.hgl-coupon-pro-head label {
    margin: 0;
}

.hgl-coupon-pro-head button,
.hgl-coupon-pro-selected button {
    width: auto;
    min-width: 124px;
    min-height: 40px;
    border: 1px solid rgba(46,125,50,.28);
    border-radius: 12px;
    background: var(--hg-surface);
    color: var(--hg-primary);
    padding: 9px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.hgl-coupon-pro-head button:hover,
.hgl-coupon-pro-selected button:hover {
    background: rgba(46,125,50,.08);
}

.hgl-coupon-pro-head button:disabled,
.hgl-coupon-pro-selected button:disabled {
    cursor: default;
    opacity: .62;
}

.hgl-coupon-pro-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(46,125,50,.18);
    border-radius: 11px;
    background: var(--hg-surface);
}

.hgl-coupon-pro-selected div {
    min-width: 0;
}

.hgl-coupon-pro-selected span,
.hgl-coupon-pro-selected strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hgl-coupon-pro-selected span {
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.hgl-coupon-pro-selected strong {
    margin-top: 3px;
    color: var(--hg-text);
    font-size: 13px;
    font-weight: 820;
}

.hgl-coupon-pro-message {
    margin: 0;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 700;
}

.hgl-coupon-pro-results {
    display: grid;
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--hg-border);
    border-radius: 12px;
    background: var(--hg-surface);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
}

.hgl-coupon-pro-results button {
    appearance: none;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    align-items: center;
    min-height: 50px;
    border: 0;
    border-bottom: 1px solid var(--hg-border);
    background: transparent;
    color: var(--hg-text);
    padding: 9px 11px;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.hgl-coupon-pro-results button:last-child {
    border-bottom: 0;
}

.hgl-coupon-pro-results button:hover {
    background: rgba(46,125,50,.07);
}

.hgl-coupon-pro-results strong,
.hgl-coupon-pro-results span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hgl-coupon-pro-results strong {
    color: var(--hg-text);
    font-size: 13px;
    font-weight: 820;
}

.hgl-coupon-pro-results span {
    grid-column: 1 / 2;
    color: var(--hg-text-muted);
    font-size: 12px;
}

.hgl-coupon-pro-results em {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    align-self: center;
    justify-self: end;
}

.hgl-coupon-margin {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(190px, .42fr) minmax(240px, 1fr) auto;
    gap: 10px 14px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid rgba(46,125,50,.18);
    border-radius: 12px;
    background: color-mix(in srgb, var(--hg-surface) 92%, rgba(46,125,50,.08));
}

.hgl-coupon-margin > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.hgl-coupon-margin span {
    display: block;
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.hgl-coupon-margin strong {
    color: var(--hg-primary);
    font-size: 18px;
    font-weight: 800;
}

.hgl-coupon-margin button {
    justify-self: end;
    width: auto;
    min-width: 136px;
    min-height: 38px;
    border: 1px solid rgba(46,125,50,.28);
    border-radius: 12px;
    background: var(--hg-surface);
    color: var(--hg-primary);
    font-weight: 800;
    padding: 8px 14px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.hgl-coupon-editor .hg-check-inline {
    align-self: end;
}

.hgl-coupon-editor .hgl-active-check input {
    width: 18px;
    height: 18px;
}

.hgl-coupon-margin-list {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.hgl-coupon-margin-list .hg-input {
    min-height: 38px;
    font-size: 13px;
    letter-spacing: 0;
    text-transform: none;
}

.hgl-coupon-margin p {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--hg-text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.hgl-coupon-margin .hgl-coupon-list-warning {
    color: #92400E;
    font-weight: 760;
}

.hgl-coupon-margin-ok {
    border-color: rgba(46,125,50,.32);
    background: rgba(46,125,50,.07);
}

.hgl-coupon-margin-warn {
    border-color: rgba(245,158,11,.5);
    background: rgba(245,158,11,.08);
}

.hgl-coupon-margin-warn strong,
.hgl-coupon-margin-warn p:last-child {
    color: #B45309;
}

.hgl-coupon-workspace .hgl-editor-actions {
    justify-content: flex-start;
    background: var(--hg-surface);
}

.hgl-coupon-workspace .hgl-editor-actions .hg-secondary-action {
    border-color: rgba(46,125,50,.28);
    background: var(--hg-surface);
    color: var(--hg-primary);
}

.hgl-coupon-workspace .hgl-editor-actions .hg-danger-action {
    border-color: #fecaca;
    background: #fff1f2;
    color: var(--hg-danger);
}

@media (max-width: 720px) {
    .hgl-coupon-pro-head,
    .hgl-coupon-margin {
        grid-template-columns: 1fr;
    }

    .hgl-coupon-pro-head button,
    .hgl-coupon-margin button {
        justify-self: stretch;
        width: 100%;
    }

    .hgl-coupon-pro-selected {
        align-items: stretch;
        flex-direction: column;
    }

    .hgl-coupon-pro-selected button {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .hgl-coupon-pro-results button {
        grid-template-columns: 1fr;
    }

    .hgl-coupon-pro-results em {
        grid-column: 1;
        grid-row: auto;
        justify-self: start;
    }
}

.hgl-legacy-workspace {
    grid-template-columns: minmax(340px, .52fr) minmax(720px, 1.48fr);
}

.hgl-legacy-list {
    max-height: calc(100vh - 178px);
}

.hgl-legacy-row {
    grid-template-columns: minmax(0, 1fr) 128px;
}

.hgl-legacy-row .hgl-product-id {
    width: 54px;
}

.hgl-drawer-page .hgl-workspace,
.hgl-drawer-page .hgl-legacy-workspace,
.hgl-drawer-page.hgl-orders-page .hgl-legacy-workspace {
    grid-template-columns: 1fr;
}

.hgl-drawer-page .hgl-product-list,
.hgl-drawer-page .hgl-legacy-list,
.hgl-drawer-page.hgl-orders-page .hgl-legacy-list,
.hgl-drawer-page .hgl-price-grid-panel,
.hgl-drawer-page .hgl-price-table-wrap {
    max-height: none;
}

.hgl-drawer-page .hgl-legacy-row,
.hgl-drawer-page.hgl-orders-page .hgl-legacy-row {
    grid-template-columns: minmax(0, 1fr) minmax(150px, auto);
    min-height: 66px;
}

.hgl-client-final-row {
    min-height: 58px;
    padding-block: 7px;
}

.hgl-client-final-row .hgl-product-main > div {
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.hgl-client-final-row .hgl-product-main strong {
    flex: 0 1 auto;
}

.hgl-client-final-row .hgl-product-main span:not(.hgl-product-id) {
    margin-top: 0;
    flex: 1 1 auto;
}

.hgl-client-final-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    min-width: 0;
}

.hgl-client-final-meta span {
    max-width: none;
    white-space: nowrap;
}

.hgl-detail-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    border: 0;
    background: rgba(15, 23, 42, .20);
    cursor: default;
}

.hgl-detail-drawer {
    position: fixed;
    top: 24px;
    right: 24px;
    bottom: 24px;
    z-index: 81;
    width: min(860px, calc(100vw - 48px));
    max-width: calc(100vw - 48px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-radius: 18px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .24);
}

.hgl-detail-head-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.hgl-drawer-close {
    min-height: 34px;
    border: 1px solid rgba(46,125,50,.28);
    border-radius: 999px;
    background: var(--hg-surface);
    color: var(--hg-primary);
    padding: 6px 12px;
    font: inherit;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
}

.hgl-legacy-detail {
    min-width: 0;
}

.hgl-legacy-summary {
    grid-template-columns: 150px 120px 80px minmax(0, 1fr);
}

.hgl-legacy-address {
    padding: 12px 16px;
    border-bottom: 1px solid var(--hg-border);
}

.hgl-legacy-address span,
.hgl-legacy-address strong {
    display: block;
    min-width: 0;
}

.hgl-legacy-address span {
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.hgl-legacy-address strong {
    margin-top: 4px;
    color: var(--hg-text);
    font-size: 13px;
    font-weight: 760;
}

.hgl-subtitle {
    border-top: 0;
}

.hgl-legacy-items {
    overflow-x: auto;
}

.hgl-legacy-items-head,
.hgl-legacy-item {
    display: grid;
    grid-template-columns: 58px minmax(180px, 1.2fr) minmax(150px, .9fr) 100px;
    gap: 10px;
    align-items: center;
    min-width: 640px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--hg-border);
}

.hgl-legacy-items-head {
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--hg-bg) 60%, var(--hg-surface));
}

.hgl-legacy-item {
    color: var(--hg-text);
    font-size: 13px;
}

.hgl-legacy-item > span:first-child {
    text-align: center;
    color: var(--hg-primary);
    font-weight: 850;
}

.hgl-legacy-item strong,
.hgl-legacy-item small,
.hgl-legacy-item span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hgl-legacy-item small {
    display: block;
    margin-top: 2px;
    color: var(--hg-text-muted);
    font-size: 11px;
    font-weight: 700;
}

.hgl-legacy-item > strong:last-child {
    text-align: right;
}

.hgl-legacy-raw {
    padding: 12px 16px 16px;
}

.hgl-legacy-raw summary {
    color: var(--hg-text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 850;
}

.hgl-legacy-raw pre,
.hgl-migration-output {
    margin: 10px 0 0;
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--hg-border);
    border-radius: 10px;
    background: color-mix(in srgb, var(--hg-bg) 72%, var(--hg-surface));
    color: var(--hg-text);
    padding: 12px;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.hgl-migration-workspace {
    grid-template-columns: minmax(320px, .65fr) minmax(520px, 1.35fr);
}

.hgl-migration-controls {
    grid-template-columns: 1fr 1fr;
}

.hgl-migration-options {
    display: grid;
    gap: 10px;
    padding: 14px 16px 4px;
}

.hgl-migration-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px 16px 16px;
}

.hgl-migration-actions button {
    min-height: 40px;
    border: 1px solid var(--hg-primary);
    border-radius: 10px;
    background: var(--hg-primary);
    color: #fff;
    padding: 8px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.hgl-migration-actions button:disabled {
    cursor: default;
    opacity: .6;
}

.hgl-migration-output {
    min-height: 300px;
    max-height: calc(100vh - 260px);
    margin: 0;
    border: 0;
    border-radius: 0;
}

.hgl-control-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--hg-border);
    border-radius: 18px;
    background: var(--hg-surface);
    box-shadow: 0 16px 36px rgba(15, 23, 42, .05);
}

.hgl-control-tabs button {
    min-height: 42px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: var(--hg-text-muted);
    padding: 8px 16px;
    font: inherit;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.hgl-control-tabs button:hover {
    background: color-mix(in srgb, var(--hg-primary) 8%, transparent);
    color: var(--hg-primary);
}

.hgl-control-tabs button.active {
    background: var(--hg-text);
    color: #fff;
}

.hgl-control-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.hgl-control-grid-narrow {
    grid-template-columns: minmax(0, 860px);
}

.hgl-control-card {
    overflow: hidden;
}

.hgl-control-card-wide {
    grid-column: 1 / -1;
}

.hgl-control-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px 16px 16px;
}

.hgl-control-links-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hgl-control-links-single {
    grid-template-columns: 1fr;
    padding-top: 10px;
}

.hgl-control-link {
    min-height: 88px;
    width: 100%;
    border: 1px solid color-mix(in srgb, var(--hg-primary) 20%, var(--hg-border));
    border-radius: 12px;
    background: color-mix(in srgb, var(--hg-primary) 5%, var(--hg-surface));
    color: var(--hg-text);
    padding: 14px;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.hgl-control-link:hover {
    border-color: color-mix(in srgb, var(--hg-primary) 42%, var(--hg-border));
    background: color-mix(in srgb, var(--hg-primary) 9%, var(--hg-surface));
}

.hgl-control-link strong {
    display: block;
    color: var(--hg-primary);
    font-size: 15px;
    font-weight: 850;
    line-height: 1.2;
}

.hgl-control-link span {
    display: block;
    margin-top: 6px;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.35;
}

.hgl-control-actions {
    grid-template-columns: repeat(2, minmax(0, 220px));
    justify-content: start;
}

.hgl-control-periods {
    padding: 14px 16px 0;
}

.hgl-control-output-preview {
    max-width: 900px;
}

.hgl-control-output-preview .hgl-migration-output {
    min-height: 120px;
    max-height: 180px;
}


.hgl-order-filters {
    grid-template-columns: minmax(320px, 1fr) minmax(220px, .42fr) auto;
}

.hgl-orders-page .hgl-legacy-workspace {
    grid-template-columns: minmax(320px, .46fr) minmax(780px, 1.54fr);
    align-items: start;
}

.hgl-orders-page .hgl-legacy-list {
    max-height: calc(100vh - 184px);
}

.hgl-orders-page .hgl-legacy-row {
    grid-template-columns: minmax(0, 1fr) 122px;
    border-left: 4px solid transparent;
}

.hgl-orders-page .hgl-legacy-row.selected {
    border-left-color: var(--hg-primary);
}

.hgl-orders-page .hgl-legacy-row .hgl-product-id {
    width: auto;
    min-width: 54px;
    justify-content: center;
}

.hgl-orders-page .hgl-legacy-detail {
    overflow: hidden;
}

.hgl-orders-page .hgl-legacy-detail.hgl-detail-drawer,
.hgl-legacy-detail.hgl-detail-drawer {
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.hgl-orders-page .hgl-editor-head {
    gap: 16px;
    padding: 18px 20px;
}

.hgl-orders-page .hgl-editor-head h2 {
    margin-top: 4px;
    font-size: 20px;
    line-height: 1.2;
}

.hgl-order-status-summary {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, .8fr) minmax(0, .8fr) minmax(0, 1fr);
}

.hgl-orders-page .hgl-order-status-summary {
    border-top: 1px solid var(--hg-border);
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.hgl-orders-page .hgl-order-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hgl-orders-page .hgl-order-editor {
    padding: 16px 20px;
    border-top: 1px solid var(--hg-border);
    background: color-mix(in srgb, var(--hg-bg) 58%, var(--hg-surface));
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hgl-order-actions {
    justify-content: flex-start;
}

.hgl-orders-page .hgl-order-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 20px 18px;
    border-bottom: 1px solid var(--hg-border);
    background: color-mix(in srgb, var(--hg-bg) 58%, var(--hg-surface));
}

.hgl-order-actions .hg-secondary-action,
.hgl-order-actions .hgl-editor-action-link.hg-secondary-action {
    border-color: rgba(46,125,50,.28);
    background: var(--hg-surface);
    color: var(--hg-primary);
}

.hgl-order-actions .hg-primary-action {
    border-color: var(--hg-primary);
    background: var(--hg-primary);
    color: #fff;
}

.hgl-orders-page .hgl-order-actions .hg-danger-action {
    margin-left: auto;
    border-color: #fecaca;
    background: #fff1f2;
    color: var(--hg-danger);
}

.hgl-order-editor label:nth-of-type(3),
.hgl-order-editor label:nth-of-type(4) {
    grid-column: 1 / -1;
}

.hgl-orders-page .hgl-legacy-address {
    padding: 14px 20px;
}

.hgl-orders-page .hgl-legacy-items-head,
.hgl-orders-page .hgl-legacy-item {
    grid-template-columns: 64px minmax(220px, 1.4fr) minmax(150px, .75fr) 112px;
    padding-left: 16px;
    padding-right: 16px;
}

.hg-guardias-panel {
    overflow: hidden;
}

.hg-guardias-table-wrap {
    overflow: auto;
    max-height: calc(100vh - 224px);
}

.hg-guardias-table {
    width: 100%;
    min-width: 980px;
    border-collapse: separate;
    border-spacing: 0;
}

.hg-guardias-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid var(--hg-border);
    background: color-mix(in srgb, var(--hg-bg) 72%, var(--hg-surface));
    color: var(--hg-text-muted);
    padding: 9px 10px;
    font-size: 11px;
    font-weight: 850;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.hg-guardias-table td {
    border-bottom: 1px solid var(--hg-border);
    color: var(--hg-text);
    padding: 10px;
    font-size: 12px;
    vertical-align: top;
}

.hg-guardias-table tr.fail {
    background: rgba(239, 68, 68, .055);
}

.hg-guardias-table strong,
.hg-guardias-table span,
.hg-guardias-table small {
    display: block;
}

.hg-guardias-table span,
.hg-guardias-table small {
    color: var(--hg-text-muted);
    margin-top: 2px;
}

.hg-guardias-table code {
    font-size: 11px;
}

.hg-guardias-audit-table {
    min-width: 1120px;
}

:root[data-theme="dark"] .hgl-product-row.selected {
    background: rgba(134, 239, 172, .10);
}

:root[data-theme="dark"] .hgl-status-on {
    color: #BBF7D0;
}

:root[data-theme="dark"] .hgl-status-off {
    background: rgba(251, 191, 36, .14);
    color: #FBBF24;
}

:root[data-theme="dark"] .hgl-status-pending {
    background: rgba(96, 165, 250, .15);
    color: #BFDBFE;
}

:root[data-theme="dark"] .hgl-status-error,
:root[data-theme="dark"] .hgl-sync-message {
    background: rgba(248, 113, 113, .14);
    color: #FECACA;
    border-color: rgba(248, 113, 113, .22);
}

:root[data-theme="dark"] .hgl-mapping-row.mapped:not(.selected),
:root[data-theme="dark"] .hgl-erp-selected {
    background: rgba(134,239,172,.08);
}

:root[data-theme="dark"] .hgl-erp-row:hover,
:root[data-theme="dark"] .hgl-erp-row.selected {
    background: rgba(134,239,172,.10);
}

.hg-clipboard-dialog {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, .34);
}

.hg-clipboard-dialog.open {
    display: flex;
}

.hg-clipboard-card {
    width: min(680px, 100%);
    border: 1px solid var(--hg-border);
    border-radius: 18px;
    background: var(--hg-surface);
    box-shadow: 0 26px 70px rgba(0,0,0,.22);
    padding: 22px;
}

.hg-clipboard-card strong,
.hg-clipboard-card span {
    display: block;
}

.hg-clipboard-card strong {
    color: var(--hg-text);
    font-size: 22px;
    font-weight: 850;
}

.hg-clipboard-card span {
    margin-top: 5px;
    color: var(--hg-text-muted);
    font-size: 14px;
    line-height: 1.42;
}

.hg-clipboard-text {
    width: 100%;
    min-height: 260px;
    margin-top: 18px;
    border: 1px solid var(--hg-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--hg-bg) 58%, var(--hg-surface));
    color: var(--hg-text);
    padding: 14px 16px;
    font: 700 17px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    resize: vertical;
}

.hg-clipboard-actions {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.hg-clipboard-actions button {
    min-height: 42px;
    border: 1px solid rgba(46,125,50,.24);
    border-radius: 999px;
    background: var(--hg-primary);
    color: #fff;
    padding: 9px 16px;
    font: inherit;
    font-weight: 850;
}

.hg-clipboard-actions .hg-clipboard-close {
    background: var(--hg-surface);
    color: var(--hg-text-muted);
    border-color: var(--hg-border);
}

@media (max-width: 1100px) {
    .hgl-admin-top,
    .hgl-workspace {
        grid-template-columns: 1fr;
    }

    .hgl-product-list {
        max-height: none;
    }

    .hgl-editor-panel {
        position: static;
    }

    .hgl-detail-drawer.hgl-editor-panel {
        position: fixed;
    }

    .hgl-orders-page .hgl-legacy-workspace {
        grid-template-columns: 1fr;
    }

    .hgl-orders-page .hgl-legacy-list {
        max-height: none;
    }
}

@media (max-width: 640px) {
    .hgl-admin-page {
        padding: 12px;
        gap: 10px;
    }

    .hgl-admin-top,
    .hgl-admin-filters,
    .hgl-workspace,
    .hgl-editor {
        grid-template-columns: 1fr;
    }

    .hgl-admin-top {
        padding: 0;
        gap: 12px;
    }

    .hgl-admin-title h1 {
        font-size: 30px;
    }

    .hgl-detail-backdrop {
        background: rgba(15, 23, 42, .28);
    }

    .hgl-detail-drawer {
        top: 8px;
        right: 8px;
        bottom: 8px;
        left: 8px;
        width: auto;
        height: auto;
        max-height: calc(100dvh - 16px);
        max-width: none;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        border-radius: 16px;
    }

    .hgl-detail-head-actions {
        justify-content: flex-start;
    }

    .hg-clipboard-card {
        padding: 18px;
    }

    .hg-clipboard-card strong {
        font-size: 20px;
    }

    .hg-clipboard-text {
        min-height: 310px;
        font-size: 15px;
    }

    .hgl-product-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .hgl-orders-page .hgl-order-row {
        grid-template-columns: 1fr;
        align-items: start;
        min-height: 0;
        padding: 14px 16px;
        gap: 10px;
    }

    .hgl-orders-page .hgl-order-row .hgl-product-main {
        display: grid;
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 10px;
        align-items: start;
    }

    .hgl-orders-page .hgl-order-row .hgl-product-id {
        width: 72px;
        min-width: 72px;
    }

    .hgl-orders-page .hgl-order-row .hgl-product-main strong {
        display: block;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        line-height: 1.18;
    }

    .hgl-orders-page .hgl-order-row .hgl-product-main span:not(.hgl-product-id) {
        display: block;
        margin-top: 3px;
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .hgl-orders-page .hgl-order-row .hgl-product-meta {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
        padding-left: 82px;
        justify-items: stretch;
    }

    .hgl-orders-page .hgl-order-row .hgl-product-meta em {
        max-width: 100%;
        text-align: center;
    }

    .hgl-product-meta {
        justify-items: start;
        padding-left: 52px;
    }

    .hgl-client-final-row .hgl-product-main > div {
        display: block;
    }

    .hgl-drawer-page .hgl-client-final-row {
        grid-template-columns: 1fr;
        align-items: start;
        gap: 8px;
        min-height: 0;
        padding: 12px 10px;
    }

    .hgl-client-final-row .hgl-product-main {
        grid-template-columns: 56px minmax(0, 1fr);
        align-items: start;
    }

    .hgl-client-final-row .hgl-product-id {
        width: 56px;
        min-width: 56px;
    }

    .hgl-client-final-row .hgl-product-main strong {
        display: block;
        max-width: 100%;
        font-size: 14px;
        line-height: 1.18;
    }

    .hgl-client-final-row .hgl-product-main span:not(.hgl-product-id) {
        display: block;
        margin-top: 3px;
        max-width: 100%;
    }

    .hgl-client-final-meta {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 6px;
        padding-left: 66px;
    }

    .hgl-client-final-meta span {
        max-width: 100%;
        font-size: 11px;
    }

    .hgl-row-actions {
        justify-content: stretch;
        padding-left: 52px;
    }

    .hgl-row-actions button {
        flex: 1 1 calc(50% - 8px);
    }

    .hgl-mapping-summary {
        grid-template-columns: 1fr 1fr;
    }

    .hgl-erp-row {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .hgl-erp-row em {
        grid-column: 2;
        justify-self: start;
    }

    .hgl-client-summary {
        grid-template-columns: 1fr 1fr;
    }

    .hgl-legacy-summary {
        grid-template-columns: 1fr 1fr;
    }

    .hgl-migration-actions,
    .hgl-migration-controls {
        grid-template-columns: 1fr;
    }

    .hgl-control-grid,
    .hgl-control-grid-narrow,
    .hgl-control-links,
    .hgl-control-links-three,
    .hgl-control-actions {
        grid-template-columns: 1fr;
    }

    .hgl-control-tabs button {
        flex: 1 1 calc(50% - 8px);
    }

    .hgl-client-summary div:nth-child(2n) {
        border-right: 0;
    }

    .hgl-client-summary div:nth-child(n+3) {
        border-top: 1px solid var(--hg-border);
    }

    .hgl-editor-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .hgl-orders-page .hgl-order-status-summary,
    .hgl-orders-page .hgl-order-facts,
    .hgl-orders-page .hgl-order-editor {
        grid-template-columns: 1fr;
    }

    .hgl-orders-page .hgl-order-actions {
        display: grid;
        grid-template-columns: 1fr;
        padding: 0 14px 16px;
    }

    .hgl-orders-page .hgl-order-actions .hg-danger-action {
        margin-left: 0;
    }

    .hgl-orders-page .hgl-legacy-row {
        grid-template-columns: 1fr;
    }

    .hgl-orders-page .hgl-legacy-items-head,
    .hgl-orders-page .hgl-legacy-item {
        grid-template-columns: 48px minmax(190px, 1fr) 110px 96px;
        min-width: 520px;
    }
}

@media print {
    @page {
        size: A4;
        margin: 8mm;
    }

    html,
    body,
    .hg-app,
    .hg-main {
        background: #fff !important;
    }

    .hg-sidebar,
    .hg-shell-sidebar,
    .hg-bottom-nav,
    .hg-env-footer,
    .hg-theme-toggle,
    .print-hidden {
        display: none !important;
    }

    .hg-app {
        display: block !important;
        width: auto !important;
        max-width: none !important;
        min-height: 0 !important;
    }

    .hg-shell-content {
        display: block !important;
        width: auto !important;
        max-width: none !important;
    }

    .hg-main {
        padding: 0 !important;
        overflow: visible !important;
        width: auto !important;
    }

    .invoice-page {
        padding: 0;
    }

    .production-print-page {
        min-height: 0;
        background: #fff;
        padding: 0;
    }

    .production-sheet {
        width: auto;
        min-height: 0;
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    .invoice-sheet {
        width: auto;
        min-height: 252mm;
        padding: 0;
        border: 0;
        box-shadow: none;
        margin: 0;
        font-size: 10.5px;
        break-after: page;
        page-break-after: always;
    }

    .invoice-sheet:last-child {
        break-after: auto;
        page-break-after: auto;
    }

    .invoice-top,
    .invoice-registry,
    .invoice-client,
    .invoice-auth,
    .invoice-summary,
    .invoice-footer {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .invoice-items {
        page-break-inside: auto;
    }

    .invoice-items thead {
        display: table-header-group;
    }

    .invoice-items tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .invoice-items th,
    .invoice-items td {
        padding: 4px 5px;
    }

    .invoice-footer {
        font-size: 9.5px;
    }
}


/* ---- LISTADO DE PRECIOS ---- */
.hg-precios-page .hgl-admin-top {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    grid-template-columns: 1fr;
    gap: 18px;
}

.hg-precios-page .hgl-admin-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    min-height: 0;
}

.hg-precios-page .hgl-admin-title h1 {
    max-width: none;
}

.hg-precios-filters {
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 12px;
}

.hg-precios-filter-fields {
    display: grid;
    grid-template-columns: minmax(220px, .8fr) minmax(320px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.hg-precios-solo-activos {
    align-self: end;
    min-height: 42px;
    justify-content: flex-start;
}

.hg-precios-filter-actions {
    justify-content: flex-start;
    align-items: center;
}

.hg-precios-filter-actions button {
    min-width: 130px;
}

.hg-precios-workspace {
    grid-template-columns: minmax(720px, 1fr) minmax(360px, .42fr);
}

.hg-precios-table-wrap {
    max-height: calc(100vh - 221px);
}

.hg-precios-table,
.hg-precios-add-table {
    min-width: 920px;
}

.hg-precios-table .code,
.hg-precios-add-table .code {
    width: 110px;
}

.hg-precios-table .presentacion,
.hg-precios-add-table .presentacion {
    width: 150px;
}

.hg-precios-table tr.inactive,
.hg-precios-add-table tr.inactive {
    opacity: .68;
}

.hg-precios-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hg-precios-modal {
    width: min(1120px, calc(100vw - 28px));
    max-height: calc(100vh - 36px);
}

.hg-precios-add-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto auto auto;
    gap: 10px;
    align-items: end;
    padding: 14px 16px;
    border-bottom: 1px solid var(--hg-border);
}

.hg-precios-add-toolbar label:not(.hg-check-inline) {
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 700;
}

.hg-precios-add-wrap {
    max-height: min(56vh, 560px);
}

@media (max-width: 900px) {
    .hg-precios-page .hgl-admin-top,
    .hg-precios-workspace,
    .hg-precios-filters,
    .hg-precios-add-toolbar {
        grid-template-columns: 1fr;
    }

    .hg-precios-grid-panel,
    .hg-precios-table-wrap {
        max-height: none;
    }

    .hg-precios-modal {
        inset: 8px;
        width: auto;
    }
}


.hg-product-config-detail-page > .hg-product-config-top-actions,
.hg-product-config-top-actions {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    justify-content: flex-start !important;
    text-align: left;
}

.hg-product-config-top-actions .hg-danger-action {
    background: #FFF1F2;
    border-color: #FECDD3;
    color: var(--hg-danger);
}

.hg-product-config-top-actions .hg-danger-action:hover {
    background: #FFE4E6;
    color: #B91C1C;
}

.hg-reconnect-modal {
    display: none;
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(env(safe-area-inset-bottom) + 82px);
    z-index: 10000;
    pointer-events: none;
}

.hg-reconnect-modal.hg-reconnect-visible,
.hg-reconnect-modal.components-reconnect-show,
.hg-reconnect-modal.components-reconnect-failed,
.hg-reconnect-modal.components-reconnect-rejected {
    display: block;
}

.hg-reconnect-card {
    max-width: 420px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid rgba(46,125,50,.18);
    border-radius: 16px;
    background: color-mix(in srgb, var(--hg-surface) 94%, transparent);
    box-shadow: 0 18px 48px rgba(0,0,0,.18);
    color: var(--hg-text);
    pointer-events: auto;
    backdrop-filter: blur(10px);
}

.hg-reconnect-card strong {
    font-size: 13px;
    font-weight: 850;
    color: var(--hg-primary);
}

.hg-reconnect-card span {
    grid-column: 1;
    color: var(--hg-text-muted);
    font-size: 12px;
    font-weight: 650;
}

.hg-reconnect-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hg-reconnect-card button {
    border: 1px solid var(--hg-border);
    border-radius: 999px;
    background: var(--hg-surface);
    color: var(--hg-text);
    padding: 7px 10px;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
}

.hg-reconnect-card button:first-child:not([hidden]) {
    border-color: rgba(46,125,50,.28);
    background: var(--hg-primary);
    color: #fff;
}

.hg-reconnect-modal.hg-reconnect-failed .hg-reconnect-card strong,
.hg-reconnect-modal.components-reconnect-failed .hg-reconnect-card strong,
.hg-reconnect-modal.components-reconnect-rejected .hg-reconnect-card strong {
    color: #b3261e;
}

@media (max-width: 520px) {
    .hg-reconnect-card {
        grid-template-columns: 1fr;
    }

    .hg-reconnect-actions {
        grid-column: 1;
        grid-row: auto;
        justify-content: flex-start;
        margin-top: 8px;
    }
}

.hgl-pro-dashboard-page .hgl-admin-top {
    grid-template-columns: 1fr;
}

.hgl-wholesale-page {
    width: 100%;
    max-width: 1220px;
    margin: 18px auto 0;
    gap: 0;
    justify-items: stretch;
}

.hgl-wholesale-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.hgl-wholesale-search button {
    min-height: 44px;
    border: 1px solid rgba(46, 125, 50, .28);
    border-radius: 12px;
    background: var(--hg-surface);
    color: var(--hg-primary);
    padding: 9px 18px;
    font: inherit;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.hgl-wholesale-search button:hover {
    background: rgba(46, 125, 50, .08);
}

.hgl-wholesale-search button:disabled {
    cursor: default;
    opacity: .6;
}

.hgl-wholesale-row {
    border-left: 4px solid transparent;
    min-height: 84px;
    padding: 14px 16px;
}

.hgl-wholesale-row.selected {
    border-left-color: var(--hg-primary);
    background: rgba(46, 125, 50, .08);
}

.hgl-wholesale-list {
    width: 100%;
    max-width: none;
    margin: 0;
}

.hgl-wholesale-row .hg-list-main-link {
    width: 100%;
}

.hgl-wholesale-row .hg-badge-row {
    margin-top: 7px;
}

.hgl-pro-dashboard-filters {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(170px, .45fr) auto;
    align-items: end;
    gap: 14px;
}

.hgl-pro-kpis {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.hgl-pro-kpis > div {
    border: 1px solid var(--hg-border);
    border-radius: 18px;
    background: var(--hg-surface);
    box-shadow: var(--hg-shadow);
    padding: 16px;
}

.hgl-pro-kpis span {
    display: block;
    color: var(--hg-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.hgl-pro-kpis strong {
    display: block;
    margin-top: 7px;
    color: var(--hg-text);
    font-size: 24px;
    line-height: 1.05;
}

.hgl-pro-list {
    overflow: hidden;
}

.hgl-pro-row {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(280px, .9fr) minmax(220px, .7fr);
    gap: 14px;
    align-items: center;
    border: 0;
    border-top: 1px solid var(--hg-border);
    background: transparent;
    padding: 16px 18px;
    text-align: left;
    color: var(--hg-text);
    cursor: pointer;
}

.hgl-pro-row:hover,
.hgl-pro-row.selected {
    background: rgba(46, 125, 50, .08);
}

.hgl-pro-row.selected {
    box-shadow: inset 4px 0 0 var(--hg-primary);
}

.hgl-pro-main strong {
    display: block;
    font-size: 17px;
    line-height: 1.2;
}

.hgl-pro-main small,
.hgl-pro-metrics span {
    display: block;
    color: var(--hg-muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.hgl-pro-metrics {
    display: grid;
    gap: 3px;
}

.hgl-pro-badges {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.hgl-pro-detail {
    max-height: calc(100vh - 88px);
    overflow-y: auto;
}

.hgl-pro-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--hg-border);
}

.hgl-pro-detail-actions button {
    border: 1px solid rgba(46, 125, 50, .24);
    border-radius: 999px;
    background: var(--hg-primary);
    color: #fff;
    padding: 10px 14px;
    font-weight: 900;
}

.hgl-pro-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-bottom: 1px solid var(--hg-border);
}

.hgl-pro-detail-grid > div {
    border-right: 1px solid var(--hg-border);
    border-bottom: 1px solid var(--hg-border);
    padding: 14px 16px;
}

.hgl-pro-detail-grid span {
    display: block;
    color: var(--hg-muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.hgl-pro-detail-grid strong {
    display: block;
    margin-top: 6px;
}

.hgl-pro-detail-section {
    padding: 16px;
    border-bottom: 1px solid var(--hg-border);
}

.hgl-pro-mini-row {
    display: grid;
    gap: 3px;
    padding: 12px 0;
    border-top: 1px solid var(--hg-border);
}

.hgl-pro-mini-row:first-of-type {
    border-top: 0;
}

.hgl-pro-mini-row span,
.hgl-pro-mini-row small,
.hgl-muted {
    color: var(--hg-muted);
    font-weight: 700;
}

.hgl-pro-order-card {
    border-top: 1px solid var(--hg-border);
    padding: 0;
}

.hgl-pro-order-card:first-of-type {
    border-top: 0;
}

.hgl-pro-order-card summary {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 13px 0;
    cursor: pointer;
    list-style: none;
}

.hgl-pro-order-card summary::-webkit-details-marker {
    display: none;
}

.hgl-pro-order-card summary::before {
    content: "+";
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(46, 125, 50, .22);
    border-radius: 999px;
    color: var(--hg-primary);
    font-weight: 900;
    grid-column: 1;
    grid-row: 1;
}

.hgl-pro-order-card[open] summary::before {
    content: "-";
}

.hgl-pro-order-card summary > span:first-child {
    display: grid;
    gap: 2px;
    grid-column: 2;
}

.hgl-pro-order-card summary small,
.hgl-pro-order-note,
.hgl-pro-order-line small {
    color: var(--hg-muted);
    font-weight: 700;
}

.hgl-pro-order-total {
    display: grid;
    gap: 2px;
    justify-items: end;
    grid-column: 3;
}

.hgl-pro-order-note {
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid rgba(46, 125, 50, .14);
    border-radius: 12px;
    background: rgba(46, 125, 50, .06);
}

.hgl-pro-order-lines {
    display: grid;
    border: 1px solid var(--hg-border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 12px;
}

.hgl-pro-order-line {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) minmax(110px, auto);
    gap: 12px;
    align-items: start;
    padding: 11px 12px;
    border-top: 1px solid var(--hg-border);
    background: var(--hg-surface);
}

.hgl-pro-order-line:first-child {
    border-top: 0;
}

.hgl-pro-order-qty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    border-radius: 999px;
    background: rgba(46, 125, 50, .12);
    color: var(--hg-primary);
    font-weight: 900;
}

.hgl-pro-order-line > span:nth-child(2) {
    display: grid;
    gap: 2px;
}

.hgl-pro-order-money {
    display: grid;
    gap: 2px;
    justify-items: end;
    text-align: right;
}

.hgl-pro-web-account {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--hg-border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 10px;
}

.hgl-pro-web-account > div {
    display: grid;
    gap: 4px;
    padding: 12px;
    border-right: 1px solid var(--hg-border);
    background: color-mix(in srgb, var(--hg-bg) 56%, var(--hg-surface));
}

.hgl-pro-web-account > div:last-child {
    border-right: 0;
}

.hgl-pro-web-account span {
    color: var(--hg-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.hgl-pro-web-account strong {
    color: var(--hg-text);
    font-weight: 850;
}

@media (max-width: 1180px) {
    .hgl-pro-dashboard-page .hgl-admin-top,
    .hgl-pro-dashboard-filters {
        grid-template-columns: 1fr;
    }

    .hgl-pro-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hgl-pro-row {
        grid-template-columns: minmax(220px, 1fr) minmax(180px, .8fr);
    }

    .hgl-pro-badges {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}

@media (max-width: 720px) {
    .hgl-wholesale-search {
        grid-template-columns: 1fr;
    }

    .hgl-wholesale-search button {
        width: 100%;
    }

    .hgl-wholesale-page {
        margin-top: 12px;
        padding: 0 12px;
    }

    .hgl-wholesale-list {
        margin: 0;
    }

    .hgl-wholesale-row {
        padding: 12px;
        min-height: 0;
    }

    .hgl-wholesale-row .hg-list-main-link {
        align-items: flex-start;
    }

    .hgl-wholesale-row .hg-list-right {
        min-width: 88px;
    }

    .hgl-pro-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hgl-pro-kpis > div {
        padding: 12px;
    }

    .hgl-pro-kpis strong {
        font-size: 18px;
    }

    .hgl-pro-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 14px;
    }

    .hgl-pro-metrics {
        grid-template-columns: 1fr 1fr;
    }

    .hgl-pro-metrics span:last-child {
        grid-column: 1 / -1;
    }

    .hgl-pro-detail {
        inset: 10px;
        width: auto;
        max-height: calc(100vh - 20px);
        border-radius: 18px;
    }

    .hgl-pro-detail-grid {
        grid-template-columns: 1fr 1fr;
    }

    .hgl-pro-detail-actions button {
        flex: 1 1 100%;
    }

    .hgl-pro-order-card summary {
        grid-template-columns: 28px minmax(0, 1fr);
        gap: 4px;
    }

    .hgl-pro-order-total {
        grid-column: 2;
        justify-items: start;
    }

    .hgl-pro-order-line {
        grid-template-columns: 36px minmax(0, 1fr);
    }

    .hgl-pro-order-money {
        grid-column: 2;
        justify-items: start;
        text-align: left;
    }

    .hgl-pro-web-account {
        grid-template-columns: 1fr 1fr;
    }

    .hgl-pro-web-account > div {
        border-right: 0;
        border-bottom: 1px solid var(--hg-border);
    }
}
