/* ============================================================
   SISTEMA DE INVENTARIOS — Design System
   ============================================================ */

:root {
    --color-black: #1a1f24;
    --color-white: #ffffff;
    --color-aqua: #e8f7f5;
    --color-teal: #2f8f83;
    --color-teal-dark: #256e65;
    --color-teal-light: #dff7f5;
    --color-grey-light: #f4f7fa;
    --color-grey: #d9dee3;
    --color-grey-border: #e6ebef;
    --color-grey-dark: #6b7280;
    --color-text: #2b2b2b;
    --color-danger: #d96b6b;
    --color-danger-dark: #c45656;
    --color-info: #5b8def;
    --color-muted-bg: #fbfcfd;

    --sidebar-width: 270px;
    --sidebar-width-collapsed: 76px;
    --sidebar-current-width: var(--sidebar-width);
    --topbar-height: 70px;
    --page-max-width: 1180px;
    --page-max-width-wide: 1500px;
    --border-radius: 14px;
    --border-radius-sm: 10px;
    --shadow-soft: 0 4px 14px rgba(15, 23, 42, 0.08);
    --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.06);

    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
}

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

body {
    font-family: 'Poppins', 'Roboto', 'Montserrat', sans-serif;
    background-color: var(--color-grey-light);
    color: var(--color-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style-position: inside;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.layout {
    min-height: 100vh;
}

.layout.sidebar-collapsed {
    --sidebar-current-width: var(--sidebar-width-collapsed);
}

.main-area {
    margin-left: var(--sidebar-current-width);
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}

.content {
    padding: calc(var(--topbar-height) + var(--space-lg)) var(--space-lg) var(--space-lg);
    width: 100%;
}

.page-container {
    width: 100%;
    max-width: var(--page-max-width);
    margin: 0 auto;
}

.page-container-wide {
    width: 100%;
    max-width: var(--page-max-width-wide);
    margin: 0 auto;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1040;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.layout.sidebar-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-current-width);
    height: 100vh;
    background: linear-gradient(180deg, #1a1f24 0%, #232a31 100%);
    color: var(--color-white);
    padding: var(--space-lg) 14px;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 1050;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease, transform 0.25s ease;
}

.sidebar-header {
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.sidebar-brand-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    color: inherit;
    text-decoration: none;
    padding: 8px 6px 4px;
    border-radius: var(--border-radius);
    transition: background-color 0.2s ease;
}

.sidebar-brand-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--color-white);
}

.sidebar-logo {
    width: 88px;
    height: 88px;
    min-width: 88px;
    object-fit: contain;
    border-radius: 16px;
    background-color: var(--color-white);
    padding: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.sidebar-brand-text {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s ease, max-width 0.25s ease;
}

.sidebar-brand-subtitle {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.52);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s ease, max-width 0.25s ease;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-height: 0;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.nav-group-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    padding: 8px 14px 4px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s ease, max-height 0.25s ease, padding 0.25s ease;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--border-radius-sm);
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.94rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, padding 0.25s ease;
}

.nav-link:hover {
    background-color: rgba(47, 143, 131, 0.85);
    color: var(--color-white);
    transform: translateX(2px);
}

.nav-link i {
    width: 20px;
    min-width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-nav-spacer {
    display: none;
    flex-shrink: 0;
}

.nav-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s ease, max-width 0.25s ease;
}

.layout.sidebar-collapsed .sidebar-header {
    padding-left: 0;
    padding-right: 0;
}

.layout.sidebar-collapsed .sidebar-brand-link {
    gap: 0;
    padding: 6px 0;
}

.layout.sidebar-collapsed .sidebar-logo {
    width: 52px;
    height: 52px;
    min-width: 52px;
    padding: 6px;
    border-radius: 12px;
}

.layout.sidebar-collapsed .sidebar-brand-text,
.layout.sidebar-collapsed .sidebar-brand-subtitle,
.layout.sidebar-collapsed .nav-link span,
.layout.sidebar-collapsed .nav-group-label {
    opacity: 0;
    max-width: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    pointer-events: none;
}

.layout.sidebar-collapsed .nav-group {
    margin-bottom: 4px;
}

.layout.sidebar-collapsed .nav-link {
    justify-content: center;
    padding-left: 12px;
    padding-right: 12px;
    gap: 0;
}

.layout.sidebar-collapsed .nav-link:hover {
    transform: none;
}

body.sidebar-menu-open {
    overflow: hidden;
}

/* ============================================================
   TOPBAR
   ============================================================ */

.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-current-width);
    right: 0;
    height: var(--topbar-height);
    background-color: var(--color-white);
    border-bottom: 1px solid var(--color-grey-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 900;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
    transition: left 0.25s ease;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.topbar-brand-link {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 4px 6px;
    border-radius: var(--border-radius-sm);
    transition: background-color 0.2s ease;
}

.topbar-brand-link:hover {
    background-color: #f3f4f6;
}

.topbar-logo {
    display: block;
    height: 38px;
    width: auto;
    max-width: 132px;
    object-fit: contain;
}

.topbar-left h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-black);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--color-grey-border);
    border-radius: var(--border-radius-sm);
    background: var(--color-white);
    color: var(--color-black);
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.sidebar-toggle:hover {
    background: var(--color-teal-light);
    border-color: var(--color-teal);
    color: var(--color-teal-dark);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.top-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    color: var(--color-black);
    background-color: var(--color-aqua);
    transition: background-color 0.2s ease;
    font-size: 0.92rem;
    font-weight: 500;
}

.top-link:hover {
    background-color: #cbeeed;
}

.top-user-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--color-grey-dark);
    font-size: 0.92rem;
    font-weight: 500;
}

.top-link-button {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
}

.audit-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 18px 20px;
    align-items: end;
}

.audit-meta-grid--bordered {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--color-grey-border);
}

@media (max-width: 900px) {
    .audit-meta-grid {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }
}

@media (max-width: 560px) {
    .audit-meta-grid {
        grid-template-columns: 1fr;
    }
}

.col-audit {
    white-space: nowrap;
    min-width: 130px;
    font-size: 0.88rem;
}

thead .col-audit {
    font-size: 0.82rem;
}

/* ============================================================
   PAGE HEADINGS
   ============================================================ */

.page-header,
.supplier-heading-card {
    margin-bottom: var(--space-lg);
}

.page-header h1,
.supplier-heading-card h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-black);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.page-header p,
.supplier-heading-card p {
    color: var(--color-grey-dark);
    font-size: 0.98rem;
}

/* ============================================================
   CARDS
   ============================================================ */

.card,
.supplier-toolbar-card,
.table-card-clean,
.form-card-centered {
    background-color: var(--color-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--color-grey-border);
}

.card {
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: var(--space-md);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-black);
}

.card-stack {
    margin-bottom: var(--space-lg);
}

.card-body {
    padding: var(--space-lg);
}

.table-card-clean {
    overflow: visible;
}

.table-card-clean .table-responsive-clean {
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.table-card-clean-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px var(--space-lg);
    border-bottom: 1px solid var(--color-grey-border);
    background-color: var(--color-muted-bg);
}

.page-size-form {
    display: flex;
    align-items: flex-end;
    flex-shrink: 0;
}

.page-size-form .form-group-inline {
    margin-bottom: 0;
}

.table-card-clean-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-black);
}

.table-card-clean-header p {
    color: var(--color-grey-dark);
    font-size: 0.92rem;
}

/* ============================================================
   TOOLBAR / SEARCH
   ============================================================ */

.supplier-toolbar-card {
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.supplier-toolbar-top {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-md);
}

.supplier-toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.supplier-toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.toolbar-btn-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-btn-group + .toolbar-btn-group {
    padding-left: var(--space-md);
    border-left: 1px solid var(--color-grey-border);
}

.bulk-import-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-radius: var(--border-radius-sm);
    background: linear-gradient(135deg, #f8fbfc 0%, #f2f8f6 100%);
    border: 1px solid #d5e6e2;
}

.bulk-import-panel__intro {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 240px;
    flex: 1 1 240px;
}

.bulk-import-panel__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: var(--color-white);
    border: 1px solid #c7dbe8;
    color: var(--color-teal-dark);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.bulk-import-panel__title {
    margin: 0;
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--color-black);
}

.bulk-import-panel__hint {
    margin: 2px 0 0;
    font-size: 0.82rem;
    color: var(--color-grey-dark);
    line-height: 1.35;
}

