:root {
    --bg-base: #f8f9fa;
    --bg-surface: #ffffff;
    --bg-elevated: #f1f5f9;
    --bg-hover: #e2e8f0;
    --border-subtle: #e2e8f0;
    --border: #cbd5e1;
    --border-accent: #f59e0b;
    --amber: #f59e0b;
    --amber-dim: #d97706;
    --amber-glow: rgba(245, 158, 11, 0.1);
    --amber-glow-strong: rgba(245, 158, 11, 0.2);
    --cyan: #0891b2;
    --cyan-dim: #0e7490;
    --green: #16a34a;
    --green-dim: #15803d;
    --red: #dc2626;
    --red-dim: #b91c1c;
    --violet: #7c3aed;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    --font-heading: 'Satoshi', 'IBM Plex Sans', system-ui, sans-serif;
    --font-body: 'IBM Plex Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px var(--border-subtle);
    --shadow-elevated: 0 4px 16px rgba(0,0,0,0.08), 0 0 0 1px var(--border);
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background: var(--bg-base);
}

.admin-layout h1, .admin-layout h2, .admin-layout h3,
.admin-layout h4, .admin-layout h5, .admin-layout h6 {
    font-family: var(--font-heading);
}

.admin-layout {
    margin-bottom: 0 !important;
    overflow: hidden;
}

.admin-layout .container {
    padding: 0 !important;
    max-width: 100% !important;
}

.admin-layout main {
    padding-bottom: 0 !important;
}

.admin-layout footer {
    display: none !important;
}

/* Admin shell layout */
.admin-shell {
    display: flex;
    height: calc(100vh - 56px);
    overflow: hidden;
}

.admin-sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    padding: 1.25rem 0;
    height: calc(100vh - 56px);
    overflow-y: auto;
    flex-shrink: 0;
}

.admin-content {
    flex: 1;
    padding: 2rem;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
    height: calc(100vh - 56px);
}

.admin-brand {
    padding: 0 1.25rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 0.75rem;
}

.admin-brand .brand-name {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    margin: 0;
}

.admin-brand small {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    margin-top: 2px;
}

.admin-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.15s ease;
    position: relative;
}

.admin-nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    border-left-color: var(--amber);
}

.admin-nav-item.active {
    color: var(--amber);
    background: var(--amber-glow);
    border-left-color: var(--amber);
}

.admin-nav-item .nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.admin-nav-item:hover .nav-icon,
.admin-nav-item.active .nav-icon {
    opacity: 1;
}

.admin-nav-item .nav-badge {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    background: var(--bg-elevated);
    color: var(--text-muted);
    padding: 1px 7px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.page-header h1 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
    margin: 0;
}

.page-header .breadcrumb-custom {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.page-header .breadcrumb-custom a {
    color: var(--text-secondary);
    text-decoration: none;
}

.page-header .breadcrumb-custom a:hover {
    color: var(--amber);
}

/* Stat grid */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border);
    transition: background 0.2s ease;
}

.stat-card:hover {
    border-color: var(--border);
    background: var(--bg-elevated);
}

.stat-card:hover::before {
    background: var(--amber);
}

.stat-card .stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.stat-card .stat-icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 20px;
    height: 20px;
    opacity: 0.15;
    color: var(--text-primary);
}

.stat-card:hover .stat-icon {
    opacity: 0.25;
    color: var(--amber);
}

.stat-card.accent-amber::before { background: var(--amber); }
.stat-card.accent-cyan::before { background: var(--cyan); }
.stat-card.accent-green::before { background: var(--green); }
.stat-card.accent-violet::before { background: var(--violet); }

.stat-card.accent-amber:hover { border-color: rgba(245,158,11,0.3); }
.stat-card.accent-cyan:hover { border-color: rgba(6,182,212,0.3); }
.stat-card.accent-green:hover { border-color: rgba(34,197,94,0.3); }
.stat-card.accent-violet:hover { border-color: rgba(139,92,246,0.3); }

/* Bento grid */
.bento-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.bento-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.bento-card:hover {
    border-color: var(--border);
    background: var(--bg-elevated);
    transform: translateY(-1px);
}

.bento-card .bento-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 1rem;
    opacity: 0.4;
    transition: opacity 0.2s ease;
}

.bento-card:hover .bento-icon {
    opacity: 0.7;
}

.bento-card h2 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.bento-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.bento-card .bento-arrow {
    align-self: flex-end;
    margin-top: 1rem;
    width: 20px;
    height: 20px;
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.2s ease;
    color: var(--amber);
}

.bento-card:hover .bento-arrow {
    opacity: 1;
    transform: translateX(0);
}

.bento-card::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: transparent;
    transition: background 0.2s ease;
}

