/* ============================================================
   AdPlatform Management Console Styles
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --card-bg: #ffffff;
    --border: rgba(0,0,0,0.09);
    --border-light: rgba(0,0,0,0.05);
    --text: #1a1d23;
    --text-secondary: #5f6672;
    --text-dim: #9099a4;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: rgba(59,130,246,0.08);
    --sidebar-bg: #ffffff;
    --sidebar-hover: rgba(0,0,0,0.04);
    --sidebar-active: rgba(59,130,246,0.08);
    --sidebar-width: 224px;
    --sidebar-collapsed-width: 64px;
    --header-height: 56px;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning-bg: #fef3cd;
    --warning-border: #ffc107;
    --warning-text: #856404;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}


/* ============================================================
   Shell Layout (sign-in / registration — no sidebar)
   ============================================================ */

.shell { min-height: 100vh; display: flex; flex-direction: column; }

.shell-header {
    background: #1a1a2e;
    color: #fff;
    padding: 0 24px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.shell-logo { display: flex; align-items: center; gap: 8px; }
.logo-icon { font-size: 24px; color: var(--accent); }
.logo-text { font-size: 18px; font-weight: 600; }
.logo-badge { font-size: 11px; background: var(--accent); padding: 2px 8px; border-radius: 4px; text-transform: uppercase; }

.shell-user { display: flex; align-items: center; gap: 16px; }
.user-name { font-size: 13px; opacity: 0.9; }

.btn-signout {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
}
.btn-signout:hover { background: rgba(255,255,255,0.1); }

.shell-content { flex: 1; padding: 24px; }

.shell-footer {
    background: #1a1a2e;
    color: rgba(255,255,255,0.5);
    padding: 12px 24px;
    font-size: 12px;
    text-align: center;
}


/* ============================================================
   Dashboard Layout (sidebar + main)
   ============================================================ */

.dashboard-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg);
}


/* ── Sidebar ── */

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.25s cubic-bezier(0.4,0,0.2,1),
                min-width 0.25s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
}

.sidebar-collapsed {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
}

/* Logo */
.sidebar-logo {
    padding: 0 20px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
    white-space: nowrap;
}
.sidebar-collapsed .sidebar-logo {
    padding: 0;
    justify-content: center;
}
.sidebar-logo-icon {
    font-size: 22px;
    color: var(--accent);
    flex-shrink: 0;
}
.sidebar-logo-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}
.sidebar-logo-badge {
    font-size: 10px;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    padding: 1px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Nav items */
.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 8px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    margin-bottom: 2px;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-collapsed .sidebar-item {
    padding: 10px 0;
    justify-content: center;
}
.sidebar-item:hover {
    background: var(--sidebar-hover);
    color: var(--text);
}
.sidebar-item-active {
    background: var(--sidebar-active);
    color: var(--accent);
    font-weight: 600;
}
.sidebar-item-active:hover {
    background: var(--sidebar-active);
    color: var(--accent);
}
.sidebar-item-disabled {
    opacity: 0.45;
    cursor: default;
}
.sidebar-item-disabled:hover {
    background: transparent;
    color: var(--text-secondary);
}
.sidebar-item-icon {
    display: flex;
    flex-shrink: 0;
}
.sidebar-item-label {
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.sidebar-soon {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    background: var(--bg);
    padding: 2px 7px;
    border-radius: 6px;
}

/* User + collapse area */
.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 8px;
}
.sidebar-user-collapsed {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}
.sidebar-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.sidebar-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.sidebar-user-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-signout {
    font-size: 11.5px;
    color: var(--text-dim);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}
.sidebar-user-signout:hover { color: var(--danger); }

.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 12.5px;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.15s;
}
.sidebar-collapsed .sidebar-collapse-btn {
    justify-content: center;
    padding: 8px 0;
}
.sidebar-collapse-btn:hover { color: var(--text-secondary); }

.sidebar-collapse-icon {
    display: flex;
    transition: transform 0.25s;
}
.sidebar-collapse-icon-flip {
    transform: rotate(180deg);
}


/* ── Main Area ── */

.dashboard-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}


/* ── Header with title + tabs ── */

.dashboard-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.dashboard-header-top {
    padding: 16px 32px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dashboard-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: var(--text);
    margin: 0;
}