.bulk-import-panel__controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1 1 320px;
    justify-content: flex-end;
}

.bulk-import-panel__divider {
    width: 1px;
    height: 34px;
    background: #cfd9df;
    flex-shrink: 0;
}

.bulk-upload-form {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 6px 8px 6px 10px;
    background: var(--color-white);
    border: 1px solid var(--color-grey-border);
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.bulk-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.bulk-upload-filename {
    font-size: 0.82rem;
    color: var(--color-grey-dark);
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

.bulk-upload-label {
    margin: 0;
    cursor: pointer;
    white-space: nowrap;
}

.supplier-toolbar-right {
    width: 100%;
    display: flex;
    justify-content: flex-start;
}

.supplier-search-form {
    display: grid;
    grid-template-columns: minmax(150px, 190px) minmax(200px, 1fr) auto;
    align-items: end;
    gap: 12px 14px;
    width: 100%;
    max-width: 100%;
}

.list-filter-date-row {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    width: fit-content;
    max-width: 100%;
}

.list-filter-date-row .form-group-inline {
    flex: 0 0 auto;
    width: 152px;
}

.list-filter-date-row input[type="date"].form-control {
    width: 152px;
    min-width: 152px;
}

.supplier-search-form--report-rm {
    grid-template-columns: minmax(130px, 160px) minmax(110px, 140px) minmax(120px, 150px) minmax(160px, 1fr) auto;
}

.supplier-search-form--report-fg {
    grid-template-columns: minmax(130px, 160px) minmax(110px, 140px) minmax(120px, 150px) minmax(160px, 1fr) auto;
}

.supplier-search-form--ventas {
    grid-template-columns: 1fr;
}

.list-filter-search-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(130px, 160px) minmax(120px, 150px) minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px 14px;
    width: 100%;
}

.list-filter-search-row .form-group-inline {
    min-width: 0;
}

.list-filter-search-row .form-control {
    width: 100%;
}

.form-group-inline {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.form-group-inline label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-grey-dark);
}

.form-group-inline .form-control {
    width: 100%;
}

.supplier-search-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: nowrap;
    align-self: end;
}

.supplier-toolbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-left: auto;
    flex-shrink: 0;
}

.collapsible-filters-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 0;
}

.collapsible-filters-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    border-radius: var(--border-radius-sm);
}

.collapsible-filters-toggle i {
    font-size: 1rem;
}

.collapsible-filters-toggle.is-open {
    background: var(--color-teal-dark);
    border-color: var(--color-teal-dark);
    color: var(--color-white);
}

.collapsible-filters-toggle.has-active-filters:not(.is-open)::after {
    content: "";
    position: absolute;
    top: 7px;
    right: 7px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-teal);
    border: 2px solid var(--color-white);
    box-sizing: content-box;
}

.collapsible-filters-panel {
    width: 100%;
    padding-top: var(--space-md);
    margin-top: var(--space-md);
    border-top: 1px solid var(--color-grey-border);
}

.collapsible-filters-panel .bulk-import-panel {
    width: 100%;
    margin-bottom: var(--space-md);
}

.collapsible-filters-panel .bulk-import-panel + .supplier-search-form,
.collapsible-filters-panel .bulk-import-panel + form.supplier-search-form {
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-grey-border);
}

.collapsible-filters-panel[hidden] {
    display: none !important;
}

.supplier-toolbar-card.is-filters-collapsed .collapsible-filters-panel {
    padding-top: 0;
    margin-top: 0;
    border-top: 0;
}

.dashboard-filter-card.is-filters-collapsed {
    padding-top: var(--space-sm);
    padding-bottom: var(--space-sm);
}

.dashboard-filter-card.is-filters-expanded .collapsible-filters-panel {
    margin-top: var(--space-sm);
}

.inventory-total-summary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 10px;
    background: linear-gradient(135deg, #eef6ff 0%, #e8f4f2 100%);
    border: 1px solid #c7dbe8;
    margin-left: 4px;
}

.inventory-total-label {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #4b5563;
}

.inventory-total-value {
    font-size: 1rem;
    color: #1f6f66;
    white-space: nowrap;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border: none;
    border-radius: var(--border-radius-sm);
    background-color: var(--color-teal);
    color: var(--color-white);
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.btn:hover {
    background-color: var(--color-teal-dark);
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #8a949e;
    color: var(--color-white);
}

.btn-secondary:hover {
    background-color: #737d86;
}

.btn-danger {
    background-color: var(--color-danger);
    color: var(--color-white);
}

.btn-danger:hover {
    background-color: var(--color-danger-dark);
}

.form-actions-row,
.form-actions-centered,
.form-actions-right,
.po-bottom-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.form-actions-row {
    margin-top: 20px;
}

.form-actions-centered,
.form-actions-right,
.po-bottom-actions {
    justify-content: flex-end;
    margin-top: 28px;
}

.inline-form {
    display: inline;
}

/* ============================================================
   FORMS
   ============================================================ */

label {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--color-grey-dark);
    margin-bottom: 6px;
    display: inline-block;
}

.form-control {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--color-grey);
    border-radius: var(--border-radius-sm);
    background-color: var(--color-white);
    color: var(--color-text);
    font-size: 0.94rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea.form-control {
    min-height: 90px;
    resize: vertical;
    line-height: 1.45;
}

.form-control:focus {
    border-color: var(--color-teal);
    box-shadow: 0 0 0 3px rgba(47, 143, 131, 0.12);
}

.form-control:disabled,
.form-control[readonly] {
    background-color: #f8fafc;
    color: #475569;
}

.form-group,
.form-field {
    display: flex;
    flex-direction: column;
}

.form-help-text {
    margin-top: 6px;
    font-size: 0.86rem;
    color: var(--color-grey-dark);
}

.attachment-field {
    gap: 12px;
}

.attachment-current-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: linear-gradient(180deg, #f8fbfc 0%, #eef6f4 100%);
    border: 1px solid #cfe8e2;
    border-radius: var(--border-radius);
}

.attachment-current-card.is-marked-for-removal {
    opacity: 0.55;
    border-color: #e8b4b4;
    background: linear-gradient(180deg, #fff8f8 0%, #fdeeee 100%);
}

.attachment-current-preview {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--color-grey-border);
    background: var(--color-white);
}

.attachment-current-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-current-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    background: var(--color-white);
    border: 1px solid var(--color-grey-border);
    color: var(--color-teal-dark);
    font-size: 1.8rem;
}

.attachment-current-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.attachment-current-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-grey-dark);
}

.attachment-current-link {
    color: var(--color-teal-dark);
    font-weight: 600;
    text-decoration: none;
    word-break: break-all;
}

.attachment-current-link:hover {
    text-decoration: underline;
}

.attachment-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--border-radius);
    border: 1px solid #e8b4b4;
    background: #fff5f5;
    color: #b42318;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    font-family: inherit;
    line-height: 1;
}

.attachment-remove-btn:hover {
    background: #fee2e2;
    border-color: #d96b6b;
}

.attachment-remove-btn.is-active {
    background: #b42318;
    border-color: #b42318;
    color: var(--color-white);
}

.attachment-clear-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.attachment-dropzone {
    position: relative;
    padding: 28px 20px;
    border: 2px dashed #b8d4cf;
    border-radius: var(--border-radius);
    background: linear-gradient(180deg, #fafdfd 0%, #f0f8f6 100%);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.attachment-dropzone:hover,
.attachment-dropzone.is-dragover {
    border-color: var(--color-teal);
    background: #e8f7f5;
    box-shadow: 0 0 0 4px rgba(47, 143, 131, 0.08);
}

.attachment-dropzone.has-file {
    border-color: var(--color-teal-dark);
    background: #eef8f6;
}

.attachment-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.attachment-dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    pointer-events: none;
}

.attachment-dropzone-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin-bottom: 4px;
    border-radius: 50%;
    background: var(--color-white);
    color: var(--color-teal-dark);
    font-size: 1.35rem;
    box-shadow: 0 2px 8px rgba(47, 143, 131, 0.12);
}

.attachment-dropzone-title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--color-black);
}

.attachment-dropzone-hint {
    margin: 0;
    font-size: 0.84rem;
    color: var(--color-grey-dark);
}

.attachment-selected-name {
    margin: 8px 0 0;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--color-white);
    border: 1px solid #bfe8e2;
    color: var(--color-teal-dark);
    font-size: 0.84rem;
    font-weight: 600;
}

