/* --- CONSTANTS & DESIGN SYSTEM --- */
:root {
    --bg-color: #f4f6fa;
    --card-bg: #ffffff;
    --border-color: #e6eaf0;
    --text-color: #1f2937;
    --text-muted: #7b8794;
    --primary: #2f5bea;
    --primary-hover: #1d4ed8;
    --success: #10b981;
    --success-hover: #059669;
    --warning: #f97316;
    --danger: #dc2626;
    --slate: #475569;
    --slate-hover: #334155;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.02);
}

/* --- RESET & BASIC SETUP --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Helpers */
.hidden {
    display: none !important;
}
.text-center {
    text-align: center;
}
.error-msg {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 12px;
    background-color: #fee2e2;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid #fca5a5;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
}
.btn-outline {
    background-color: #eef2ff;
    color: var(--primary);
}
.btn-outline:hover {
    background-color: #dbeafe;
}
.icon-button {
    min-width: 42px;
    padding: 8px 12px;
    font-size: 16px;
    line-height: 1;
}
.sync-glyph {
    display: inline-block;
}
.icon-button.is-spinning .sync-glyph {
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.btn-success {
    background-color: var(--success);
    color: white;
    border: none;
    padding: 8px 16px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.btn-success:hover {
    background-color: var(--success-hover);
}
.btn-slate {
    background-color: var(--slate);
    color: white;
    border: none;
    padding: 8px 16px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.btn-slate:hover {
    background-color: var(--slate-hover);
}
.btn-full {
    width: 100%;
}
.btn-large {
    padding: 12px 28px;
    font-size: 15px;
    border-radius: var(--radius-md);
}

/* Form controls */
input[type="text"], input[type="password"], select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #ffffff;
    color: var(--text-color);
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
}
input:focus, select:focus {
    border-color: var(--primary);
}

/* --- AUTH WRAPPER (LOGIN SCREEN) --- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    padding: 20px;
}
.auth-card {
    background-color: var(--card-bg);
    width: 100%;
    max-width: 400px;
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.8);
}
.auth-card h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}
.auth-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}
.input-group {
    margin-bottom: 16px;
}
.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* --- DASHBOARD WRAPPER LAYOUT --- */
.dashboard-wrapper {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    background-color: #ffffff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar .logo h1 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-color);
    letter-spacing: -0.5px;
}
.sidebar .logo span {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}
.nav-menu {
    margin-top: 40px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.nav-item {
    display: block;
    text-decoration: none;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.nav-item:hover {
    background-color: #f1f5f9;
}
.nav-item.active {
    background-color: #eef2ff;
    color: var(--primary);
}
.btn-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 14px;
    width: 100%;
    text-align: left;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s;
}
.btn-logout:hover {
    background-color: #fee2e2;
    color: var(--danger);
}

/* Main Content */
.main-content {
    padding: 32px;
    max-height: 100vh;
    overflow-y: auto;
}
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.header-title h2 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.header-title p {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}
.header-title p span {
    color: var(--warning);
}
.header-actions {
    display: flex;
    gap: 12px;
}

/* Tab Panels */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* Card base */
.card {
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.metric-card {
    background-color: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}
.metric-card .card-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.metric-card .card-header .icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}
.metric-card h3 {
    font-size: 28px;
    font-weight: 800;
}
/* Metrics coloring */
.card-blue h3, .card-blue .icon { color: var(--primary); }
.card-blue .icon { background-color: #dbeafe; }
.card-orange h3, .card-orange .icon { color: var(--warning); }
.card-orange .icon { background-color: #ffedd5; }
.card-purple h3, .card-purple .icon { color: #8b5cf6; }
.card-purple .icon { background-color: #f3e8ff; }
.card-green h3, .card-green .icon { color: var(--success); }
.card-green .icon { background-color: #dcfce7; }
.card-red h3, .card-red .icon { color: var(--danger); }
.card-red .icon { background-color: #fee2e2; }

/* Config Toolbar */
.config-toolbar {
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.form-row {
    display: grid;
    grid-template-columns: 280px 280px 1fr;
    gap: 16px;
}
.form-group label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
}
.input-inline {
    display: flex;
    gap: 8px;
}
.input-inline input,
.input-inline select {
    flex-grow: 1;
    min-width: 0;
}
#btn-manage-profiles {
    padding: 0;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

/* Layout Grid (Table + Logs) */
.layout-grid {
    display: grid;
    grid-template-columns: 1fr 460px;
    gap: 20px;
    margin-bottom: 20px;
}

/* Table Card */
.table-container {
    display: flex;
    flex-direction: column;
}
.table-header-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.table-header-toolbar h3 {
    font-size: 15px;
    font-weight: 700;
}
.table-header-toolbar .filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
}
.table-header-toolbar .filters select, .table-header-toolbar .filters input {
    padding: 6px 12px;
    font-size: 13px;
    width: auto;
}
.table-header-toolbar .filters input {
    width: 200px;
}
#tab-listings-content .table-header-toolbar .filters {
    justify-content: flex-start;
}
#tab-listings-content #search-listing {
    width: 260px;
}

/* Segmented tabs */
.segmented-tabs {
    display: flex;
    background-color: #f1f5f9;
    padding: 4px;
    border-radius: var(--radius-sm);
    gap: 4px;
    margin-bottom: 12px;
}
.tab-badge {
    flex-grow: 1;
    background: none;
    border: none;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-color);
    transition: all 0.2s;
}
.tab-badge.active {
    background-color: var(--primary);
    color: #ffffff;
}

/* Orders Table */
.scrollable-table-wrapper {
    overflow-x: auto;
    flex-grow: 1;
    min-height: 350px;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}
.orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}
.orders-table th, .orders-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    overflow-wrap: anywhere;
}
.orders-table th:nth-child(1), .orders-table td:nth-child(1) { width: 42px; }
.orders-table th:nth-child(2), .orders-table td:nth-child(2) { width: 11%; }
.orders-table th:nth-child(3), .orders-table td:nth-child(3) { width: 20%; }
.orders-table th:nth-child(4), .orders-table td:nth-child(4) { width: 27%; }
.orders-table th:nth-child(5), .orders-table td:nth-child(5) { width: 10%; }
.orders-table th:nth-child(6), .orders-table td:nth-child(6) { width: 13%; }
.orders-table th:nth-child(7), .orders-table td:nth-child(7) { width: 12%; }
.orders-table th:nth-child(8), .orders-table td:nth-child(8) { width: 10%; }
.orders-table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 10;
}
.orders-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s;
}
.orders-table tbody tr:hover {
    background-color: #f8fafc;
}
.orders-table tbody tr.selected {
    background-color: #eef4ff;
    border-left: 3px solid var(--primary);
}

/* Status Pills */
.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
    white-space: normal;
    text-align: center;
}
.pill-orange { background-color: #ffedd5; color: var(--warning); }
.pill-blue { background-color: #dbeafe; color: var(--primary); }
.pill-purple { background-color: #f3e8ff; color: #8b5cf6; }
.pill-green { background-color: #dcfce7; color: var(--success); }
.pill-red { background-color: #fee2e2; color: var(--danger); }
.pill-muted { background-color: #f1f5f9; color: var(--text-muted); }

/* Pagination */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
}
.pager {
    display: flex;
    gap: 4px;
}
.pager button {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.pager button:hover {
    background-color: #f1f5f9;
}
.pager button.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Logs Container & Flow steps */
.logs-container {
    display: flex;
    flex-direction: column;
}
.logs-header h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
}
.flow-steps-card {
    background-color: #f8fafc;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 14px;
    border: 1px solid var(--border-color);
}
.flow-steps-card h4 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.flow-steps-card ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.flow-steps-card li {
    font-size: 11px;
    color: var(--text-color);
    display: flex;
    align-items: center;
}
.flow-steps-card .dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #dbeafe;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    margin-right: 8px;
}

.timeline-logs-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    max-height: 250px;
    background-color: #f8fafc;
    border-radius: var(--radius-md);
    padding: 12px;
    border: 1px solid var(--border-color);
}
.log-row {
    display: flex;
    margin-bottom: 10px;
    font-size: 11px;
    line-height: 1.4;
}
.log-time {
    color: var(--text-muted);
    width: 60px;
    flex-shrink: 0;
}
.log-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    margin-right: 8px;
    flex-shrink: 0;
    margin-top: 1px;
}
.log-row.info .log-icon { background-color: #dbeafe; color: var(--primary); }
.log-row.success .log-icon { background-color: #dcfce7; color: var(--success); }
.log-row.error .log-icon { background-color: #fee2e2; color: var(--danger); }
.log-msg {
    color: var(--text-color);
    word-break: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
}

/* Bottom Panels Grid */
.bottom-panels-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.bottom-card {
    min-height: 180px;
}
.bottom-card h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}
.placeholder-content {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding-top: 40px;
}

/* Detail UI elements */
.grid-details {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 12px;
}
.detail-label {
    color: var(--text-muted);
}
.detail-value {
    font-weight: 600;
}
.actions-inline {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}
.product-match-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
}

.order-info-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}
.order-info-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #f8fafc;
}
.order-info-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 4px;
}
.order-info-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    color: var(--text-muted);
    font-size: 12px;
}
.order-issue-list {
    margin-top: 10px;
    padding-left: 18px;
    color: var(--danger);
    font-size: 12px;
}

