/* ==========================================================================
   History catalog + shell overrides (Plan tokens + LSIP viewer)
   Full LSIP styles: history-lsip.css
   ========================================================================== */

.his-page {
    width: 100%;
    max-width: 1280px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: var(--plan-text, #17222e);
}

.his-page-head {
    margin-bottom: 1.15rem;
}

.his-page-head-row {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.his-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--plan-text, #17222e);
}

.his-subtitle {
    color: var(--plan-text-muted, #64748b);
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
}

.his-back {
    padding: 0.35rem 0.7rem;
    margin-top: 0.15rem;
    text-decoration: none;
    white-space: nowrap;
    color: var(--plan-blue, #0d47a1);
    font-weight: 600;
    font-size: 0.88rem;
    border: 1px solid var(--plan-border, #d8e0ea);
    border-radius: 8px;
    background: #fff;
    line-height: 1.2;
}

.his-back:hover {
    background: var(--plan-blue-soft, #e8f0fb);
    border-color: #93c5fd;
    text-decoration: none;
}

.his-toolbar {
    margin-bottom: 1.25rem;
}

.his-search,
.his-input {
    display: block;
    width: 100%;
    max-width: 480px;
    height: 40px;
    margin: 0;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: var(--plan-text, #17222e);
    font-size: 0.9rem;
    box-shadow: none;
    outline: none;
}

.his-search:focus,
.his-input:focus {
    border-color: var(--plan-blue, #0d47a1);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.12);
}

.his-search-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    max-width: 720px;
}

.his-search-row .his-input {
    flex: 1 1 220px;
    max-width: none;
    min-width: 0;
}

/* Combo gắn input + nút như LSIP hình 2 */
.his-search-combo {
    display: flex;
    align-items: stretch;
    max-width: 640px;
    width: 100%;
}

.his-search-combo .his-input {
    flex: 1 1 auto;
    max-width: none;
    min-width: 0;
    border-radius: 8px 0 0 8px;
    border-right: 0;
}

.his-search-combo .his-btn {
    border-radius: 0 8px 8px 0;
    height: auto;
    min-height: 40px;
}

.his-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.his-btn-sm {
    height: 36px;
    padding: 0 0.9rem;
    font-size: 0.82rem;
}

.his-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.his-btn-primary {
    color: #fff;
    background: #2563eb;
    border-color: #1d4ed8;
}

.his-btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
}

.his-btn-secondary {
    color: var(--plan-text, #17222e);
    background: #fff;
    border-color: #d1d5db;
}

.his-btn-secondary:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #93c5fd;
}

.his-field-label {
    display: block;
    margin: 0 0 0.2rem;
    font-size: 0.92rem;
    font-weight: 700;
    color: #111827;
}

.his-field-hint {
    margin: 0 0 0.55rem;
    font-size: 0.82rem;
    color: #6b7280;
    line-height: 1.35;
}

/* Trang tìm theo entity — căn giữa kiểu Module Weighing */
.his-entity-page {
    --his-weig-blue: #0d47a1;
    --his-weig-blue-dark: #0b3c85;
    --his-weig-blue-soft: #e8f0fb;
    width: min(560px, 100%);
    max-width: 560px;
    margin: 0 auto;
    padding: 8px 0 40px;
}

.his-entity-top {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.1rem;
}

.his-entity-head-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.his-entity-heading {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.25;
}

.his-entity-table-line {
    margin: 0;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.82rem;
    font-weight: 600;
    color: #c62828;
    letter-spacing: 0.02em;
}

.his-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    margin-top: 1px;
    padding: 0;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.his-back-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: var(--his-weig-blue, #0d47a1);
    box-shadow: 0 2px 8px rgba(13, 71, 161, 0.12);
}

.his-back-btn:active {
    background: #dbeafe;
}

.his-weig-panel {
    background: #fff;
    border: 1px solid rgba(15, 32, 54, 0.1);
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(11, 36, 64, 0.08);
    overflow: visible;
}

.his-weig-panel__head {
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(15, 32, 54, 0.08);
    background: linear-gradient(180deg, #f4f8fd 0%, #fff 100%);
    border-radius: 14px 14px 0 0;
}

.his-weig-panel__title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--his-weig-blue, #0d47a1);
}

.his-weig-panel__desc {
    margin: 4px 0 0;
    font-size: 13px;
    color: #5b7086;
    line-height: 1.4;
}

.his-weig-panel__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 20px 20px;
}

.his-weig-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.his-weig-field__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #64798e;
}

.his-weig-field__input {
    height: 42px;
    width: 100%;
    max-width: none;
    padding: 0 12px;
    border: 1px solid rgba(15, 32, 54, 0.14);
    border-radius: 10px;
    background: #f7f9fc;
    font-size: 14px;
    color: #10233c;
    outline: none;
    box-shadow: none;
}

.his-weig-field__input:focus {
    background: #fff;
    border-color: var(--his-weig-blue, #0d47a1);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.16);
}

.his-weig-field__input:disabled {
    opacity: 0.75;
    cursor: wait;
}

.his-weig-field__hint {
    margin: -4px 0 0;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.35;
}

.his-weig-primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    width: 100%;
    border: 0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, var(--his-weig-blue, #0d47a1) 0%, var(--his-weig-blue-dark, #0b3c85) 100%);
    box-shadow: 0 8px 18px rgba(13, 71, 161, 0.28);
}

.his-weig-primary-btn:disabled {
    opacity: 0.7;
    cursor: progress;
}

.his-weig-search-icon {
    flex-shrink: 0;
}

.his-weig-alert {
    padding: 10px 12px;
    border-radius: 9px;
    font-size: 13px;
    line-height: 1.45;
}

.his-weig-alert--danger {
    color: #c92a2a;
    background: #fdecec;
    border: 1px solid #f3bcbc;
}

.his-weig-result-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.his-weig-result-list__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #64798e;
}

.his-weig-result-card {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    text-align: left;
    padding: 10px 14px;
    border: 1px solid rgba(15, 32, 54, 0.1);
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
}

.his-weig-result-card:hover {
    border-color: var(--his-weig-blue, #0d47a1);
    box-shadow: 0 6px 16px rgba(13, 71, 161, 0.12);
}

.his-weig-result-card__img {
    width: 88px;
    height: 64px;
    object-fit: contain;
    display: block;
}

.his-weig-result-card__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.his-weig-result-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.his-weig-result-card__top strong {
    font-size: 14px;
    color: #10233c;
}

.his-weig-result-card__meta {
    margin-top: 4px;
    font-size: 12px;
    color: #5b7086;
    line-height: 1.4;
    word-break: break-word;
}

.his-weig-chip {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid rgba(13, 71, 161, 0.22);
    background: var(--his-weig-blue-soft, #e8f0fb);
    font-size: 12px;
    font-weight: 700;
    color: var(--his-weig-blue, #0d47a1);
    flex-shrink: 0;
}

.his-weig-chip--status {
    border-color: #a7f3d0;
    background: #ecfdf5;
    color: #065f46;
}

/* Legacy entity panel (detail / catalog reuse) */
.his-entity-panel {
    background: var(--plan-surface, #fff);
    border: 1px solid var(--plan-border, #d8e0ea);
    border-radius: 10px;
    padding: 1.1rem 1.15rem 1.2rem;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
    max-width: 760px;
}

.his-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.15rem;
}

.his-chip {
    border: 1px solid #bfdbfe;
    background: #fff;
    color: var(--plan-blue, #0d47a1);
    border-radius: 999px;
    padding: 0.32rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.his-chip.active {
    border-color: var(--plan-blue, #0d47a1);
    background: var(--plan-blue, #0d47a1);
    color: #fff;
}

.his-chip:hover:not(.active) {
    background: var(--plan-blue-soft, #e8f0fb);
}

.his-group {
    margin-bottom: 1.5rem;
}

.his-group-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--plan-blue, #0d47a1);
    margin: 0 0 0.65rem;
    letter-spacing: 0.01em;
}

.his-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.75rem;
}

.his-card {
    text-align: left;
    border: 1px solid var(--plan-border, #d8e0ea);
    border-radius: 12px;
    background: var(--plan-surface, #fff);
    padding: 1rem 1.05rem;
    cursor: pointer;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.his-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 8px 20px rgba(13, 71, 161, 0.1);
    transform: translateY(-1px);
}

.his-card-title {
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--plan-blue-dark, #0b3c85);
}

.his-card-desc {
    font-size: 0.82rem;
    color: var(--plan-text-muted, #6b7280);
    margin: 0.3rem 0 0.6rem;
    min-height: 2.2em;
    line-height: 1.4;
}

.his-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.his-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    color: #065f46;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 999px;
    padding: 0.12rem 0.55rem;
}

.his-hint {
    font-size: 0.72rem;
    color: #9ca3af;
}

.his-search-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--plan-border, #e5e7eb);
    border-radius: 10px;
    overflow: hidden;
}

.his-search-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 11px 13px;
    border: 0;
    border-bottom: 1px solid #f3f4f6;
    background: #fff;
    cursor: pointer;
}

.his-search-item:last-child {
    border-bottom: none;
}

.his-search-item:hover {
    background: var(--plan-blue-soft, #f8fafc);
}

.his-search-title {
    font-weight: 700;
    font-size: 14px;
}

.his-search-sub {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.his-search-status {
    display: inline-block;
    margin-left: 8px;
    font-size: 11px;
    font-weight: 700;
    color: #065f46;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 999px;
    padding: 1px 8px;
    vertical-align: middle;
}

.his-toolbar .his-search {
    margin-bottom: 0.75rem;
}

.his-filters .form-control,
.his-filters .form-select {
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--plan-border, #d8e0ea);
    max-width: none;
    padding: 0.35rem 0.7rem;
}

/* Detail shell — map Blazor classes → LSIP look */
.his-detail-page .his-entity-card,
.his-detail-page .ev-entity-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 0.9rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.his-entity-title-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.his-entity-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.his-status-badge,
.ev-status-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: #065f46;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
}

.his-entity-grid,
.ev-entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.55rem 0.85rem;
}

.his-grid-label,
.ev-grid-label {
    display: block;
    font-size: 0.7rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.his-grid-value,
.ev-grid-value {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
}

.his-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
    align-items: flex-end;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.his-filter label {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.2rem;
    font-weight: 600;
    text-transform: uppercase;
}

.his-filter-grow {
    flex: 1;
    min-width: 160px;
}

.his-filter-input {
    display: block;
    width: 100%;
    min-width: 120px;
    height: 36px;
    padding: 0.3rem 0.7rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    font-size: 0.82rem;
    color: #111827;
    outline: none;
}

.his-filter-input:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.his-detail-page {
    max-width: 1100px;
}

.his-detail-page .ev-page-head {
    margin-bottom: 14px;
}

.his-detail-page .his-entity-card {
    margin-bottom: 14px;
}

.his-detail-page .filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.ev-list-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 16px 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ev-list-title {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.ev-event-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ev-event-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid #f1f5f9;
}

.ev-event-row:last-child {
    border-bottom: 0;
}

.ev-action-dot {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: #3b82f6;
}

.ev-rail-insert .ev-action-dot { background: #10b981; }
.ev-rail-update .ev-action-dot { background: #3b82f6; }
.ev-rail-delete .ev-action-dot { background: #ef4444; }
.ev-rail-sync .ev-action-dot { background: #9333ea; }

.ev-event-main {
    flex: 1 1 auto;
    min-width: 0;
}

.ev-event-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    font-size: 13px;
}

.ev-event-time {
    font-family: Consolas, monospace;
    font-weight: 700;
    color: #374151;
}

.ev-event-user {
    color: #1e40af;
    font-weight: 600;
}

.ev-event-action {
    color: #4b5563;
}

.ev-event-module {
    color: #64748b;
    font-size: 12px;
}

.ev-event-summary {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}

.ev-event-changes {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

.ev-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.ev-pill-insert { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.ev-pill-update { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.ev-pill-delete { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.ev-pill-sync { background: #f3e8ff; color: #6b21a8; border: 1px solid #d8b4fe; }

.his-detail-foot {
    margin: 14px 0 0;
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
}

.his-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 0.85rem;
    padding: 0;
}

.his-tab {
    border: 0;
    background: transparent;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
}

.his-tab.active {
    color: var(--plan-blue-dark, #1e40af);
    border-bottom-color: var(--plan-blue, #3b82f6);
}

.his-summary-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 0.85rem;
}

@media (max-width: 640px) {
    .his-summary-row {
        grid-template-columns: 1fr;
    }
}

.his-summary-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.his-summary-label {
    font-size: 0.7rem;
    color: #6b7280;
    font-weight: 700;
    text-transform: uppercase;
}

.his-summary-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--plan-blue, #2563eb);
}

.his-summary-unit {
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
}

.his-table {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
}

.his-table thead th {
    background: var(--plan-blue-soft, #bdd7ee);
    border-bottom: 2px solid #9dc3e6;
    padding: 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--plan-blue-dark, #1f4e78);
    text-transform: uppercase;
    white-space: nowrap;
}

.his-table tbody td {
    padding: 9px 10px;
    font-size: 12px;
    vertical-align: middle;
}

.his-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

/* Plan-tint LSIP surfaces when embedded in Admin */
.cntr-his-page .app-content-body.cntr-his-body,
.cntr-his-page-header,
.cntr-his-body .view-tabs {
    background: var(--plan-surface-alt, #f2f5f9);
}

.cntr-his-body .view-tab.active {
    color: var(--plan-blue-dark, #0b3c85);
    border-bottom-color: var(--plan-blue, #0d47a1);
}

.ev-summary-value {
    color: var(--plan-blue, #0d47a1) !important;
}

.ev-btn-search {
    background: var(--plan-blue, #0d47a1) !important;
}

.admin-placeholder {
    max-width: 720px;
}
