:root {
    --cx-orange:       #ff9e1b;
    --cx-bg:           #111111;
    --cx-surface:      #1a1a1a;
    --cx-surface-deep: #0d0d0d;
    --cx-surface-mid:  #222222;
    --cx-border:       #2a2a2a;
    --cx-border-input: #333333;
    --cx-text:         #ffffff;
    --cx-text-muted:   #cccccc;
    --cx-text-dim:     #888888;
    --cx-text-faint:   #555555;
    --cx-font:         'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ── Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--cx-font);
    background-color: var(--cx-bg);
    color: var(--cx-text-muted);
    margin: 0;
    min-height: 100vh;
}

a { color: var(--cx-orange); text-decoration: none; }
a:hover { color: #ffb84d; text-decoration: underline; }

/* ── Blank layout (login / register / logout) ─────────── */
.cx-blank-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.cx-blank-bg {
    flex: 1;
    background-color: var(--cx-bg);
    background-image: radial-gradient(ellipse 65% 55% at 50% 38%,
        rgba(255, 158, 27, 0.07) 0%,
        rgba(255, 158, 27, 0.02) 55%,
        transparent 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.cx-top-bar {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cx-text-dim);
    margin-bottom: 18px;
}

/* ── Auth card ────────────────────────────────────────── */
.cx-card {
    background: var(--cx-surface);
    border: 1px solid var(--cx-border);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    width: 100%;
    max-width: 560px;
    overflow: hidden;
}

.cx-card-header {
    background: var(--cx-surface-deep);
    border-top: 3px solid var(--cx-orange);
    padding: 32px 36px 26px;
    text-align: center;
}

.cx-card-header img.cx-logo {
    height: 56px;
    margin-bottom: 14px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.cx-card-header h1 {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--cx-text);
    margin: 0;
}

.cx-card-body {
    padding: 30px 36px 28px;
}

.cx-card-footer {
    background: var(--cx-surface-deep);
    border-top: 1px solid var(--cx-border);
    padding: 14px 36px;
    font-size: 0.75rem;
    color: var(--cx-text-dim);
    text-align: center;
}

/* ── Form controls ────────────────────────────────────── */
.cx-form-group {
    margin-bottom: 16px;
}

.cx-form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--cx-text-muted);
    margin-bottom: 6px;
}

.cx-input-wrap {
    position: relative;
}

.cx-input-wrap .cx-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cx-text-faint);
    font-size: 1rem;
    pointer-events: none;
}

.cx-input-wrap input,
.cx-input {
    width: 100%;
    background: var(--cx-surface-deep);
    border: 1.5px solid var(--cx-border-input);
    border-radius: 8px;
    color: var(--cx-text);
    font-family: var(--cx-font);
    font-size: 0.95rem;
    padding: 11px 14px;
    transition: border-color 0.18s, box-shadow 0.18s;
    outline: none;
}

.cx-input-wrap input {
    padding-left: 38px;
}

.cx-input-wrap input::placeholder,
.cx-input::placeholder { color: var(--cx-text-faint); }

.cx-input-wrap input:focus,
.cx-input:focus {
    border-color: var(--cx-orange);
    box-shadow: 0 0 0 3px rgba(255, 158, 27, 0.15);
}

/* validation */
.cx-input-wrap input.input-validation-error,
.cx-input.input-validation-error {
    border-color: #e05c5c;
}

.field-validation-error {
    display: block;
    font-size: 0.77rem;
    color: #e07070;
    margin-top: 4px;
}

/* ── Checkbox row ─────────────────────────────────────── */
.cx-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.cx-check-row input[type="checkbox"] {
    accent-color: var(--cx-orange);
    width: 16px;
    height: 16px;
}

.cx-check-row label {
    font-size: 0.875rem;
    color: var(--cx-text-muted);
    cursor: pointer;
    margin: 0;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn-cx {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: var(--cx-orange);
    color: #000;
    font-family: var(--cx-font);
    font-size: 1rem;
    font-weight: 700;
    padding: 13px 22px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.18s, transform 0.15s, box-shadow 0.18s;
    text-decoration: none;
}

.btn-cx:hover {
    opacity: 0.88;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 158, 27, 0.3);
    color: #000;
    text-decoration: none;
}

.btn-cx:active { transform: translateY(0); opacity: 0.8; }

.btn-cx-full { width: 100%; }

.btn-cx-outline {
    background: transparent;
    color: var(--cx-orange);
    border: 1.5px solid var(--cx-orange);
}

.btn-cx-outline:hover {
    background: rgba(255, 158, 27, 0.08);
    color: var(--cx-orange);
}

/* pill shape (logout in footer) */
.btn-cx-pill {
    border-radius: 20px;
    font-size: 0.85rem;
    padding: 7px 18px;
}

/* ── Alert / error box ────────────────────────────────── */
.cx-alert {
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 0.875rem;
    margin-bottom: 18px;
}