/* --- CHROME EXTENSION PAGE --- */
.extension-card {
    max-width: 800px;
    margin: 0 auto;
}
.extension-card h2 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--primary);
}
.extension-card .subtitle {
    color: var(--text-muted);
    margin-bottom: 24px;
}
.extension-action {
    background-color: #eef2ff;
    padding: 30px;
    border-radius: var(--radius-md);
    text-align: center;
    margin-bottom: 30px;
    border: 1px solid #c7d2fe;
}
.extension-action .note {
    font-size: 12px;
    color: var(--primary);
    margin-top: 10px;
    font-weight: 500;
}
.setup-guide h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 14px;
}
.steps-list {
    padding-left: 20px;
    font-size: 14px;
}
.steps-list li {
    margin-bottom: 14px;
    line-height: 1.6;
}
.highlight {
    background-color: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 600;
    color: var(--danger);
}

/* --- RESPONSIVENESS --- */
@media (max-width: 1200px) {
    .dashboard-wrapper {
        grid-template-columns: 1fr;
    }
    .sidebar {
        height: auto;
        position: relative;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 16px 24px;
    }
    .nav-menu {
        flex-direction: row;
        margin-top: 0;
        gap: 16px;
    }
    .sidebar-footer {
        margin-left: auto;
    }
    .main-content {
        padding: 20px;
    }
    .layout-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    .dashboard-wrapper {
        display: block;
    }
    .main-content {
        padding: 14px;
        max-height: none;
        overflow: visible;
    }
    .app-header {
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 16px;
    }
    .header-title h2 {
        font-size: 22px;
    }
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .metrics-grid > div:last-child {
        grid-column: auto;
    }
    .metric-card {
        padding: 12px;
        min-height: 86px;
    }
    .metric-card h3 {
        display: block;
        font-size: 24px;
        line-height: 1.15;
        min-height: 28px;
        margin: 0;
    }
    .config-toolbar,
    .card {
        padding: 14px;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .table-header-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }
    .table-header-toolbar .filters {
        justify-content: flex-start;
        width: 100%;
    }
    .table-header-toolbar .filters input,
    .table-header-toolbar .filters select,
    #tab-listings-content #search-listing {
        width: 100%;
    }
    .order-toolbar-actions {
        width: 100%;
        margin-left: 0 !important;
    }
    .order-toolbar-actions button,
    #btn-listing-sync,
    #btn-listing-scan {
        flex: 1;
        min-height: 40px;
    }
    .segmented-tabs {
        overflow-x: auto;
    }
    .tab-badge {
        min-width: 130px;
    }
    .scrollable-table-wrapper {
        min-height: 260px;
        max-height: none;
        overflow: visible;
        border: none;
    }
    .orders-table,
    .orders-table thead,
    .orders-table tbody,
    .orders-table tr,
    .orders-table td {
        display: block;
        width: 100% !important;
    }
    .orders-table thead {
        display: none;
    }
    .orders-table tbody tr {
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 10px;
        margin-bottom: 10px;
        background: #fff;
    }
    .orders-table th,
    .orders-table td {
        border-bottom: 0;
        padding: 7px 4px;
    }
    .orders-table td {
        display: grid;
        grid-template-columns: 120px 1fr;
        gap: 8px;
        align-items: start;
        font-size: 13px;
    }
    .orders-table td::before {
        color: var(--text-muted);
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
    }
    .orders-table td:first-child {
        display: block;
    }
    #tab-orders-content .orders-table td:nth-child(2)::before { content: "Order"; }
    #tab-orders-content .orders-table td:nth-child(3)::before { content: "Customer"; }
    #tab-orders-content .orders-table td:nth-child(4)::before { content: "Items"; }
    #tab-orders-content .orders-table td:nth-child(5)::before { content: "Total"; }
    #tab-orders-content .orders-table td:nth-child(6)::before { content: "Fulfillment"; }
    #tab-orders-content .orders-table td:nth-child(7)::before { content: "Order Check"; }
    #tab-orders-content .orders-table td:nth-child(8)::before { content: "Tracking"; }
    #tab-listings-content .orders-table td:nth-child(2)::before { content: "Sản phẩm"; }
    #tab-listings-content .orders-table td:nth-child(3)::before { content: "Màu"; }
    #tab-listings-content .orders-table td:nth-child(4)::before { content: "Sync"; }
    #tab-listings-content .orders-table td:nth-child(5)::before { content: "Printify"; }
    #tab-listings-content .orders-table td:nth-child(6)::before { content: "Chi tiết"; }
    .pagination-wrapper {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }
    .bottom-panels-grid {
        grid-template-columns: 1fr;
    }
    .sidebar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 14px;
    }
    .nav-menu {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        gap: 6px;
    }
    .nav-item {
        white-space: nowrap;
        padding: 8px 10px;
    }
    .sidebar-footer {
        width: 100%;
        margin-top: 8px;
    }
    .design-choice-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* --- COOKIE STATUS INDICATOR --- */