.dashboard-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-meta {
    display: flex;
    gap: 16px;
    font-size: 12.5px;
    color: var(--text-secondary);
}
.dashboard-meta strong {
    font-weight: 600;
    color: var(--text-dim);
}

/* Horizontal tabs within the header */
.dashboard-tabs {
    display: flex;
    padding: 0 32px;
    margin-top: 12px;
    gap: 0;
    position: relative;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-dim);
    cursor: pointer;
    position: relative;
    transition: color 0.15s;
    border-bottom: 2px solid transparent;
}
.tab-btn:hover {
    color: var(--text-secondary);
}
.tab-btn.active {
    color: var(--accent);
    font-weight: 600;
    border-bottom-color: var(--accent);
}


/* ── Content area ── */

.dashboard-content {
    flex: 1;
    overflow: auto;
    padding: 28px 32px;
}


/* ── Placeholder panel for coming-soon features ── */

.placeholder-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-dim);
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px dashed var(--border);
}
.placeholder-panel .placeholder-icon {
    font-size: 36px;
    margin-bottom: 12px;
}
.placeholder-panel h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.placeholder-panel p {
    font-size: 13px;
}


/* ============================================================
   Shared Components (loading, messages, forms, tables)
   ============================================================ */

/* Loading */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-dim);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Sign In */
.signin-overlay { display: flex; align-items: center; justify-content: center; min-height: 60vh; }

.signin-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 48px;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    max-width: 400px;
    width: 100%;
}

.signin-icon { font-size: 48px; color: var(--accent); margin-bottom: 24px; }
.signin-card h1 { font-size: 24px; font-weight: 600; margin-bottom: 8px; }
.signin-subtitle { color: var(--text-secondary); margin-bottom: 32px; }

.btn-signin {
    background: #0078d4;
    color: #fff;
    border: none;
    padding: 14px 32px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
}
.btn-signin:hover { background: #006cbd; }

.signin-help { margin-top: 24px; font-size: 12px; color: var(--text-dim); }

/* Registration */
.registration-container { display: flex; align-items: center; justify-content: center; min-height: 60vh; }

.registration-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 48px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    max-width: 480px;
    width: 100%;
}

.registration-card h1 { font-size: 24px; font-weight: 600; margin-bottom: 8px; }
.registration-subtitle { color: var(--text-secondary); margin-bottom: 32px; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 8px; }

.form-group input, .form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--accent); }

.form-help { display: block; margin-top: 8px; font-size: 12px; color: var(--text-dim); }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 14px 32px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { background: #a0c4ff; cursor: not-allowed; }

/* Messages */
.error-message {
    background: var(--danger-bg);
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 13px;
}

.success-message {
    background: var(--success-bg);
    border: 1px solid #86efac;
    color: var(--success);
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 13px;
}


/* ============================================================
   Overview Panel
   ============================================================ */

.overview-panel h2 { font-size: 18px; margin-bottom: 24px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    text-align: center;
}
.stat-value { font-size: 36px; font-weight: 700; color: var(--accent); margin-bottom: 8px; letter-spacing: -1px; }
.stat-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 550; }

.server-time { font-size: 12px; color: var(--text-dim); text-align: right; }


/* ============================================================
   Table Panels
   ============================================================ */

.table-panel h2 { font-size: 18px; margin-bottom: 20px; }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.data-table { width: 100%; border-collapse: collapse; }

.data-table th, .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.data-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
}

.data-table tr:hover { background: rgba(0,0,0,0.015); }
.empty-row { text-align: center !important; color: var(--text-dim); padding: 40px !important; }

