/* ============================================================
   PEFC Sync Manager — Design System
   ============================================================ */

:root {
    /* Backgrounds */
    --bg-base: #06090f;
    --bg-surface: #0d1117;
    --bg-surface-alt: #111827;
    --bg-surface-hover: #1a2332;
    --bg-elevated: #161f2d;

    /* Text */
    --text-main: #e2e8f0;
    --text-bright: #f1f5f9;
    --text-muted: #64748b;
    --text-dimmed: #475569;

    /* Brand — PEFC Green Palette */
    --accent: #A3B18A;
    --accent-hover: #588157;
    --accent-subtle: rgba(163, 177, 138, 0.10);
    --accent-glow: rgba(88, 129, 87, 0.25);
    --gradient-brand: linear-gradient(135deg, #588157, #3A5A40);
    --gradient-brand-hover: linear-gradient(135deg, #3A5A40, #2d4a33);

    /* Semantic */
    --success: #34d399;
    --success-subtle: rgba(52, 211, 153, 0.1);
    --danger: #f87171;
    --danger-subtle: rgba(248, 113, 113, 0.1);
    --warning: #fbbf24;
    --warning-subtle: rgba(251, 191, 36, 0.1);
    --info: #38bdf8;
    --info-subtle: rgba(56, 189, 248, 0.1);
    --hubspot: #ff7a59;

    /* Borders */
    --border: rgba(148, 163, 184, 0.08);
    --border-strong: rgba(148, 163, 184, 0.15);

    /* Layout */
    --sidebar-width: 240px;
    --header-height: 64px;
    --radius: 10px;
    --radius-lg: 14px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====== Reset & Base ====== */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dimmed); }

/* ====== Sidebar ====== */

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 10;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand .brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--gradient-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 16px var(--accent-glow);
}

.sidebar-brand .brand-icon svg {
    width: 18px;
    height: 18px;
    color: white;
}

.sidebar-brand .brand-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-bright);
    letter-spacing: -0.02em;
}

.sidebar-brand .brand-version {
    font-size: 0.65rem;
    color: var(--text-dimmed);
    font-weight: 500;
    margin-top: 1px;
}

.nav-section-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-dimmed);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 24px 20px 8px;
}

.nav-link {
    padding: 10px 20px;
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    margin: 2px 8px;
    border-radius: 8px;
}

.nav-link svg {
    opacity: 0.5;
    transition: opacity var(--transition-fast);
    flex-shrink: 0;
}

.nav-link:hover {
    color: var(--text-main);
    background-color: var(--accent-subtle);
}

.nav-link:hover svg {
    opacity: 0.8;
}

.nav-link.active {
    color: var(--accent);
    background-color: var(--accent-subtle);
}

.nav-link.active svg {
    opacity: 1;
    color: var(--accent);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 0 3px 3px 0;
    background: var(--gradient-brand);
}

/* ====== Main Content ====== */

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ====== Header ====== */

.header {
    height: var(--header-height);
    background-color: rgba(6, 9, 15, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-bright);
    letter-spacing: -0.01em;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--warning);
    box-shadow: 0 0 8px var(--warning);
    animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.success {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: none;
}

.status-dot.error {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
    animation: none;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ====== Container ====== */

.container {
    padding: 28px;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

.section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-dimmed);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ====== Cards ====== */

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

.cards-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* KPI Cards */
.kpi-card {
    border-top: 2px solid transparent;
    border-image: var(--gradient-brand) 1;
}

.kpi-card .card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.kpi-card .card-icon.icon-entities {
    background: var(--accent-subtle);
    color: var(--accent);
}

.kpi-card .card-icon.icon-new {
    background: var(--info-subtle);
    color: var(--info);
}

.kpi-card .card-icon.icon-sync {
    background: var(--success-subtle);
    color: var(--success);
}

.card-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-bright);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

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

.card-value.value-pending {
    color: var(--info);
}

.card-subtitle {
    font-size: 0.78rem;
    color: var(--text-dimmed);
    margin-top: 8px;
    font-weight: 500;
}

.card-subtitle.highlight {
    color: var(--success);
}

/* History list in KPI */
.kpi-history {
    padding-bottom: 16px;
}

.history-list {
    max-height: 180px;
    overflow-y: auto;
}

.history-entry {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    font-size: 0.8rem;
    line-height: 1.4;
    border-bottom: 1px solid var(--border);
}

.history-entry:last-child {
    border-bottom: none;
}

.history-date {
    color: var(--text-dimmed);
    white-space: nowrap;
    font-size: 0.72rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    min-width: 100px;
    padding-top: 1px;
}

.history-msg {
    color: var(--text-muted);
    font-weight: 500;
}

.history-empty {
    color: var(--text-dimmed);
    font-size: 0.82rem;
    padding: 12px 0;
}

/* ====== Sync Toolbar ====== */

