:root {
    --admin-sidebar: 254px;
    --admin-topbar: 78px;
    --admin-bg: #f5f7fb;
    --admin-surface: #ffffff;
    --admin-border: #e5e9f2;
    --admin-text: #152033;
    --admin-muted: #6b778c;
    --admin-primary: #5b5ce2;
    --admin-primary-dark: #4748c9;
    --admin-success: #139b72;
    --admin-danger: #d94b64;
}

* { box-sizing: border-box; }
html { background: var(--admin-bg); }

body.admin-body {
    min-height: 100vh;
    margin: 0 !important;
    padding: calc(var(--admin-topbar) + 30px) 32px 56px calc(var(--admin-sidebar) + 32px) !important;
    background: radial-gradient(circle at 82% 2%, rgba(91, 92, 226, .08), transparent 26rem), var(--admin-bg) !important;
    color: var(--admin-text) !important;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    font-size: 14px;
    line-height: 1.5;
}

.admin-body > *:not(.admin-sidebar):not(.admin-topbar):not(.admin-overlay):not(script):not(link) {
    width: 100%;
    max-width: 1480px;
    margin-left: auto;
    margin-right: auto;
}

.admin-sidebar {
    position: fixed;
    z-index: 1000;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    width: var(--admin-sidebar);
    padding: 24px 18px 20px;
    overflow-y: auto;
    color: #dbe2f2;
    background: radial-gradient(circle at 0 0, rgba(112, 114, 255, .2), transparent 18rem), linear-gradient(180deg, #172039 0%, #10172a 100%);
    border-right: 1px solid rgba(255, 255, 255, .06);
    box-shadow: 18px 0 50px rgba(16, 23, 42, .08);
}

.admin-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 0 8px 25px;
    color: #fff !important;
    text-decoration: none !important;
}

.admin-brand-mark {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, #7778ff, #5557df);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 13px;
    box-shadow: 0 8px 22px rgba(70, 72, 200, .4);
}