.attachment-detail-card {
    padding: 16px;
    background: linear-gradient(180deg, #f8fbfc 0%, #eef6f4 100%);
    border: 1px solid #cfe8e2;
    border-radius: var(--border-radius);
}

.supplier-attachment-preview,
.attachment-detail-preview {
    margin: 0 0 12px;
}

.supplier-attachment-preview img,
.attachment-detail-preview img {
    display: block;
    max-width: 100%;
    max-height: 360px;
    border-radius: var(--border-radius);
    border: 1px solid var(--color-grey-border);
    object-fit: contain;
    background-color: var(--color-white);
}

.supplier-attachment-link,
.attachment-detail-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--color-teal-dark);
    font-weight: 600;
    text-decoration: none;
}

.supplier-attachment-link:hover,
.attachment-detail-link:hover {
    text-decoration: underline;
}

.attachment-detail-link--icon {
    justify-content: center;
    min-width: 34px;
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 8px;
    background: #eef8f6;
    border: 1px solid #cfe8e2;
    font-size: 1rem;
}

.attachment-detail-link--icon:hover {
    text-decoration: none;
    background: #dff3ef;
}

.attachment-pending-removal {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 0;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: #9a6b00;
    background: #fff8e6;
    border: 1px solid #f0df9a;
    border-radius: 8px;
}

.attachment-pending-removal i {
    flex-shrink: 0;
}

.supplier-attachments-existing,
.supplier-attachments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.supplier-detail-attachments {
    margin-top: 8px;
}

.detail-value-multiline {
    white-space: pre-wrap;
    line-height: 1.5;
}

.attachment-selected-list {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.form-field-full,
.form-group.form-field-full {
    grid-column: 1 / -1;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 24px;
}

.form-grid-header {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 18px 20px;
    align-items: end;
    max-width: 900px;
}

.form-grid-items {
    display: grid;
    grid-template-columns: 1.35fr 1fr 1.35fr 0.8fr;
    gap: 18px 20px;
    align-items: end;
}

.form-grid-items-5 {
    grid-template-columns: 1.2fr 0.9fr 1.1fr 0.7fr 0.7fr;
}

.po-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.po-page-container {
    width: 98%;
    max-width: 1500px;
    margin: 0 auto;
}

.po-grid-4-compact {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 18px 20px;
    align-items: end;
}

.po-grid-3-compact {
    display: grid;
    grid-template-columns: repeat(3, minmax(200px, 1fr));
    gap: 18px 20px;
    align-items: end;
}

.detail-value {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--color-grey);
    border-radius: var(--border-radius-sm);
    background-color: #f9fbfc;
    color: var(--color-text);
    font-size: 0.94rem;
    display: flex;
    align-items: center;
}

.coverage-matrix-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 110px;
}

.form-control-compact {
    padding: 6px 8px;
    font-size: 0.86rem;
    min-height: 34px;
}

.coverage-matrix-table td {
    vertical-align: top;
}

.detail-page {
    max-width: 1500px;
    width: 98%;
    margin: 0 auto;
}

.detail-page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.detail-card {
    margin-bottom: 24px;
}

.detail-view {
    padding: 24px;
}

/* Resumen: fila de datos clave con separadores */
.detail-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 0;
    padding-bottom: 22px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--color-grey-border);
}

.detail-summary-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding-right: 22px;
    margin-right: 22px;
    margin-bottom: 8px;
    border-right: 1px solid #e3e8ee;
}

.detail-summary-item:last-child {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
}

.detail-label {
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #6b7c8a;
    line-height: 1.3;
}

.detail-value-plain {
    font-size: 1.02rem;
    font-weight: 500;
    color: #2c3640;
    line-height: 1.45;
    word-break: break-word;
}

.detail-value-primary {
    font-size: 1.36rem;
    font-weight: 700;
    color: var(--color-teal-dark);
    letter-spacing: -0.015em;
    line-height: 1.25;
    word-break: break-word;
}

.detail-value-numeric {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.detail-value-slot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 1.45em;
}

.detail-empty {
    color: #9aa8b5;
    font-weight: 400;
}

/* Grid: label arriba, valor abajo, sin cajas */
.detail-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    padding-bottom: 2px;
}

.detail-field-primary .detail-value-primary,
.detail-field-primary .detail-value-plain {
    color: var(--color-teal-dark);
    font-weight: 600;
}

.detail-field-numeric .detail-value-plain,
.detail-field-numeric .detail-value-numeric {
    font-weight: 600;
    color: #1f3d38;
}

.detail-field-full {
    grid-column: 1 / -1;
}

.detail-field .detail-value {
    width: 100%;
    min-height: auto;
    padding: 10px 0 0;
    margin-top: 4px;
    border: none;
    border-top: 1px solid #edf1f4;
    border-radius: 0;
    background: transparent;
    font-size: 0.98rem;
    line-height: 1.6;
    color: #3d4a56;
    align-items: flex-start;
}

.detail-value-plain a,
.detail-field .detail-value a {
    color: var(--color-teal-dark);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(47, 143, 131, 0.35);
    text-underline-offset: 2px;
}

.detail-value-plain a:hover,
.detail-field .detail-value a:hover {
    color: var(--color-teal);
}

.detail-grid {
    display: grid;
    gap: 20px 28px;
    align-items: end;
}

.detail-grid-4 {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.detail-grid-3 {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.detail-grid-2 {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    max-width: none;
}

.detail-page--narrow {
    max-width: 1180px;
}

.detail-totals-view {
    border-top: 1px solid var(--color-grey-border);
    padding-top: 4px;
}

.detail-totals-view .detail-label {
    color: #5a6a78;
}

.detail-totals-view .detail-value-plain,
.detail-totals-view .detail-value-numeric {
    font-size: 1.06rem;
    font-weight: 700;
    color: var(--color-teal-dark);
}

.detail-value-prefix {
    color: #6b7c8a;
    font-weight: 600;
    margin-right: 2px;
}

@media (max-width: 1100px) {
    .detail-grid-4 {
        grid-template-columns: repeat(3, minmax(150px, 1fr));
    }
}

@media (max-width: 820px) {
    .detail-grid-4,
    .detail-grid-3 {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }

    .detail-summary-item {
        flex: 1 1 100%;
        border-right: none;
        margin-right: 0;
        padding-right: 0;
        padding-bottom: 14px;
        border-bottom: 1px solid #eef2f5;
    }

    .detail-summary-item:last-child {
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 0;
    }
}

@media (max-width: 520px) {
    .detail-grid-4,
    .detail-grid-3,
    .detail-grid-2 {
        grid-template-columns: 1fr;
    }

    .detail-view {
        padding: 18px 16px;
    }

    .detail-value-primary {
        font-size: 1.24rem;
    }
}

/* ============================================================
   FORM PAGE LAYOUTS
   ============================================================ */

.form-page-wrapper,
.po-form-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
}

.form-card-centered,
.po-form-container {
    width: 100%;
    max-width: var(--page-max-width);
    padding: var(--space-xl);
}

.form-card-wide,
.po-form-container.form-card-wide {
    max-width: var(--page-max-width-wide);
    width: 98%;
}

.form-card-header {
    margin-bottom: 26px;
}

.form-card-header h1 {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    color: var(--color-black);
}

.form-card-header p {
    color: var(--color-grey-dark);
    font-size: 0.95rem;
}

.po-card,
.po-totals-card {
    margin-bottom: var(--space-lg);
}

.po-order-totals {
    padding: 24px;
}

.po-order-totals-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 16px;
}

.po-order-totals-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #e8eef2;
}

.po-total-stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 16px 18px;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fbfc 0%, #f3f7f9 100%);
    border: 1px solid #e3eaef;
}

.po-total-stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #6b7c88;
    line-height: 1.3;
}

.po-total-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    color: #1f3d38;
    font-variant-numeric: tabular-nums;
}

