/* ============================================================
   FacePresence — App CSS
   Design: Corporate slate — professional admin panel
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:    #334155;
    --primary-d:  #1e293b;
    --accent:     #0ea5e9;
    --accent-d:   #0284c7;
    --success:    #059669;
    --warning:    #d97706;
    --danger:     #dc2626;
    --info:       #0284c7;
    --dark:       #0f172a;
    --sidebar-bg: #0f172a;
    --sidebar-w:  252px;
    --text:       #1e293b;
    --text-muted: #64748b;
    --border:     #e2e8f0;
    --bg:         #f1f5f9;
    --card-bg:    #ffffff;
    --radius:     6px;
    --shadow:     0 1px 2px rgba(15, 23, 42, .06);
    --shadow-md:  0 4px 12px rgba(15, 23, 42, .08);
}

html, body { height: 100%; font-family: 'Inter', system-ui, -apple-system, sans-serif; color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-d); text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────── */
.app-wrapper { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform .3s ease;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.125rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    color: #fff;
    font-weight: 600;
    font-size: .9375rem;
    letter-spacing: -.01em;
}
.brand-name { line-height: 1.2; }

.sidebar-nav { flex: 1; padding: .875rem .75rem; }

.nav-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5625rem .875rem;
    margin-bottom: 2px;
    color: rgba(255,255,255,.55);
    font-size: .8125rem;
    font-weight: 500;
    transition: all .15s;
    border-radius: var(--radius);
    border-left: none;
}
.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,.06);
    text-decoration: none;
}
.nav-item.active {
    color: #fff;
    background: rgba(14, 165, 233, .12);
    text-decoration: none;
}
.nav-item.active .nav-icon { color: var(--accent); }
.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    color: rgba(255,255,255,.45);
}
.nav-item:hover .nav-icon { color: rgba(255,255,255,.8); }

.nav-divider { height: 1px; background: rgba(255,255,255,.06); margin: .625rem .5rem; }

.nav-checkin { color: var(--accent) !important; }
.nav-checkin .nav-icon { color: var(--accent); }
.nav-checkin:hover { background: rgba(14, 165, 233, .1) !important; }

