/* ============================================================
   HMI SYNC - App-level overrides & global layout
   Pairs with css/hmi-sync-theme.css (the design system).
   No Bootstrap. All colors via CSS variables from the theme.

   IMPORTANT: Critical layout styles live here (not in scoped
   .razor.css) so they work regardless of environment mode.
   ============================================================ */

/* ============================================================
   LAYOUT — App shell, nav, content
   ============================================================ */

.hmi-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hmi-nav-left {
    display: flex;
    align-items: center;
}

.hmi-nav-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.hmi-nav-brand:hover {
    color: inherit;
    text-decoration: none;
}

.hmi-nav-logo {
    height: 32px;
    width: auto;
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

/* ---- Taller nav variant ---- */
.hmi-nav.hmi-nav-tall {
    height: 72px;
    padding: 0 28px;
}

.hmi-nav-tall .hmi-nav-logo {
    height: 44px;
}

.hmi-nav-tall .hmi-nav-link {
    font-size: 14px;
    padding: 10px 18px;
}

.hmi-nav-center {
    display: flex;
    align-items: center;
    gap: 4px;
}

.hmi-nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ---- Profile dropdown ---- */
.hmi-profile-wrapper {
    position: relative;
}

.hmi-profile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 199;
    background: transparent;
    display: none;
}

.hmi-profile-wrapper.open .hmi-profile-backdrop {
    display: block;
}

.hmi-profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 200;
    min-width: 220px;
    background: var(--overlay-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--overlay-shadow);
    padding: 8px 0;
    display: none;
}

.hmi-profile-wrapper.open .hmi-profile-dropdown {
    display: block;
    animation: hmi-dropdown-in 0.15s ease-out;
}

@keyframes hmi-dropdown-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hmi-profile-info {
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hmi-profile-info strong {
    font-size: 14px;
    color: var(--text);
}

.hmi-profile-info span {
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-all;
}

.hmi-profile-dropdown hr {
    margin: 4px 0;
    border-top: 1px solid var(--border-light);
}

.hmi-profile-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.hmi-profile-item:hover {
    background: var(--surface-hover);
    color: var(--text);
    text-decoration: none;
}

.hmi-profile-item i {
    width: 16px;
    text-align: center;
    color: var(--text-muted);
}

.hmi-profile-signout:hover {
    color: var(--hmi-red);
}

.hmi-profile-signout:hover i {
    color: var(--hmi-red);
}

.hmi-contact-link {
    color: var(--text) !important;
    font-weight: 600;
}

.hmi-contact-link:hover,
.hmi-contact-link:focus {
    color: var(--text) !important;
    text-decoration: underline !important;
}

.hmi-main {
    flex: 1;
    background: var(--bg);
    padding: 28px 40px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* ---- Mobile bottom nav — hidden on desktop ---- */

.hmi-mobile-nav {
    display: none !important;
}

.hmi-mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--steel-400);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
}

.hmi-mobile-nav-link:hover,
.hmi-mobile-nav-link.active {
    color: var(--hmi-red-light);
}

.hmi-mobile-nav-link i {
    font-size: 18px;
}

@media (max-width: 767px) {
    .hmi-nav-center,
    .hmi-hide-mobile {
        display: none !important;
    }

    .hmi-mobile-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: var(--steel-900);
        border-top: 1px solid var(--steel-700);
        padding: 8px 0;
        justify-content: space-around;
    }

    .hmi-main {
        padding: 16px;
        padding-bottom: 80px;
    }
}

/* ============================================================
   FORM CONTROLS
   ============================================================ */

.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--hmi-red);
    box-shadow: 0 0 0 2px var(--hmi-red-glow);
}

.form-control::placeholder {
    color: var(--text-dim);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check-input {
    width: 18px;
    height: 18px;
    accent-color: var(--hmi-red);
    cursor: pointer;
}

.form-check-label {
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}

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

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

.alert-success {
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    color: var(--green);
}

.alert-danger {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error);
}

.alert-info {
    background: var(--steel-50);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.alert-warning {
    background: var(--amber-bg);
    border: 1px solid var(--amber-border);
    color: var(--amber);
}

.alert-dismissible {
    padding-right: 3rem;
    position: relative;
}

.alert-dismissible .btn-close {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    border: none;
    transition: all var(--transition-normal);
    white-space: nowrap;
    text-decoration: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--hmi-red), var(--hmi-red-dark));
    color: #fff;
    box-shadow: var(--btn-shadow);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--hmi-red-light), var(--hmi-red));
}

.btn-outline-secondary,
.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--clickable-action-text);
}

.btn-outline-secondary:hover:not(:disabled),
.btn-outline-primary:hover:not(:disabled) {
    background: var(--surface-hover);
    color: var(--clickable-action-hover);
    border-color: var(--steel-300);
}

.btn-outline-light {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.btn-outline-light:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.btn-success {
    background: linear-gradient(135deg, var(--green), #15803D);
    color: #fff;
    box-shadow: var(--btn-shadow);
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #22C55E, var(--green));
}

.btn-outline-success {
    background: transparent;
    border: 1px solid var(--green);
    color: var(--clickable-success-text);
}

.btn-outline-success:hover:not(:disabled) {
    background: var(--green-bg);
    color: var(--clickable-success-text);
}

.btn-danger {
    background: linear-gradient(135deg, var(--error), #DC2626);
    color: #fff;
    box-shadow: var(--btn-shadow);
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--error);
    color: var(--clickable-danger-text);
}

.btn-outline-danger:hover:not(:disabled) {
    background: var(--error-bg);
    color: var(--clickable-danger-text);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--hmi-red);
    padding: 0;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--hmi-red-dark);
}

.hmi-icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    min-width: 2.25rem;
    height: 2.25rem;
    min-height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--clickable-action-text);
    font-size: 1.05rem;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.hmi-icon-action:hover:not(:disabled),
.hmi-icon-action:focus-visible:not(:disabled) {
    background: var(--surface-hover);
    color: var(--clickable-action-hover);
    outline: none;
}

.hmi-icon-action:disabled,
.hmi-icon-action[disabled] {
    color: var(--text-dim);
    cursor: not-allowed;
    opacity: 0.55;
}

