:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 64px;
    --header-height: 64px;
    --primary-color: #3A7D44;
    /* Fern */
    --primary-dark: #254D32;
    /* Dark Spruce */
    --text-color: #181D27;
    /* Shadow Grey */
    --text-muted: #64748b;
    --bg-color: #f6f8fc;
    --surface-color: #ffffff;
    --border-color: #e2e8f0;
    --shadow-color: rgba(24, 29, 39, 0.08);
    /* Shadow Grey with opacity */
    --success-color: #3A7D44;
    /* Fern (doubles as success) */
    --warning-color: #b45309;
    --danger-color: #b91c1c;
    --info-color: #69B578;
    /* Emerald */
    --sidebar-bg: #ffffff;
    --sidebar-border: #e2e8f0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-color);
    min-height: 100vh;
    display: flex;
    color: var(--text-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    z-index: 1000;
}

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

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar.collapsed .sidebar-header {
    padding: 0;
    justify-content: center;
}

.logo-text {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.sidebar.collapsed .logo-text {
    display: none;
}

.sidebar.collapsed .logo-icon {
    display: block;
    font-size: 24px;
}

.logo-icon {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: #666;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-item {
    padding: 12px 0;
    justify-content: center;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.sidebar.collapsed .nav-item:hover,
.sidebar.collapsed .nav-item.active {
    border-right: none;
    border-left: 3px solid var(--primary-color);
}

.nav-icon {
    width: 24px;
    font-size: 18px;
    margin-right: 12px;
    text-align: center;
}

.sidebar.collapsed .nav-icon {
    margin-right: 0;
}

.nav-label {
    font-size: 15px;
    font-weight: 500;
}

.sidebar.collapsed .nav-label {
    display: none;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    width: calc(100% - var(--sidebar-width));
}

.sidebar.collapsed+.main-content {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

.top-bar {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 999;
}

.toggle-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 8px;
    border-radius: 4px;
}

.toggle-btn:hover {
    background: #f0f0f0;
}

.content-wrapper {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Common UI */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

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

.header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-icon,
.icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary-color);
    font-size: 16px;
}

.icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 20px;
}

.icon-muted {
    background: rgba(100, 116, 139, 0.12);
    color: var(--text-muted);
}

.icon-success {
    background: rgba(21, 128, 61, 0.12);
    color: var(--success-color);
}

.icon-warning {
    background: rgba(180, 83, 9, 0.12);
    color: var(--warning-color);
}

.icon-danger {
    background: rgba(185, 28, 28, 0.12);
    color: var(--danger-color);
}

.icon-info {
    background: rgba(15, 118, 110, 0.12);
    color: var(--info-color);
}

.card,
.metric-card,
.stat-card,
.chart-card,
.param-chart-card,
.link-info {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 10px 30px var(--shadow-color);
}

