/* ============================================================================
   auth-user-db.css  App Settings, Auth User DB tab (migration_v148)
   ============================================================================ */
#authUserDbRoot { --aud-green: #1E6332; --aud-line: #e8e3da; --aud-panel: #fff; --aud-muted: #6b7280; --aud-ink: #231F20; }

.aud-loading, .aud-empty { padding: 48px 16px; text-align: center; color: var(--aud-muted); }
.aud-empty i { font-size: 28px; color: #b00000; display: block; margin-bottom: 10px; }

.aud-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.aud-title { font-size: 1.25rem; font-weight: 600; color: #214A3E; margin: 0 0 4px; }
.aud-title i { color: var(--aud-green); margin-right: 6px; }
.aud-sub { color: var(--aud-muted); font-size: 13px; margin: 0; max-width: 72ch; }
.aud-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aud-updated { font-size: 12px; color: var(--aud-muted); margin-right: 4px; }

.aud-btn {
    border: 1px solid var(--aud-line); background: #fff; color: #214A3E; border-radius: 8px;
    padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.aud-btn:hover:not([disabled]) { border-color: var(--aud-green); color: var(--aud-green); }
.aud-btn[disabled] { opacity: 0.45; cursor: default; }
.aud-btn-primary { background: var(--aud-green); border-color: var(--aud-green); color: #fff; }
.aud-btn-primary:hover:not([disabled]) { background: #214A3E; color: #fff; }
.aud-btn i { margin-right: 5px; }

/* KPI tiles double as filters */
.aud-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.aud-kpi {
    text-align: left; background: var(--aud-panel); border: 1px solid var(--aud-line); border-radius: 12px;
    padding: 14px 16px; cursor: pointer; font: inherit; color: inherit; transition: border-color .15s, box-shadow .15s;
}
.aud-kpi:hover { border-color: #b9c9bd; }
.aud-kpi { display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start; }
.aud-kpi-on { border-color: var(--aud-green); box-shadow: 0 0 0 2px rgba(30, 99, 50, 0.15); }
.aud-kpi-info { cursor: default; background: #F4F0E9; border-color: #E8DFD0; }
.aud-kpi-icon { width: 32px; height: 32px; border-radius: 8px; background: #e7f0ea; color: var(--aud-green); display: flex; align-items: center; justify-content: center; font-size: 14px; margin-bottom: 8px; }
.aud-kpi-info .aud-kpi-icon { background: #fff; color: #8a6536; }
.aud-kpi-num { font-size: 1.6rem; font-weight: 600; color: var(--aud-ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.aud-kpi-label { font-size: 13px; font-weight: 600; color: #214A3E; margin-top: 2px; }
.aud-kpi-hint { font-size: 12px; color: var(--aud-muted); margin-top: 2px; }

/* Activity distribution */
.aud-dist { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: #eceeef; }
.aud-dist-seg { border: 0; padding: 0; cursor: pointer; min-width: 3px; }
.aud-dist-seg + .aud-dist-seg { box-shadow: -1px 0 0 #fff; }
.aud-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 16px; font-size: 12px; color: var(--aud-muted); }
.aud-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.aud-legend b { color: var(--aud-ink); font-weight: 600; }

/* Toolbar */
.aud-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.aud-search { position: relative; flex: 1 1 260px; max-width: 380px; }
.aud-search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--aud-muted); font-size: 13px; }
.aud-search input { width: 100%; border: 1px solid var(--aud-line); border-radius: 8px; padding: 8px 10px 8px 32px; font-size: 13px; background: #fff; }
.aud-search input:focus, .aud-select:focus { outline: none; border-color: var(--aud-green); box-shadow: 0 0 0 3px rgba(30, 99, 50, 0.12); }
.aud-select { border: 1px solid var(--aud-line); border-radius: 8px; padding: 8px 10px; font-size: 13px; background: #fff; color: var(--aud-ink); }
.aud-count { margin-left: auto; font-size: 12px; color: var(--aud-muted); }

/* Table */
.aud-table-wrap { background: var(--aud-panel); border: 1px solid var(--aud-line); border-radius: 12px; overflow: auto; max-height: calc(100vh - 360px); min-height: 240px; }
.aud-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.aud-table thead th {
    position: sticky; top: 0; z-index: 2; background: #F4F0E9; text-align: left;
    padding: 10px 12px; border-bottom: 1px solid var(--aud-line); white-space: nowrap;
    font-size: 11px; font-weight: 600; color: #475453; text-transform: uppercase; letter-spacing: .04em;
}
.aud-table thead th:has(.aud-sort) { padding: 0; }
.aud-sort { border: 0; background: transparent; width: 100%; text-align: left; padding: 10px 12px; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.aud-sort:hover, .aud-sort-on { color: var(--aud-green); }
.aud-sort i { font-size: 10px; margin-left: 3px; }
.aud-table td { padding: 10px 12px; border-bottom: 1px solid #f1ede6; vertical-align: middle; color: var(--aud-ink); }
.aud-row { cursor: pointer; }
.aud-row:hover td, .aud-row-open td { background: #fbfaf7; }
.aud-row:focus-visible { outline: 2px solid var(--aud-green); outline-offset: -2px; }
.aud-user { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.aud-avatar { flex: 0 0 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #2F8542, #1E6332); color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.aud-name { font-weight: 600; }
.aud-email { color: var(--aud-muted); font-size: 12px; }
.aud-muted { color: #9ca3af; font-weight: 400; }
.aud-role { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: #eceeef; color: #475453; white-space: nowrap; }
.aud-role-employee { background: #e7f0ea; color: #1E6332; }
.aud-role-admin { background: #f6efe4; color: #8a6536; }
.aud-status { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
/* 30-day activity strip: one square per day, today on the right */
.aud-strip-wrap { display: flex; flex-direction: column; gap: 5px; }
.aud-strip { display: grid; grid-template-columns: repeat(30, 7px); gap: 2px; }
.aud-day { display: block; width: 7px; height: 14px; border-radius: 2px; background: #ebe7e0; }
.aud-day-on { background: var(--aud-green); }
.aud-day-today { box-shadow: 0 0 0 1px #C19A6B; }
.aud-strip-sum { font-size: 12px; color: var(--aud-muted); white-space: nowrap; }
.aud-strip-sum b { color: var(--aud-ink); }
.aud-num { font-variant-numeric: tabular-nums; }
.aud-none { text-align: center; color: var(--aud-muted); padding: 32px 12px !important; }

.aud-detail td { background: #fbfaf7; padding: 4px 12px 16px 56px; }
.aud-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 20px; }
.aud-det span { display: block; font-size: 11px; color: var(--aud-muted); text-transform: uppercase; letter-spacing: .04em; }
.aud-det b { font-size: 13px; font-weight: 500; color: var(--aud-ink); word-break: break-word; }
.aud-det-wide { grid-column: 1 / -1; }

.aud-pager { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--aud-muted); }

/* Dark theme */
body.dark-theme #authUserDbRoot { --aud-line: #334155; --aud-panel: #1e293b; --aud-muted: #94a3b8; --aud-ink: #e2e8f0; }
body.dark-theme .aud-title, body.dark-theme .aud-kpi-label { color: #e2e8f0; }
body.dark-theme .aud-btn, body.dark-theme .aud-search input, body.dark-theme .aud-select { background: #0f172a; color: #e2e8f0; }
body.dark-theme .aud-btn-primary { background: #1E6332; }
body.dark-theme .aud-kpi-info { background: #0f172a; }
body.dark-theme .aud-table thead th { background: #0f172a; color: #94a3b8; }
body.dark-theme .aud-row:hover td, body.dark-theme .aud-row-open td, body.dark-theme .aud-detail td { background: #0f172a; }
body.dark-theme .aud-table td { border-bottom-color: #334155; }
body.dark-theme .aud-day { background: #334155; }
body.dark-theme .aud-day-on { background: #4ade80; }

@media (max-width: 768px) {
    .aud-kpis { grid-template-columns: repeat(2, 1fr); }
    .aud-table-wrap { max-height: none; }
    .aud-count { margin-left: 0; width: 100%; }
}
