/* ===========================================================================
   Manage App — dashboard (accent portocaliu)
   =========================================================================== */

:root {
    --accent: #f97316;
    --accent-hover: #ea580c;
    --accent-active: #c2410c;
    --accent-bg: #fff7ed;
    --accent-bg-strong: #ffedd5;

    --bg: #ffffff;
    --bg-subtle: #f9fafb;
    --bg-hover: #f9fafb;

    --border: #ececee;
    --border-strong: #e5e7eb;

    --text: #111827;
    --text-muted: #6b7280;
    --text-faint: #9ca3af;

    --radius: 12px;
    --radius-sm: 8px;

    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.06);

    --sidebar-w: 240px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
svg { display: block; }

/* ── App shell ───────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    border-right: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 18px;
}

.brand-logo {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: linear-gradient(140deg, #fb923c, var(--accent));
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.35);
}

.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.2px; }

.nav { padding: 6px 12px; flex: 1; }

.nav-section {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-faint);
    padding: 12px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--bg-subtle); color: var(--text); }
.nav-item.is-active { background: var(--accent-bg); color: var(--accent-active); }
.nav-item.is-active svg { color: var(--accent); }

.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }

.admin-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
}
.admin-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--accent-bg-strong);
    color: var(--accent-active);
    font-weight: 700;
    font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
}
.admin-meta { flex: 1; min-width: 0; }
.admin-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-role { font-size: 11.5px; color: var(--text-faint); }
.logout {
    color: var(--text-faint);
    padding: 6px;
    border-radius: 8px;
    display: flex;
    flex: 0 0 auto;
}
.logout:hover { color: var(--accent); background: var(--accent-bg); }

/* ── Main ────────────────────────────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-muted); }
.breadcrumb .sep { color: var(--text-faint); }
.breadcrumb .current { color: var(--text); font-weight: 500; }

.support {
    display: flex; align-items: center; gap: 7px;
    font-size: 13.5px; color: var(--text-muted);
    padding: 6px 10px; border-radius: 8px;
}
.support:hover { color: var(--text); background: var(--bg-subtle); }

.content { padding: 28px 32px 48px; max-width: 1280px; width: 100%; }

/* ── Page head ───────────────────────────────────────────────────────────── */
.page-head { margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.page-sub { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}
.stat-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    background: var(--accent-bg);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
}
.stat-label { font-size: 13px; color: var(--text-muted); }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.2; }

/* ── Card + table ────────────────────────────────────────────────────────── */
.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.search { position: relative; flex: 1; max-width: 380px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.search input {
    width: 100%;
    height: 38px;
    padding: 0 34px 0 34px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 13.5px;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search input::placeholder { color: var(--text-faint); }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12); }
.search-clear {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-faint); font-size: 16px; line-height: 1;
}
.search-clear:hover { background: var(--bg-subtle); color: var(--text); }
.search-clear[hidden] { display: none; }

/* Spinner de căutare live (afișat cât timp rulează cererea AJAX). */
.search-spinner {
    position: absolute; right: 12px; top: 50%; margin-top: -7.5px;
    width: 15px; height: 15px; box-sizing: border-box;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    display: none;
    animation: spin 0.6s linear infinite;
}
.search.is-loading .search-spinner { display: block; }
.search.is-loading .search-clear { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.toolbar-right { color: var(--text-muted); font-size: 13px; }

/* Tabelul se estompează ușor cât timp se încarcă rezultatele căutării live. */
.table-card .table-wrap { transition: opacity 0.15s ease; }
.table-card.is-searching .table-wrap { opacity: 0.5; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table thead th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-subtle);
    white-space: nowrap;
}
.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg-hover); }
.table .muted { color: var(--text-muted); white-space: nowrap; }

.user-cell { display: flex; align-items: center; gap: 12px; }
.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--accent-bg-strong);
    color: var(--accent-active);
    font-weight: 600;
    font-size: 12.5px;
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
}
.user-name { font-weight: 600; font-size: 14px; }
.user-email { font-size: 12.5px; color: var(--text-faint); }

.badge {
    display: inline-flex; align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid transparent;
}
.badge-active   { background: #ecfdf3; color: #067647; border-color: #abefc6; }
.badge-inactive { background: #f2f4f7; color: #475467; border-color: #e4e7ec; }
.badge-pending  { background: var(--accent-bg); color: var(--accent-active); border-color: var(--accent-bg-strong); }

.empty {
    display: flex; flex-direction: column; align-items: center;
    gap: 10px; padding: 48px 16px; color: var(--text-faint);
}
.empty p { margin: 0; font-size: 13.5px; }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}
.per-page { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; }
.per-page select {
    height: 32px;
    padding: 0 26px 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 13px;
    color: var(--text);
    background: var(--bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 8px center;
    -webkit-appearance: none; appearance: none;
    cursor: pointer;
}
.per-page select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12); }