.cx-alert-error {
    background: rgba(224, 80, 80, 0.12);
    border: 1px solid rgba(224, 80, 80, 0.35);
    color: #f09090;
}

.cx-alert-success {
    background: rgba(60, 180, 100, 0.12);
    border: 1px solid rgba(60, 180, 100, 0.35);
    color: #7adda0;
}

/* ── Divider prompt ───────────────────────────────────── */
.cx-divider {
    border-top: 1px solid var(--cx-border);
    margin: 22px 0 18px;
}

.cx-signup-prompt {
    text-align: center;
    font-size: 0.875rem;
    color: var(--cx-text-dim);
}

/* ── Logout icon animation ────────────────────────────── */
.cx-logout-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 158, 27, 0.12);
    border: 2px solid rgba(255, 158, 27, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--cx-orange);
    margin: 0 auto 20px;
    animation: cx-pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes cx-pop-in {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* ── Portal layout (authenticated) ───────────────────── */
.cx-portal-wrap {
    min-height: 100vh;
    background-color: var(--cx-bg);
    background-image: radial-gradient(ellipse 80% 50% at 50% 0%,
        rgba(255, 158, 27, 0.05) 0%,
        transparent 70%);
    display: flex;
    flex-direction: column;
}

.cx-portal-header {
    background: var(--cx-surface-deep);
    border-bottom: 1px solid var(--cx-border);
    padding: 0 28px;
    height: 62px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.cx-portal-header-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

.cx-portal-header-username {
    font-size: 0.85rem;
    color: var(--cx-text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
}

.cx-portal-header img.cx-logo {
    height: 42px;
}

.cx-portal-header .cx-portal-title {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--cx-text);
    letter-spacing: -0.02em;
}

.cx-portal-content {
    flex: 1;
    padding: 28px 32px 20px;
    width: 100%;
}

.cx-portal-footer {
    background: var(--cx-surface-deep);
    border-top: 1px solid var(--cx-border);
    padding: 12px 28px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    font-size: 0.78rem;
    color: var(--cx-text-dim);
}

.cx-portal-footer span:nth-child(2) {
    text-align: center;
}

.cx-portal-footer span:nth-child(3) {
    text-align: right;
}

/* ── Index menu cards ─────────────────────────────────── */
.cx-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.cx-menu-card {
    background: var(--cx-surface);
    border: 1px solid var(--cx-border);
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cx-menu-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.cx-menu-card-header {
    background: var(--cx-surface-deep);
    border-top: 3px solid var(--cx-orange);
    padding: 14px 18px 12px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--cx-text);
}

.cx-menu-card-body {
    padding: 14px 14px 16px;
}

.cx-section-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--cx-text-faint);
    padding: 0 6px;
    margin-bottom: 6px;
}

.cx-menu-btn {
    display: flex;
    align-items: center;
    width: 100%;
    background: var(--cx-surface-mid);
    color: var(--cx-text-muted);
    border: 1.5px solid transparent;
    border-radius: 8px;
    padding: 9px 12px;
    font-family: var(--cx-font);
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.18s, color 0.18s, transform 0.15s;
    margin-bottom: 6px;
}

.cx-menu-btn:hover {
    border-color: var(--cx-orange);
    color: var(--cx-orange);
    transform: translateX(3px);
    text-decoration: none;
}

/* ── Blank layout footer ──────────────────────────────── */
.cx-blank-footer {
    text-align: center;
    font-size: 0.78rem;
    color: var(--cx-text-faint);
    padding: 16px;
}

.cx-blank-footer a {
    color: var(--cx-text-faint);
}

.cx-blank-footer a:hover {
    color: var(--cx-text-dim);
    text-decoration: none;
}

/* ── Audit log filter bar ─────────────────────────────── */
.cx-audit-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    background: var(--cx-surface);
    border: 1px solid var(--cx-border);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    padding: 14px 16px;
}

.cx-audit-filter-input {
    background: var(--cx-surface-deep);
    border: 1.5px solid var(--cx-border-input);
    border-radius: 6px;
    color: var(--cx-text-muted);
    font-family: var(--cx-font);
    font-size: 0.82rem;
    padding: 6px 10px;
    outline: none;
    transition: border-color 0.15s;
    min-width: 120px;
}

.cx-audit-filter-input:focus { border-color: var(--cx-orange); }

/* date inputs — override browser default background in dark theme */
.cx-audit-filter-input[type="date"] {
    color-scheme: dark;
    min-width: 140px;
}

.cx-audit-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--cx-surface-deep);
    border: 1px solid var(--cx-border);
    border-top: none;
    border-bottom: none;
    padding: 9px 16px;
    font-size: 0.82rem;
    color: var(--cx-text-dim);
}