/* ============================================================
   SHARED TABLE CELLS
   ============================================================ */
.hmi-table-note-cell {
    max-width: 20rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* ============================================================
   SHARED TABLE PAGER
   ============================================================ */

.hmi-table-pager {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0 0;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.hmi-table-pager-summary {
    grid-column: 1;
    justify-self: start;
    white-space: nowrap;
}

.hmi-table-pager-controls {
    grid-column: 2;
    justify-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-width: 0;
}

.hmi-table-pager-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--clickable-action-text);
    line-height: 1;
    cursor: pointer;
}

.hmi-table-pager-button:hover:not(:disabled),
.hmi-table-pager-button:focus-visible:not(:disabled) {
    background: var(--surface-hover);
    color: var(--clickable-action-hover);
    outline: none;
}

.hmi-table-pager-button:disabled {
    color: var(--text-dim);
    cursor: not-allowed;
    opacity: 0.55;
}

.hmi-table-pager-page {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0.15rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.hmi-table-pager-page-label {
    font-weight: 600;
    color: var(--text-muted);
}

.hmi-table-pager-page-input {
    width: 4.5rem;
    min-width: 4.5rem;
    height: 2rem;
    padding: 0.25rem 0.35rem;
    text-align: center;
}

.hmi-table-pager-page-count {
    white-space: nowrap;
}

@media (max-width: 640px) {
    .hmi-table-pager {
        grid-template-columns: minmax(0, 1fr);
    }

    .hmi-table-pager-summary,
    .hmi-table-pager-controls {
        grid-column: 1;
        justify-self: center;
    }

    .hmi-table-pager-controls {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* ============================================================
   UTILITY CLASSES (Bootstrap replacements)
   ============================================================ */

/* Margin */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 6px !important; }
.mb-2 { margin-bottom: 12px !important; }
.mb-3 { margin-bottom: 20px !important; }
.mb-4 { margin-bottom: 28px !important; }
.mt-1 { margin-top: 6px !important; }
.mt-2 { margin-top: 12px !important; }
.mt-3 { margin-top: 20px !important; }
.mt-4 { margin-top: 28px !important; }
.my-1 { margin-top: 6px !important; margin-bottom: 6px !important; }
.me-1 { margin-right: 6px !important; }
.me-2 { margin-right: 10px !important; }
.me-3 { margin-right: 16px !important; }
.ms-1 { margin-left: 6px !important; }
.ms-2 { margin-left: 10px !important; }
.ms-3 { margin-left: 16px !important; }

/* Padding */
.p-0 { padding: 0 !important; }
.p-2 { padding: 10px !important; }
.p-3 { padding: 16px !important; }
.pt-0 { padding-top: 0 !important; }
.pt-2 { padding-top: 10px !important; }
.px-1 { padding-left: 6px !important; padding-right: 6px !important; }
.px-2 { padding-left: 10px !important; padding-right: 10px !important; }
.px-3 { padding-left: 16px !important; padding-right: 16px !important; }
.py-1 { padding-top: 6px !important; padding-bottom: 6px !important; }
.py-2 { padding-top: 10px !important; padding-bottom: 10px !important; }
.py-3 { padding-top: 16px !important; padding-bottom: 16px !important; }

/* Display */
.d-flex { display: flex !important; }
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline-block { display: inline-block !important; }

/* Flex */
.flex-wrap { flex-wrap: wrap !important; }
.flex-fill { flex: 1 1 auto !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.gap-0 { gap: 0 !important; }
.gap-1 { gap: 6px !important; }
.gap-2 { gap: 10px !important; }
.gap-3 { gap: 16px !important; }
.align-items-center { align-items: center !important; }
.align-items-end { align-items: flex-end !important; }
.align-self-center { align-self: center !important; }
.align-middle { vertical-align: middle !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-around { justify-content: space-around !important; }

/* Sizing */
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

/* Typography */
.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }
.text-center { text-align: center !important; }
.text-end { text-align: right !important; }
.text-start { text-align: left !important; }
.text-decoration-none { text-decoration: none !important; }
.small { font-size: 0.875em !important; }
.fs-1 { font-size: 2.5rem !important; }
.fs-2 { font-size: 2rem !important; }
.fs-3 { font-size: 1.5rem !important; }
.fs-4 { font-size: 1.25rem !important; }
.fs-5 { font-size: 1.1rem !important; }
.fs-6 { font-size: 0.95rem !important; }

/* Entity/detail primitives. Use these for repeated customer, part,
   order, vendor, and contact detail views instead of page-local
   nested font-size reductions. */
.hmi-entity-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.85rem;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--text);
}

.hmi-entity-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-height: 1.5rem;
    color: var(--text);
}

.hmi-entity-meta-muted {
    color: var(--text-muted);
}

.hmi-entity-summary-separator {
    color: var(--text-dim);
}

.hmi-status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.55rem;
    padding: 0.25rem 0.55rem;
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