.po-total-stat--primary {
    background: linear-gradient(135deg, #e8f5f3 0%, #dff0ed 100%);
    border-color: rgba(47, 143, 131, 0.28);
    box-shadow: 0 8px 20px rgba(47, 143, 131, 0.08);
}

.po-total-stat--primary .po-total-stat-label {
    color: #2f8f83;
}

.po-total-stat--primary .po-total-stat-value {
    color: #1a5c54;
    font-size: 1.5rem;
}

.po-total-breakdown-item {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    font-size: 0.92rem;
    color: #5f6f7a;
}

.po-total-breakdown-item strong {
    font-size: 1rem;
    font-weight: 700;
    color: #24343f;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
    .po-order-totals-grid {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }
}

@media (max-width: 640px) {
    .po-order-totals-grid {
        grid-template-columns: 1fr;
    }
}

.po-form-section,
.fg-bom-lines-section {
    scroll-margin-top: 88px;
}

.po-card-compact {
    margin-bottom: 12px !important;
}

.po-card-compact .table-card-clean-header {
    padding: 12px 16px;
}

.po-card-body--panel {
    padding: 24px;
}

.po-card-compact .po-card-body {
    padding: 12px 16px;
}

.po-card-compact .form-actions-row {
    margin-top: 12px !important;
}

.po-grid-compact {
    gap: 8px 20px;
}

.po-grid-compact .form-group label {
    margin-bottom: 2px;
    font-size: 0.88rem;
}

.po-grid-compact .po-header-hint {
    min-height: 0;
    margin-top: 2px;
    line-height: 1.2;
}

.po-grid-compact .po-header-hint--spacer {
    visibility: hidden;
    min-height: 0;
    margin: 0;
    padding: 0;
    font-size: 0;
    line-height: 0;
}

.po-collapsible .table-card-clean-header {
    padding-top: 14px;
    padding-bottom: 14px;
}

.po-collapsible-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    cursor: pointer;
}

.po-collapsible-header-text {
    flex: 1;
    min-width: 0;
}

.po-collapse-toggle {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--color-grey-border);
    border-radius: 8px;
    background: var(--color-white);
    color: var(--color-grey-dark);
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.po-collapse-toggle:hover {
    background: #f8fafc;
}

.po-collapsible.is-expanded .po-collapse-toggle i {
    transform: rotate(180deg);
}

.po-collapsible-panel[hidden] {
    display: none !important;
}

.po-collapsible-summary {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--color-grey-dark);
}

.po-collapsible:not(.is-expanded) .po-collapsible-header-text > p:not(.po-collapsible-summary) {
    display: none;
}

.po-collapsible.is-expanded .po-collapsible-summary {
    display: none;
}

.po-header-status-panel {
    grid-column: 1 / -1;
    margin: 4px 0 8px;
    padding: 20px 24px 18px;
    text-align: center;
    background: linear-gradient(135deg, #f0faf8 0%, #f8fbfc 48%, #eef6ff 100%);
    border: 1px solid #cfe8e2;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(47, 143, 131, 0.06);
}

.po-header-status-panel-head {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 18px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(47, 143, 131, 0.14);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-teal-dark);
}

.po-header-status-panel-head i {
    font-size: 0.9rem;
    color: var(--color-teal);
}

.po-header-status-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    max-width: 920px;
    margin: 0 auto;
}

.po-header-status-card {
    flex: 1 1 200px;
    max-width: 260px;
    min-width: 180px;
    padding: 18px 16px 16px;
    background: var(--color-white);
    border: 1px solid var(--color-grey-border);
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.po-header-status-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
}

.po-header-status-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin-bottom: 12px;
    border-radius: 12px;
    font-size: 1rem;
}

.po-header-status-card-icon--payment {
    background: linear-gradient(135deg, #e8f4fd 0%, #dbeafe 100%);
    color: #2563eb;
}

.po-header-status-card-icon--import {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    color: #6d28d9;
}

.po-header-status-card-icon--shipment {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #b45309;
}

.po-header-status-card-icon--date {
    background: linear-gradient(135deg, var(--color-teal-light) 0%, #c7ebe6 100%);
    color: var(--color-teal-dark);
}

.po-header-status-card-label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-grey-dark);
}

.po-header-status-card-value {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
}

.po-header-status-card-value--stacked {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    min-height: 32px;
    width: 100%;
}

.po-header-status-card-value .status-pill {
    min-width: 0;
    max-width: 100%;
    padding: 6px 12px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.po-header-status-cards .po-quick-pill-link {
    display: inline-flex;
    max-width: 100%;
}

.po-header-status-cards .po-quick-pill-link .status-pill {
    min-width: 0;
}

.po-header-status-date {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 130px;
    padding: 8px 14px;
    border-radius: 10px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #dbe3ea;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--color-black);
    letter-spacing: 0.02em;
}

.po-header-status-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    padding: 8px 14px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    font-size: 0.82rem;
    font-weight: 600;
    color: #94a3b8;
}

.po-header-status-select {
    width: 100%;
    max-width: 220px;
    font-size: 0.85rem;
    text-align: center;
}

.po-header-status-footnote {
    display: block;
    margin: 14px auto 0;
    padding: 0;
    max-width: 640px;
    font-size: 0.78rem;
    line-height: 1.45;
    text-align: center;
    color: var(--color-grey-dark);
}

.po-header-status-footnote i {
    color: var(--color-teal);
    flex-shrink: 0;
}

.po-history-hint {
    margin: 0 0 12px;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--color-grey-dark);
}

.action-icon-group--history-v2 {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.po-history-action-form {
    display: block;
    margin: 0;
}

.po-history-edit-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: none;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-teal-dark);
    cursor: pointer;
    text-align: left;
}

.po-history-edit-link:hover,
.po-history-edit-link:focus-visible {
    color: var(--color-teal);
    text-decoration: underline;
}

.po-quick-pill-link {
    display: inline-flex;
    text-decoration: none;
    border-radius: 999px;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.po-quick-pill-link:hover,
.po-quick-pill-link:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
    outline: none;
}

.po-quick-amount-link {
    font-weight: 700;
    color: var(--color-teal-dark);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.po-quick-amount-link:hover,
.po-quick-amount-link:focus-visible {
    color: var(--color-teal);
}

.compra-quick-page {
    max-width: 1200px;
    width: 98%;
    margin: 0 auto;
}

.compra-quick-page--narrow {
    max-width: 960px;
}

.compra-quick-heading {
    margin-bottom: var(--space-lg);
    padding: 24px var(--space-lg) 20px;
    background: var(--color-white);
    border: 1px solid var(--color-grey-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
}

.compra-quick-heading h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-black);
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}

.compra-quick-alerts {
    margin-bottom: var(--space-md);
}

.compra-quick-alerts .alert {
    margin-bottom: 10px;
}

.compra-quick-alerts .alert:last-child {
    margin-bottom: 0;
}

.compra-quick-card {
    overflow: hidden;
}

.compra-quick-section {
    padding-top: 28px;
    margin-top: 28px;
    border-top: 1px solid var(--color-grey-border);
}

.compra-quick-section:first-child {
    padding-top: 0;
    margin-top: 0;
    border-top: 0;
}

.compra-quick-section-title {
    margin: 0 0 16px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-black);
}

.compra-quick-inline-alert {
    margin-bottom: 20px;
}

.compra-quick-table-wrap {
    margin-top: 8px;
    margin-bottom: 8px;
}

.compra-quick-qty-input {
    max-width: 120px;
}

.compra-quick-heading-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.compra-quick-subtitle {
    margin-top: 8px;
    color: var(--color-grey-dark);
}

.compra-quick-heading-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.compra-quick-status-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 14px;
    margin-top: 18px;
}

.compra-quick-status-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-grey-dark);
}

.compra-quick-status-hint {
    font-size: 0.78rem;
    color: var(--color-grey-dark);
}

.compra-quick-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 18px;
}

.compra-quick-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--color-grey-border);
    background: var(--color-white);
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--color-grey-dark);
    text-decoration: none;
}

.compra-quick-nav-link.is-active,
.compra-quick-nav-link:hover {
    border-color: var(--color-teal);
    color: var(--color-teal-dark);
    background: var(--color-teal-light);
}

.po-quick-payment-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 18px 20px;
    align-items: end;
}

.po-quick-payment-grid .form-field-full {
    grid-column: 1 / -1;
}

.po-quick-shipment-grid {
    grid-template-columns: repeat(3, minmax(200px, 1fr));
    margin-bottom: 8px;
}

.po-quick-import-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    max-width: 720px;
    align-items: start;
}

.po-quick-import-grid .form-group {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.po-quick-import-grid .form-group label {
    min-height: 2.6rem;
    display: flex;
    align-items: flex-end;
    margin-bottom: 6px;
}

.po-quick-import-grid .form-group .po-header-hint {
    min-height: 2.5rem;
    margin-top: 6px;
}

.po-shipment-mode-toggle {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    padding: 14px 18px;
    background: #f8fafc;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-grey-border);
}

.po-shipment-mode-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--color-black);
    cursor: pointer;
}