/* ── Sortable column headers ──────────────────────────── */
.cx-sort-link {
    color: var(--cx-text-faint);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.cx-sort-link:hover { color: var(--cx-orange); text-decoration: none; }

/* ── Pagination ───────────────────────────────────────── */
.cx-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.cx-page-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--cx-surface);
    border: 1.5px solid var(--cx-border);
    border-radius: 6px;
    color: var(--cx-text-muted);
    font-family: var(--cx-font);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 5px 12px;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}

.cx-page-btn:hover { border-color: var(--cx-orange); color: var(--cx-orange); text-decoration: none; }

.cx-page-btn-disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.cx-page-info {
    font-size: 0.85rem;
    color: var(--cx-text-dim);
    padding: 0 8px;
}

/* ── Privacy policy typography ────────────────────────── */
.cx-policy-h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cx-text);
    margin: 28px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--cx-border);
}

.cx-policy-h3 {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--cx-orange);
    margin: 18px 0 6px;
}

.cx-policy-list {
    padding-left: 22px;
    margin-bottom: 14px;
    color: var(--cx-text-muted);
}

.cx-policy-list li { margin-bottom: 4px; }

/* ── Filter tabs ──────────────────────────────────────── */
.cx-tab-bar {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--cx-border);
    padding-bottom: 0;
}

.cx-tab {
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--cx-text-dim);
    border-radius: 8px 8px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    text-decoration: none;
    position: relative;
    bottom: -1px;
    transition: color 0.15s;
}

.cx-tab:hover { color: var(--cx-text-muted); text-decoration: none; }

.cx-tab-active {
    color: var(--cx-orange);
    background: var(--cx-surface);
    border-color: var(--cx-border);
    border-bottom-color: var(--cx-surface);
}

.cx-tab-count {
    display: inline-block;
    background: var(--cx-surface-mid);
    color: var(--cx-text-dim);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 5px;
}

.cx-tab-count-warn { background: rgba(255,158,27,0.18); color: var(--cx-orange); }

/* ── Badges ────────────────────────────────────────────── */
.cx-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.03em;
}

.cx-badge-active   { background: rgba(60,180,100,0.15); color: #7adda0; }
.cx-badge-pending  { background: rgba(255,158,27,0.15); color: var(--cx-orange); }
.cx-badge-customer { background: rgba(100,140,255,0.15); color: #8cacff; }
.cx-badge-staff    { background: rgba(180,100,255,0.15); color: #c57fff; }
.cx-badge-admin    { background: rgba(255,80,80,0.15);   color: #ff9090; }

/* ── Admin table ──────────────────────────────────────── */
.cx-admin-table-wrap {
    background: var(--cx-surface);
    border: 1px solid var(--cx-border);
    border-top: none;
    border-radius: 0 0 12px 12px;
    overflow-x: auto;
}

.cx-admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.cx-admin-table thead tr {
    background: var(--cx-surface-deep);
    border-bottom: 1px solid var(--cx-border);
}

.cx-admin-table th {
    padding: 11px 14px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cx-text-faint);
    white-space: nowrap;
}

.cx-admin-table td {
    padding: 11px 14px;
    color: var(--cx-text-muted);
    border-bottom: 1px solid var(--cx-border);
    vertical-align: middle;
}

.cx-admin-table tbody tr:last-child td { border-bottom: none; }

.cx-admin-table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* ── Admin action buttons ─────────────────────────────── */
.cx-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--cx-font);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.12s;
    white-space: nowrap;
}

.cx-action-btn:hover { opacity: 0.82; transform: translateY(-1px); }

.cx-action-btn-ok {
    background: rgba(60,180,100,0.12);
    border-color: rgba(60,180,100,0.35);
    color: #7adda0;
}

.cx-action-btn-warn {
    background: rgba(255,158,27,0.10);
    border-color: rgba(255,158,27,0.30);
    color: var(--cx-orange);
}

.cx-action-btn-danger {
    background: rgba(220,53,69,0.10);
    border-color: rgba(220,53,69,0.30);
    color: #f07080;
}

/* ── Honeypot (anti-bot) ──────────────────────────────── */
.cx-honeypot {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ── Role select ──────────────────────────────────────── */
.cx-role-select {
    background: var(--cx-surface-mid);
    border: 1.5px solid var(--cx-border-input);
    border-radius: 6px;
    color: var(--cx-text-muted);
    font-family: var(--cx-font);
    font-size: 0.78rem;
    padding: 4px 8px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}

.cx-role-select:hover,
.cx-role-select:focus { border-color: var(--cx-orange); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
    .cx-card-grid { grid-template-columns: 1fr; }
    .cx-card-body, .cx-card-header { padding-left: 22px; padding-right: 22px; }
    .cx-card-footer { padding-left: 22px; padding-right: 22px; }
    .cx-portal-header .cx-portal-title { font-size: 1.3rem; }
}