.text-muted { color: var(--text-dim); font-size: 12px; }

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active { background: var(--success-bg); color: var(--success); }
.status-inactive { background: #f3f4f6; color: #6b7280; }
.status-default { background: #f3f4f6; color: #6b7280; }

/* Buttons */
.btn-action {
    background: var(--surface);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.btn-action:hover { background: var(--accent); color: #fff; }

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #fee2e2; }

.btn-cancel {
    background: var(--surface);
    border: 1px solid #ddd;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}
.btn-cancel:hover { background: var(--bg); }

/* Admin Form */
.admin-form {
    background: var(--bg);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    max-width: 500px;
}
.admin-form h3 { font-size: 16px; margin-bottom: 20px; }

.form-buttons { display: flex; gap: 12px; margin-top: 24px; }
.form-buttons button { flex: 1; }


/* ============================================================
   Multi-Channel Admin Panel Styles
   ============================================================ */

/* Filter Row */
.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 8px;
}
.filter-row select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: var(--surface);
    cursor: pointer;
    font-family: inherit;
}
.filter-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-dim);
}

/* Inline Form Row */
.form-row-inline {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.form-row-inline .form-group {
    flex: 1;
    min-width: 140px;
}
.form-row-inline select,
.form-row-inline input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}

/* Badges */
.channel-badge,
.objective-badge {
    display: inline-block;
    padding: 2px 8px;
    border: 2px solid;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    font-family: monospace;
}

/* Number Cells */
.number-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.mono-cell {
    font-family: monospace;
    font-size: 12px;
}

/* Inactive Rows */
.row-inactive {
    opacity: 0.5;
}

/* Allocation Summary */
.allocation-summary {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}
.allocation-summary h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--text);
}
.summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}
.summary-warning {
    border-color: #fbbf24;
    background: #fffbeb;
}
.summary-label {
    color: var(--text-secondary);
}
.summary-ok {
    color: var(--success);
    font-weight: 600;
}
.summary-bad {
    color: var(--danger);
    font-weight: 600;
}

/* Coverage Matrix */
.coverage-matrix {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}
.coverage-matrix h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--text);
}
.matrix-table {
    table-layout: fixed;
}
.matrix-cell {
    text-align: center;
    font-size: 16px;
    padding: 8px !important;
}
.matrix-mapped {
    background: #ecfdf5;
    color: var(--success);
}
.matrix-empty {
    background: var(--surface);
}
.matrix-missing {
    color: #d1d5db;
}
.matrix-legend {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-dim);
}


/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
    .shell-header { padding: 0 16px; }
    .shell-content { padding: 16px; }

    .sidebar {
        width: var(--sidebar-collapsed-width) !important;
        min-width: var(--sidebar-collapsed-width) !important;
    }
    .sidebar .sidebar-item-label,
    .sidebar .sidebar-logo-text,
    .sidebar .sidebar-logo-badge,
    .sidebar .sidebar-badge,
    .sidebar .sidebar-soon,
    .sidebar .sidebar-user-info { display: none; }
    .sidebar .sidebar-item { padding: 10px 0; justify-content: center; }
    .sidebar .sidebar-logo { padding: 0; justify-content: center; }

    .dashboard-header-top { padding: 12px 16px 0; }
    .dashboard-tabs { padding: 0 16px; }
    .dashboard-content { padding: 16px; }
    .dashboard-meta { display: none; }

    .stats-grid { grid-template-columns: 1fr 1fr; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 12px; }
}

/* ─── Campaigns Panel ─────────────────────────────────────────────────────── */