.sync-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.sync-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ====== Progress Bar ====== */

.progress-container {
    margin-bottom: 14px;
    animation: fadeIn 0.2s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.progress-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.progress-pct {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.progress-track {
    width: 100%;
    height: 6px;
    background-color: var(--bg-surface-hover);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-brand);
    border-radius: 3px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ====== Console ====== */

.console-container {
    background-color: #080c14;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.console-header {
    background-color: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(8px);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.console-title {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.78rem;
    color: var(--text-dimmed);
    display: flex;
    align-items: center;
    gap: 8px;
}

.console-dots {
    display: flex;
    gap: 6px;
}

.console-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    opacity: 0.8;
}

.console-dots .dot-red { background: #ff5f56; }
.console-dots .dot-yellow { background: #ffbd2e; }
.console-dots .dot-green { background: #27c93f; }

.console-body {
    height: 460px;
    overflow-y: auto;
    padding: 14px 18px;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    color: #a3be8c;
}

.console-line {
    margin-bottom: 2px;
    padding: 2px 0;
}

.console-line .time { color: #5e6c84; margin-right: 10px; }
.console-line .info { color: #88c0d0; }
.console-line .success { color: #a3be8c; }
.console-line .error { color: #bf616a; }
.console-line .warning { color: #ebcb8b; }

/* ====== Buttons ====== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    white-space: nowrap;
    font-family: inherit;
    letter-spacing: -0.01em;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Primary */
.btn-primary {
    background: var(--gradient-brand);
    color: white;
    box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover {
    background: var(--gradient-brand-hover);
    box-shadow: 0 4px 20px var(--accent-glow);
    transform: translateY(-1px);
}

/* Secondary / Ghost */
.btn-ghost {
    background-color: var(--bg-surface-hover);
    color: var(--text-muted);
    border-color: var(--border-strong);
}
.btn-ghost:hover {
    background-color: var(--bg-elevated);
    color: var(--text-main);
    border-color: var(--accent);
}

/* Success */
.btn-success {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    box-shadow: 0 2px 12px rgba(16, 185, 129, 0.25);
}
.btn-success:hover {
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}

/* HubSpot Orange */
.btn-hubspot {
    background: linear-gradient(135deg, #e05a3a, #ff7a59);
    color: white;
    box-shadow: 0 2px 12px rgba(255, 122, 89, 0.25);
}
.btn-hubspot:hover {
    box-shadow: 0 4px 20px rgba(255, 122, 89, 0.35);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0) !important;
}

.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ====== Form Controls ====== */

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-control {
    width: 100%;
    background-color: var(--bg-base);
    border: 1px solid var(--border-strong);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-control::placeholder {
    color: var(--text-dimmed);
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.settings-section-title {
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 600;
    margin: 28px 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-section-title svg {
    color: var(--text-dimmed);
    width: 16px;
    height: 16px;
}

/* Settings footer */
.settings-footer {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ====== Search Input ====== */

.search-wrapper {
    position: relative;
    width: 300px;
}

.search-wrapper svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-dimmed);
    pointer-events: none;
}

.search-wrapper .form-control {
    padding-left: 38px;
    padding-right: 14px;
    height: 38px;
    font-size: 0.85rem;
}

/* ====== Data Table ====== */

.data-header {
    display: flex;
    justify-content: flex-start;
    gap: 24px;
    align-items: center;
    margin-bottom: 16px;
}

.data-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.data-table-wrapper {
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
    font-size: 0.82rem;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 3;
}

.data-table th {
    background-color: var(--bg-surface-alt);
    color: var(--text-dimmed);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-strong);
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
    background-color: var(--accent-subtle);
}

.data-table tbody tr:nth-child(even) {
    background-color: rgba(13, 17, 23, 0.5);
}

.data-table tbody tr:nth-child(even):hover {
    background-color: var(--accent-subtle);
}

/* Sticky first col */
.th-sticky, .td-sticky {
    position: sticky;
    left: 0;
    z-index: 2;
    background-color: var(--bg-surface);
}

.th-sticky {
    background-color: var(--bg-surface-alt);
    z-index: 4;
}

.td-sticky {
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
}

.data-table tbody tr:nth-child(even) .td-sticky {
    background-color: #0b1018;
}

.td-name {
    font-weight: 600;
    color: var(--accent);
    min-width: 180px;
}

.td-mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
    color: var(--text-dimmed);
}

.td-email { font-size: 0.78rem; }

.td-products {
    white-space: normal;
    min-width: 180px;
    max-width: 300px;
}

/* Badges */
.status-cell {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.status-valid {
    background-color: var(--success-subtle);
    color: var(--success);
}

.status-terminated {
    background-color: var(--danger-subtle);
    color: var(--danger);
}

.status-suspended {
    background-color: var(--warning-subtle);
    color: var(--warning);
}

.product-badge {
    display: inline-block;
    padding: 3px 8px;
    margin: 2px;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: 500;
    background-color: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid rgba(163, 177, 138, 0.12);
    cursor: default;
    line-height: 1.3;
}

.product-badge small {
    color: var(--text-dimmed);
    font-size: 0.65rem;
}

.licence-badge {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.licence-badge.active {
    background-color: var(--success-subtle);
    color: var(--success);
}

.licence-badge.inactive {
    background-color: var(--danger-subtle);
    color: var(--danger);
}

.data-table-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    color: var(--text-dimmed);
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-surface);
}

/* ====== Toast ====== */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: var(--bg-elevated);
    border-left: 3px solid var(--success);
    color: var(--text-main);
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 300px;
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.88rem;
}

.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast.error {
    border-left-color: var(--danger);
}

/* ====== Dynamic Mapping Rows ====== */

.mapping-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 36px;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text-dimmed);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mapping-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 36px;
    gap: 8px;
    margin-bottom: 6px;
    align-items: center;
    animation: fadeInRow 0.2s ease;
}

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

.mapping-row .form-control {
    padding: 8px 12px;
    font-size: 0.85rem;
}

.btn-delete-row {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-dimmed);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
}

.btn-delete-row:hover {
    color: var(--danger);
    background-color: var(--danger-subtle);
    border-color: rgba(248, 113, 113, 0.2);
}

.btn-add-row {
    background-color: transparent;
    border: 1px dashed var(--border-strong);
    color: var(--text-dimmed);
    padding: 9px 16px;
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: none;
    width: 100%;
    margin-top: 2px;
    margin-bottom: 14px;
    border-radius: 8px;
}

.btn-add-row:hover {
    color: var(--accent);
    border-color: var(--accent);
    background-color: var(--accent-subtle);
    box-shadow: none;
    transform: none;
}

.mapping-note {
    font-size: 0.78rem;
    color: var(--text-dimmed);
    background-color: var(--accent-subtle);
    border: 1px solid rgba(163, 177, 138, 0.1);
    border-radius: 8px;
    padding: 10px 14px;
    line-height: 1.5;
}

.mapping-note strong {
    color: var(--text-muted);
}

.mapping-note code {
    background-color: rgba(163, 177, 138, 0.1);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.76rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ====== Loading ====== */

.loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ====== Empty State ====== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dimmed);
}

.empty-state svg {
    width: 40px;
    height: 40px;
    color: var(--text-dimmed);
    margin-bottom: 14px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.88rem;
    margin-top: 4px;
}

/* ====== View Transitions ====== */

.container {
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ====== Login View ====== */

.login-wrapper {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-base);
    background-image:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(88, 129, 87, 0.08), transparent),
        radial-gradient(ellipse 60% 50% at 80% 100%, rgba(58, 90, 64, 0.06), transparent);
    z-index: 100;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 40px 36px 36px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 80px rgba(88, 129, 87, 0.06);
    animation: loginAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginAppear {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.login-brand .brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--gradient-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 20px var(--accent-glow);
}

.login-brand .brand-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.login-brand .brand-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-bright);
    letter-spacing: -0.02em;
}

.login-brand .brand-version {
    font-size: 0.68rem;
    color: var(--text-dimmed);
    font-weight: 500;
    margin-top: 1px;
}

.login-subtitle {
    color: var(--text-dimmed);
    font-size: 0.85rem;
    margin-bottom: 28px;
    margin-top: 4px;
    line-height: 1.5;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card .form-control {
    height: 44px;
    font-size: 0.92rem;
}

.login-error {
    color: var(--danger);
    font-size: 0.82rem;
    min-height: 20px;
    margin-bottom: 8px;
    font-weight: 500;
}

.login-btn {
    width: 100%;
    justify-content: center;
    height: 44px;
    font-size: 0.92rem;
}

/* ====== Toggle Switch ====== */

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
    cursor: pointer;
}

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

.toggle-slider {
    position: absolute;
    inset: 0;
    background-color: var(--bg-surface-hover);
    border: 1px solid var(--border-strong);
    border-radius: 26px;
    transition: all var(--transition-smooth);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-dimmed);
    border-radius: 50%;
    transition: all var(--transition-smooth);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent-hover);
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
    background-color: white;
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ====== Automation Row ====== */

.automation-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    gap: 20px;
}

.automation-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.automation-label > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.automation-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.automation-desc {
    font-size: 0.78rem;
    color: var(--text-dimmed);
    line-height: 1.4;
}

/* ====== Responsive ====== */

@media (max-width: 768px) {
    .settings-grid { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .sync-toolbar { flex-direction: column; gap: 12px; align-items: flex-start; }
    .sync-actions { width: 100%; }
    .search-wrapper { width: 100%; }
    .login-card { margin: 0 16px; padding: 32px 24px 28px; }
}