.po-shipment-history {
    margin-bottom: 0;
}

.po-shipment-history h4 {
    margin: 0 0 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-black);
}

.po-quick-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid var(--color-grey-border);
}

.po-quick-summary-grid div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.po-quick-summary-grid span {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-grey-dark);
}

.po-quick-summary-grid strong {
    font-size: 1.05rem;
    color: var(--color-black);
}

@media (max-width: 900px) {
    .compra-quick-heading-top {
        flex-direction: column;
    }

    .compra-quick-heading-actions {
        width: 100%;
    }

    .po-quick-payment-grid,
    .po-quick-summary-grid,
    .po-quick-shipment-grid,
    .po-quick-import-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 720px) {
    .compra-quick-heading {
        padding: 18px 16px;
    }

    .po-quick-payment-grid,
    .po-quick-summary-grid,
    .po-quick-shipment-grid,
    .po-quick-import-grid {
        grid-template-columns: 1fr;
    }

    .compra-quick-status-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 720px) {
    .po-header-status-panel {
        padding: 16px 14px;
    }

    .po-header-status-card {
        flex: 1 1 100%;
        max-width: none;
    }
}

.po-shipment-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 0.8fr) auto;
    gap: 18px 20px;
    align-items: end;
}

.po-shipment-actions-label {
    visibility: hidden;
}

@media (max-width: 900px) {
    .po-shipment-grid {
        grid-template-columns: 1fr;
    }

    .po-shipment-actions-label {
        display: none;
    }
}

.po-inline-form {
    margin-top: 10px;
}

/* ============================================================
   TABLES
   ============================================================ */