.initiative-row:hover { background: var(--hover-bg, #f9fafb); }

.channel-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.channel-detail-row td { padding: 0 !important; border-top: none !important; }
.channel-detail-row + .channel-detail-row td { border-top: none !important; }
.channel-detail {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 36px;
    background: #f9fafb;
    border-left: 3px solid var(--accent);
    font-size: 13px;
}
.channel-detail-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 120px;
}
.channel-detail-type { font-weight: 500; }
.channel-detail-alloc { font-size: 12px; color: #6b7280; }
.channel-detail-ext {
    font-family: monospace;
    font-size: 11px;
    color: #9ca3af;
    margin-left: auto;
}
.channel-detail-provider {
    font-size: 11px;
    color: #9ca3af;
    margin-left: 8px;
}

.objective-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    background: #f0f4ff;
    color: #4b5563;
}

.status-pending { background: var(--warning-bg); color: var(--warning-text); }
.status-warning { background: #fef9c3; color: #a16207; }
.status-error   { background: var(--danger-bg); color: var(--danger); }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { margin: 0 0 8px; color: #374151; }
.empty-state p { margin: 0; font-size: 14px; }

/* ─── Filter Bar ──────────────────────────────────────────────────────────── */

.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.filter-label {
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.filter-select,
.filter-input {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: #1f2937;
    min-width: 140px;
    outline: none;
    transition: border-color 0.15s;
}
.filter-select:focus,
.filter-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}
.filter-input[type="date"] { min-width: 130px; }
.btn-clear-filters {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #6b7280;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    align-self: flex-end;
}
.btn-clear-filters:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

/* ═══════════════════════════════════════════════════════════
   CLIENT MANAGEMENT PANEL
   ═══════════════════════════════════════════════════════════ */

/* ── Pending Tab: Card layout ── */
.client-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.client-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    transition: box-shadow 0.15s;
}

.client-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.client-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.client-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.client-card-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.category-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: var(--accent-light, #e0e7ff);
    color: var(--accent, #4f46e5);
}

.client-card-date {
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
}

.client-card-desc {
    font-size: 13px;
    color: var(--text-secondary, #6b7280);
    margin: 0 0 12px;
    line-height: 1.5;
}

.client-card-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px 24px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}

.detail-item a {
    color: var(--accent);
    text-decoration: none;
}

.detail-item a:hover {
    text-decoration: underline;
}

.client-card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.reject-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
}

.reject-form input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}

.text-success { color: #16a34a; }
.text-warning { color: #d97706; }

/* ── All Clients Tab ── */
.client-search {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    width: 200px;
    outline: none;
    transition: border-color 0.15s;
}

.client-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}

.client-filter-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    outline: none;
    min-width: 120px;
}

/* ── Expandable Row ── */
.client-row {
    cursor: pointer;
    transition: background 0.1s;
}

.client-row.expanded {
    background: rgba(59,130,246,0.04);
}

.expand-toggle {
    text-align: center;
    color: var(--text-dim);
    font-size: 11px;
    user-select: none;
}

.client-name-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.client-url {
    font-size: 11px;
    color: var(--text-dim);
    font-weight: 400;
}

.client-detail-row td {
    padding: 0 !important;
    border-top: none !important;
}

.client-detail {
    padding: 16px 24px 20px;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

/* ── Detail Sections ── */
.detail-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.detail-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px;
}

.detail-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.detail-section-header h4 {
    margin: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px 24px;
}

.detail-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}

.detail-field-wide {
    grid-column: 1 / -1;
}

.detail-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.admin-notes {
    font-size: 13px;
    color: var(--text-secondary, #6b7280);
    margin: 0;
    white-space: pre-wrap;
}

/* ── Status Actions ── */
.action-buttons {
    display: flex;
    gap: 8px;
}

.action-confirm {
    background: var(--surface);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.action-confirm p {
    margin: 0 0 8px;
    font-size: 13px;
}

.action-confirm input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    margin-bottom: 4px;
}

/* ── Status Timeline ── */
.status-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-left: 12px;
}

.timeline-entry {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    position: relative;
}

.timeline-entry:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 22px;
    bottom: -2px;
    width: 1px;
    background: var(--border);
}

.timeline-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    margin-top: 4px;
}

.timeline-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}

.timeline-action {
    font-weight: 500;
}