.card,
.link-info {
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 20px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-success {
    background: rgba(21, 128, 61, 0.12);
    color: var(--success-color);
    border-color: rgba(21, 128, 61, 0.2);
}

.badge-warning {
    background: rgba(180, 83, 9, 0.12);
    color: var(--warning-color);
    border-color: rgba(180, 83, 9, 0.2);
}

.badge-danger {
    background: rgba(185, 28, 28, 0.12);
    color: var(--danger-color);
    border-color: rgba(185, 28, 28, 0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    border-color: rgba(37, 99, 235, 0.5);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-color);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-success {
    background: rgba(21, 128, 61, 0.12);
    color: var(--success-color);
    border-color: rgba(21, 128, 61, 0.3);
}

.btn-warning {
    background: rgba(180, 83, 9, 0.12);
    color: var(--warning-color);
    border-color: rgba(180, 83, 9, 0.3);
}

.btn-danger {
    background: rgba(185, 28, 28, 0.12);
    color: var(--danger-color);
    border-color: rgba(185, 28, 28, 0.3);
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 8px;
}

.alert {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(21, 128, 61, 0.12);
    color: var(--success-color);
    border-color: rgba(21, 128, 61, 0.2);
}

.alert-error {
    background: rgba(185, 28, 28, 0.12);
    color: var(--danger-color);
    border-color: rgba(185, 28, 28, 0.2);
}

.alert-warning {
    background: rgba(180, 83, 9, 0.12);
    color: var(--warning-color);
    border-color: rgba(180, 83, 9, 0.2);
}

.empty-state {
    text-align: center;
    padding: 28px;
    color: var(--text-muted);
}

.empty-state .icon {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: #fff;
}

.filter-btn.active {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary-color);
    border-color: rgba(37, 99, 235, 0.3);
}

.compare-toggle {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.back-link:hover {
    color: var(--primary-color);
}

.link-info {
    padding: 20px;
}

.link-info h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.link-info .dest {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 8px;
    word-break: break-all;
}

.link-info .meta {
    color: var(--text-muted);
    font-size: 13px;
}

.meta-separator {
    padding: 0 8px;
    color: var(--border-color);
}

/* Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.metric-card {
    padding: 18px;
}

.metric-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 12px;
}

.metric-value.good {
    color: var(--success-color);
}

.metric-value.warning {
    color: var(--warning-color);
}

.metric-value.bad {
    color: var(--danger-color);
}

.latency-breakdown {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 6px;
}

.latency-item {
    background: #f8fafc;
    border-radius: 10px;
    padding: 8px;
    text-align: center;
}

.latency-item .label {
    font-size: 11px;
    color: var(--text-muted);
}

.latency-item .value {
    font-size: 13px;
    font-weight: 600;
}

.metric-detail {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.error-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.error-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.error-type {
    font-weight: 600;
}

.error-count {
    color: var(--danger-color);
}

/* Layout helpers */
.two-column {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.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-color);
    font-size: 13px;
}

.data-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.02em;
}

.data-table tr:hover {
    background: #f8fafc;
}

.slug-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: var(--primary-color);
    font-weight: 600;
}

/* Stats and charts */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 16px;
}

.stat-card h3 {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 24px;
    font-weight: 700;
}

.stat-card .change {
    font-size: 12px;
    margin-top: 6px;
}

.stat-card .change.positive {
    color: var(--success-color);
}

.stat-card .change.negative {
    color: var(--danger-color);
}

.stat-card .change.neutral {
    color: var(--text-muted);
}

.charts-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.charts-grid,
.param-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.chart-card,
.param-chart-card {
    padding: 16px;
}

.chart-card h3,
.param-chart-card h3 {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-container {
    height: 240px;
}

.chart-container.tall {
    height: 320px;
}

/* Variations */
.expand-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.expand-btn.is-open {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary-color);
    border-color: rgba(37, 99, 235, 0.3);
}

.variation-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 8px;
}

.variations-row td {
    background: #f8fafc;
}

.variations-container {
    padding: 16px;
}

.add-variation-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.variation-name-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 13px;
}

.variation-name-input:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

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

.variations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loading,
.empty-variations {
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}

.error {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(185, 28, 28, 0.12);
    color: var(--danger-color);
    font-size: 12px;
    text-align: center;
}

.variation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
}

.variation-name {
    font-weight: 600;
}

.variation-params {
    font-size: 12px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

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

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

.utm-builder {
    margin-top: 12px;
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px;
}

.utm-add-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.utm-quick-btn {
    border: 1px solid var(--border-color);
    background: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
}

.utm-param-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.utm-param-row select,
.utm-param-row input {
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 12px;
}

.params-preview {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.utm-remove-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid rgba(185, 28, 28, 0.3);
    color: var(--danger-color);
    background: rgba(185, 28, 28, 0.12);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Forms */
.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 16px;
}

.advanced-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--primary-color);
    cursor: pointer;
}

/* QR Modal */
.qr-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 2000;
}

.qr-modal.show {
    display: flex;
}

.qr-modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    width: min(520px, 100%);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar.active .logo-text,
    .sidebar.active .nav-label {
        display: block;
    }

    .sidebar.active .logo-icon {
        display: none;
    }

    .sidebar.active .nav-item {
        justify-content: flex-start;
        padding: 12px 24px;
    }

    .sidebar.active .nav-icon {
        margin-right: 12px;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .sidebar.collapsed+.main-content {
        margin-left: 0;
        width: 100%;
    }

    /* Overlay for mobile */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    .sidebar.active~.sidebar-overlay {
        display: block;
    }
}


