/* Dark Theme - Gold & Teal */
:root {
    /* Background layers */
    --bg-dark: #0a0e14;
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-elevated: #2d333b;

    /* Gold accents */
    --gold-primary: #d4a418;
    --gold-light: #f0c640;
    --gold-dark: #b8930f;
    --gold-muted: rgba(212, 164, 24, 0.2);

    /* Teal accents */
    --teal-primary: #00bcd4;
    --teal-light: #4dd0e1;
    --teal-dark: #0097a7;
    --teal-muted: rgba(0, 188, 212, 0.2);

    /* Text colors */
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;

    /* Status colors */
    --success: #2ea043;
    --success-muted: rgba(46, 160, 67, 0.2);
    --warning: #d4a418;
    --warning-muted: rgba(212, 164, 24, 0.15);
    --error: #f85149;
    --error-muted: rgba(248, 81, 73, 0.15);

    /* Borders */
    --border-default: #30363d;
    --border-muted: #21262d;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Navigation */
nav {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-bottom: 1px solid var(--border-default);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 2rem;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-links a.active {
    color: var(--gold-light);
    background: var(--gold-muted);
}

/* Nav user section */
.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-user .user-email {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.nav-user .logout-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    border: 1px solid var(--border-default);
}

.nav-user .logout-link:hover {
    color: var(--error);
    border-color: var(--error);
    background: var(--error-muted);
}

/* Flash messages */
.flash-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem 2rem 0;
}

.flash-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 14px;
}

.flash-message.error {
    background: var(--error-muted);
    border: 1px solid var(--error);
    color: #ff6b6b;
}

.flash-message.info {
    background: var(--teal-muted);
    border: 1px solid var(--teal-primary);
    color: var(--teal-light);
}

.flash-message.success {
    background: var(--success-muted);
    border: 1px solid var(--success);
    color: #6bff8b;
}

/* Main content */
main {
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Search and filter */
.search-form {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.search-form input, .search-form select {
    padding: 0.6rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-form input:focus, .search-form select:focus {
    outline: none;
    border-color: var(--teal-primary);
    box-shadow: 0 0 0 3px var(--teal-muted);
}

.search-form input[type="text"] {
    min-width: 280px;
}

.search-form button, .btn-clear {
    padding: 0.6rem 1.25rem;
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-dark) 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.1s, box-shadow 0.2s;
}

.search-form button:hover, .btn-clear:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.3);
}

.btn-clear {
    background: var(--bg-tertiary);
}

.filter-bar {
    margin-bottom: 1rem;
}

.stats-bar {
    display: flex;
    gap: 2rem;
    margin-top: 0.5rem;
    color: var(--text-muted);
    align-items: center;
}

.btn-logic-ref {
    margin-left: auto;
    padding: 0.5rem 1rem;
    background: var(--teal-muted);
    color: var(--teal-light);
    border: 1px solid var(--teal-dark);
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-logic-ref:hover {
    background: var(--teal-dark);
    color: var(--text-primary);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.data-table th, .data-table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border-muted);
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table a {
    color: var(--teal-light);
    text-decoration: none;
    transition: color 0.2s;
}

.data-table a:hover {
    color: var(--teal-primary);
    text-decoration: underline;
}

.mapped {
    color: var(--success);
}

.unmapped {
    color: var(--text-muted);
}

/* Config table */
.config-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
}

.config-table th, .config-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-muted);
    text-align: left;
}

.config-table th {
    width: 280px;
    background: var(--bg-tertiary);
    font-weight: 500;
    color: var(--text-secondary);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-default);
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    transition: all 0.2s;
}

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

.tab-btn.active {
    background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-dark) 100%);
    color: var(--bg-dark);
    border-color: var(--gold-primary);
    font-weight: 600;
}

.tab-content {
    display: none;
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Forms */
.mapping-form {
    max-width: 800px;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--teal-primary);
    box-shadow: 0 0 0 3px var(--teal-muted);
}

.form-group input:disabled {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.btn-primary {
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-dark) 100%);
    color: var(--bg-dark);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: transform 0.1s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 164, 24, 0.4);
}

#save-status {
    margin-left: 1rem;
}

#save-status.success {
    color: var(--success);
}

#save-status.error {
    color: var(--error);
}

/* Inline edit in mapping table */
.inline-edit {
    padding: 0.4rem 0.6rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    color: var(--text-primary);
    width: 100%;
}

.inline-edit:focus {
    outline: none;
    border-color: var(--teal-primary);
}