.admin-brand-mark svg { width: 27px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.admin-brand strong, .admin-brand small { display: block; }
.admin-brand strong { font-size: 15px; letter-spacing: .01em; }
.admin-brand small { margin-top: 1px; color: #9ba9c3; font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.admin-nav-label { padding: 0 12px 9px; color: #75829d; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.admin-nav { display: grid; gap: 5px; padding: 0 !important; background: transparent !important; }

.admin-nav a {
    position: relative;
    display: flex;
    gap: 12px;
    align-items: center;
    min-height: 45px;
    margin: 0 !important;
    padding: 0 13px;
    color: #aeb9ce !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    border: 1px solid transparent;
    border-radius: 11px;
    transition: color .18s ease, background .18s ease, transform .18s ease;
}

.admin-nav a:hover { color: #fff !important; background: rgba(255,255,255,.055); transform: translateX(2px); }
.admin-nav a.is-active { color: #fff !important; background: linear-gradient(110deg, rgba(101, 103, 238, .92), rgba(88, 90, 216, .82)); border-color: rgba(255,255,255,.08); box-shadow: 0 9px 24px rgba(49, 50, 148, .28); }
.admin-nav a.is-active::after { position: absolute; right: 12px; width: 4px; height: 4px; content: ''; background: #fff; border-radius: 50%; box-shadow: 0 0 0 4px rgba(255,255,255,.13); }
.admin-nav svg { flex: 0 0 19px; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.admin-sidebar-footer { display: flex; gap: 10px; align-items: center; margin-top: auto; padding: 15px 12px 4px; color: #aeb9ce; border-top: 1px solid rgba(255,255,255,.07); }
.admin-sidebar-footer strong, .admin-sidebar-footer small { display: block; }
.admin-sidebar-footer strong { color: #dfe5f1; font-size: 11px; }
.admin-sidebar-footer small { margin-top: 1px; color: #73809a; font-size: 10px; }
.admin-status-dot { flex: 0 0 8px; width: 8px; height: 8px; background: #4ed2a7; border-radius: 50%; box-shadow: 0 0 0 4px rgba(78,210,167,.13); }

.admin-topbar {
    position: fixed;
    z-index: 900;
    top: 0;
    right: 0;
    left: var(--admin-sidebar);
    display: flex;
    align-items: center;
    height: var(--admin-topbar);
    padding: 0 32px;
    background: rgba(255,255,255,.86);
    border-bottom: 1px solid rgba(225,229,239,.9);
    box-shadow: 0 4px 18px rgba(26,36,60,.035);
    backdrop-filter: blur(16px);
}

.admin-page-context span, .admin-page-context strong { display: block; }
.admin-page-context span { margin-bottom: 2px; color: #929caf; font-size: 10px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.admin-page-context strong { color: #243048; font-size: 14px; }
.admin-user { display: flex; gap: 11px; align-items: center; margin-left: auto; }
.admin-user-copy { text-align: right; }
.admin-user-copy strong, .admin-user-copy small { display: block; }
.admin-user-copy strong { color: #263249; font-size: 12px; }
.admin-user-copy small { color: #8a95a8; font-size: 10px; }
.admin-avatar { display: grid; width: 38px; height: 38px; place-items: center; color: #fff; font-size: 13px; font-weight: 700; background: linear-gradient(145deg, #6869e8, #4e50c8); border-radius: 12px; box-shadow: 0 7px 18px rgba(78,80,200,.22); }
.admin-menu-toggle, .admin-overlay { display: none !important; }

.admin-body h1, .admin-body h2, .admin-body h3 { color: var(--admin-text); letter-spacing: -.025em; }
.admin-body h1 { margin-top: 0; margin-bottom: 20px; font-size: clamp(24px, 2.1vw, 32px); line-height: 1.2; }
.admin-body h2 { margin-top: 28px; margin-bottom: 14px; font-size: 19px; }
.admin-body h3 { font-size: 15px; }
.admin-page-title { position: relative; padding-left: 16px; }
.admin-page-title::before { position: absolute; top: .13em; bottom: .13em; left: 0; width: 4px; content: ''; background: linear-gradient(180deg, #7778f2, #4d4fc9); border-radius: 99px; }
.admin-body a { color: var(--admin-primary); text-decoration: none; }
.admin-body a:hover { color: var(--admin-primary-dark); text-decoration: none; }

.admin-notice { margin: -4px 0 20px; padding: 12px 14px; color: #4c5870; font-size: 12px; font-weight: 600; background: #f0f3f8; border: 1px solid #dfe4ed; border-radius: 11px; }
.admin-notice.success { color: #087553; background: #eaf8f3; border-color: #bde8d9; }
.admin-notice.warning { color: #9a5d0b; background: #fff7e8; border-color: #f1d49d; }

.admin-body > form, .admin-body .filter, .admin-body .section, .admin-body .card {
    background: var(--admin-surface) !important;
    border: 1px solid var(--admin-border) !important;
    border-radius: 16px !important;
    box-shadow: 0 7px 26px rgba(28, 38, 63, .055) !important;
}

.admin-body > form { margin-bottom: 30px; padding: 22px 24px; }
.admin-body > form > h2:first-child { margin-top: 0; }
.admin-page-index > form, .admin-page-facturi > form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.admin-page-index > form h2, .admin-page-facturi > form h2 { flex: 0 0 100%; }
.admin-page-facturi > form label { flex: 0 0 100%; margin-bottom: -7px; }
.admin-page-facturi > form #hosting_hint { flex: 1 0 100%; }

.admin-body label { color: #435068; font-size: 12px; font-weight: 600; }
.admin-body input:not([type="checkbox"]):not([type="radio"]), .admin-body select, .admin-body textarea {
    min-height: 42px;
    padding: 9px 11px !important;
    color: #233048 !important;
    font: inherit;
    background: #fff !important;
    border: 1px solid #dce1eb !important;
    border-radius: 10px !important;
    outline: none;
    box-shadow: 0 1px 2px rgba(20,30,50,.02);
    transition: border .18s ease, box-shadow .18s ease;
}

.admin-body input:not([type="checkbox"]):not([type="radio"]):focus, .admin-body select:focus, .admin-body textarea:focus { border-color: #8c8df0 !important; box-shadow: 0 0 0 3px rgba(91,92,226,.11) !important; }
.admin-body input::placeholder, .admin-body textarea::placeholder { color: #a1a9b8; }
.admin-body textarea { min-height: 86px; resize: vertical; }
.admin-body select[multiple] { min-height: 130px; }
.admin-body input[type="file"] { padding: 6px !important; background: #f8fafc !important; }
.admin-body input[type="file"]::file-selector-button { margin-right: 10px; padding: 7px 10px; color: #4143b7; font: inherit; font-size: 12px; font-weight: 600; background: #eeeeff; border: 0; border-radius: 7px; cursor: pointer; }
.admin-body input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--admin-primary); }

.admin-body button, .admin-body .btn {
    display: inline-flex;
    gap: 7px;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px !important;
    color: #fff !important;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    background: linear-gradient(135deg, #6869e9, #5052cb) !important;
    border: 0 !important;
    border-radius: 10px !important;
    cursor: pointer;
    box-shadow: 0 7px 16px rgba(80,82,203,.18);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.admin-body button:hover, .admin-body .btn:hover { filter: brightness(1.04); transform: translateY(-1px); box-shadow: 0 9px 20px rgba(80,82,203,.24); }
.admin-body button[type="button"] { color: #465269 !important; background: #eef0f6 !important; box-shadow: none; }
.admin-body button.danger { color: #fff !important; background: linear-gradient(135deg, #e35b70, #c83e57) !important; }
.form-row { display: grid; grid-template-columns: minmax(150px, 190px) minmax(220px, 520px); gap: 10px 16px; align-items: center; margin-bottom: 14px !important; }
.form-row label { min-width: 0 !important; }
.form-row .small { grid-column: 2; }

.admin-table-scroll {
    width: 100%;
    margin: 8px 0 26px;
    overflow-x: auto;
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 15px;
    box-shadow: 0 7px 26px rgba(28,38,63,.05);
    scrollbar-color: #c5ccda transparent;
    scrollbar-width: thin;
}

.admin-table-scroll table { width: 100% !important; min-width: 100%; margin: 0 !important; table-layout: auto; border-collapse: separate !important; border-spacing: 0 !important; background: transparent !important; }
.admin-table-scroll th, .admin-table-scroll td { min-width: 0; padding: 12px 11px !important; overflow-wrap: anywhere; color: #354158 !important; font-size: 12px !important; text-align: left; vertical-align: middle; background-clip: padding-box; border: 0 !important; border-bottom: 1px solid #edf0f5 !important; }
.admin-table-scroll th { position: sticky; top: 0; z-index: 1; color: #707c91 !important; font-size: 10px !important; font-weight: 700 !important; letter-spacing: .065em; text-transform: uppercase; background: #f8f9fc !important; }
.admin-table-scroll tbody tr { transition: background .15s ease; }
.admin-table-scroll tbody tr:hover { background: #fafbff !important; }
.admin-table-scroll tbody tr:last-child td { border-bottom: 0 !important; }
.admin-table-scroll td.num, .admin-table-scroll td.right, .admin-table-scroll th.right { text-align: right !important; font-variant-numeric: tabular-nums; }
.admin-table-scroll td form { display: flex !important; gap: 6px; align-items: center; flex-wrap: wrap; }
.admin-table-scroll td form input { width: 135px; min-height: 34px !important; padding: 6px 8px !important; font-size: 11px !important; }
.admin-table-scroll td form button { min-height: 34px; padding: 6px 10px !important; }
.admin-table-scroll td input, .admin-table-scroll td select, .admin-table-scroll td textarea { max-width: 100% !important; min-width: 0 !important; }
.admin-table-scroll td:last-child > a { display: inline-block; margin: 2px 3px 2px 0; padding: 5px 8px; color: #4e50c7; font-size: 11px; font-weight: 700; white-space: nowrap; background: #eeeeff; border-radius: 7px; }
.admin-table-scroll a[href*="delete"], .admin-table-scroll a[href*="sterge"] { color: #c64058 !important; background: #fff0f3 !important; }
.admin-table-scroll a[href*="mark_paid"] { color: #087d5b !important; background: #e9f8f3 !important; }

.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; white-space: nowrap !important; border: 0 !important; clip: rect(0, 0, 0, 0) !important; }
.admin-table-tools, .admin-table-pagination { display: flex; gap: 12px; align-items: center; justify-content: space-between; width: 100%; }
.admin-table-tools { margin: 8px 0 10px; }
.admin-table-search { position: relative; display: block; width: min(330px, 100%); }
.admin-table-search svg { position: absolute; z-index: 1; top: 50%; left: 12px; width: 17px; height: 17px; fill: none; stroke: #8a95a8; stroke-width: 1.8; stroke-linecap: round; transform: translateY(-50%); pointer-events: none; }
.admin-table-search input { width: 100%; padding-left: 38px !important; background: #fff !important; }
.admin-page-size { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.admin-page-size select { width: 72px; min-height: 38px; padding: 6px 9px !important; }
.admin-table-scroll.has-pagination { margin-bottom: 10px; }
.admin-table-pagination { margin: 0 0 28px; color: var(--admin-muted); font-size: 11px; }
.admin-pagination-actions { display: flex; gap: 8px; align-items: center; }
.admin-pagination-actions button { min-height: 34px !important; padding: 6px 10px !important; color: #505d73 !important; background: #fff !important; border: 1px solid #dfe4ed !important; box-shadow: none !important; }
.admin-pagination-actions button:hover:not(:disabled) { color: var(--admin-primary) !important; border-color: #b8b9ef !important; transform: none; }
.admin-pagination-actions button:disabled { cursor: not-allowed; opacity: .45; }
.admin-pagination-page { min-width: 82px; color: #4d596e; font-weight: 600; text-align: center; }
.admin-table-scroll tr[hidden] { display: none !important; }

.admin-body .wrap { max-width: 1480px !important; margin: 0 auto !important; padding: 0 !important; }
.admin-body .dashboard { gap: 14px !important; }
.admin-body .dashboard .card { position: relative; min-height: 126px; padding: 18px !important; overflow: hidden; }
.admin-body .dashboard .card::after { position: absolute; top: -26px; right: -22px; width: 82px; height: 82px; content: ''; background: linear-gradient(135deg, rgba(91,92,226,.13), rgba(91,92,226,.02)); border-radius: 50%; }
.admin-body .dashboard .card h3 { color: #7c8799 !important; font-size: 11px !important; letter-spacing: .04em; text-transform: uppercase; }
.admin-body .dashboard .card .big { color: #202c43; font-size: 23px !important; font-weight: 700; }
.admin-body .filter { padding: 16px 18px !important; }
.admin-body .section { padding: 20px !important; }
.admin-body .section .admin-table-scroll { margin-bottom: 8px; box-shadow: none; }
.admin-body .bar { height: 8px !important; background: #edf0f6 !important; }
.admin-body .bar > i { height: 8px !important; background: linear-gradient(90deg, #797af0, #5557ce) !important; border-radius: 99px; }

.admin-body .badge, .admin-body .pill, .admin-body .badge-time, .admin-body .pills span { border-radius: 999px !important; font-size: 10px !important; font-weight: 700 !important; }
.admin-body .status-citit, .admin-body .badge-on, .admin-body .pill.ok { color: #087d5b !important; }
.admin-body .status-necitit, .admin-body .badge-off, .admin-body .pill.off { color: #c64058 !important; }
.admin-body .small, .admin-body .sub, .admin-body .hint, .admin-body .meta { color: var(--admin-muted) !important; }
.admin-body tr.row-inactive { opacity: .58; }
.admin-body tr.row-overdue, .admin-body tr.overdue { background: #fff3f5 !important; }
.admin-body tr.row-today, .admin-body tr.due-today { background: #fff8eb !important; }
.admin-body tr.row-soon { background: #fffbea !important; }
.admin-body tr.row-week { background: #f1f7ff !important; }
.admin-page-manage_hosting_accounts .container { max-width: 1480px !important; margin: 0 auto !important; padding: 0 !important; }
.admin-page-manage_hosting_accounts .grid { gap: 18px !important; }
.admin-page-manage_hosting_accounts .card { padding: 20px !important; }
.admin-page-manage_hosting_accounts .ghost { color: #4d4fc4 !important; background: #f0f0ff !important; border: 0 !important; }

/* Facturile folosesc toate lățimea disponibilă, fără scrollbar pe desktop. */
.admin-page-facturi .admin-table-scroll table { table-layout: fixed; }
.admin-page-facturi .admin-table-scroll th:nth-child(1) { width: 4%; }
.admin-page-facturi .admin-table-scroll th:nth-child(2) { width: 19%; }
.admin-page-facturi .admin-table-scroll th:nth-child(3) { width: 11%; }
.admin-page-facturi .admin-table-scroll th:nth-child(4) { width: 12%; }
.admin-page-facturi .admin-table-scroll th:nth-child(5) { width: 8%; }
.admin-page-facturi .admin-table-scroll th:nth-child(6) { width: 8%; }
.admin-page-facturi .admin-table-scroll th:nth-child(7) { width: 13%; }
.admin-page-facturi .admin-table-scroll th:nth-child(8) { width: 10%; }
.admin-page-facturi .admin-table-scroll th:nth-child(9) { width: 15%; }

@media (max-width: 1050px) {
    .admin-body { padding-right: 22px !important; padding-left: calc(var(--admin-sidebar) + 22px) !important; }
    .admin-topbar { padding: 0 22px; }
}

@media (max-width: 820px) {
    body.admin-body { padding: calc(68px + 22px) 16px 42px !important; }
    .admin-sidebar { width: min(286px, 84vw); transform: translateX(-105%); transition: transform .24s ease; }
    .admin-topbar { left: 0; height: 68px; padding: 0 16px; }
    .admin-menu-toggle { display: grid !important; width: 38px; min-height: 38px !important; margin-right: 12px; padding: 0 !important; place-items: center; color: #465269 !important; background: #f0f2f7 !important; border-radius: 10px !important; box-shadow: none !important; }
    .admin-menu-toggle svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
    .admin-body .admin-overlay { position: fixed; z-index: 950; inset: 0; display: block !important; width: auto !important; max-width: none !important; padding: 0 !important; pointer-events: none; background: rgba(11,17,32,.48) !important; border-radius: 0 !important; opacity: 0; box-shadow: none !important; transform: none; transition: opacity .2s ease; }
    .admin-menu-open { overflow: hidden; }
    .admin-menu-open .admin-sidebar { transform: translateX(0); }
    .admin-menu-open .admin-overlay { pointer-events: auto; opacity: 1; }
    .admin-user-copy { display: none; }
    .admin-page-context strong { font-size: 12px; }
    .admin-body h1 { font-size: 25px; }
    .form-row { grid-template-columns: 1fr; }
    .form-row .small { grid-column: 1; }
    .admin-body > form { padding: 18px; }
    .admin-page-index > form, .admin-page-facturi > form { align-items: stretch; }
    .admin-page-index > form input, .admin-page-facturi > form input, .admin-page-facturi > form select { width: 100%; max-width: none !important; }
    .admin-page-manage_hosting_accounts .grid { grid-template-columns: 1fr !important; }
    .admin-table-scroll table { min-width: max-content; table-layout: auto; }
    .admin-page-facturi .admin-table-scroll table { table-layout: auto; }
    .admin-table-tools { align-items: stretch; }
    .admin-table-search { flex: 1; }
    .admin-table-pagination { align-items: flex-start; flex-direction: column; }
    .admin-pagination-actions { width: 100%; justify-content: space-between; }
}

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

body.login-page {
    display: grid;
    min-height: 100vh;
    margin: 0;
    padding: 30px;
    place-content: center;
    color: var(--admin-text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at 20% 10%, rgba(91,92,226,.17), transparent 28rem), #f4f6fb;
}

.login-card { width: min(420px, calc(100vw - 32px)); padding: 34px; background: #fff; border: 1px solid var(--admin-border); border-radius: 20px; box-shadow: 0 12px 36px rgba(23,32,56,.1); }
.login-card .admin-brand { padding: 0 0 28px; color: var(--admin-text) !important; }
.login-card .admin-brand small { color: var(--admin-muted); }
.login-card h1 { margin: 0 0 7px; font-size: 27px; letter-spacing: -.03em; }
.login-card > p { margin: 0 0 24px; color: var(--admin-muted); }
.login-card form { display: grid; gap: 8px; }
.login-card label { margin-top: 8px; color: #435068; font-size: 12px; font-weight: 600; }
.login-card input { min-height: 44px; padding: 10px 12px; font: inherit; border: 1px solid #dce1eb; border-radius: 10px; outline: 0; }
.login-card input:focus { border-color: #8c8df0; box-shadow: 0 0 0 3px rgba(91,92,226,.11); }
.login-card button { min-height: 44px; margin-top: 14px; color: #fff; font: inherit; font-weight: 700; background: linear-gradient(135deg, #6869e9, #5052cb); border: 0; border-radius: 10px; cursor: pointer; box-shadow: 0 8px 18px rgba(80,82,203,.2); }
.login-error { padding: 10px 12px; color: #b8344c !important; font-size: 12px; background: #fff0f3; border-radius: 9px; }