/* ==================== Premium QR Code Modal ==================== */

.premium-qr-modal {
    width: min(900px, 95vw);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.qr-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.qr-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.qr-modal-header h3 i {
    color: var(--primary-color);
}

.qr-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #f1f5f9;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.qr-close-btn:hover {
    background: #e2e8f0;
    color: var(--text-color);
}

.qr-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.qr-preview-section {
    flex: 0 0 340px;
    padding: 24px;
    background: #f8fafc;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.qr-preview-container {
    position: relative;
    background: repeating-conic-gradient(#e2e8f0 0% 25%, #fff 0% 50%) 50% / 16px 16px;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    min-width: 280px;
}

.qr-preview-container img {
    max-width: 100%;
    max-height: 280px;
    border-radius: 4px;
}

.qr-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 24px;
    color: var(--primary-color);
}

.qr-preview-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.qr-preview-actions .btn {
    flex: 1;
    justify-content: center;
}

.qr-customize-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.qr-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding: 0 16px;
    gap: 4px;
}

.qr-tab {
    padding: 12px 16px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s ease;
}

.qr-tab:hover {
    color: var(--text-color);
}

.qr-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.qr-tab i {
    font-size: 14px;
}

.qr-tab-content {
    display: none;
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

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

.qr-option-group {
    margin-bottom: 20px;
}

.qr-option-group > label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 8px;
}

.color-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker-row input[type="color"] {
    width: 44px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
}

.color-hex-input {
    width: 90px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.color-hex-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(58, 125, 68, 0.1);
}

.transparent-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: auto;
}

.transparent-toggle input {
    cursor: pointer;
}

.color-presets {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.color-preset {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.color-preset:hover {
    transform: scale(1.1);
    border-color: var(--border-color);
}

.logo-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #fafbfc;
}

.logo-upload-area:hover,
.logo-upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(58, 125, 68, 0.05);
}

.logo-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.logo-upload-placeholder i {
    font-size: 32px;
    color: var(--primary-color);
    opacity: 0.6;
}

.logo-upload-placeholder small {
    font-size: 11px;
    opacity: 0.7;
}

.logo-preview {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-preview img {
    max-width: 120px;
    max-height: 80px;
    border-radius: 8px;
}

.logo-remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: var(--danger-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-color);
    cursor: pointer;
}

.checkbox-option input {
    cursor: pointer;
}

.qr-option-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    appearance: none;
    cursor: pointer;
}

.qr-option-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.size-options,
.style-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.size-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.size-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.size-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.style-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: white;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 80px;
}

.style-btn:hover {
    border-color: var(--primary-color);
}

.style-btn.active {
    border-color: var(--primary-color);
    background: rgba(58, 125, 68, 0.08);
    color: var(--primary-color);
}

.style-preview,
.corner-preview {
    width: 24px;
    height: 24px;
    background: var(--text-color);
}

.style-preview.square,
.corner-preview.square {
    border-radius: 0;
}

.style-preview.rounded,
.corner-preview.rounded {
    border-radius: 6px;
}

.style-preview.dots,
.corner-preview.dots {
    border-radius: 50%;
}

/* Mobile responsive for QR modal */
@media (max-width: 768px) {
    .premium-qr-modal {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .qr-modal-body {
        flex-direction: column;
    }
    
    .qr-preview-section {
        flex: 0 0 auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 16px;
    }
    
    .qr-preview-container {
        min-height: 200px;
        min-width: 200px;
    }
    
    .qr-preview-container img {
        max-height: 200px;
    }
    
    .qr-customize-section {
        flex: 1;
        min-height: 0;
    }
    
    .qr-tabs {
        overflow-x: auto;
        padding: 0 12px;
    }
    
    .qr-tab {
        padding: 10px 12px;
        white-space: nowrap;
    }
}


/* Link Type Options */
.link-type-options {
    display: flex;
    gap: 12px;
}

.link-type-option {
    flex: 1;
    cursor: pointer;
}

.link-type-option input[type="radio"] {
    display: none;
}

.link-type-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: white;
    transition: all 0.15s ease;
}