.table-responsive-clean {
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

.table-scroll-wrapper {
    width: 100%;
    position: relative;
}

.table-scroll-wrapper.has-horizontal-scroll {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-bottom: none;
}

.table-scroll-wrapper.has-horizontal-scroll::-webkit-scrollbar {
    display: none;
    height: 0;
}

/* Encabezado clonado fijo bajo la topbar (activado por JS) */
.table-thead-pin {
    position: fixed;
    top: var(--topbar-height);
    left: var(--pin-left, 0);
    width: var(--pin-width, 100%);
    z-index: 800;
    pointer-events: none;
    display: none;
    box-sizing: border-box;
}

.table-thead-pin.is-active {
    display: block;
    overflow: hidden;
}

.table-thead-pin.is-active.is-split {
    overflow: visible;
}

.table-thead-pin .table-thead-pin-table {
    width: max-content;
    min-width: 100%;
    margin: 0;
    border-collapse: collapse;
    background-color: var(--color-white);
}

.table-thead-pin .table-thead-pin-table th {
    background-color: var(--color-teal-light);
    box-shadow: 0 2px 6px -3px rgba(30, 59, 57, 0.14);
}

.table-thead-pin-id {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 2;
    box-shadow: 8px 0 14px -8px rgba(30, 59, 57, 0.22);
}

.table-thead-pin-scroll {
    position: absolute;
    left: var(--pin-id-width, 0);
    top: 0;
    right: 0;
    overflow: hidden;
}

.table-thead-pin-inner {
    will-change: transform;
}

.table-scroll-footer {
    display: none;
    padding: 12px 14px 10px;
    background: linear-gradient(180deg, #eef8f6 0%, #e8f2f6 100%);
    border-top: 1px solid #bfe8e2;
}

.table-scroll-footer.is-visible {
    display: block;
}

.table-hscroll-track {
    position: relative;
    width: 100%;
    height: 16px;
    margin-bottom: 10px;
    background: #b8c9d4;
    border-radius: 999px;
    cursor: pointer;
    touch-action: none;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.table-hscroll-thumb {
    position: absolute;
    top: 0;
    left: 0;
    height: 16px;
    min-width: 56px;
    background: var(--color-teal-dark);
    border-radius: 999px;
    cursor: grab;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
    will-change: transform;
}

.table-hscroll-thumb.is-dragging {
    cursor: grabbing;
    background: var(--color-teal);
}

.table-scroll-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #256e65;
    font-size: 0.84rem;
    font-weight: 600;
    user-select: none;
}

.table-scroll-hint i {
    font-size: 0.95rem;
}

.table-responsive-clean .suppliers-table,
.table-responsive-clean .products-table {
    width: max-content;
    min-width: 100%;
}

/* Columna ID fija al desplazar tablas anchas (detalle / móvil) */
.table-scroll-wrapper.has-horizontal-scroll {
    --table-sticky-id-left: 0;
    --table-sticky-id-width: 6.75rem;
    --table-sticky-id-shadow: 8px 0 14px -8px rgba(30, 59, 57, 0.22);
}

.table-scroll-wrapper.has-horizontal-scroll .suppliers-table :is(
    th.col-rm-id,
    td.col-rm-id,
    th.col-po-id,
    td.col-po-id,
    th.col-pr-id,
    td.col-pr-id,
    th.col-tr-id,
    td.col-tr-id,
    th.col-aj-id,
    td.col-aj-id,
    th.col-ar-id,
    td.col-ar-id,
    th.col-supplier-id,
    td.col-supplier-id,
    th.col-fg-sku,
    td.col-fg-sku
),
.table-scroll-wrapper.has-horizontal-scroll .products-table :is(
    th.col-fg-sku,
    td.col-fg-sku
) {
    position: sticky;
    left: var(--table-sticky-id-left);
    z-index: 2;
    min-width: var(--table-sticky-id-width);
    max-width: calc(var(--table-sticky-id-width) + 2rem);
    box-shadow: var(--table-sticky-id-shadow);
}

.table-scroll-wrapper.has-horizontal-scroll .suppliers-table thead :is(
    th.col-rm-id,
    th.col-po-id,
    th.col-pr-id,
    th.col-tr-id,
    th.col-aj-id,
    th.col-ar-id,
    th.col-supplier-id,
    th.col-fg-sku
),
.table-scroll-wrapper.has-horizontal-scroll .products-table thead th.col-fg-sku {
    z-index: 5;
    background-color: var(--color-teal-light);
    box-shadow: var(--table-sticky-id-shadow), 0 2px 6px -3px rgba(30, 59, 57, 0.14);
}

.table-scroll-wrapper.has-horizontal-scroll .suppliers-table tbody :is(
    td.col-rm-id,
    td.col-po-id,
    td.col-pr-id,
    td.col-tr-id,
    td.col-aj-id,
    td.col-ar-id,
    td.col-supplier-id,
    td.col-fg-sku
),
.table-scroll-wrapper.has-horizontal-scroll .products-table tbody td.col-fg-sku {
    background-color: var(--color-white);
}

.table-scroll-wrapper.has-horizontal-scroll .suppliers-table tbody tr:nth-child(even) :is(
    td.col-rm-id,
    td.col-po-id,
    td.col-pr-id,
    td.col-tr-id,
    td.col-aj-id,
    td.col-ar-id,
    td.col-supplier-id,
    td.col-fg-sku
),
.table-scroll-wrapper.has-horizontal-scroll .products-table tbody tr:nth-child(even) td.col-fg-sku {
    background-color: #fafcfc;
}

.table-scroll-wrapper.has-horizontal-scroll .suppliers-table tbody tr:hover :is(
    td.col-rm-id,
    td.col-po-id,
    td.col-pr-id,
    td.col-tr-id,
    td.col-aj-id,
    td.col-ar-id,
    td.col-supplier-id,
    td.col-fg-sku
),
.table-scroll-wrapper.has-horizontal-scroll .products-table tbody tr:hover td.col-fg-sku {
    background-color: #f2fbfa;
}

.table-scroll-wrapper.has-horizontal-scroll .suppliers-table :is(
    td.col-rm-id,
    td.col-po-id,
    td.col-pr-id,
    td.col-tr-id,
    td.col-aj-id,
    td.col-ar-id,
    td.col-supplier-id,
    td.col-fg-sku
) .table-id-link {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.suppliers-table,
.products-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--color-white);
}

.table-fixed {
    table-layout: fixed;
}

.table-auto {
    table-layout: auto;
}

.suppliers-table thead th,
.products-table thead th {
    background-color: var(--color-teal-light);
    color: #1e3b39;
    font-size: 0.88rem;
    font-weight: 700;
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid #cfe4e2;
    white-space: nowrap;
}

.suppliers-table tbody td,
.products-table tbody td {
    padding: 14px 16px;
    font-size: 0.92rem;
    color: var(--color-text);
    border-bottom: 1px solid #edf1f4;
    vertical-align: middle;
    background-color: var(--color-white);
}

.suppliers-table tbody tr:nth-child(even) td,
.products-table tbody tr:nth-child(even) td {
    background-color: #fafcfc;
}

.suppliers-table tbody tr:hover td,
.products-table tbody tr:hover td {
    background-color: #f2fbfa;
}

.suppliers-table thead th.actions-header,
.products-table thead th.actions-header {
    text-align: center;
}

.suppliers-table thead th.status-header,
.products-table thead th.status-header {
    text-align: center;
}

.suppliers-table th.col-numeric,
.suppliers-table td.col-numeric,
.products-table th.col-numeric,
.products-table td.col-numeric,
.suppliers-table th.col-qty,
.suppliers-table td.col-qty,
.products-table th.col-qty,
.products-table td.col-qty {
    text-align: center;
    white-space: nowrap;
}

.suppliers-table td.col-actions,
.products-table td.col-actions {
    text-align: center;
    vertical-align: middle;
}

.suppliers-table td.col-status,
.products-table td.col-status {
    text-align: center;
    vertical-align: middle;
}

.table-id-link {
    color: var(--color-teal-dark, #1f6f66);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.table-id-link:hover {
    color: #166b58;
    text-decoration: underline;
}

.suppliers-table .table-cell-link {
    color: var(--color-teal-dark, #256e65);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.suppliers-table .table-cell-link:hover {
    color: #166b58;
    text-decoration: underline;
}

.suppliers-table td.col-supplier-email {
    min-width: 11rem;
    max-width: 280px;
    color: var(--color-text);
}

.suppliers-table td.col-supplier-email .supplier-email-value {
    display: inline-block;
    max-width: 100%;
    color: var(--color-text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.suppliers-table th.col-supplier-email,
.suppliers-table th.col-supplier-phone,
.suppliers-table th.col-supplier-website {
    min-width: 9rem;
}

.suppliers-table td.col-supplier-website {
    min-width: 10rem;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suppliers-table.table-summary-compact {
    --summary-alias-max-ch: 36;
    width: max-content;
    min-width: 100%;
    table-layout: auto;
}

.suppliers-table.table-summary-compact .col-item-label {
    max-width: calc(var(--summary-alias-max-ch) * 1ch);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suppliers-table.table-summary-compact thead th.col-item-label {
    max-width: calc(var(--summary-alias-max-ch) * 1ch);
}

.suppliers-table.table-summary-compact .col-numeric,
.suppliers-table.table-summary-compact .col-qty,
.suppliers-table.table-summary-compact .col-status,
.suppliers-table.table-summary-compact td.col-actions,
.suppliers-table.table-summary-compact .col-rm-id,
.suppliers-table.table-summary-compact .col-fg-sku,
.suppliers-table.table-summary-compact .col-po-id,
.suppliers-table.table-summary-compact .col-pr-id,
.suppliers-table.table-summary-compact .col-tr-id,
.suppliers-table.table-summary-compact .col-aj-id,
.suppliers-table.table-summary-compact .col-ar-id,
.suppliers-table.table-summary-compact .col-supplier-id,
.suppliers-table.table-summary-compact .col-semaforo {
    white-space: nowrap;
}

.suppliers-table.table-summary-compact .col-numeric,
.suppliers-table.table-summary-compact .col-qty,
.suppliers-table.table-summary-compact .col-status,
.suppliers-table.table-summary-compact .col-semaforo {
    text-align: center;
}

.suppliers-table.table-summary-compact .inventory-semaforo {
    min-width: 0;
    max-width: 11rem;
    padding: 4px 8px;
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .table-scroll-wrapper.has-horizontal-scroll {
        --table-sticky-id-width: 5.75rem;
    }

    .suppliers-table.table-summary-compact {
        --summary-alias-max-ch: 28;
    }

    .suppliers-table.table-summary-compact thead th,
    .suppliers-table.table-summary-compact tbody td {
        padding: 10px 8px;
        font-size: 0.84rem;
    }

    .suppliers-table.table-summary-compact .col-numeric,
    .suppliers-table.table-summary-compact .col-qty {
        font-size: 0.8rem;
    }

    .suppliers-table.table-summary-compact .status-pill {
        font-size: 0.72rem;
        padding: 3px 8px;
    }

    .suppliers-table.table-summary-compact .icon-action-btn {
        width: 30px;
        height: 30px;
        font-size: 0.82rem;
    }
}

.form-control-numeric {
    text-align: center;
}

.po-status-pill-wrap {
    min-height: 42px;
    display: flex;
    align-items: center;
}

.po-status-pill-wrap .status-pill {
    min-width: 110px;
}


.po-header-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 18px 20px;
    align-items: start;
}

.po-header-hint {
    display: block;
    min-height: 2.5rem;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted, #6b7280);
    line-height: 1.25;
}

.cell-center {
    text-align: center;
}

.cell-nowrap {
    white-space: nowrap;
}

.cell-truncate {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-cell-wrap {
    max-width: 220px;
    position: relative;
    overflow: visible;
    vertical-align: middle;
}

.note-cell {
    position: relative;
    display: block;
    max-width: 100%;
    cursor: help;
    outline: none;
}

.note-cell__text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-cell__empty {
    color: var(--color-grey-dark);
}

.note-cell__tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    z-index: 3000;
    min-width: 200px;
    max-width: min(380px, 70vw);
    padding: 10px 12px;
    background: #1f2937;
    color: #f9fafb;
    font-size: 0.88rem;
    font-weight: 400;
    line-height: 1.5;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
    white-space: pre-wrap;
    word-break: break-word;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.note-cell__tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 18px;
    border: 7px solid transparent;
    border-bottom-color: #1f2937;
}

.note-cell:hover .note-cell__tooltip,
.note-cell:focus .note-cell__tooltip,
.note-cell:focus-visible .note-cell__tooltip {
    visibility: visible;
    opacity: 1;
}

.suppliers-table tr:has(.note-cell:hover),
.suppliers-table tr:has(.note-cell:focus-within) {
    position: relative;
    z-index: 2;
}

.empty-table-message-clean {
    text-align: center;
    padding: 32px 20px !important;
    color: var(--color-grey-dark);
    font-size: 0.95rem;
}

/* ============================================================
   STATUS & ACTION ICONS
   ============================================================ */

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 95px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid transparent;
    line-height: 1;
}

.status-active {
    background-color: var(--color-teal-light);
    color: #1f6f66;
    border-color: #bfe8e2;
}

.status-inactive {
    background-color: #fff4cc;
    color: #9a6b00;
    border-color: #f0df9a;
}

.status-blocked {
    background-color: #fde2e2;
    color: #b42318;
    border-color: #f3c3c3;
}

.status-default {
    background-color: #eef2f6;
    color: #5f6b76;
    border-color: #d8e1e7;
}

.status-muted {
    background-color: #f8fafc;
    color: #94a3b8;
    border-color: #e2e8f0;
}

.inventory-semaforo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    max-width: 100%;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid transparent;
    line-height: 1.2;
    text-align: center;
}

.inventory-semaforo-red {
    background-color: #fde2e2;
    color: #b42318;
    border-color: #f3c3c3;
}

.inventory-semaforo-yellow {
    background-color: #fff4cc;
    color: #9a6b00;
    border-color: #f0df9a;
}

.inventory-semaforo-green {
    background-color: var(--color-teal-light, #e8f4f2);
    color: #1f6f66;
    border-color: #bfe8e2;
}

.inventory-semaforo-blue {
    background-color: #dbeafe;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.inventory-semaforo-na {
    background-color: #f3f4f6;
    color: #9ca3af;
    border-color: #e5e7eb;
    min-width: 48px;
}

.status-supplier-paid {
    background-color: #dff5ef;
    color: #166b58;
    border-color: #a8dfd0;
}

.status-supplier-pending {
    background-color: #fff4e5;
    color: #9a5b00;
    border-color: #f5d9a8;
}

.status-info {
    background-color: #e8f1fb;
    color: #1e4f8a;
    border-color: #bfd3ef;
}

.rm-price-value {
    display: inline-block;
    min-width: 72px;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1.2;
}

.rm-price-value.rm-price-up {
    color: #b42318;
    font-weight: 700;
    background-color: #fde2e2;
    border: 1px solid #f3c3c3;
}

.rm-price-value.rm-price-down {
    color: #1f6f66;
    font-weight: 700;
    background-color: #dff5ef;
    border: 1px solid #a8dfd0;
}

.form-control.rm-price-up {
    color: #b42318;
    font-weight: 700;
    background-color: #fde2e2;
    border-color: #f3c3c3;
}

.form-control.rm-price-down {
    color: #1f6f66;
    font-weight: 700;
    background-color: #dff5ef;
    border-color: #a8dfd0;
}

thead .col-status,
thead .status-header {
    text-align: center;
}

.action-icon-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 82px;
}

.icon-action-btn--spacer {
    visibility: hidden;
    pointer-events: none;
    flex-shrink: 0;
}

.icon-action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--border-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.icon-action-btn:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}

.details-icon-btn {
    background-color: #4f8f8b;
}

.edit-icon-btn {
    background-color: var(--color-info);
}

.delete-icon-btn {
    background-color: var(--color-danger);
}

/* ============================================================
   RM SELECT (Tom Select) + FIELD HINTS
   ============================================================ */

.field-format-hint {
    margin-top: 6px;
    margin-bottom: 0;
    font-size: 0.82rem;
    color: #6b7280;
    line-height: 1.45;
}

.field-format-hint strong {
    color: #4b5563;
    font-weight: 600;
}

.field-hint-inline {
    font-size: 0.82rem;
    font-weight: 400;
    color: #9ca3af;
}

.po-rm-select-toolbar {
    margin-bottom: 16px;
}

/* Searchable selects (Tom Select) — aligned with form-control fields */
.searchable-select-control {
    position: relative;
    width: 100%;
    min-height: 42px;
}

.searchable-select-control select.tomselected,
.searchable-select-control select.searchable-select,
.searchable-select-control select.rm-alias-tom-select {
    display: none !important;
}

.po-header-grid > .rm-alias-select-group,
.capture-items-grid > .rm-alias-select-group {
    display: contents;
}

.capture-items-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr 1.35fr 0.8fr;
    gap: 18px 20px;
    align-items: start;
}

.capture-items-grid--rm {
    grid-template-columns: 1fr 1.35fr 0.9fr 1.1fr;
}

.capture-items-grid label,
.form-grid-capture label {
    margin-bottom: 6px;
    line-height: 1.2;
}

.po-grid-compact .rm-alias-select-group label,
.po-grid-compact.capture-items-grid label,
.po-header-grid.po-grid-compact label {
    margin-bottom: 2px;
    font-size: 0.88rem;
}

.form-grid-capture {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: start;
}

#fg-item-form .form-grid-2 {
    align-items: start;
}

#fg-item-form .form-grid-2 > .rm-alias-select-group {
    display: contents;
}