.hmi-detail-panel {
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.hmi-detail-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.hmi-detail-section-label {
    display: block;
    margin-bottom: 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.hmi-detail-table {
    font-size: 0.94rem;
    line-height: 1.4;
}

.hmi-detail-table td {
    padding: 0.28rem 0.25rem;
}

.hmi-metric-row > td:first-child {
    width: 55%;
    color: var(--text-muted);
}

.hmi-contact-card {
    padding: 0.85rem;
    color: var(--text);
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    line-height: 1.45;
}

.hmi-contact-card-primary {
    background: var(--hmi-red-soft);
    border-color: var(--hmi-red-border);
}

.hmi-contact-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.hmi-contact-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.7rem;
    font-size: 0.95rem;
    line-height: 1.45;
}

.hmi-contact-action {
    font-size: 0.92rem;
    text-decoration: none !important;
}

.hmi-contact-action:hover,
.hmi-contact-action:focus {
    text-decoration: none !important;
}

.hmi-contact-detail-list {
    font-size: 0.92rem;
    line-height: 1.45;
}

/* Text colors (using theme variables) */
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--text) !important; }
.text-success { color: var(--green) !important; }
.text-danger { color: var(--text) !important; }
.text-warning { color: var(--amber) !important; }
.text-info { color: #0dcaf0 !important; }
.text-secondary { color: var(--steel-500) !important; }
.text-dark { color: var(--steel-900) !important; }
.text-white { color: #fff !important; }

/* Background colors */
.bg-success { background-color: var(--green) !important; color: #fff; }
.bg-danger { background-color: var(--error) !important; color: #fff; }
.bg-warning { background-color: var(--amber) !important; color: #000; }
.bg-primary { background-color: var(--hmi-red) !important; color: #fff; }
.bg-secondary { background-color: var(--steel-500) !important; color: #fff; }
.bg-info { background-color: #0dcaf0 !important; color: #000; }
.bg-dark { background-color: var(--steel-900) !important; color: #fff; }
.bg-light { background-color: var(--steel-50) !important; color: var(--text); }
.bg-white { background-color: #fff !important; }
.bg-opacity-10 { --bg-opacity: 0.1; }
.bg-warning.bg-opacity-10 { background-color: rgba(217, 119, 6, 0.1) !important; }

/* Borders */
.border { border: 1px solid var(--border) !important; }
.border-top { border-top: 1px solid var(--border) !important; }
.border-bottom { border-bottom: 1px solid var(--border) !important; }
.border-danger { border-color: var(--error) !important; }
.border-warning { border-color: var(--amber) !important; }
.rounded { border-radius: var(--radius-md) !important; }
.rounded-top { border-radius: var(--radius-md) var(--radius-md) 0 0 !important; }
.rounded-pill { border-radius: 50rem !important; }

/* Position */
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.sticky-top { position: sticky !important; top: 0; z-index: 10; }
.top-0 { top: 0 !important; }
.start-100 { left: 100% !important; }
.end-0 { right: 0 !important; }
.translate-middle { transform: translate(-50%, -50%) !important; }

/* ============================================================
   GRID (Bootstrap replacements)
   ============================================================ */

.row {
    display: flex;
    flex-wrap: wrap;
    margin: -8px;
}

.row.g-2 { margin: -6px; }
.row.g-2 > [class*="col"] { padding: 6px; }
.row.g-3 { margin: -10px; }
.row.g-3 > [class*="col"] { padding: 10px; }

[class*="col"] {
    padding: 8px;
    box-sizing: border-box;
}

.col { flex: 1 0 0%; }
.col-auto { flex: 0 0 auto; width: auto; }
.col-12 { width: 100%; }
.col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-6, .col-md-12 { width: 100%; }

@media (min-width: 768px) {
    .col-md-1 { width: 8.3333%; }
    .col-md-2 { width: 16.6667%; }
    .col-md-3 { width: 25%; }
    .col-md-4 { width: 33.3333%; }
    .col-md-6 { width: 50%; }
    .col-md-12 { width: 100%; }
}

@media (min-width: 1200px) {
    .col-xl-6 { width: 50%; }
}

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

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    min-width: 0;
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--table-header-bg);
}

.card-body {
    padding: 20px;
    min-width: 0;
}

.card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--table-header-bg);
}

/* ============================================================
   PROGRESS BARS
   ============================================================ */

.progress {
    display: flex;
    height: 1rem;
    overflow: hidden;
    font-size: 0.75rem;
    background-color: var(--steel-100);
    border-radius: var(--radius-md);
}

.progress-bar {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    transition: width 0.6s ease;
}

.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    from { background-position: 1rem 0; }
    to { background-position: 0 0; }
}

/* ============================================================
   CLOSE BUTTON
   ============================================================ */

.btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: 0.25em;
    color: var(--text);
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
    border: 0;
    border-radius: var(--radius-sm);
    opacity: 0.5;
    cursor: pointer;
}

.btn-close:hover {
    opacity: 1;
}

/* ============================================================
   FORM CONTROL SIZES
   ============================================================ */

.form-control-sm {
    padding: 6px 10px;
    font-size: 13px;
}

.form-select-sm {
    padding: 6px 10px;
    font-size: 13px;
}

.form-range {
    width: 100%;
    height: 1.5rem;
    padding: 0;
    background: transparent;
    appearance: auto;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: var(--table-header-bg);
    border-bottom: 1px solid var(--border-light);
}

.table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}

.table tbody tr:last-child {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--surface-hover);
}

.table td {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text);
}

.table-sm th,
.table-sm td {
    padding: 8px 12px;
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive > .table {
    margin-bottom: 0;
}

.table-hover tbody tr:hover {
    background: var(--surface-hover);
}

.table-light th,
.table-light td,
tr.table-light td {
    background: var(--table-header-bg);
}

.table-active td {
    background: var(--steel-100);
}

tr.table-danger td {
    background: var(--error-bg);
}

tr.table-success td {
    background: var(--green-bg);
}

tr.table-warning td {
    background: var(--amber-bg);
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.text-bg-danger {
    background: var(--hmi-red-soft);
    color: var(--hmi-red);
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    color: var(--text);
    margin-top: 0;
    font-weight: 700;
}

h1 { font-size: 26px; margin-bottom: 16px; }
h2 { font-size: 20px; margin-bottom: 12px; }
.h5, h3 { font-size: 17px; margin-bottom: 10px; }
h4, h5 { font-size: 15px; margin-bottom: 8px; }
h6 { font-size: 14px; margin-bottom: 6px; }

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

a:hover {
    color: var(--hmi-red-dark);
}

p {
    line-height: 1.6;
    font-size: 14px;
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    color: var(--hmi-red);
    word-wrap: break-word;
}

small, .small {
    font-size: 0.875em;
}

strong {
    font-weight: 700;
}

::selection {
    background: var(--hmi-red-glow);
    color: var(--text);
}

.shadow {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* ============================================================
   VALIDATION & ERRORS
   ============================================================ */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--green);
}

.invalid {
    outline: 1px solid var(--error);
}

.validation-message {
    color: var(--error);
    font-size: 13px;
}

.blazor-error-boundary {
    background: var(--hmi-red-dark);
    padding: 14px 18px 14px 44px;
    color: #fff;
    border-radius: var(--radius-md);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ============================================================
   MISC
   ============================================================ */

hr {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 20px 0;
}

/* ============================================================
   ENGINEERING PAGE — critical styles (global fallback)
   ============================================================ */

.eng-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow);
    padding: 20px 24px;
}

.eng-card h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
}