.sidebar-footer {
    padding: .75rem 1rem;
    border-top: 1px solid rgba(255,255,255,.08);
}
.user-info { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.user-avatar {
    width: 2rem; height: 2rem; border-radius: var(--radius);
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: .8125rem;
}
.user-name { color: #fff; font-size: .8125rem; font-weight: 600; }
.user-role { color: rgba(255,255,255,.45); font-size: .75rem; }
.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: rgba(255,255,255,.45);
    font-size: .75rem;
    font-weight: 500;
}
.btn-logout:hover { color: #f87171; text-decoration: none; }

/* ── Main content ─────────────────────────────────────────── */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .875rem 1.5rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.page-title { font-size: 1rem; font-weight: 600; flex: 1; letter-spacing: -.02em; color: var(--text); }
.topbar-right { color: var(--text-muted); font-size: .8125rem; }
.topbar-clock {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-weight: 500;
    font-size: .8125rem;
    color: var(--text-muted);
}
.topbar-clock .icon { color: var(--text-muted); }
.sidebar-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 2rem;
    height: 2rem;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
}
.sidebar-toggle .icon { vertical-align: 0; }

.content-body { flex: 1; overflow-y: auto; padding: 1.5rem; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .875rem; }
.alert-success { background: #f0fff4; color: #276749; border: 1px solid #9ae6b4; }
.alert-error   { background: #fff5f5; color: #9b2c2c; border: 1px solid #fc8181; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: .875rem; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.card-body { padding: 1.25rem; }
.card-body.p-0 { padding: 0; }
.card-form { max-width: 760px; }
.card-form-wide { max-width: 960px; }

/* ── Stats grid ───────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    border-left: 4px solid;
}
.stat-primary { border-left-color: var(--primary); }
.stat-success { border-left-color: var(--success); }
.stat-warning { border-left-color: var(--warning); }
.stat-danger  { border-left-color: var(--danger); }
.stat-info    { border-left-color: var(--info); }
.stat-icon-wrap {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-primary .stat-icon-wrap { color: var(--primary); background: #f1f5f9; }
.stat-success .stat-icon-wrap { color: var(--success); background: #ecfdf5; }
.stat-warning .stat-icon-wrap { color: var(--warning); background: #fffbeb; }
.stat-danger  .stat-icon-wrap { color: var(--danger);  background: #fef2f2; }
.stat-info    .stat-icon-wrap { color: var(--info);    background: #eff6ff; }
.stat-value { font-size: 1.625rem; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }

/* ── Dashboard grid ───────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

/* ── Data tables ──────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: .75rem 1rem; text-align: left; }
.data-table th {
    background: #f8fafc;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    font-weight: 600;
}
.data-table td { border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }
.table-responsive { overflow-x: auto; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .2em .55em;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-trial   { background: #ede9fe; color: #5b21b6; }
.badge-basic   { background: #dbeafe; color: #1e40af; }
.badge-pro     { background: #d1fae5; color: #065f46; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .5rem 1rem;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all .2s;
    text-decoration: none;
    line-height: 1;
}
.btn-primary  { background: var(--primary); color: #fff; border: 1px solid var(--primary); }
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); text-decoration: none; }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover { background: #38a169; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #ed8936; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #f56565; }
.btn-outline  { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); color: var(--text); border-color: #cbd5e1; text-decoration: none; }
.btn-secondary { background: #edf2f7; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; text-decoration: none; }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; font-size: .875rem; margin-bottom: .375rem; color: var(--text); }
.required { color: var(--danger); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .875rem;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .12);
}
.form-group input:disabled { background: #f1f5f9; color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-row-4 { grid-template-columns: repeat(4, 1fr); }
.form-row-checks { align-items: center; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.5rem; flex-wrap: wrap; }
.form-group-actions { display: flex; align-items: flex-end; gap: .5rem; }
.form-group-check { margin-bottom: 0; }
.form-group-action { margin-bottom: 0; display: flex; align-items: flex-end; }
.form-hint {
    display: block;
    margin-top: .35rem;
    font-size: .75rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    font-weight: 500;
    font-size: .875rem;
    margin-bottom: 0;
    user-select: none;
}
.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.input-password { position: relative; }
.input-password input { padding-right: 2.5rem; }
.btn-show-pass {
    position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: var(--text-muted);
    font-size: 1rem;
}

/* ── Filter form ──────────────────────────────────────────── */
.filter-form .filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: flex-end;
}
.filter-form .form-group { margin-bottom: 0; min-width: 140px; }

/* ── Photo upload ─────────────────────────────────────────── */
.photo-upload-area { position: relative; border: 2px dashed var(--border); border-radius: var(--radius); cursor: pointer; }
.photo-upload-area:hover { border-color: var(--primary); }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.photo-preview { display: flex; align-items: center; justify-content: center; min-height: 200px; }
.photo-preview img { max-height: 250px; border-radius: var(--radius); object-fit: cover; }
.upload-placeholder { text-align: center; color: var(--text-muted); padding: 2rem; }
.upload-placeholder span { font-size: 2.5rem; display: block; margin-bottom: .5rem; }

.current-photo { margin-bottom: 1rem; }
.current-photo img { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radius); border: 2px solid var(--border); }
.current-photo small { display: block; color: var(--text-muted); font-size: .75rem; margin-top: .25rem; }

.photo-method-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .75rem;
}
.photo-tab {
    padding: .5rem 1rem;
    border: 1px solid var(--border);
    background: var(--bg);
    border-radius: 6px;
    cursor: pointer;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all .2s;
}
.photo-tab:hover { border-color: var(--accent); color: var(--accent); }
.photo-tab.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}
.photo-panel { margin-bottom: .5rem; }