.pager { display: flex; align-items: center; gap: 8px; }
.pager-info { font-size: 13px; color: var(--text-muted); margin-right: 4px; }
.pager-btn {
    width: 32px; height: 32px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--text); font-size: 18px; line-height: 1;
    transition: background 0.12s, border-color 0.12s;
}
.pager-btn:hover { background: var(--bg-subtle); border-color: var(--accent); color: var(--accent); }
.pager-btn.is-disabled { color: var(--text-faint); pointer-events: none; opacity: 0.5; }

/* ── Notice ──────────────────────────────────────────────────────────────── */
.notice {
    border-radius: var(--radius);
    padding: 16px 18px;
    font-size: 14px;
}
.notice-error { background: #fef3f2; border: 1px solid #fecdca; color: #b42318; }
.notice p { margin: 6px 0 0; }
.notice code { background: rgba(0, 0, 0, 0.06); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.notice-detail { font-size: 12.5px; opacity: 0.85; word-break: break-word; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
    height: 42px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(140deg, #fb923c, var(--accent));
    color: #fff;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.28);
    transition: filter 0.15s;
}
.btn-primary:hover { filter: brightness(1.05); }

/* ── Login ───────────────────────────────────────────────────────────────── */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(700px 380px at 50% -8%, rgba(249, 115, 22, 0.10), transparent 60%),
        var(--bg-subtle);
    padding: 24px;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    padding: 28px;
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.auth-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }
.auth-sub { margin: 4px 0 20px; color: var(--text-muted); font-size: 14px; }
.auth-error {
    background: #fef3f2; border: 1px solid #fecdca; color: #b42318;
    padding: 10px 12px; border-radius: var(--radius-sm);
    font-size: 13px; margin-bottom: 16px;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.field input {
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12); }
.auth-form .btn-primary { margin-top: 4px; }

/* ── Flash ───────────────────────────────────────────────────────────────── */
.flash {
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 18px;
    border: 1px solid transparent;
}
.flash-success { background: #ecfdf3; color: #067647; border-color: #abefc6; }
.flash-error   { background: #fef3f2; color: #b42318; border-color: #fecdca; }

/* ── Delete action ───────────────────────────────────────────────────────── */
.col-actions { width: 52px; text-align: right; }
.btn-del {
    width: 32px; height: 32px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-faint);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.btn-del:hover { color: #d92d20; background: #fef3f2; border-color: #fecdca; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 50;
}
.modal-overlay[hidden] { display: none; }
.modal {
    width: 100%;
    max-width: 420px;
    background: var(--bg);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    padding: 22px;
}
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.modal-icon {
    width: 42px; height: 42px; flex: 0 0 auto;
    border-radius: 10px;
    background: #fef3f2; color: #d92d20;
    display: flex; align-items: center; justify-content: center;
}
.modal-title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.modal-sub { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }
.modal-text { font-size: 13.5px; color: var(--text); margin: 0 0 10px; }
.modal-text strong { font-weight: 600; }

.email-copy {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 8px 8px 12px;
    margin-bottom: 14px;
}
.email-copy code {
    flex: 1; min-width: 0;
    font-size: 13px;
    color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.copy-btn {
    flex: 0 0 auto;
    width: 30px; height: 30px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: var(--bg);
    color: var(--text-muted);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.copy-btn.copied { color: #067647; border-color: #abefc6; }

.modal-input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font: inherit;
    font-size: 13.5px;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.modal-input:focus { border-color: #d92d20; box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.10); }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.btn-ghost {
    height: 40px; padding: 0 16px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font: inherit; font-weight: 600; font-size: 13.5px;
    cursor: pointer;
}
.btn-ghost:hover { background: var(--bg-subtle); }
.btn-danger {
    height: 40px; padding: 0 16px;
    border: none;
    border-radius: 10px;
    background: #d92d20;
    color: #fff;
    font: inherit; font-weight: 600; font-size: 13.5px;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}
.btn-danger:hover { background: #b42318; }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    .stats { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 20; transform: translateX(-100%); }
    .content { padding: 20px 16px 40px; }
    .topbar { padding: 12px 16px; }
}