.eng-note {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.eng-pill {
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
    letter-spacing: 0.3px;
    line-height: 1.3;
}

.eng-pill-warning {
    background: var(--amber-bg);
    border-color: var(--amber-border);
    color: var(--amber);
}

.eng-pill-info {
    background: var(--steel-50);
    border-color: var(--border);
    color: var(--text-muted);
}

.eng-pill-active {
    background: var(--green-bg);
    border-color: var(--green-border);
    color: var(--green);
    animation: eng-pulse 1.5s ease-in-out infinite;
}

@keyframes eng-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.eng-sync-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.eng-pinned-workspace {
    position: sticky;
    top: 0;
    z-index: 20;
}

.eng-pinned-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.eng-pinned-title h2 {
    margin: 0 0 8px;
}

.eng-pinned-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.eng-find-refresh-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: start;
}

@media (min-width: 960px) {
    .eng-find-refresh-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.eng-find-refresh-grid h3 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.eng-active-definition {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--steel-50);
    color: var(--text);
    font-size: 14px;
}

.eng-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.eng-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-muted);
    font-weight: 500;
    font-family: var(--font-sans);
    font-size: 14px;
    padding: 9px 18px;
    min-width: 130px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.eng-tab:hover {
    background: var(--surface-hover);
    border-color: var(--steel-300);
    color: var(--text);
}

.eng-tab.active {
    background: linear-gradient(135deg, var(--hmi-red), var(--hmi-red-dark));
    border-color: var(--hmi-red-dark);
    color: #ffffff;
    box-shadow: var(--btn-shadow);
}

.eng-tab-icon {
    width: 16px;
    text-align: center;
}

.eng-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.eng-subtab {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
    padding: 7px 14px;
    min-width: 110px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.eng-subtab:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.eng-subtab.active {
    background: var(--steel-900);
    border-color: var(--steel-800);
    color: #ffffff;
}

.eng-keyword-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--steel-50);
    color: var(--text);
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-mono);
}

.eng-keyword-remove {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.eng-keyword-remove:hover {
    color: var(--hmi-red);
}

.eng-autocomplete {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--overlay-bg);
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 10px;
    box-shadow: var(--overlay-shadow);
}

.eng-autocomplete-empty {
    padding: 12px 16px;
    color: var(--text-dim);
    font-size: 14px;
}

.eng-autocomplete-item {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
    text-align: left;
    border: none;
    border-bottom: 1px solid var(--border-light);
    background: transparent;
    padding: 10px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.eng-autocomplete-item:last-child {
    border-bottom: none;
}

.eng-autocomplete-item:hover {
    background: var(--surface-hover);
}

.eng-autocomplete-item.active {
    background: var(--hmi-red-soft);
}

.eng-autocomplete-part {
    color: var(--hmi-red);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-mono);
}

.eng-autocomplete-name {
    color: var(--text-muted);
    font-size: 13px;
}

.eng-form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.eng-form-row label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