.inline-edit.small {
    width: 80px;
}

.btn-save {
    padding: 0.35rem 0.85rem;
    background: linear-gradient(135deg, var(--success) 0%, #238636 100%);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.1s;
}

.btn-save:hover {
    transform: translateY(-1px);
}

.btn-save.saved {
    background: var(--teal-primary);
}

/* SIP Trunk Toggle */
.sip-trunk-cell {
    text-align: center;
}

.sip-trunk-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.sip-trunk-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-muted);
    border-radius: 50%;
    transition: 0.3s;
}

.sip-trunk-toggle input:checked + .toggle-slider {
    background-color: var(--gold-muted);
    border-color: var(--gold-primary);
}

.sip-trunk-toggle input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background-color: var(--gold-primary);
}

.sip-trunk-toggle input:focus + .toggle-slider {
    box-shadow: 0 0 0 2px var(--gold-muted);
}

/* Billing Frequency Select */
.billing-freq-cell {
    text-align: center;
}

.billing-freq-select {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 0.8em;
    cursor: pointer;
}

.billing-freq-select:focus {
    outline: none;
    border-color: var(--teal-primary);
}

.billing-freq-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-default);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--teal-light) 0%, var(--teal-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--text-muted);
    text-transform: capitalize;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.section {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 1.5rem;
    border: 1px solid var(--border-default);
}

.section h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.25rem;
}

pre {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Record cards for displaying all fields */
.record-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.record-header {
    background: linear-gradient(135deg, var(--teal-dark) 0%, var(--teal-primary) 100%);
    color: white;
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.record-card .config-table {
    margin: 0;
    border-radius: 0;
}

.record-card .config-table th {
    width: 250px;
    font-size: 0.85rem;
}

.record-card .config-table td {
    font-size: 0.85rem;
    word-break: break-word;
}

/* Billing summary styles */
.billing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.billing-section {
    background: var(--bg-tertiary);
    padding: 1.25rem;
    border-radius: 8px;
}

.billing-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.billing-section ul {
    margin-left: 1.5rem;
    color: var(--text-secondary);
}

@media (max-width: 900px) {
    .billing-grid {
        grid-template-columns: 1fr;
    }
}

/* Sync Controls */
.sync-controls {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-default);
    margin-bottom: 2rem;
}

.sync-controls h2 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.sync-controls .subtitle {
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.sync-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.btn-sync {
    padding: 0.85rem 1.75rem;
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-dark) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    min-width: 180px;
    transition: transform 0.1s, box-shadow 0.2s;
}

.btn-sync:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 188, 212, 0.3);
}

.btn-sync:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sync-status {
    margin-top: 1rem;
}

.sync-running {
    color: var(--teal-light);
    padding: 1rem;
    background: var(--teal-muted);
    border-radius: 8px;
    border-left: 4px solid var(--teal-primary);
}

.sync-success {
    color: var(--success);
    padding: 1rem;
    background: var(--success-muted);
    border-radius: 8px;
    border-left: 4px solid var(--success);
}

.sync-error {
    color: var(--error);
    padding: 1rem;
    background: var(--error-muted);
    border-radius: 8px;
    border-left: 4px solid var(--error);
}

.sync-output {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-dark);
    border-radius: 8px;
    font-size: 0.85rem;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: 'Monaco', 'Menlo', monospace;
    color: #0f0;
    border: 1px solid var(--border-default);
}

/* Company Type Selector */
.cw-type-selector {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.type-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-default);
    max-height: 200px;
    overflow-y: auto;
}