.timeline-reason {
    color: var(--text-secondary, #6b7280);
    font-style: italic;
}

.timeline-meta {
    font-size: 11px;
    color: var(--text-dim);
}

/* ── Edit Form ── */
.edit-form .form-row-inline {
    margin-bottom: 12px;
}

.form-group-wide {
    flex: 1 1 100% !important;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .client-card-header { flex-direction: column; gap: 4px; }
    .client-card-details { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .client-search { width: 140px; }
}
/* ============================================================
   Contextual Help System
   Append to: admin/src/styles/app.css
              client/src/styles/app.css  (update --accent vars as needed)
   ============================================================ */

/* ── Help Trigger (floating icon + label) ────────────────────*/

.help-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1px solid transparent;
    border-radius: 20px;
    padding: 3px 8px 3px 4px;
    cursor: pointer;
    color: var(--accent, #3b82f6);
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    line-height: 1;
}

.help-trigger:hover {
    background: var(--accent-light, rgba(59,130,246,0.08));
    border-color: var(--accent, #3b82f6);
    color: var(--accent-hover, #2563eb);
}

.help-trigger-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--accent-light, rgba(59,130,246,0.1));
    border-radius: 50%;
    flex-shrink: 0;
    color: var(--accent, #3b82f6);
}

.help-trigger-label {
    color: var(--accent, #3b82f6);
    font-size: 12px;
}


/* ── Help Modal ───────────────────────────────────────────────*/

.help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    animation: helpFadeIn 0.15s ease;
}

@keyframes helpFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.help-modal {
    background: var(--surface, #fff);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 12px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: helpSlideUp 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes helpSlideUp {
    from { transform: translateY(16px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.help-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--border, rgba(0,0,0,0.09));
    flex-shrink: 0;
}

.help-modal-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.help-modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: var(--accent-light, rgba(59,130,246,0.1));
    border-radius: 8px;
    color: var(--accent, #3b82f6);
    flex-shrink: 0;
}

.help-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text, #1a1d23);
    margin: 0;
}

.help-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-dim, #9099a4);
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}
.help-modal-close:hover {
    background: var(--bg, #f4f5f7);
    color: var(--text, #1a1d23);
}

.help-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.help-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-dim, #9099a4);
    font-size: 14px;
    padding: 8px 0;
}

.help-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border, #e5e7eb);
    border-top-color: var(--accent, #3b82f6);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.help-error {
    color: var(--danger, #dc2626);
    font-size: 14px;
    background: var(--danger-bg, #fef2f2);
    padding: 10px 14px;
    border-radius: 8px;
    margin: 0;
}

/* Rendered HTML help content */
.help-content {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text, #1a1d23);
}
.help-content p      { margin: 0 0 12px; }
.help-content p:last-child { margin-bottom: 0; }
.help-content h4     { font-size: 13px; font-weight: 600; margin: 16px 0 6px; color: var(--text-secondary, #374151); text-transform: uppercase; letter-spacing: 0.3px; }
.help-content ul, .help-content ol { margin: 0 0 12px 20px; }
.help-content li     { margin-bottom: 5px; }
.help-content strong { font-weight: 600; }
.help-content a      { color: var(--accent, #3b82f6); text-decoration: none; }
.help-content a:hover { text-decoration: underline; }

.help-modal-footer {
    padding: 10px 20px;
    border-top: 1px solid var(--border, rgba(0,0,0,0.06));
    flex-shrink: 0;
    background: var(--bg, #f4f5f7);
}

.help-key-badge {
    font-family: var(--font-mono, monospace);
    font-size: 11px;
    color: var(--text-dim, #9099a4);
}


/* ── HelpPanel (Admin) ────────────────────────────────────────*/

.help-panel {
    padding: 24px;
    max-width: 1000px;
    position: relative;
}

.help-panel-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--success, #16a34a);
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    animation: helpFadeIn 0.2s ease;
}
.help-panel-toast.help-panel-toast-error {
    background: var(--danger, #dc2626);
}

.help-edit-card {
    background: var(--surface, #fff);
    border: 1px solid var(--accent, #3b82f6);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 0 0 4px var(--accent-light, rgba(59,130,246,0.08));
}

.help-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.help-edit-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #1a1d23);
    margin: 0;
}

.help-form-row {
    margin-bottom: 14px;
}
.help-form-row-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.help-form-label {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #5f6672);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.help-form-hint {
    font-weight: 400;
    font-size: 11px;
    color: var(--text-dim, #9099a4);
    text-transform: none;
    letter-spacing: 0;
}

.help-key-suggestions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.help-key-chip {
    background: var(--accent-light, rgba(59,130,246,0.08));
    border: 1px solid var(--accent, #3b82f6);
    color: var(--accent, #3b82f6);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-family: var(--font-mono, monospace);
    cursor: pointer;
    transition: background 0.12s;
}
.help-key-chip:hover {
    background: var(--accent-light, rgba(59,130,246,0.16));
}

.help-key-display {
    font-family: var(--font-mono, monospace);
    font-size: 13px;
    color: var(--text, #1a1d23);
    background: var(--bg, #f4f5f7);
    border: 1px solid var(--border, rgba(0,0,0,0.09));
    border-radius: 6px;
    padding: 7px 10px;
}

.help-body-textarea {
    resize: vertical;
    min-height: 160px;
}

/* Table extras */
.help-table-wrap {
    background: var(--surface, #fff);
    border: 1px solid var(--border, rgba(0,0,0,0.09));
    border-radius: 10px;
    overflow: hidden;
}

.help-row-inactive {
    opacity: 0.5;
}

.help-key-code {
    font-family: var(--font-mono, monospace);
    font-size: 12px;
    background: var(--bg, #f4f5f7);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text, #1a1d23);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary, #5f6672);
    cursor: pointer;
    user-select: none;
}

/* Account type badge on pending registration cards */
.category-tag-type {
    background: #ede9fe;
    color: #5b21b6;
    border-color: #c4b5fd;
}
