:root {
    --bg: #05080f;
    --surface: #101623;
    --surface-alt: #1b2335;
    --text: #f2f5ff;
    --muted: #7a86a8;
    --accent: #7bdcb5;
    --danger: #ff6b6b;
    --border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.muted {
    color: var(--muted);
}

.admp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 32px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.primary-nav a {
    color: var(--muted);
    margin: 0 12px;
    text-decoration: none;
    font-weight: 500;
}

.primary-nav a:hover {
    color: var(--text);
}

.admp-main {
    padding: 32px;
}

.admin-chip {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-chip .logout {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.admin-chip .logout:hover {
    color: var(--text);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.card {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    min-height: 140px;
}

.admp-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--border);
    color: var(--muted);
}

.table-shell {
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    background: var(--surface);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.table-shell a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.table-shell a:hover,
.table-shell a:focus {
    color: #a6f2d3;
}

.table-shell a:visited {
    color: var(--accent);
}

tr:last-child td {
    border-bottom: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn-primary {
    background: var(--accent);
    color: #062417;
}

.empty-state {
    padding: 40px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: 16px;
}

.filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-bar input,
.filter-bar select {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--text);
    min-width: 200px;
}

.flash {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.flash.success {
    background: rgba(123, 220, 181, 0.2);
    border: 1px solid rgba(123, 220, 181, 0.4);
}

.flash.error {
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid rgba(255, 107, 107, 0.4);
}

.lead-form input,
.lead-form select,
.lead-form textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--text);
    margin-top: 6px;
}

.lead-form label {
    color: #1b2335;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.kpi-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
}

.kpi-list li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.kpi-list li:last-child {
    border-bottom: none;
}

.support-iframe {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    background: var(--surface);
}

.login-shell {
    max-width: 420px;
    margin: 120px auto;
    padding: 32px;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.login-shell input {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--text);
}

.error-box {
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.4);
    color: var(--danger);
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 16px;
}

/* ============================================
   Environment Switcher
   ============================================ */

.env-switcher {
    position: relative;
    margin-left: 16px;
}

.env-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.env-toggle:hover {
    background: var(--surface);
    border-color: var(--env-color, var(--accent));
}

.env-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--env-color, var(--accent));
    box-shadow: 0 0 6px var(--env-color, var(--accent));
}

.env-arrow {
    transition: transform 0.2s ease;
}

.env-switcher:hover .env-arrow {
    transform: rotate(180deg);
}

.env-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.env-switcher:hover .env-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.env-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s ease;
}

.env-option:first-child {
    border-radius: 12px 12px 0 0;
}

.env-option:last-child {
    border-radius: 0 0 12px 12px;
}

.env-option:hover {
    background: var(--surface-alt);
}

.env-option.active {
    background: rgba(123, 220, 181, 0.1);
}

.env-option .env-name {
    font-weight: 600;
    flex: 1;
}

.env-option .env-domain {
    font-size: 0.8rem;
    color: var(--muted);
}

/* Environment Warning Banner */
.env-warning-banner {
    background: linear-gradient(90deg, rgba(255, 167, 38, 0.15) 0%, rgba(255, 167, 38, 0.05) 100%);
    border-bottom: 2px solid var(--env-color, #ffa726);
    padding: 10px 32px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--env-color, #ffa726);
}

/* Dev mode body styling */
body.dev-mode .admp-header {
    border-bottom-color: rgba(255, 167, 38, 0.3);
}

body.dev-mode .brand strong::after {
    content: ' [DEV]';
    color: #ffa726;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Footer environment badge */
.admp-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.env-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.env-badge.dev {
    background: rgba(255, 167, 38, 0.2);
    color: #ffa726;
    border: 1px solid rgba(255, 167, 38, 0.3);
}
