*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    background: #f0f2f5;
    color: #374151;
    -webkit-font-smoothing: antialiased;
}

a {
    color: #2563eb;
}

/* Bootstrap spinner (MudBlazor doesn't ship it) */
.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: middle;
    border: 0.18em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .65s linear infinite;
}

.spinner-border-sm {
    width: .8rem;
    height: .8rem;
    border-width: .15em;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

/* Blazor error UI */
#blazor-error-ui {
    display: none;
    background: #fef2f2;
    border-top: 1px solid #fecaca;
    bottom: 0;
    color: #dc2626;
    font-size: .83rem;
    left: 0;
    padding: .6rem 1rem;
    position: fixed;
    right: 0;
    z-index: 9999;
}

#blazor-error-ui .reload, #blazor-error-ui .dismiss {
    cursor: pointer;
    color: #dc2626;
    margin-left: .5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Shared Admin UI
   ═══════════════════════════════════════════════════════════════════════════ */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-title { font-size: 1.4rem; font-weight: 700; color: #111827; margin: 0 0 .2rem; }
.page-sub   { font-size: .83rem; color: #6b7280; margin: 0; }

.btn-primary, .btn-secondary, .btn-danger, .btn-back {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .55rem 1rem; border-radius: 8px; text-decoration: none;
    font-size: .83rem; font-weight: 600; white-space: nowrap;
    border: none; cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.btn-primary   { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; color: #fff; }
.btn-primary:disabled { background: #93c5fd; cursor: default; }
.btn-secondary { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.btn-secondary:hover { background: #f9fafb; color: #111827; }
.btn-danger    { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-back      { background: #f3f4f6; color: #374151; }
.btn-back:hover { background: #e5e7eb; color: #111827; }
.btn-sm        { padding: .35rem .7rem; font-size: .78rem; }

.loading-state, .error-state, .empty-state {
    display: flex; flex-direction: column; align-items: center; gap: .75rem;
    padding: 4rem 2rem; color: #9ca3af; font-size: .9rem;
}
.error-state { color: #dc2626; }
.empty-state i { font-size: 2.5rem; margin-bottom: .25rem; }

.data-table-wrap {
    background: #fff; border-radius: 12px; border: 1px solid #e5e7eb; overflow: auto;
}
.data-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.data-table th {
    text-align: left; padding: .75rem 1rem; font-size: .72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em; color: #9ca3af;
    border-bottom: 1px solid #f3f4f6; background: #fafafa; white-space: nowrap;
}
.data-table td {
    padding: .8rem 1rem; border-bottom: 1px solid #f3f4f6; color: #374151; vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #f9fafb; }
.data-table tr.row-click { cursor: pointer; }

.td-mono { font-family: monospace; font-size: .78rem; color: #6b7280; }
.td-bold { font-weight: 600; color: #111827; }
.td-actions { text-align: right; white-space: nowrap; }

.badge { display: inline-block; padding: .2rem .55rem; border-radius: 6px; font-size: .72rem; font-weight: 600; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-gray   { background: #f3f4f6; color: #6b7280; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-blue   { background: #dbeafe; color: #1e40af; }

.action-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 6px; color: #6b7280;
    text-decoration: none; border: none; background: transparent; cursor: pointer;
    transition: background .15s, color .15s;
}
.action-btn:hover { background: #f3f4f6; color: #2563eb; }
.action-btn.danger:hover { background: #fee2e2; color: #dc2626; }

/* Cards / panels */
.card-panel {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
    padding: 1.5rem; margin-bottom: 1.25rem;
}
.card-title { font-size: 1rem; font-weight: 700; color: #111827; margin: 0 0 1rem; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem 1.25rem; }
.form-field { display: flex; flex-direction: column; gap: .35rem; }
.form-field.full { grid-column: 1 / -1; }
.form-label { font-size: .78rem; font-weight: 600; color: #374151; }
.form-input, .form-select, .form-textarea {
    padding: .55rem .7rem; border: 1px solid #d1d5db; border-radius: 8px;
    font-size: .85rem; color: #111827; background: #fff; width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-check { display: inline-flex; align-items: center; gap: .5rem; font-size: .85rem; color: #374151; cursor: pointer; }
.form-check input { width: 16px; height: 16px; }
.form-actions { display: flex; gap: .6rem; margin-top: 1.25rem; }
.form-hint { font-size: .72rem; color: #9ca3af; }

/* Alerts */
.alert { padding: .7rem 1rem; border-radius: 8px; font-size: .82rem; margin-bottom: 1rem; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Stat cards */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.stat-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 1.25rem; display: flex; align-items: center; gap: 1rem; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.1rem; flex-shrink: 0; }
.stat-body { min-width: 0; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: #111827; line-height: 1; margin-bottom: .25rem; }
.stat-label { font-size: .76rem; color: #6b7280; }

/* Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid #e5e7eb; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab-item {
    padding: .6rem 1rem; font-size: .84rem; font-weight: 600; color: #6b7280;
    background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer;
}
.tab-item:hover { color: #111827; }
.tab-item.tab-active { color: #2563eb; border-bottom-color: #2563eb; }

/* Wizard */
.wizard-steps { display: flex; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: .5rem; }
.wizard-step { display: flex; align-items: center; gap: .5rem; }
.wizard-dot {
    width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 700; background: #e5e7eb; color: #6b7280; flex-shrink: 0;
}
.wizard-step.active .wizard-dot { background: #2563eb; color: #fff; }
.wizard-step.done .wizard-dot   { background: #16a34a; color: #fff; }
.wizard-step-label { font-size: .78rem; color: #6b7280; font-weight: 600; }
.wizard-step.active .wizard-step-label { color: #111827; }
.wizard-line { flex: 1; height: 2px; background: #e5e7eb; min-width: 20px; margin: 0 .25rem; }

/* Modules grid */
.modules-group { margin-bottom: 1.25rem; }
.modules-group-title { font-size: .8rem; font-weight: 700; color: #374151; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .6rem; }
.modules-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.module-check { display: flex; align-items: center; gap: .55rem; padding: .55rem .7rem; border: 1px solid #e5e7eb; border-radius: 8px; font-size: .82rem; color: #374151; cursor: pointer; }
.module-check:hover { border-color: #cbd5e1; background: #f9fafb; }
.module-check input { width: 16px; height: 16px; }

/* Modal */
.modal-backdrop-c { position: fixed; inset: 0; background: rgba(17,24,39,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.modal-box { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.4rem; border-bottom: 1px solid #f3f4f6; }
.modal-head h3 { margin: 0; font-size: 1.05rem; font-weight: 700; color: #111827; }
.modal-body { padding: 1.4rem; }
.modal-x { background: none; border: none; font-size: 1.1rem; color: #9ca3af; cursor: pointer; }
.modal-x:hover { color: #111827; }

.toolbar { display: flex; gap: .75rem; margin-bottom: 1.25rem; flex-wrap: wrap; align-items: center; }
.search-input { padding: .55rem .8rem .55rem 2.2rem; border: 1px solid #d1d5db; border-radius: 8px; font-size: .84rem; min-width: 260px; }
.search-wrap { position: relative; }
.search-wrap i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: .8rem; }