@media (min-width: 960px) {
    .eng-form-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.eng-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.eng-grid-full {
    grid-template-columns: 1fr;
}

@media (min-width: 960px) {
    .eng-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .eng-grid-full {
        grid-template-columns: 1fr;
    }
}

.eng-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.eng-table-wrap .table {
    width: 100%;
    min-width: 980px;
}

.eng-group-row td {
    background: var(--steel-50);
    color: var(--text);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.3px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.eng-cell-part {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-mono);
    color: var(--hmi-red);
    font-size: 13px;
}

.eng-cell-desc {
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eng-cell-rev {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eng-mini-stack {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
}

.eng-flag {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    background: var(--amber-bg);
    border: 1px solid var(--amber-border);
    color: var(--amber);
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.eng-flag-info {
    background: var(--steel-50);
    border-color: var(--border);
    color: var(--text-muted);
}

.eng-card hr {
    border-top: 1px solid var(--border-light);
    margin: 14px 0;
}

.eng-card code {
    color: var(--hmi-red);
    font-size: 13px;
    font-family: var(--font-mono);
}

.eng-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1500;
}

.eng-modal {
    position: fixed;
    z-index: 1501;
    top: 6vh;
    left: 50%;
    transform: translateX(-50%);
    width: min(1100px, calc(100vw - 2rem));
    max-height: 88vh;
    overflow-y: auto;
    background: var(--overlay-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--overlay-shadow);
    padding: 20px 24px;
}

.eng-modal-large {
    width: min(1280px, calc(100vw - 1rem));
    top: 1vh;
    height: 98vh;
    max-height: 98vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.eng-modal-alerts {
    width: min(1200px, calc(100vw - 2rem));
    overflow-x: hidden;
}

.eng-alerts-table {
    table-layout: fixed;
    width: 100%;
}

.eng-alerts-table th:nth-child(1),
.eng-alerts-table td:nth-child(1) {
    width: 22%;
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eng-alerts-table th:nth-child(3),
.eng-alerts-table td:nth-child(3) {
    width: 120px;
}

.eng-alerts-table th:nth-child(4),
.eng-alerts-table td:nth-child(4) {
    width: 90px;
    text-align: right;
}

.eng-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.eng-modal h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.hmi-pdf-viewport {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-hover);
    -webkit-overflow-scrolling: touch;
}

.hmi-pdf-floating-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
    pointer-events: none;
}

.hmi-pdf-floating-actions > * {
    pointer-events: auto;
}

.hmi-pdf-floating-actions .btn {
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--overlay-bg);
    box-shadow: var(--btn-shadow);
}

.hmi-pdf-renderer {
    width: 100%;
    min-height: 100%;
    display: flex;
    align-items: stretch;
    justify-content: center;
    color: var(--text);
}

.hmi-pdf-pages {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 12px;
}

.hmi-pdf-page {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.hmi-pdf-page-body {
    max-width: 100%;
    display: flex;
    justify-content: center;
}

.hmi-pdf-page-label {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.hmi-pdf-page-canvas {
    max-width: 100%;
    height: auto;
    display: block;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
}

.hmi-pdf-page-placeholder {
    min-width: min(28rem, 100%);
    min-height: 18rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
}

.hmi-pdf-page-placeholder.is-error {
    color: var(--error);
    border-color: var(--error-border);
    background: var(--error-bg);
}

.hmi-pdf-status {
    align-self: center;
    margin: auto;
    max-width: min(34rem, 100%);
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
}

.hmi-pdf-status.is-error {
    color: var(--error);
    border-color: var(--error-border);
    background: var(--error-bg);
}

/* ============================================================
   APPWIDE FULLSCREEN PDF VIEWER
   ============================================================ */

.hmi-fullscreen-pdf-shell {
    position: fixed;
    inset: 0;
    z-index: 9101;
    width: 100vw;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--bg);
}

.hmi-fullscreen-pdf-backdrop {
    z-index: 9100;
}

.hmi-fullscreen-pdf-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

.hmi-fullscreen-pdf-viewport {
    --hmi-pdf-edge-tap-zone-width: 11vw;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
    overscroll-behavior: contain;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.hmi-fullscreen-pdf-viewport[data-hmi-pdf-edge-tap-zones="true"] {
    touch-action: none;
}

.hmi-fullscreen-pdf-renderer .hmi-pdf-pages {
    --hmi-pdf-live-scale: 1;
    --hmi-pdf-pan-x: 0px;
    --hmi-pdf-pan-y: 0px;
    min-height: 100%;
    padding: 0;
    gap: 0;
    align-items: stretch;
}

.hmi-fullscreen-pdf-renderer .hmi-pdf-pages.is-live-zoomed .hmi-pdf-page-body {
    will-change: transform;
}

.hmi-fullscreen-pdf-renderer .hmi-pdf-page {
    width: 100vw;
    min-height: 100dvh;
    height: 100dvh;
    justify-content: flex-start;
    gap: 0;
    overflow: hidden;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.hmi-fullscreen-pdf-renderer .hmi-pdf-page-body {
    width: 100%;
    min-height: 100%;
    align-items: flex-start;
    transform-origin: center center;
    transform: translate3d(var(--hmi-pdf-pan-x, 0px), var(--hmi-pdf-pan-y, 0px), 0) scale(var(--hmi-pdf-live-scale, 1));
}

.hmi-fullscreen-pdf-renderer .hmi-pdf-page-canvas {
    border: 0;
    box-shadow: none;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.hmi-fullscreen-pdf-actions {
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: nowrap;
    pointer-events: none;
}

.hmi-fullscreen-pdf-left-rail {
    pointer-events: auto;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    min-width: 0;
    max-width: min(42vw, 32rem);
}

.hmi-fullscreen-pdf-title-card,
.hmi-fullscreen-pdf-zoom-controls,
.hmi-fullscreen-pdf-page-indicator {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.hmi-fullscreen-pdf-title-card {
    min-width: 0;
    max-width: min(60vw, 42rem);
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    background: var(--overlay-bg);
    box-shadow: var(--btn-shadow);
    color: var(--text);
    font-weight: 700;
}

.hmi-fullscreen-pdf-title-card span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hmi-fullscreen-pdf-direct-controls {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    gap: 0.5rem;
}

.hmi-fullscreen-pdf-zoom-controls {
    height: 2.75rem;
    padding: 0.2rem;
    border-radius: var(--radius-md);
    background: var(--overlay-bg);
    box-shadow: var(--btn-shadow);
}

.hmi-fullscreen-pdf-zoom-controls .hmi-fullscreen-pdf-floating-button {
    width: 2.35rem;
    min-width: 2.35rem;
    height: 2.35rem;
    min-height: 2.35rem;
    background: transparent;
    box-shadow: none;
}

.hmi-fullscreen-pdf-zoom-fit {
    min-width: 3.75rem;
    height: 2.35rem;
    min-height: 2.35rem;
    padding: 0 0.65rem;
    color: var(--text);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: none;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 800;
}

.hmi-fullscreen-pdf-page-indicator {
    min-height: 2rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-md);
    background: var(--overlay-bg);
    box-shadow: var(--btn-shadow);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 800;
}

.hmi-fullscreen-pdf-floating-button {
    width: 2.75rem;
    min-width: 2.75rem;
    height: 2.75rem;
    min-height: 2.75rem;
    background: var(--overlay-bg);
    box-shadow: var(--btn-shadow);
}

.hmi-fullscreen-pdf-close {
    color: var(--clickable-danger-text);
}

.hmi-fullscreen-pdf-page-nav {
    position: absolute;
    top: 50%;
    z-index: 5;
    width: 3.25rem;
    height: 5.5rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--overlay-bg);
    color: var(--text);
    box-shadow: var(--btn-shadow);
    opacity: 0.62;
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.hmi-fullscreen-pdf-page-nav:hover,
.hmi-fullscreen-pdf-page-nav:focus-visible {
    opacity: 1;
}

.hmi-fullscreen-pdf-page-nav:focus-visible {
    outline: 2px solid var(--hmi-red-light);
    outline-offset: 2px;
}

.hmi-fullscreen-pdf-page-nav:disabled {
    opacity: 0.16;
    cursor: default;
    pointer-events: none;
}

.hmi-fullscreen-pdf-page-nav i {
    font-size: 1.35rem;
}

.hmi-fullscreen-pdf-page-nav-previous {
    left: 0.75rem;
}

.hmi-fullscreen-pdf-page-nav-next {
    right: 0.75rem;
}

@media (max-width: 767px) {
    .hmi-fullscreen-pdf-actions {
        top: 0.5rem;
        left: 0.5rem;
        right: 0.5rem;
    }

    .hmi-fullscreen-pdf-title-card {
        max-width: 100%;
        min-height: 3rem;
    }

    .hmi-fullscreen-pdf-left-rail {
        max-width: min(48vw, 20rem);
    }

    .hmi-fullscreen-pdf-page-nav {
        width: 3rem;
        height: 5rem;
    }
}

@media (pointer: coarse) {
    .hmi-fullscreen-pdf-floating-button {
        width: 3rem;
        min-width: 3rem;
        height: 3rem;
        min-height: 3rem;
    }

    .hmi-fullscreen-pdf-renderer .hmi-pdf-pages {
        padding: 0;
    }

    .hmi-fullscreen-pdf-zoom-controls {
        height: 3rem;
    }

    .hmi-fullscreen-pdf-zoom-controls .hmi-fullscreen-pdf-floating-button {
        width: 2.55rem;
        min-width: 2.55rem;
        height: 2.55rem;
        min-height: 2.55rem;
    }

    .hmi-fullscreen-pdf-zoom-fit {
        height: 2.55rem;
        min-height: 2.55rem;
    }

    .hmi-fullscreen-pdf-page-nav {
        width: 3.5rem;
        height: 6rem;
    }
}

/* ============================================================
   PRODUCTION BETA VIEWER
   ============================================================ */

.production-beta-workspace {
    width: min(100%, 900px);
    max-width: calc(100vw - 3rem);
}

.production-part-lookup-card {
    width: 100%;
    max-width: 100%;
    padding: 1rem;
    box-sizing: border-box;
    overflow: visible;
}

.production-job-orders-workspace {
    width: min(100%, 1280px);
}

.production-job-orders-card {
    width: 100%;
    max-width: 100%;
    padding: 1rem;
    box-sizing: border-box;
    overflow: visible;
}

.production-job-orders-toolbar {
    margin-bottom: 0.75rem;
}

.production-job-orders-table-wrap {
    max-height: calc(100dvh - 16rem);
    overflow: auto;
}

.production-job-orders-table {
    table-layout: fixed;
}

.production-job-orders-table th:nth-child(1) { width: 11rem; }
.production-job-orders-table th:nth-child(2) { width: 13rem; }
.production-job-orders-table th:nth-child(3) { width: 7rem; }
.production-job-orders-table th:nth-child(4) { width: 18rem; }
.production-job-orders-table th:nth-child(5) { width: 4rem; }
.production-job-orders-table th:nth-child(6) { width: 13rem; }
.production-job-orders-table th:nth-child(7) { width: 11rem; }
.production-job-orders-table th:nth-child(8) { width: 12rem; }

.production-job-orders-table td {
    vertical-align: middle;
}

.production-part-lookup-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.production-lookup-mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
}

.production-job-primary {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.production-job-primary code {
    color: var(--text);
    font-family: var(--font-mono);
    font-weight: 700;
}

.production-job-primary span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.production-line-description,
.production-readiness-reason {
    overflow-wrap: anywhere;
}

.production-job-packet-button {
    min-height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    white-space: normal;
    text-align: left;
}

.production-empty-state {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.hmi-part-search-results-shell.with-preview {
    display: contents;
    z-index: var(--hmi-part-search-z, 2100);
    /* Historical two-column contract retained for docs/tests: grid-template-columns: minmax(16rem, 24rem) minmax(34rem, 56rem); width: min(82rem, calc(100vw - 2rem)); */
    grid-template-columns: minmax(16rem, 24rem) minmax(34rem, 56rem);
    align-items: start;
    gap: 0.5rem;
    width: min(82rem, calc(100vw - 2rem));
    max-height: calc(100vh - 6rem);
    overflow: hidden;
    pointer-events: auto;
}

.hmi-part-search-results-shell.with-preview .hmi-part-search-dropdown {
    position: fixed !important;
    top: var(--hmi-part-search-anchor-top, 4rem) !important;
    left: var(--hmi-part-search-anchor-left, 1rem) !important;
    width: calc(var(--hmi-part-search-anchor-width, 20rem) - 1.25rem) !important;
    min-width: min(12rem, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    max-height: min(32rem, calc(100vh - 6rem)) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    align-self: start;
    z-index: calc(var(--hmi-part-search-z, 2100) + 2) !important;
}

.hmi-part-search-preview {
    position: fixed;
    top: clamp(4.5rem, 12vh, 7rem);
    left: 50%;
    transform: translateX(-50%);
    width: min(56rem, calc(100vw - 2rem));
    max-height: calc(100vh - 6rem);
    overflow: auto;
    z-index: calc(var(--hmi-part-search-z, 2100) + 1);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--overlay-shadow);
    padding: 0.75rem;
    display: grid;
    gap: 0.625rem;
    align-content: start;
    min-height: 28rem;
}

.hmi-part-search-preview-heading {
    display: grid;
    gap: 0.125rem;
    color: var(--text);
}

.hmi-part-search-preview-heading code {
    font-family: var(--font-mono);
    color: var(--text);
}

.hmi-part-search-preview-heading span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.hmi-part-search-preview-image {
    width: 100%;
    aspect-ratio: 11 / 8.5;
    object-fit: contain;
    background: var(--surface-hover);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

.hmi-part-search-preview-empty {
    display: grid;
    place-items: center;
    min-height: 24rem;
    color: var(--text-muted);
    background: var(--surface-hover);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
}

.hmi-part-search-primary-action {
    justify-self: stretch;
}

@media (hover: hover) and (pointer: fine) {
    .hmi-part-search-results-shell.desktop-direct-select .hmi-part-search-primary-action {
        display: none;
    }
}

@media (hover: none), (pointer: coarse) {
    .hmi-part-search-results-shell.with-preview {
        grid-template-columns: 1fr;
        width: min(40rem, calc(100vw - 1rem));
        max-height: calc(100vh - 2rem);
    }

    .hmi-part-search-preview {
        min-height: 18rem;
    }
}

.production-part-lookup-search {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.production-part-lookup-search .hmi-part-search:not(.hmi-part-search-preview-enabled) {
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
}

.production-part-lookup-search .hmi-part-search-preview-enabled {
    width: min(100%, 42rem) !important;
    max-width: 100%;
    min-width: 0;
}

.production-selected-part {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.production-selected-part-main {
    min-width: 0;
}

.production-selected-part-heading {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 700;
}

.production-selected-part-heading code {
    font-family: var(--font-mono);
    color: var(--text);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.15rem 0.35rem;
}

.production-selected-part-heading span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.production-selected-part-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.production-selected-part-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex: 0 0 auto;
    min-width: 0;
}

.production-packet-button {
    flex: 1 1 16rem;
    min-width: min(16rem, 100%);
    max-width: 100%;
    min-height: 3.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.65rem;
    text-align: left;
    white-space: normal;
}

.production-packet-button i {
    font-size: 1.1rem;
}

.production-packet-button span {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

@media (max-width: 767px) {
    .production-beta-workspace {
        max-width: none;
        width: calc(100vw - 1.5rem);
    }

    .production-part-lookup-card {
        padding: 0.75rem;
    }

    .production-job-orders-card {
        padding: 0.75rem;
    }

    .production-job-orders-table-wrap {
        max-height: calc(100dvh - 14rem);
    }

    .production-selected-part {
        align-items: stretch;
        flex-direction: column;
    }

    .production-selected-part-actions {
        justify-content: stretch;
        align-items: stretch;
    }

    .production-packet-button {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
        justify-content: flex-start;
    }

}

@media (pointer: coarse) {
    .hmi-pdf-page-placeholder {
        min-height: min(72vh, 28rem);
    }
}

.eng-drawing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.eng-drawing-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    background: var(--surface);
    transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.eng-drawing-card:hover {
    border-color: var(--hmi-red-border);
    box-shadow: 0 4px 12px var(--hmi-red-glow);
}

.eng-drawing-thumb {
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: var(--steel-50);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.eng-drawing-thumb-object {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
}

.eng-drawing-card-info {
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    border-top: 1px solid var(--border-light);
}

.eng-drawing-card-info strong {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.eng-drawing-card-info .eng-note {
    font-size: 11px;
}

.eng-upload-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.eng-upload-row label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

@media (min-width: 960px) {
    .eng-upload-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.eng-queue-alert {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================
   SETTINGS PAGE — critical styles (global fallback)
   ============================================================ */

.settings-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow);
    padding: 20px 24px;
}

.settings-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.settings-card-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.settings-note {
    color: var(--text-muted);
    font-size: 13px;
}

.settings-create-user {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--steel-50);
    padding: 16px;
}

.settings-create-user h3 {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 700;
}

.settings-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 12px;
}

.settings-toggle-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    align-content: center;
}

.settings-toggle-desc {
    display: block;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.4;
    padding-left: 26px;
    margin-bottom: 8px;
}

.settings-form-grid label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1400;
}

.settings-modal {
    position: fixed;
    top: 6vh;
    left: 50%;
    transform: translateX(-50%);
    width: min(720px, calc(100vw - 2rem));
    max-height: 88vh;
    overflow: auto;
    z-index: 1401;
    background: var(--overlay-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 20px 24px;
    box-shadow: var(--overlay-shadow);
}

.settings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.settings-modal-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.settings-role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 6px 16px;
}

@media (min-width: 768px) {
    .settings-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .settings-toggle-grid {
        padding-top: 18px;
    }
}

/* ============================================================
   LOGIN PAGE — critical styles (global fallback)
   ============================================================ */

.login-page {
    min-height: 80vh;
    display: grid;
    place-items: center;
    padding: 32px;
}

.login-card {
    width: min(100%, 420px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.login-logo {
    width: min(100%, 240px);
    height: auto;
    display: block;
}

.login-btn {
    min-width: 180px;
    text-align: center;
    justify-content: center;
}

/* ============================================================
   SHARED KEYWORD MANAGER — global fallback
   ============================================================ */

.hmi-keyword-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow);
    padding: 20px 24px;
}

.hmi-keyword-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 8px;
}

.hmi-keyword-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.hmi-keyword-note {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 10px;
}

.hmi-keyword-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.hmi-keyword-grid label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.hmi-keyword-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 4px 12px;
    background: var(--steel-50);
    color: var(--text);
    font-weight: 500;
    font-size: 12px;
    font-family: var(--font-mono);
}

.hmi-keyword-remove {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.hmi-keyword-remove:hover {
    color: var(--hmi-red);
}

@media (min-width: 960px) {
    .hmi-keyword-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ============================================================
   UI SETTINGS — Font Size, Compact Tables, Reduced Motion
   Classes applied on <html> to survive Blazor enhanced navigation.
   ============================================================ */

/* ---- Font Size ---- */
html.hm-font-small {
    font-size: 12px;
}

html.hm-font-small .hmi-main h1 { font-size: 22px; }
html.hm-font-small .hmi-main h2 { font-size: 17px; }
html.hm-font-small .hmi-main h3 { font-size: 15px; }
html.hm-font-small .hmi-main p,
html.hm-font-small .hmi-main .form-control,
html.hm-font-small .hmi-main .form-select,
html.hm-font-small .hmi-main .btn,
html.hm-font-small .hmi-main .table td,
html.hm-font-small .hmi-main .form-check-label {
    font-size: 12px;
}
html.hm-font-small .hmi-main .table thead th,
html.hm-font-small .hmi-main .form-label {
    font-size: 10px;
}
html.hm-font-small .hmi-main .eng-note,
html.hm-font-small .hmi-main .settings-note {
    font-size: 11px;
}
html.hm-font-small .hmi-entity-summary,
html.hm-font-small .hmi-contact-card,
html.hm-font-small .hmi-contact-line,
html.hm-font-small .hmi-detail-table {
    font-size: 1rem;
}
html.hm-font-small .hmi-detail-section-label,
html.hm-font-small .hmi-status-chip,
html.hm-font-small .hmi-contact-action,
html.hm-font-small .hmi-contact-detail-list {
    font-size: 0.92rem;
}

html.hm-font-medium {
    font-size: 14px;
}

/* medium is the default — no overrides needed */

html.hm-font-large {
    font-size: 16px;
}

html.hm-font-large .hmi-main h1 { font-size: 30px; }
html.hm-font-large .hmi-main h2 { font-size: 24px; }
html.hm-font-large .hmi-main h3 { font-size: 20px; }
html.hm-font-large .hmi-main {
    max-width: none;
    padding-inline: clamp(1rem, 2vw, 2.5rem);
}
html.hm-font-large .hmi-main p,
html.hm-font-large .hmi-main .form-control,
html.hm-font-large .hmi-main .form-select,
html.hm-font-large .hmi-main .btn,
html.hm-font-large .hmi-main .table td,
html.hm-font-large .hmi-main .form-check-label {
    font-size: 16px;
}
html.hm-font-large .hmi-main .table thead th,
html.hm-font-large .hmi-main .form-label {
    font-size: 12px;
}
html.hm-font-large .hmi-main .eng-note,
html.hm-font-large .hmi-main .settings-note {
    font-size: 15px;
}
html.hm-font-large .hmi-main .eng-cell-part {
    font-size: 15px;
}
html.hm-font-large .hmi-main .badge {
    font-size: 13px;
}
html.hm-font-large .hmi-entity-summary,
html.hm-font-large .hmi-contact-card,
html.hm-font-large .hmi-contact-line,
html.hm-font-large .hmi-detail-table {
    font-size: 1rem;
}
html.hm-font-large .hmi-detail-section-label,
html.hm-font-large .hmi-status-chip,
html.hm-font-large .hmi-contact-action,
html.hm-font-large .hmi-contact-detail-list {
    font-size: 0.94rem;
}
html.hm-font-large .hmi-main .d-flex.flex-wrap {
    row-gap: 0.65rem !important;
}
html.hm-font-large .hmi-main .table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}
html.hm-font-large .hmi-main .card,
html.hm-font-large .hmi-main .card-body,
html.hm-font-large .hmi-main .row,
html.hm-font-large .hmi-main [class*="col"] {
    min-width: 0;
}

/* ---- Compact Tables ---- */
html.hm-compact-tables .table thead th {
    padding: 6px 10px;
}

html.hm-compact-tables .table td {
    padding: 5px 10px;
    font-size: 13px;
}

html.hm-compact-tables .table-sm th,
html.hm-compact-tables .table-sm td {
    padding: 4px 8px;
}

html.hm-compact-tables .eng-cell-part {
    font-size: 12px;
}

html.hm-compact-tables .eng-drawing-card-info {
    padding: 6px 10px;
}

html.hm-compact-tables .eng-flag {
    padding: 2px 8px;
    font-size: 10px;
}

/* ---- Reduced Motion ---- */
html.hm-reduced-motion *,
html.hm-reduced-motion *::before,
html.hm-reduced-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

/* ============================================================
   Shared Search Controls
   ============================================================ */
.hmi-search {
    --hmi-search-width: 20rem;
    position: relative;
    width: min(var(--hmi-search-width), 100%);
    min-width: 0;
    flex: 0 1 var(--hmi-search-width);
}

.hmi-search[data-hmi-search-size="compact"] {
    --hmi-search-width: 12rem;
}

.hmi-search[data-hmi-search-size="wide"] {
    --hmi-search-width: 28rem;
}

.hmi-search[data-hmi-search-size="xl"] {
    --hmi-search-width: 34rem;
}

.hmi-search[data-hmi-search-size="full"] {
    --hmi-search-width: 100%;
    width: 100%;
    flex-basis: 100%;
}

.hmi-search-control {
    width: 100%;
    display: flex;
    align-items: stretch;
    flex-wrap: nowrap;
}

.hmi-search-prefix {
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    color: var(--text-muted);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-right: 0;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.hmi-search-input {
    flex: 1 1 auto;
    min-width: 0;
    width: 1%;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.hmi-search-control.has-clear .hmi-search-input {
    border-radius: 0;
}

.hmi-search-clear {
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.hmi-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-width: 0;
}

.hmi-toolbar-title {
    flex: 0 1 auto;
    min-width: 0;
    margin-bottom: 0 !important;
}

.hmi-toolbar-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
}

.hmi-toolbar-controls > .hmi-search {
    flex: 0 1 var(--hmi-search-width);
}

.hmi-toolbar-controls > .btn,
.hmi-toolbar-controls > .form-select,
.hmi-toolbar-controls > a {
    flex: 0 0 auto;
}

.hmi-filter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-width: 0;
}

.hmi-filter-toolbar-main,
.hmi-filter-toolbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-width: 0;
}

.hmi-filter-toolbar-main {
    flex: 1 1 38rem;
    justify-content: flex-start;
}

.hmi-filter-toolbar-actions {
    flex: 0 0 auto;
    justify-content: flex-end;
    margin-left: auto;
}

.hmi-search-anchor {
    position: relative;
    width: min(28rem, 100%);
    min-width: min(16rem, 100%);
    flex: 0 1 28rem;
}

.hmi-search-anchor > .hmi-search {
    width: 100%;
    flex: 1 1 auto;
}

.hmi-filter-option {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    color: var(--text);
    font-size: 0.75rem;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}

.hmi-filter-select {
    width: auto;
    min-width: 6.25rem;
    padding: 0.125rem 0.35rem;
    font-size: 0.75rem;
    flex: 0 0 auto;
}

html.hm-font-large .hmi-search {
    --hmi-search-width: 22rem;
    width: min(var(--hmi-search-width), 100%);
}

html.hm-font-large .hmi-search[data-hmi-search-size="wide"] {
    --hmi-search-width: 30rem;
    width: min(var(--hmi-search-width), 100%);
}

html.hm-font-large .hmi-search[data-hmi-search-size="xl"] {
    --hmi-search-width: 36rem;
    width: min(var(--hmi-search-width), 100%);
}

html.hm-font-large .hmi-search-anchor {
    width: min(30rem, 100%);
    flex-basis: 30rem;
}

html.hm-font-large .hmi-filter-option,
html.hm-font-large .hmi-filter-select {
    font-size: 0.82rem;
}

/* ============================================================
   Quick Search (Dashboard)
   ============================================================ */
.search-result-item:hover {
    background-color: var(--bs-gray-100, #f8f9fa);
}

/* ============================================================
   Toast Notifications
   ============================================================ */
#hmi-toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.hmi-toast {
    pointer-events: auto;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 420px;
    box-shadow: var(--overlay-shadow);
    transform: translateX(calc(100% + 1rem));
    transition: transform var(--transition-normal);
}

.hmi-toast-show {
    transform: translateX(0);
}

.hmi-toast-success {
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    color: var(--green);
}

.hmi-toast-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error);
}

.hmi-toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
    margin-left: auto;
    color: inherit;
    padding: 0 0.25rem;
}

.hmi-toast-close:hover {
    opacity: 1;
}

.eng-hidden-file-input {
    display: none !important;
}