.rm-alias-select-group .ts-wrapper,
.searchable-select-field .ts-wrapper,
.searchable-select-control .ts-wrapper {
    width: 100%;
}

.rm-alias-select-group .ts-wrapper.single .ts-control,
.searchable-select-field .ts-wrapper.single .ts-control,
.searchable-select-control .ts-wrapper.single .ts-control {
    min-height: 42px;
    height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--color-grey, #d1d5db);
    border-radius: var(--border-radius-sm, 8px);
    background: #fff;
    font-size: 0.94rem;
    box-shadow: none;
    line-height: 1.2;
}

.rm-alias-select-group .ts-wrapper.single.focus .ts-control,
.searchable-select-field .ts-wrapper.single.focus .ts-control,
.searchable-select-control .ts-wrapper.single.focus .ts-control {
    border-color: var(--color-teal, #4f8f8b);
    box-shadow: 0 0 0 3px rgba(79, 143, 139, 0.15);
}

.rm-alias-select-group .ts-dropdown,
.searchable-select-field .ts-dropdown,
.searchable-select-control .ts-dropdown {
    border: 1px solid var(--color-grey-border, #d1d5db);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    font-size: 0.92rem;
}

.rm-alias-select-group .ts-dropdown .option,
.searchable-select-field .ts-dropdown .option,
.searchable-select-control .ts-dropdown .option {
    padding: 8px 12px;
}

.rm-alias-select-group .ts-dropdown .active,
.searchable-select-field .ts-dropdown .active,
.searchable-select-control .ts-dropdown .active {
    background-color: rgba(79, 143, 139, 0.12);
    color: inherit;
}

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
    padding: 18px var(--space-lg) 22px;
    border-top: 1px solid var(--color-grey-border);
    background-color: var(--color-muted-bg);
}

.pagination-info {
    font-size: 0.92rem;
    color: var(--color-grey-dark);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background-color: var(--color-white);
    border: 1px solid #d8e1e7;
    border-radius: var(--border-radius-sm);
    color: var(--color-black);
    font-size: 0.9rem;
    font-weight: 500;
}

.pagination-btn:hover {
    background-color: #eef9f7;
}

.pagination-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    border-radius: var(--border-radius-sm);
    background-color: var(--color-teal);
    color: var(--color-white);
    font-size: 0.92rem;
    font-weight: 600;
}

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--space-lg);
    font-size: 0.94rem;
    font-weight: 500;
}

.alert-success {
    background-color: var(--color-teal-light);
    color: #1e5b54;
    border: 1px solid #bfe8e2;
}

.alert-warning {
    background-color: #fff4cc;
    color: #8a6500;
    border: 1px solid #f0df9a;
}

/* ============================================================
   PROCESSING OVERLAY
   ============================================================ */

.processing-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(31, 31, 31, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.processing-overlay.active {
    display: flex;
}

.processing-box {
    background-color: var(--color-white);
    padding: 28px 32px;
    border-radius: var(--border-radius);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-width: 220px;
}

.processing-box p {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-black);
}

.processing-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid var(--color-teal-light);
    border-top: 4px solid var(--color-teal);
    border-radius: 50%;
    animation: spinLoader 0.8s linear infinite;
}