.link-type-option input[type="radio"]:checked + .link-type-card {
    border-color: var(--primary-color);
    background: rgba(58, 125, 68, 0.06);
}

.link-type-option:hover .link-type-card {
    border-color: var(--primary-color);
}

.link-type-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(58, 125, 68, 0.12);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.link-type-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.link-type-info strong {
    font-size: 13px;
    color: var(--text-color);
}

.link-type-info span {
    font-size: 11px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.link-type-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.link-type-hint i {
    color: var(--info-color);
}


/* ==================== Traffic Flow Diagram (Sankey-style) ==================== */

.flow-diagram {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 24px 16px;
    min-height: 300px;
    position: relative;
    overflow-x: auto;
}

.flow-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 200px;
    flex: 0 0 auto;
}

.flow-column-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}

.sources-column {
    flex: 0 0 180px;
}

.links-column {
    flex: 1 1 auto;
    min-width: 220px;
    max-width: 320px;
}

.destination-column {
    flex: 0 0 280px;
}

.flow-lines-container {
    flex: 0 0 80px;
    position: relative;
    min-height: 200px;
}

.flow-lines {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.flow-node {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.2s ease;
    position: relative;
}

.flow-node:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(58, 125, 68, 0.12);
    transform: translateY(-2px);
}

.flow-node-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.source-node .flow-node-icon {
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
}

.qr-source .flow-node-icon {
    background: rgba(139, 92, 246, 0.12);
    color: #8b5cf6;
}

.other-source .flow-node-icon {
    background: rgba(14, 165, 233, 0.12);
    color: #0ea5e9;
}

.link-node .flow-node-icon {
    background: rgba(58, 125, 68, 0.12);
    color: var(--primary-color);
}

.variation-link .flow-node-icon {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.destination-node .flow-node-icon {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.flow-node-content {
    flex: 1;
    min-width: 0;
}

.flow-node-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flow-node-params {
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    margin: 4px 0;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flow-node-url {
    font-size: 11px;
    color: var(--text-muted);
    word-break: break-all;
    line-height: 1.4;
    margin-bottom: 4px;
    max-height: 32px;
    overflow: hidden;
}

.flow-node-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 4px;
}

.flow-empty-variations {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px dashed var(--border-color);
}

.flow-empty-variations i {
    margin-right: 6px;
}

/* Flow Summary Bar */
.flow-summary {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 20px;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 14px 14px;
    margin: 0 -16px -16px -16px;
    flex-wrap: wrap;
}

.flow-summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.flow-summary-item.total {
    margin-left: auto;
}

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

.flow-summary-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-color);
}

.flow-summary-percent {
    font-size: 11px;
    color: var(--text-muted);
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.flow-summary-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

/* Flow Path Lines */
.flow-path {
    fill: none;
    stroke-linecap: round;
    opacity: 0.6;
    transition: opacity 0.2s ease, stroke-width 0.2s ease;
}

.flow-path:hover {
    opacity: 1;
    stroke-width: 4px !important;
}

.flow-path.qr-path {
    stroke: #8b5cf6;
}

.flow-path.other-path {
    stroke: #0ea5e9;
}

.flow-path.link-path {
    stroke: var(--primary-color);
}

.flow-path.variation-path {
    stroke: #f59e0b;
}

/* Full width chart card */
.chart-card.full-width {
    grid-column: 1 / -1;
}

/* Mobile responsive */
@media (max-width: 900px) {
    .flow-diagram {
        flex-direction: column;
        gap: 24px;
    }
    
    .flow-column {
        min-width: 100%;
        max-width: 100%;
    }
    
    .flow-lines-container {
        display: none;
    }
    
    .flow-column-header {
        text-align: center;
        padding: 8px;
        background: #f8fafc;
        border-radius: 8px;
    }
}
