:root {
    --z-primary: #245db5;
    --z-primary-strong: #174786;
    --z-primary-soft: #eaf2ff;
    --z-ink: #14231f;
    --z-muted: #66736f;
    --z-canvas: #eef2ef;
    --z-surface: #fffdf8;
    --z-surface-raised: #ffffff;
    --z-border: #d9dfdc;
    --z-danger: #b4232f;
    --z-warning: #8a5a00;
    --z-success: #157347;
    --z-radius-sm: 6px;
    --z-radius-md: 10px;
    --z-radius-lg: 16px;
    --z-shadow-menu: 0 16px 40px rgba(21, 39, 33, .16);
    --z-shadow-raised: 0 8px 22px rgba(21, 39, 33, .07);
    --z-motion: 150ms;
    --ui-optical-label-shift: 1px;
}

html { background: var(--z-canvas); }
body { color: var(--z-ink); background: var(--z-canvas); font-family: "IBM Plex Sans", "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
a, button, input, select, textarea, [tabindex] { scroll-margin: 90px; }
:focus-visible { outline: 3px solid rgba(36, 93, 181, .3) !important; outline-offset: 2px; }

.form-control, .form-select, .input-group-text, .btn { min-height: 46px; border-radius: var(--z-radius-sm); }
.form-control, .form-select { border-color: var(--z-border); background-color: var(--z-surface-raised); }
.form-control:focus, .form-select:focus { border-color: var(--z-primary); box-shadow: 0 0 0 3px rgba(36, 93, 181, .14); }
.form-label, legend.form-label { margin-bottom: 7px; font-weight: 700; color: var(--z-ink); }
fieldset { min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; transform: translateY(var(--ui-optical-label-shift)); }
.btn-primary { background: var(--z-primary); border-color: var(--z-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--z-primary-strong); border-color: var(--z-primary-strong); }

.card, .modern-card, .premium-card, .acl-panel { border-color: var(--z-border) !important; box-shadow: none; }
.card.zentry-elevated, .modern-card.zentry-elevated, .premium-card.zentry-elevated { box-shadow: var(--z-shadow-raised); }
.table-responsive { border: 1px solid var(--z-border); border-radius: var(--z-radius-md); background: var(--z-surface-raised); }
.table { margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 13px 14px; vertical-align: middle; border-color: #e7ebe9; }
.table thead th { color: #52605b; background: #f4f7f5; font-size: .78rem; letter-spacing: .055em; text-transform: uppercase; white-space: nowrap; }
.zentry-actions-cell { text-align: right !important; white-space: nowrap; width: 1%; }
.zentry-actions-cell > .btn, .zentry-actions-cell > a { margin-left: 5px; }

.alert { border-radius: var(--z-radius-md); border-width: 1px; }
.alert-danger { color: #7d1c25; background: #fff2f3; border-color: #efc7cc; }
.alert-warning { color: #694500; background: #fff8e8; border-color: #edd7a3; }
.alert-success { color: #105b39; background: #edf8f2; border-color: #b9ddc9; }
.zentry-error-recovery { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.zentry-error-recovery .zentry-recovery-action { min-width: 44px; }

.zentry-select-shell { position: relative; min-width: 0; }
.zentry-native-select { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; }
.zentry-select-trigger { width: 100%; min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 13px; color: var(--z-ink); background: var(--z-surface-raised); border: 1px solid var(--z-border); border-radius: var(--z-radius-sm); text-align: left; }
.zentry-select-trigger::after { content: ""; width: 8px; height: 8px; border-right: 2px solid #52605b; border-bottom: 2px solid #52605b; transform: rotate(45deg) translateY(-2px); flex: 0 0 auto; }
.zentry-select-trigger[aria-expanded="true"] { border-color: var(--z-primary); box-shadow: 0 0 0 3px rgba(36, 93, 181, .14); }
.zentry-select-trigger:disabled { color: #89938f; background: #f1f3f2; cursor: not-allowed; }
.zentry-select-menu { position: fixed; z-index: 2000; display: grid; gap: 5px; max-height: min(360px, calc(100dvh - 24px)); padding: 7px; overflow: hidden; background: var(--z-surface-raised); border: 1px solid var(--z-border); border-radius: var(--z-radius-md); box-shadow: var(--z-shadow-menu); opacity: 0; transform: translateY(-4px); transition: opacity var(--z-motion), transform var(--z-motion); }
.zentry-select-menu[data-open="true"] { opacity: 1; transform: translateY(0); }
.zentry-select-search { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--z-border); border-radius: var(--z-radius-sm); }
.zentry-select-options { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.zentry-select-option { width: 100%; min-height: 44px; padding: 9px 11px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: var(--z-radius-sm); color: var(--z-ink); background: transparent; text-align: left; }
.zentry-select-option:hover, .zentry-select-option:focus, .zentry-select-option[data-active="true"] { background: var(--z-primary-soft); color: var(--z-primary-strong); outline: 0; }
.zentry-select-option[aria-selected="true"] { font-weight: 750; }
.zentry-select-option[aria-selected="true"]::after { content: "Selected"; color: var(--z-primary); font-size: .72rem; font-weight: 700; }
.zentry-select-empty { padding: 14px 11px; color: var(--z-muted); }

.zentry-overflow-trigger { width: 44px; min-width: 44px; height: 44px; padding: 0; border: 1px solid var(--z-border); border-radius: var(--z-radius-sm); background: var(--z-surface-raised); color: var(--z-ink); }
.zentry-overflow-menu { position: fixed; z-index: 2100; min-width: 210px; max-width: min(300px, calc(100vw - 24px)); padding: 6px; background: var(--z-surface-raised); border: 1px solid var(--z-border); border-radius: var(--z-radius-md); box-shadow: var(--z-shadow-menu); opacity: 0; transform: translateY(-4px); transition: opacity var(--z-motion), transform var(--z-motion); }
.zentry-overflow-menu[data-open="true"] { opacity: 1; transform: translateY(0); }
.zentry-overflow-menu > a, .zentry-overflow-menu > button, .zentry-overflow-menu > form > button { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 0; border-radius: var(--z-radius-sm); color: var(--z-ink); background: transparent; text-align: left; text-decoration: none; }
.zentry-overflow-menu > a:hover, .zentry-overflow-menu > button:hover, .zentry-overflow-menu > form > button:hover { background: var(--z-primary-soft); }
.zentry-overflow-menu .text-danger, .zentry-overflow-menu .btn-danger, .zentry-overflow-menu .btn-outline-danger { color: var(--z-danger) !important; border-top: 1px solid var(--z-border); border-radius: 0 0 var(--z-radius-sm) var(--z-radius-sm); }

.zentry-loading { position: relative; pointer-events: none; }
.zentry-loading::before { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: zentry-spin .7s linear infinite; }
@keyframes zentry-spin { to { transform: rotate(360deg); } }
.zentry-skeleton { color: transparent !important; border-color: transparent !important; background: linear-gradient(90deg, #e7ebe9 20%, #f4f6f5 40%, #e7ebe9 60%); background-size: 240% 100%; animation: zentry-skeleton 1.2s ease-in-out infinite; }
@keyframes zentry-skeleton { to { background-position: -200% 0; } }

.zentry-toast-viewport { position: fixed; z-index: 2200; right: 18px; bottom: 18px; width: min(380px, calc(100vw - 36px)); display: grid; gap: 9px; pointer-events: none; }
.zentry-toast { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; padding: 13px 14px; color: var(--z-ink); background: var(--z-surface-raised); border: 1px solid var(--z-border); border-left: 4px solid var(--z-primary); border-radius: var(--z-radius-md); box-shadow: var(--z-shadow-menu); pointer-events: auto; }
.zentry-toast[data-severity="error"] { border-left-color: var(--z-danger); }
.zentry-toast[data-severity="warning"] { border-left-color: var(--z-warning); }
.zentry-toast[data-severity="success"] { border-left-color: var(--z-success); }
.zentry-toast button { width: 44px; height: 44px; margin: -9px -10px 0 0; border: 0; background: transparent; }

.zentry-sidebar-collapsed .nav-link { position: relative; }
.zentry-sidebar-collapsed .nav-link:focus-visible::after, .zentry-sidebar-collapsed .nav-link:hover::after { content: attr(data-nav-label); position: absolute; z-index: 2150; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); padding: 7px 10px; color: #fff; background: #17231f; border-radius: var(--z-radius-sm); white-space: nowrap; box-shadow: var(--z-shadow-menu); }

@media (max-width: 767.98px) {
    .main-content, main > .p-4 { padding: 16px !important; }
    .table-responsive { border-radius: var(--z-radius-sm); }
    .zentry-toast-viewport { top: max(12px, env(safe-area-inset-top)); right: 12px; bottom: auto; width: calc(100vw - 24px); }
    .zentry-actions-cell { position: sticky; right: 0; background: inherit; }
    .form-control, .form-select, .btn, .zentry-select-trigger { min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