.bento-card:hover::after {
    background: var(--amber);
}

.bento-card.wide {
    grid-column: 1 / -1;
}

/* Admin tables */
.table-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table-container .table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.table-container .table-count {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: var(--bg-elevated);
    color: var(--text-muted);
    padding: 2px 10px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
}

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

.admin-table th {
    text-align: left;
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-base);
    white-space: nowrap;
}

.admin-table td {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
}

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

.admin-table tr:hover td {
    background: var(--bg-hover);
}

.admin-table .cell-mono {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.admin-table .cell-primary {
    color: var(--text-primary);
    font-weight: 500;
}

/* Search bar */
.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    transition: border-color 0.2s ease;
    max-width: 400px;
}

.search-bar:focus-within {
    border-color: var(--amber);
    box-shadow: 0 0 0 3px var(--amber-glow);
}

.search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-bar .search-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.search-bar button {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.search-bar button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border);
}

.search-bar .search-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}

.search-bar .search-clear:hover {
    color: var(--text-primary);
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25em 0.75em;
    border-radius: 100px;
    border: 1px solid transparent;
}

.status-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge.active {
    color: var(--green);
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.08);
}

.status-badge.active .dot { background: var(--green); }

.status-badge.disabled {
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
}

.status-badge.disabled .dot { background: var(--red); }

.status-badge.converted {
    color: var(--cyan);
    border-color: rgba(6, 182, 212, 0.3);
    background: rgba(6, 182, 212, 0.08);
}

.status-badge.converted .dot { background: var(--cyan); }

.status-badge.neutral {
    color: var(--text-muted);
    border-color: var(--border-subtle);
}

.status-badge.neutral .dot { background: var(--text-muted); }

/* Plan badges */
.plan-badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2em 0.7em;
    border-radius: 4px;
    border: 1px solid;
}

.plan-badge.free {
    color: var(--text-muted);
    border-color: var(--border-subtle);
    background: transparent;
}

.plan-badge.premium {
    color: var(--amber);
    border-color: rgba(245, 158, 11, 0.3);
    background: var(--amber-glow);
}

.plan-badge.team {
    color: var(--cyan);
    border-color: rgba(6, 182, 212, 0.3);
    background: rgba(6, 182, 212, 0.08);
}

/* Action buttons */
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}

.action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border);
}

.action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.3);
}

.action-btn.warning:hover {
    background: rgba(245, 158, 11, 0.1);
    color: var(--amber);
    border-color: rgba(245, 158, 11, 0.3);
}

.action-btn.success:hover {
    background: rgba(34, 197, 94, 0.1);
    color: var(--green);
    border-color: rgba(34, 197, 94, 0.3);
}

.action-btn.ghost {
    border-color: var(--border-subtle);
    color: var(--text-muted);
}
.action-btn.ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border);
}

/* Admin alerts */
.admin-alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    border: 1px solid;
    animation: alertSlideIn 0.3s ease;
}

@keyframes alertSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.admin-alert.info {
    background: rgba(6, 182, 212, 0.08);
    border-color: rgba(6, 182, 212, 0.2);
    color: var(--cyan);
}

.admin-alert.error {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--red);
}

.admin-alert .alert-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0.25rem;
}

.admin-alert .alert-close:hover {
    opacity: 1;
}

/* Admin modal (Bootstrap-based) */
.admin-modal .modal-header {
    border-bottom-color: var(--border-subtle);
}

.admin-modal .modal-header h2 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
}

.admin-modal .modal-body p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.admin-modal .modal-body label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-modal .modal-body .radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.admin-modal .modal-body .radio-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.admin-modal .modal-footer {
    border-top-color: var(--border-subtle);
}

/* Truncate */
.admin-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
    display: block;
}

.admin-code {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--cyan);
    background: rgba(6, 182, 212, 0.06);
    padding: 0.125em 0.375em;
    border-radius: 3px;
}

/* Animations */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.anim-fade-up {
    animation: fadeUp 0.4s ease forwards;
    opacity: 0;
}

.anim-delay-1 { animation-delay: 0.05s; }
.anim-delay-2 { animation-delay: 0.1s; }
.anim-delay-3 { animation-delay: 0.15s; }
.anim-delay-4 { animation-delay: 0.2s; }
.anim-delay-5 { animation-delay: 0.25s; }
.anim-delay-6 { animation-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
    .anim-fade-up { animation: none; opacity: 1; }
    .admin-alert { animation: none; }
}

/* Responsive */
@media (max-width: 991.98px) {
    .admin-sidebar { display: none; }
    .admin-content { padding: 1.25rem; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .bento-grid { grid-template-columns: 1fr; }
}

@media (max-width: 575.98px) {
    .stat-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .admin-content { padding: 1rem; }
}