.type-checkbox {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.type-checkbox:hover {
    border-color: var(--teal-primary);
    color: var(--text-primary);
}

.type-checkbox input[type="checkbox"] {
    accent-color: var(--teal-primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.type-checkbox:has(input:checked) {
    background: var(--teal-muted);
    border-color: var(--teal-primary);
    color: var(--teal-light);
}

.cw-sync-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.btn-small {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

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

.selected-types {
    margin-top: 0.5rem;
}

.info-muted {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

.info-highlight {
    color: var(--teal-light);
    font-size: 0.9rem;
    font-weight: 500;
}

.loading-types {
    color: var(--text-muted);
    font-style: italic;
}

.stats-grid.small {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

@media (max-width: 900px) {
    .two-column {
        grid-template-columns: 1fr;
    }
}

/* Empty state */
.empty-state {
    background: var(--bg-secondary);
    padding: 4rem;
    text-align: center;
    border-radius: 12px;
    color: var(--text-muted);
    border: 1px solid var(--border-default);
}

.empty-state a {
    color: var(--teal-light);
}

/* ============================================
   RECONCILIATION PAGE - Dark Theme
   ============================================ */

/* Summary Dashboard */
.reconcile-summary {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-default);
}

.summary-cards {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    flex: 1;
    text-align: center;
    padding: 1.5rem;
    border-radius: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    transition: transform 0.2s, box-shadow 0.2s;
}

.summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.summary-card.total {
    border-color: var(--teal-dark);
}

.summary-card.matched {
    border-color: var(--success);
}

.summary-card.cw-mismatch {
    border-color: var(--error);
}

.summary-card.revio-mismatch {
    border-color: var(--gold-primary);
}

.summary-card.both-mismatch {
    border: 1px solid;
    border-image: linear-gradient(135deg, var(--error) 0%, var(--gold-primary) 100%) 1;
}

.summary-card .summary-value {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

.summary-card.total .summary-value {
    background: linear-gradient(135deg, var(--teal-light) 0%, var(--teal-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.summary-card.matched .summary-value {
    color: var(--success);
}

.summary-card.cw-mismatch .summary-value {
    color: var(--error);
}

.summary-card.revio-mismatch .summary-value {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.summary-card.both-mismatch .summary-value {
    background: linear-gradient(135deg, var(--error) 0%, var(--gold-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.summary-card .summary-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
}

.summary-totals {
    display: flex;
    gap: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-default);
}

.summary-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.summary-row .label {
    font-weight: 600;
    color: var(--text-secondary);
}

.summary-row .value {
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', monospace;
}

.summary-row .diff {
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.summary-row .diff.positive {
    color: var(--gold-light);
    background: var(--gold-muted);
}

.summary-row .diff.negative {
    color: var(--teal-light);
    background: var(--teal-muted);
}

/* Item mismatch summary chips */
.item-mismatch-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border-default);
    flex-wrap: wrap;
}

.item-mismatch-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.item-mismatch-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chip {
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip:hover {
    transform: scale(1.05);
}

.chip-warn {
    background: rgba(212, 175, 55, 0.2);
    color: #d4af37;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.chip-warn:hover, .chip-warn.active {
    background: rgba(212, 175, 55, 0.4);
    border-color: #d4af37;
}

.chip-revio {
    background: rgba(232, 136, 136, 0.2);
    color: #e88;
    border: 1px solid rgba(232, 136, 136, 0.3);
}

.chip-revio:hover, .chip-revio.active {
    background: rgba(232, 136, 136, 0.4);
    border-color: #e88;
}

.chip-clear {
    background: rgba(100, 100, 100, 0.2);
    color: #aaa;
    border: 1px solid rgba(100, 100, 100, 0.3);
}

.chip-clear:hover {
    background: rgba(100, 100, 100, 0.4);
    color: #fff;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-default);
    flex-wrap: wrap;
}

.filter-label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-default);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

.filter-btn.active {
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-dark) 100%);
    border-color: var(--teal-primary);
    color: var(--bg-dark);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.3);
}

.filter-btn[data-filter="matched"].active {
    background: linear-gradient(135deg, var(--success) 0%, #1a7f37 100%);
    border-color: var(--success);
    box-shadow: 0 4px 12px rgba(46, 160, 67, 0.3);
}

.filter-btn[data-filter="mismatch-cw"].active {
    background: linear-gradient(135deg, var(--error) 0%, #b91c1c 100%);
    border-color: var(--error);
    box-shadow: 0 4px 12px rgba(248, 81, 73, 0.3);
}

.filter-btn[data-filter="mismatch-revio"].active {
    background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-dark) 100%);
    border-color: var(--gold-primary);
    box-shadow: 0 4px 12px rgba(212, 164, 24, 0.3);
}

.filter-btn[data-filter="mismatch-both"].active {
    background: linear-gradient(135deg, var(--error) 0%, var(--gold-primary) 100%);
    border-color: var(--error);
    box-shadow: 0 4px 12px rgba(248, 81, 73, 0.3);
}

/* Domain Cards Grid */
.reconcile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.25rem;
}

.domain-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1px solid var(--border-default);
    border-left: 4px solid var(--success);
    overflow: hidden;
}

.domain-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    transform: translateY(-4px);
    border-color: var(--teal-primary);
}

/* Mismatch types */
.domain-card.mismatch {
    border-left-color: var(--error);
}

.domain-card.mismatch:hover {
    border-color: var(--error);
}

.domain-card.mismatch-revio {
    border-left-color: var(--gold-primary);
}

.domain-card.mismatch-revio:hover {
    border-color: var(--gold-primary);
}

.domain-card.mismatch-cw {
    border-left-color: var(--error);
}

.domain-card.mismatch-cw:hover {
    border-color: var(--error);
}

.domain-card.mismatch-both {
    border-left: 4px solid;
    border-image: linear-gradient(180deg, var(--error) 0%, var(--error) 50%, var(--gold-primary) 50%, var(--gold-primary) 100%) 1;
}

.domain-card.mismatch-both:hover {
    border-color: var(--error);
}

.domain-card.expanded {
    grid-column: 1 / -1;
    border-color: var(--teal-primary);
}

.card-summary {
    padding: 1.25rem;
}

.domain-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.domain-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.site-badge {
    background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-dark) 100%);
    color: var(--bg-dark);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.sip-badge {
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-dark) 100%);
    color: var(--bg-dark);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.badge-info {
    background: var(--teal-muted);
    color: var(--teal-light);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.row-info {
    background: var(--teal-muted);
}

.metric-info {
    opacity: 0.7;
}

.status-indicator {
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-indicator.success {
    background: var(--success-muted);
    color: var(--success);
    border: 1px solid var(--success);
}

.status-indicator.warning {
    background: var(--warning-muted);
    color: var(--gold-light);
    border: 1px solid var(--gold-primary);
}

.status-indicator.danger {
    background: var(--error-muted);
    color: var(--error);
    border: 1px solid var(--error);
}

.status-indicator.danger-warning {
    background: linear-gradient(135deg, var(--error-muted) 0%, var(--warning-muted) 100%);
    color: var(--text-primary);
    border: 1px solid var(--error);
    border-image: linear-gradient(135deg, var(--error) 0%, var(--gold-primary) 100%) 1;
}

.card-metrics {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.metric {
    background: var(--bg-tertiary);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    text-align: center;
    min-width: 65px;
    border: 1px solid var(--border-muted);
    transition: background 0.2s;
}

.metric.has-diff {
    background: var(--warning-muted);
    border-color: var(--gold-dark);
}

.metric-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-values {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', monospace;
}

/* Card Details (expanded view) */
.card-details {
    border-top: 1px solid var(--border-default);
    padding: 1.25rem;
    background: var(--bg-tertiary);
    position: relative;
}

.btn-close-card {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: #3a3a3a;
    border: 1px solid #555;
    color: #aaa;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.btn-close-card:hover {
    background: #4a4a4a;
    border-color: #d4af37;
    color: #d4af37;
}

.details-section {
    margin-bottom: 1.25rem;
}

.details-section:last-child {
    margin-bottom: 0;
}

.details-section h4 {
    font-size: 0.9rem;
    color: var(--teal-light);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-default);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.details-table thead th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--teal-light);
    border-bottom: 2px solid var(--teal-primary);
    background: var(--bg-tertiary);
}

.details-table thead th:nth-child(2),
.details-table thead th:nth-child(3) {
    text-align: center;
}

.details-table thead th:last-child {
    text-align: right;
}

.details-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-muted);
}

.details-table td:first-child {
    font-weight: 500;
    width: 120px;
    color: var(--text-secondary);
}

.details-table td:nth-child(2),
.details-table td:nth-child(3) {
    text-align: center;
    width: 60px;
    font-family: 'Monaco', 'Menlo', monospace;
}

.details-table td:last-child {
    text-align: right;
    width: 90px;
}

.details-table .row-mismatch {
    background: var(--warning-muted);
}

.badge-ok {
    background: var(--success-muted);
    color: var(--success);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-warn {
    background: var(--warning-muted);
    color: var(--gold-light);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.did-summary-row {
    display: flex;
    gap: 2rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.did-issue {
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.did-issue.missing {
    background: var(--error-muted);
    border-left: 3px solid var(--error);
}

.did-issue.extra {
    background: var(--warning-muted);
    border-left: 3px solid var(--gold-primary);
}

.did-issue strong {
    color: var(--text-primary);
}

.did-issue .did-list {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.did-ok {
    color: var(--success);
    font-weight: 600;
    font-size: 0.9rem;
}

.details-footer {
    display: flex;
    gap: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-default);
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

/* Site mappings */
.btn-expand {
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-dark) 100%);
    color: white;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}

.btn-expand:hover {
    transform: scale(1.1);
}

.sites-container {
    background: var(--bg-tertiary);
}

.sites-content {
    padding: 1rem;
}

.site-mapping-table {
    width: 100%;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-collapse: collapse;
}

.site-mapping-table th,
.site-mapping-table td {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-muted);
    text-align: left;
}

.site-mapping-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
}

.badge-small {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-left: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-small.inherited {
    background: var(--success-muted);
    color: var(--success);
}

.badge-small.override {
    background: var(--warning-muted);
    color: var(--gold-light);
}

.btn-inherit {
    padding: 0.3rem 0.6rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

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

/* Responsive */
@media (max-width: 800px) {
    .reconcile-grid {
        grid-template-columns: 1fr;
    }

    .summary-cards {
        flex-direction: column;
    }

    .summary-totals {
        flex-direction: column;
        gap: 0.75rem;
    }

    nav {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links a {
        margin-left: 0;
        margin-right: 1rem;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection */
::selection {
    background: var(--teal-primary);
    color: var(--bg-dark);
}

/* Sync button on reconcile cards */
.card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-sync {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #d4af37;
    min-width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
}

.btn-sync:hover {
    background: #3a3a3a;
    border-color: #d4af37;
}

.btn-sync.syncing {
    width: 120px;
    color: transparent;
    cursor: wait;
}

.btn-sync.syncing::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--progress, 0%);
    background: linear-gradient(90deg, #d4af37 0%, #b8962e 100%);
    transition: width 0.3s ease;
}

.btn-sync.syncing::after {
    content: attr(data-stage);
    position: absolute;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    text-shadow: 0 0 2px #000;
    z-index: 1;
}

.btn-sync.success {
    background: #1a3a1a;
    border-color: #4a9;
    color: #4a9;
    width: 28px;
}

.btn-sync.error {
    background: #3a1a1a;
    border-color: #a44;
    color: #a44;
    width: 28px;
}

.btn-sync.btn-sync-revio {
    background: #2a2520;
    border-color: #e88;
    color: #e88;
}

.btn-sync.btn-sync-revio:hover {
    background: #3a3025;
    border-color: #faa;
}

/* Search box on reconcile page */
.search-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    flex: 1;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--teal-primary);
    box-shadow: 0 0 0 3px var(--teal-muted);
}

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

.search-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.search-count:empty {
    display: none;
}

.domain-card.search-hidden {
    display: none;
}

/* Mapping Logic Page Styles */
.logic-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.logic-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-default);
}

.logic-section h2 {
    color: var(--gold-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-default);
    font-size: 1.3rem;
}

.logic-section h3 {
    color: var(--teal-primary);
    margin: 1rem 0 0.5rem 0;
    font-size: 1.1rem;
}

.logic-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.logic-table th,
.logic-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-default);
}