.camera-container {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--bg);
}
.camera-viewport {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto .875rem;
    border-radius: var(--radius);
    overflow: hidden;
    background: #111;
    aspect-ratio: 4/3;
}
.camera-viewport video,
.camera-viewport canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.camera-result {
    position: absolute;
    inset: 0;
    background: #000;
}
.camera-result img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.camera-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.face-guide-box {
    width: 55%;
    aspect-ratio: 3/4;
    border: 3px solid rgba(14, 165, 233, .8);
    border-radius: 50%;
    box-shadow: 0 0 0 4000px rgba(0, 0, 0, .25);
    animation: pulse-guide 2s ease-in-out infinite;
}
@keyframes pulse-guide {
    0%, 100% { border-color: rgba(14, 165, 233, .8); }
    50%       { border-color: rgba(14, 165, 233, 1); }
}
.camera-controls {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: center;
    margin-bottom: .5rem;
}
.camera-status {
    text-align: center;
    font-size: .8125rem;
    color: var(--text-muted);
    margin: 0;
}
.btn-danger-outline {
    border: 1px solid var(--danger);
    color: var(--danger);
    background: transparent;
}
.btn-danger-outline:hover {
    background: var(--danger);
    color: #fff;
    text-decoration: none;
}

.alert-face-error {
    border-left: 4px solid var(--danger);
    background: #fff5f5;
    padding: .875rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.face-error-title {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    font-weight: 600;
    color: #9b2c2c;
    margin-bottom: .625rem;
    font-size: .9375rem;
}
.face-error-tips {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.face-error-tips li {
    font-size: .8125rem;
    color: #9b2c2c;
}

/* ── Employee form ────────────────────────────────────────── */
.employee-form .form-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}
.employee-form .reenroll-section { margin-top: .25rem; }
.employee-form .reenroll-desc {
    margin-bottom: 1rem;
    font-size: .875rem;
    color: var(--text-muted);
}
.employee-form .current-photo-card {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.employee-form .current-photo-card img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 2px solid var(--border);
}
.employee-form .current-photo-card small {
    display: block;
    color: var(--text-muted);
    font-size: .75rem;
    margin-top: .25rem;
}
.employee-form .reenroll-actions { margin-top: 1rem; }

/* ── Employee cell ────────────────────────────────────────── */
.employee-cell { display: flex; align-items: center; gap: .5rem; }
.avatar-sm {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8rem; overflow: hidden; flex-shrink: 0;
}
.avatar-sm img { width: 100%; height: 100%; object-fit: cover; }

/* ── Confidence bar ───────────────────────────────────────── */
.confidence-bar {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .8rem;
}
.confidence-bar > div {
    flex: 1;
    background: var(--border);
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
    max-width: 80px;
}
.confidence-fill { height: 100%; background: var(--success); border-radius: 999px; }

/* ── Info table ───────────────────────────────────────────── */
.info-table { width: 100%; }
.info-table td { padding: .4rem 0; font-size: .875rem; }
.info-table td:first-child { color: var(--text-muted); width: 50%; }
.info-table td:last-child { font-weight: 600; }

/* ── Quick actions ────────────────────────────────────────── */
.quick-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 1.25rem 2rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: .875rem;
    font-weight: 500;
    transition: all .2s;
    cursor: pointer;
    text-decoration: none;
}
.quick-action-btn span:first-child { font-size: 2rem; }
.quick-action-btn:hover { background: var(--primary); color: #fff; text-decoration: none; }
.quick-action-btn .icon { color: var(--text-muted); }
.quick-action-btn:hover .icon { color: #fff; }

/* ── Section title ────────────────────────────────────────── */
.section-title {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    font-weight: 700;
    margin: 1.25rem 0 .75rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
}
.section-title-first { margin-top: 0; }

/* ── Branch form ──────────────────────────────────────────── */
.branch-form .form-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}
.branch-form .ip-whitelist-section { margin-top: .5rem; }
.branch-form .ip-whitelist-desc { margin-bottom: 1rem; font-size: .8125rem; }
.branch-form .ip-empty { margin-bottom: 1rem; font-size: .875rem; }
.branch-form .table-inset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
}
.branch-form .table-inset .data-table { margin: 0; }
.branch-form .table-inset .data-table th,
.branch-form .table-inset .data-table td { padding: .625rem 1rem; }
.branch-form .ip-add-form {
    align-items: flex-end;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.branch-form .ip-add-form .form-group { margin-bottom: 0; }
.branch-form .ip-add-form .form-group-action .btn { width: 100%; justify-content: center; }

/* ── Divider ──────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ── Misc ─────────────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
code { background: #f1f5f9; padding: .1em .35em; border-radius: 4px; font-family: monospace; font-size: .85em; }
.link-small { font-size: .75rem; }

/* ── Auth page ────────────────────────────────────────────── */
.auth-body {
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.auth-container { width: 100%; max-width: 400px; padding: 1.5rem; }
.auth-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}
.auth-brand { text-align: center; margin-bottom: 1.75rem; }
.auth-brand .brand-mark { margin: 0 auto .875rem; }
.auth-brand h1 { font-size: 1.25rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.auth-brand p { color: var(--text-muted); margin-top: .35rem; font-size: .8125rem; }
.auth-form .form-group { margin-bottom: 1.125rem; }
.auth-footer { text-align: center; margin-top: 1.25rem; color: var(--text-muted); font-size: .75rem; }
.branch-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .75rem;
    background: #eff6ff;
    color: var(--info);
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 1000; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-form .filter-row { flex-direction: column; }
    .card-header { flex-wrap: wrap; gap: .75rem; }
    .datatable-wrap .datatable-toolbar { flex-direction: column; align-items: stretch; }
    .datatable-wrap .datatable-toolbar .dataTables_filter { margin-left: 0; }
    .form-row-4 { grid-template-columns: repeat(2, 1fr); }
    .card-form-wide { max-width: 100%; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .form-row-4 { grid-template-columns: 1fr; }
    .branch-form .ip-add-form .form-group-action .btn { width: auto; }
}

/* ── DataTables ───────────────────────────────────────────── */
.datatable-wrap { padding: 1rem; }
.datatable-wrap .dataTables_wrapper { font-size: .875rem; }
.datatable-wrap .datatable-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .75rem;
}
.datatable-wrap .datatable-toolbar .dataTables_length,
.datatable-wrap .datatable-toolbar .dataTables_filter {
    float: none;
    margin: 0;
}
.datatable-wrap .datatable-toolbar .dataTables_filter {
    margin-left: auto;
    text-align: right;
}
.datatable-wrap .datatable-toolbar .dataTables_filter label {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    font-weight: 500;
}
.datatable-wrap .dataTables_length select,
.datatable-wrap .dataTables_filter input {
    padding: .35rem .5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .875rem;
    background: var(--card-bg);
    color: var(--text);
    outline: none;
}
.datatable-wrap .dataTables_filter input {
    width: 220px;
}
.datatable-wrap .dataTables_filter input:focus,
.datatable-wrap .dataTables_length select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .12);
}
.datatable-wrap .dataTables_info,
.datatable-wrap .dataTables_paginate { margin-top: .75rem; }
.datatable-wrap .dataTables_paginate .paginate_button {
    padding: .3rem .6rem !important;
    border-radius: 6px !important;
    margin-left: 2px;
}
.datatable-wrap .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
}