.cookie-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #f8fafc;
    font-size: 13px;
    height: 38px;
}
.indicator-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--text-muted);
}
.cookie-indicator.active .indicator-dot {
    background-color: var(--success);
}
.cookie-indicator.inactive .indicator-dot {
    background-color: var(--danger);
}
.cookie-indicator.active .indicator-text {
    color: var(--success);
    font-weight: bold;
}
.cookie-indicator.inactive .indicator-text {
    color: var(--danger);
    font-weight: bold;
}

/* --- MODAL DIALOG --- */
.modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-card {
    background-color: #ffffff;
    width: 100%;
    max-width: 580px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-color);
}
.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.15s;
}
.btn-close:hover {
    color: var(--danger);
}
.modal-body {
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.design-choice-card {
    max-width: 760px;
}
.design-choice-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 14px;
}
.design-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    max-height: 55vh;
    overflow-y: auto;
    margin-bottom: 14px;
}
.design-choice-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    padding: 10px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.design-choice-item:hover,
.design-choice-item.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(47, 91, 234, 0.12);
}
.design-choice-item img {
    width: 100%;
    height: 130px;
    object-fit: contain;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}
.design-choice-item span {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color);
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    .design-choice-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Profiles List UI */
.profile-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}
.profile-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #ffffff;
    transition: border-color 0.15s;
}
.profile-item:hover {
    border-color: var(--primary);
}
.profile-item.active {
    border-color: var(--success);
    background-color: #f0fdf4;
}
.profile-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.profile-title {
    font-weight: bold;
    font-size: 14px;
}
.profile-sub {
    font-size: 11px;
    color: var(--text-muted);
}
.profile-actions {
    display: flex;
    gap: 8px;
}
.btn-sm-slate {
    background-color: #f1f5f9;
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    font-size: 11px;
    font-weight: bold;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-sm-slate:hover {
    background-color: var(--slate);
    color: white;
}
.btn-sm-danger {
    background-color: #fee2e2;
    border: 1px solid #fca5a5;
    color: var(--danger);
    padding: 4px 8px;
    font-size: 11px;
    font-weight: bold;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-sm-danger:hover {
    background-color: var(--danger);
    color: white;
}