.logic-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.logic-table td {
    color: var(--text-primary);
}

.logic-table code {
    background: var(--bg-tertiary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    color: var(--teal-light);
}

.logic-formula {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 8px;
    margin: 0.75rem 0;
    border-left: 3px solid var(--teal-primary);
}

.logic-formula code {
    background: var(--bg-elevated);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--gold-light);
}

.logic-formula ul,
.logic-formula ol {
    margin: 0.5rem 0 0.5rem 1.5rem;
}

.logic-formula li {
    margin: 0.25rem 0;
}

.logic-note {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 8px;
    margin: 0.75rem 0;
    border-left: 3px solid var(--gold-primary);
    color: var(--text-secondary);
}

.logic-note.warning {
    border-left-color: var(--error);
    background: var(--error-muted);
}

.logic-note strong {
    color: var(--text-primary);
}

.logic-example {
    background: var(--success-muted);
    padding: 1rem;
    border-radius: 8px;
    margin: 0.75rem 0;
    border-left: 3px solid var(--success);
}

.logic-steps {
    margin: 1rem 0 1rem 1.5rem;
}

.logic-steps li {
    margin: 0.5rem 0;
    padding-left: 0.5rem;
}

.logic-steps ul {
    margin: 0.5rem 0 0.5rem 1.5rem;
}

.logic-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin: 1rem 0;
}

.flow-item {
    background: var(--bg-elevated);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: var(--teal-light);
    font-weight: 500;
}

.flow-arrow {
    color: var(--gold-primary);
    font-size: 1.2rem;
}