@keyframes spinLoader {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================================
   PRODUCTS TABLE
   ============================================================ */

.products-table th,
.products-table td {
    white-space: nowrap;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
    .table-scroll-wrapper.has-horizontal-scroll {
        overflow-x: scroll;
        background:
            linear-gradient(90deg, var(--color-white) 24px, rgba(255, 255, 255, 0)) 0 0 / 28px 100% no-repeat local,
            linear-gradient(270deg, var(--color-white) 24px, rgba(255, 255, 255, 0)) 100% 0 / 28px 100% no-repeat local,
            radial-gradient(farthest-side at 0 50%, rgba(47, 143, 131, 0.28), transparent) 0 50% / 16px 72% no-repeat scroll,
            radial-gradient(farthest-side at 100% 50%, rgba(47, 143, 131, 0.28), transparent) 100% 50% / 16px 72% no-repeat scroll;
    }

    .table-card-clean-header p::after {
        content: none;
    }
}

@media (max-width: 1200px) {
    .po-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid-items,
    .form-grid-items-5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .supplier-search-form {
        grid-template-columns: 1fr;
    }

    .list-filter-date-row {
        width: 100%;
    }

    .list-filter-search-row {
        grid-template-columns: 1fr;
    }

    .list-filter-date-row .form-group-inline,
    .list-filter-date-row input[type="date"].form-control {
        width: 100%;
        min-width: 0;
    }

    .supplier-search-actions {
        width: 100%;
    }

    .supplier-search-actions .btn,
    .supplier-search-actions .btn-secondary {
        flex: 1;
        justify-content: center;
    }

    .toolbar-btn-group + .toolbar-btn-group {
        padding-left: 0;
        border-left: none;
        width: 100%;
    }

    .bulk-import-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .bulk-import-panel__controls {
        justify-content: flex-start;
    }

    .bulk-import-panel__divider {
        display: none;
    }

    .bulk-upload-form {
        width: 100%;
        border-radius: var(--border-radius-sm);
        justify-content: space-between;
    }

    .bulk-upload-filename {
        max-width: 100%;
        flex: 1 1 auto;
    }
}

@media (max-width: 900px) {
    .po-grid-4-compact {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .po-grid-3-compact {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .sidebar-brand-text {
        font-size: 0.98rem;
    }

    .sidebar-logo {
        width: 76px;
        height: 76px;
        min-width: 76px;
    }

    .topbar-logo {
        height: 32px;
        max-width: 108px;
    }

    .topbar-left h2 {
        font-size: 1.05rem;
    }

    .top-link span {
        display: none;
    }

    .form-grid-2,
    .form-grid-header {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 800px) {
    .form-card-centered,
    .po-form-container {
        padding: var(--space-lg);
    }
}

@media (max-width: 768px) {
    .layout,
    .layout.sidebar-collapsed {
        --sidebar-current-width: 0px;
    }

    .sidebar {
        width: min(300px, 88vw);
        max-width: 300px;
        height: 100dvh;
        max-height: 100dvh;
        transform: translateX(-105%);
        box-shadow: 8px 0 32px rgba(15, 23, 42, 0.2);
        padding: 18px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
        overflow: hidden;
    }

    .sidebar-header {
        flex-shrink: 0;
        margin-bottom: 14px;
        padding-bottom: 14px;
    }

    .sidebar-logo {
        width: 64px;
        height: 64px;
        min-width: 64px;
        padding: 8px;
    }

    .sidebar-nav {
        flex: 1;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
        margin-right: -6px;
        padding-right: 6px;
    }

    .sidebar-nav-spacer {
        display: block;
        min-height: calc(env(safe-area-inset-bottom, 0px) + 120px);
        width: 100%;
        pointer-events: none;
    }

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

    .layout.sidebar-collapsed .sidebar-brand-text,
    .layout.sidebar-collapsed .sidebar-brand-subtitle,
    .layout.sidebar-collapsed .nav-link span,
    .layout.sidebar-collapsed .nav-group-label {
        opacity: 1;
        max-width: none;
        max-height: none;
        padding: inherit;
        margin: inherit;
        pointer-events: auto;
    }

    .layout.sidebar-collapsed .nav-link {
        justify-content: flex-start;
        gap: 12px;
        padding: 11px 14px;
    }

    .main-area {
        margin-left: 0;
    }

    .topbar {
        position: fixed;
        left: 0;
        right: 0;
        height: var(--topbar-height);
        padding: 0 16px;
        flex-direction: row;
        align-items: center;
        gap: 0;
    }

    .topbar-left h2 {
        font-size: 1rem;
    }

    .topbar-right {
        flex-wrap: nowrap;
        gap: 8px;
    }

    .content {
        padding: calc(var(--topbar-height) + var(--space-lg)) 16px var(--space-lg);
    }

    .table-card-clean-header {
        padding: 18px;
    }

    .suppliers-table thead th,
    .suppliers-table tbody td {
        padding: 12px;
    }

    .pagination-container {
        padding: 18px;
        flex-direction: column;
        align-items: flex-start;
    }

    .po-grid-4,
    .form-grid-items,
    .form-grid-items-5 {
        grid-template-columns: 1fr;
    }

    .po-grid-4-compact,
    .po-grid-3-compact {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   DASHBOARD
   ============================================================ */

.dashboard-heading {
    margin-bottom: var(--space-md);
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: var(--space-lg);
}

.dashboard-kpi-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    border-radius: var(--border-radius);
    border: 1px solid var(--color-grey-border);
    background: var(--color-white);
    box-shadow: var(--shadow-soft);
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.dashboard-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.dashboard-kpi-card--neutral {
    cursor: default;
}

.dashboard-kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.dashboard-kpi-label {
    display: block;
    font-size: 0.82rem;
    color: var(--color-grey-dark);
    margin-bottom: 4px;
}

.dashboard-kpi-value {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-black);
    line-height: 1.2;
}

.dashboard-kpi-meta {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--color-grey-dark);
}

.dashboard-kpi-card--teal .dashboard-kpi-icon { background: #dff7f5; color: #256e65; }
.dashboard-kpi-card--blue .dashboard-kpi-icon { background: #dbeafe; color: #2563eb; }
.dashboard-kpi-card--green .dashboard-kpi-icon { background: #dcfce7; color: #15803d; }
.dashboard-kpi-card--amber .dashboard-kpi-icon { background: #fef3c7; color: #b45309; }
.dashboard-kpi-card--rose .dashboard-kpi-icon { background: #ffe4e6; color: #be123c; }
.dashboard-kpi-card--slate .dashboard-kpi-icon { background: #e2e8f0; color: #475569; }
.dashboard-kpi-card--purple .dashboard-kpi-icon { background: #ede9fe; color: #7c3aed; }
.dashboard-kpi-card--neutral .dashboard-kpi-icon { background: var(--color-grey-light); color: var(--color-grey-dark); }

.dashboard-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.dashboard-quick-links a {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-teal-dark);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--color-teal-light);
}

.dashboard-quick-links a:hover {
    background: #c9f0eb;
}

.dashboard-charts-grid,
.dashboard-alerts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: var(--space-lg);
}

.dashboard-charts-grid .dashboard-panel:first-child {
    grid-column: 1 / -1;
}

.dashboard-panel {
    background: var(--color-white);
    border: 1px solid var(--color-grey-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    padding: 20px;
    min-width: 0;
}

.dashboard-panel-header {
    margin-bottom: 16px;
}

.dashboard-panel-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--color-black);
    margin-bottom: 4px;
}

.dashboard-panel-header p {
    color: var(--color-grey-dark);
    font-size: 0.88rem;
}

.dashboard-chart-wrap {
    position: relative;
    height: 280px;
}

.dashboard-chart-wrap--compact {
    height: 240px;
}

.dashboard-mini-table {
    margin-bottom: 0;
}

.dashboard-mini-table thead th,
.dashboard-mini-table tbody td {
    padding: 10px 12px;
    font-size: 0.88rem;
}

.dashboard-mini-table .dashboard-rm-alias {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-mini-table .dashboard-fg-alias {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-empty {
    color: var(--color-grey-dark);
    font-size: 0.92rem;
    padding: 12px 0;
}

.dashboard-filter-card {
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-lg);
}

.dashboard-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
}

.dashboard-inventory-history {
    margin-bottom: var(--space-lg);
}

.dashboard-panel--wide {
    width: 100%;
}

.dashboard-alerts-grid .dashboard-panel--wide {
    grid-column: 1 / -1;
}

.suppliers-table tr.row-warning td {
    background-color: #fff7ed;
}

.dashboard-chart-wrap--history {
    height: 260px;
    margin-bottom: 16px;
}

.dashboard-inventory-table {
    margin-top: 8px;
}

.dashboard-ops-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: var(--space-lg);
}

.dashboard-link {
    color: var(--color-teal-dark);
    font-weight: 600;
    text-decoration: none;
}

.dashboard-link:hover {
    text-decoration: underline;
}

.dashboard-order-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 320px;
    overflow-y: auto;
}

.dashboard-order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-grey-border);
}

.dashboard-order-item:last-child {
    border-bottom: none;
}

.dashboard-order-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.dashboard-order-id {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-teal-dark);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.dashboard-order-id:hover {
    text-decoration: underline;
}

.dashboard-order-supplier {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--color-black);
    line-height: 1.3;
    word-break: break-word;
}

.dashboard-order-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
    text-align: right;
}

.dashboard-order-amount {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--color-black);
    white-space: nowrap;
}

.dashboard-order-tag {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-grey-dark);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dashboard-order-list li {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-grey-border);
}

.dashboard-order-list li:last-child {
    border-bottom: none;
}

.dashboard-order-link {
    font-weight: 700;
    color: var(--color-teal-dark);
    text-decoration: none;
    font-size: 0.95rem;
    white-space: nowrap;
}

.dashboard-order-link:hover {
    text-decoration: underline;
}

.dashboard-order-meta {
    color: var(--color-grey-dark);
    font-size: 0.8rem;
    text-align: right;
    line-height: 1.35;
    max-width: 62%;
}

@media (max-width: 1200px) {
    .dashboard-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-ops-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-kpi-grid,
    .dashboard-charts-grid,
    .dashboard-alerts-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-charts-grid .dashboard-panel:first-child {
        grid-column: auto;
    }
}

/* Hub de configuración (solo admin) */
.config-hub-grid {
    display: grid;
    gap: 16px;
    margin-top: 8px;
}

.config-hub-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
    background: var(--color-white, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.config-hub-card:hover {
    border-color: var(--color-primary, #256e65);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.config-hub-card__icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #f1f5f9;
    color: var(--color-primary, #256e65);
    font-size: 1.1rem;
}

.config-hub-card__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.config-hub-card__body strong {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
}

.config-hub-card__body span {
    font-size: 0.875rem;
    color: var(--text-muted, #64748b);
    line-height: 1.45;
}

.config-hub-card__arrow {
    flex-shrink: 0;
    color: var(--text-muted, #94a3b8);
    font-size: 0.85rem;
}