/* ── Icon in buttons / badges ─────────────────────────────── */
.btn .icon, .badge .icon { vertical-align: -0.15em; }
.badge .icon { width: .75rem; height: .75rem; }
.badge-icon { display: inline-flex; align-items: center; gap: .3rem; }
.upload-placeholder .icon { width: 2.5rem; height: 2.5rem; color: var(--text-muted); margin-bottom: .5rem; }
.face-error-tips li { display: flex; align-items: flex-start; gap: .5rem; }
.face-error-tips .icon { flex-shrink: 0; margin-top: .1rem; color: #9b2c2c; }
.datatable-wrap table.dataTable thead th { border-bottom: 2px solid var(--border); }
.datatable-wrap table.dataTable.no-footer { border-bottom: none; }

/* ── Image preview modal ──────────────────────────────────── */
.img-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.img-modal[hidden] { display: none !important; }
.img-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .65);
}
.img-modal-dialog {
    position: relative;
    z-index: 1;
    max-width: min(90vw, 640px);
    max-height: 90vh;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: .5rem;
    box-shadow: var(--shadow-md);
}
.img-modal-dialog img {
    display: block;
    max-width: 100%;
    max-height: calc(90vh - 2rem);
    border-radius: 6px;
    object-fit: contain;
}
.img-modal-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--dark);
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}
