/* =============================================================
   TOOLSIFY — Master Stylesheet v1.0.0
   ============================================================= */

/* -------------------------------------------------------------
   1. GOOGLE FONTS IMPORT
   ------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* -------------------------------------------------------------
   2. CSS CUSTOM PROPERTIES
   ------------------------------------------------------------- */
:root {
    /* Brand */
    --primary: #6366F1;
    --primary-hover: #4F46E5;
    --primary-light: rgba(99, 102, 241, 0.12);
    --primary-glow: rgba(99, 102, 241, 0.35);
    --secondary: #0EA5E9;
    --success: #10B981;
    --success-light: rgba(16, 185, 129, 0.12);
    --warning: #F59E0B;
    --warning-light: rgba(245, 158, 11, 0.12);
    --danger: #EF4444;
    --danger-light: rgba(239, 68, 68, 0.12);
    --purple: #A855F7;

    /* Gradients */
    --grad-primary: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    --grad-cyan: linear-gradient(135deg, #0EA5E9 0%, #6366F1 100%);
    --grad-success: linear-gradient(135deg, #10B981 0%, #059669 100%);
    --grad-warning: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    --grad-danger: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    --grad-hero: linear-gradient(135deg, #020617 0%, #0d0d2b 50%, #1a1040 100%);

    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --fs-xs: 0.75rem;
    --fs-sm: 0.8125rem;
    --fs-base: 0.9375rem;
    --fs-md: 1rem;
    --fs-lg: 1.125rem;
    --fs-xl: 1.25rem;
    --fs-2xl: 1.5rem;
    --fs-3xl: 1.875rem;
    --fs-4xl: 2.25rem;
    --fs-5xl: 3rem;
    --font-scale: 1;

    /* Spacing */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --sp-10: 2.5rem;
    --sp-12: 3rem;
    --sp-16: 4rem;

    /* Radii */
    --r-sm: 0.375rem;
    --r-md: 0.5rem;
    --r-lg: 0.75rem;
    --r-xl: 1rem;
    --r-2xl: 1.5rem;
    --r-full: 9999px;

    /* Transitions */
    --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-base: 220ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --sidebar-w: 260px;
    --sidebar-sm: 72px;
    --header-h: 64px;
}

/* Dark Theme (default) */
:root,
[data-theme="dark"] {
    --bg: #020617;
    --bg-card: #0F172A;
    --bg-elevated: #1E293B;
    --bg-hover: rgba(255, 255, 255, 0.04);
    --bg-active: rgba(255, 255, 255, 0.07);
    --bg-overlay: rgba(2, 6, 23, 0.85);
    --bg-input: #1E293B;
    --bg-sidebar: #080f1f;

    --text: #F1F5F9;
    --text-2: #94A3B8;
    --text-3: #475569;
    --text-inv: #0F172A;

    --border: rgba(148, 163, 184, 0.07);
    --border-2: rgba(148, 163, 184, 0.14);
    --input-bdr: rgba(148, 163, 184, 0.12);
    --input-focus: var(--primary);

    --sh-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --sh-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --sh-lg: 0 12px 28px rgba(0, 0, 0, 0.55);
    --sh-xl: 0 24px 48px rgba(0, 0, 0, 0.6);
    --sh-glow: 0 0 24px var(--primary-glow);

    --scrollbar-thumb: #1E293B;
    --toggle-bg: #334155;
    --toggle-bg-off: #475569;
    color-scheme: dark;
}

/* Light Theme */
[data-theme="light"] {
    --bg: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-elevated: #F8FAFC;
    --bg-hover: rgba(15, 23, 42, 0.035);
    --bg-active: rgba(15, 23, 42, 0.065);
    --bg-overlay: rgba(248, 250, 252, 0.88);
    --bg-input: #FFFFFF;
    --bg-sidebar: #FFFFFF;

    --text: #0F172A;
    --text-2: #475569;
    --text-3: #94A3B8;
    --text-inv: #F1F5F9;

    --border: rgba(15, 23, 42, 0.08);
    --border-2: rgba(15, 23, 42, 0.15);
    --input-bdr: rgba(15, 23, 42, 0.28);
    --input-focus: var(--primary);

    --sh-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --sh-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --sh-lg: 0 12px 28px rgba(15, 23, 42, 0.1);
    --sh-xl: 0 24px 48px rgba(15, 23, 42, 0.12);
    --sh-glow: 0 0 24px rgba(99, 102, 241, 0.15);

    --scrollbar-thumb: #CBD5E1;
    --toggle-bg: #94A3B8;
    --toggle-bg-off: #64748B;
    color-scheme: light;
}

/* Font scale variants */
[data-font="small"] {
    --font-scale: 0.875;
}

[data-font="medium"] {
    --font-scale: 1;
}

[data-font="large"] {
    --font-scale: 1.125;
}

/* Accent color overrides */
[data-accent="#6366F1"] {
    --primary: #6366F1;
    --primary-hover: #4F46E5;
}

[data-accent="#8B5CF6"] {
    --primary: #8B5CF6;
    --primary-hover: #7C3AED;
}

[data-accent="#EC4899"] {
    --primary: #EC4899;
    --primary-hover: #DB2777;
}

[data-accent="#EF4444"] {
    --primary: #EF4444;
    --primary-hover: #DC2626;
}

[data-accent="#F59E0B"] {
    --primary: #F59E0B;
    --primary-hover: #D97706;
}

[data-accent="#10B981"] {
    --primary: #10B981;
    --primary-hover: #059669;
}

[data-accent="#0EA5E9"] {
    --primary: #0EA5E9;
    --primary-hover: #0284C7;
}

[data-accent="#14B8A6"] {
    --primary: #14B8A6;
    --primary-hover: #0D9488;
}

/* -------------------------------------------------------------
   3. RESET & BASE
   ------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: calc(var(--fs-base) * var(--font-scale));
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    touch-action: pan-x pan-y;
}

body {
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--t-slow), color var(--t-slow);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--t-fast), opacity var(--t-fast);
}

a:hover {
    opacity: 0.82;
}

img,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
}

button {
    cursor: pointer;
}

ul,
ol {
    list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    line-height: 1.25;
    font-weight: 700;
    color: var(--text);
}

/* -------------------------------------------------------------
   4. SCROLLBAR
   ------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--r-full);
}

::-webkit-scrollbar-thumb:hover {
    opacity: 0.8;
}

/* -------------------------------------------------------------
   5. SELECTION
   ------------------------------------------------------------- */
::selection {
    background: var(--primary-light);
    color: var(--primary);
}

/* -------------------------------------------------------------
   6. LAYOUT UTILITIES
   ------------------------------------------------------------- */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--sp-6);
}

.flex {
    display: flex;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-2 {
    gap: var(--sp-2);
}

.gap-3 {
    gap: var(--sp-3);
}

.gap-4 {
    gap: var(--sp-4);
}

.gap-6 {
    gap: var(--sp-6);
}

.w-full {
    width: 100%;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-4);
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-4);
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-sm {
    font-size: var(--fs-sm);
}

.text-xs {
    font-size: var(--fs-xs);
}

.text-lg {
    font-size: var(--fs-lg);
}

.text-xl {
    font-size: var(--fs-xl);
}

.text-2xl {
    font-size: var(--fs-2xl);
}

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

.text-muted2 {
    color: var(--text-3);
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.mt-1 {
    margin-top: var(--sp-1);
}

.mt-2 {
    margin-top: var(--sp-2);
}

.mt-4 {
    margin-top: var(--sp-4);
}

.mt-6 {
    margin-top: var(--sp-6);
}

.mb-1 {
    margin-bottom: var(--sp-1);
}

.mb-2 {
    margin-bottom: var(--sp-2);
}

.mb-4 {
    margin-bottom: var(--sp-4);
}

.mb-6 {
    margin-bottom: var(--sp-6);
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* -------------------------------------------------------------
   7. BUTTONS
   ------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 0.625rem 1.25rem;
    font-size: var(--fs-sm);
    font-weight: 600;
    border-radius: var(--r-lg);
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--t-base);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0);
    transition: background var(--t-fast);
}

.btn:hover::after {
    background: rgba(255, 255, 255, 0.06);
}

.btn:active {
    transform: scale(0.98);
}

/* Primary */
.btn-primary {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px var(--primary-glow);
    transform: translateY(-1px);
    color: #fff;
    opacity: 1;
}

/* Secondary */
.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border-color: var(--border-2);
}

/* Outline */
.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1.5px solid var(--border-2);
}

.btn-outline:hover {
    background: var(--surface-2);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-2);
    color: var(--text);
    opacity: 1;
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--text-2);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
    opacity: 1;
}

/* Danger */
.btn-danger {
    background: var(--grad-danger);
    color: #fff;
}

.btn-danger:hover {
    transform: translateY(-1px);
    color: #fff;
    opacity: 1;
}

/* Sizes */
.btn-sm {
    padding: 0.4rem 0.875rem;
    font-size: var(--fs-xs);
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: var(--fs-md);
    border-radius: var(--r-xl);
}

.btn-xl {
    padding: 1rem 2.25rem;
    font-size: var(--fs-lg);
    border-radius: var(--r-xl);
}

.btn-full {
    width: 100%;
}

/* Icon button */
.btn-icon {
    padding: 0.5rem;
    border-radius: var(--r-lg);
    background: transparent;
    border: none;
    color: var(--text-2);
    transition: all var(--t-base);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* Loading state */
.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading .btn-text {
    opacity: 0;
}

.btn.loading::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* Premium / Gradient outline */
.btn-premium {
    background: transparent;
    border: 1px solid;
    border-image: var(--grad-primary) 1;
    color: var(--primary);
    position: relative;
    border-radius: var(--r-lg);
    overflow: hidden;
}

.btn-premium:hover {
    background: var(--primary-light);
    color: var(--primary);
    opacity: 1;
}

/* -------------------------------------------------------------
   8. FORM ELEMENTS
   ------------------------------------------------------------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.form-label {
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-2);
    letter-spacing: 0.01em;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--input-bdr);
    border-radius: var(--r-lg);
    color: var(--text);
    font-size: var(--fs-base);
    transition: border-color var(--t-base), box-shadow var(--t-base), background var(--t-slow);
    outline: none;
    -webkit-appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-3);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--bg-input);
}

.form-input.error {
    border-color: var(--danger);
}

.form-input.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-input-icon {
    position: relative;
}

.form-input-icon .form-input {
    padding-left: 2.75rem;
}

.form-input-icon .icon-left {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    pointer-events: none;
    width: 18px;
    height: 18px;
}

.form-input-icon .icon-right {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    cursor: pointer;
    transition: color var(--t-fast);
    width: 18px;
    height: 18px;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
}

.form-input-icon .icon-right:hover {
    color: var(--text);
}

.form-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394A3B8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    background-size: 14px;
    padding-right: 2.5rem;
}

.form-error {
    font-size: var(--fs-xs);
    color: var(--danger);
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    margin-top: var(--sp-1);
}

.form-hint {
    font-size: var(--fs-xs);
    color: var(--text-3);
}

/* Checkbox & Toggle */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    margin-top: 2px;
}

/* Toggle switch */
.toggle-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
}

.toggle-info {
    flex: 1;
}

.toggle-info .toggle-label {
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text);
    display: block;
}

.toggle-info .toggle-desc {
    font-size: var(--fs-xs);
    color: var(--text-3);
}

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

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-track {
    position: absolute;
    inset: 0;
    background: var(--toggle-bg-off);
    border-radius: 999px;
    transition: background 0.22s ease;
    display: flex;
    align-items: center;
}

.toggle-thumb {
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    transition: left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle input:checked+.toggle-track {
    background: var(--primary);
}

.toggle input:checked+.toggle-track .toggle-thumb {
    left: calc(100% - 21px);
}

/* Range slider */
.range-wrap {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.form-range {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    background: var(--bg-elevated);
    border-radius: var(--r-full);
    outline: none;
    cursor: pointer;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 2px 6px var(--primary-glow);
    cursor: pointer;
    transition: transform var(--t-fast);
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.range-value {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-2);
    min-width: 32px;
    text-align: right;
}

/* -------------------------------------------------------------
   9. CARDS
   ------------------------------------------------------------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: var(--sp-6);
    transition: border-color var(--t-slow), background var(--t-slow);
}

.card-hover {
    transition: all var(--t-base);
}

.card-hover:hover {
    border-color: var(--border-2);
    box-shadow: var(--sh-md);
    transform: translateY(-2px);
}

.card-glow {
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.15),
        0 8px 24px rgba(99, 102, 241, 0.08);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-5);
}

.card-title {
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--text);
}

.card-subtitle {
    font-size: var(--fs-sm);
    color: var(--text-2);
    margin-top: 2px;
}

/* Stat card */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: var(--sp-6);
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    transition: all var(--t-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
    pointer-events: none;
}

.stat-card:hover {
    border-color: var(--border-2);
    box-shadow: var(--sh-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--r-lg);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.stat-icon svg {
    width: 20px;
    height: 20px;
}

.stat-value {
    font-size: var(--fs-3xl);
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.stat-label {
    font-size: var(--fs-sm);
    color: var(--text-2);
    font-weight: 500;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--fs-xs);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--r-full);
}

.stat-change.up {
    background: var(--success-light);
    color: var(--success);
}

.stat-change.down {
    background: var(--danger-light);
    color: var(--danger);
}

/* -------------------------------------------------------------
   10. BADGE
   ------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.65rem;
    font-size: var(--fs-xs);
    font-weight: 600;
    border-radius: var(--r-full);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-premium {
    background: var(--grad-primary);
    color: #fff;
}

.badge-neutral {
    background: var(--bg-elevated);
    color: var(--text-2);
}

/* -------------------------------------------------------------
   11. AVATAR
   ------------------------------------------------------------- */
.avatar {
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--grad-primary);
    color: #fff;
    position: relative;
}

.avatar-xs {
    width: 28px;
    height: 28px;
    font-size: 0.65rem;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    font-size: 0.75rem;
}

.avatar-md {
    width: 44px;
    height: 44px;
    font-size: 0.875rem;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1rem;
}

.avatar-xl {
    width: 72px;
    height: 72px;
    font-size: 1.25rem;
}

.avatar-2xl {
    width: 96px;
    height: 96px;
    font-size: 1.5rem;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-ring {
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary);
}

/* -------------------------------------------------------------
   12. DIVIDER
   ------------------------------------------------------------- */
.divider {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    color: var(--text-3);
    font-size: var(--fs-sm);
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* -------------------------------------------------------------
   13. ALERT / TOAST
   ------------------------------------------------------------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border-radius: var(--r-lg);
    font-size: var(--fs-sm);
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Toast container */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    max-width: 380px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    background: var(--bg-card);
    border: 1px solid var(--border-2);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-xl);
    pointer-events: all;
    animation: toastIn var(--t-spring) forwards;
    font-size: var(--fs-sm);
}

.toast.removing {
    animation: toastOut var(--t-base) forwards;
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--text);
}

.toast-msg {
    color: var(--text-2);
    margin-top: 2px;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    padding: 2px;
}

.toast-success .toast-icon {
    color: var(--success);
}

.toast-danger .toast-icon {
    color: var(--danger);
}

.toast-warning .toast-icon {
    color: var(--warning);
}

.toast-info .toast-icon {
    color: var(--primary);
}

/* -------------------------------------------------------------
   14. AUTH LAYOUT (Login / Register)
   ------------------------------------------------------------- */
.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
}

/* Left brand panel */
.auth-brand {
    background: var(--grad-hero);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--sp-12);
    overflow: hidden;
}

.auth-brand::before {
    content: '';
    position: absolute;
    top: -120px;
    left: -120px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 65%);
    pointer-events: none;
}

.auth-brand::after {
    content: '';
    position: absolute;
    bottom: -80px;
    right: -80px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.25) 0%, transparent 65%);
    pointer-events: none;
}

.auth-brand-logo {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    z-index: 1;
}

.auth-brand-logo .logo-icon {
    width: 42px;
    height: 42px;
    background: var(--grad-primary);
    border-radius: var(--r-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.auth-brand-logo .logo-name {
    font-size: var(--fs-xl);
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
}

.auth-brand-center {
    z-index: 1;
}

.auth-brand-headline {
    font-size: var(--fs-4xl);
    font-weight: 800;
    color: #fff;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: var(--sp-4);
}

.auth-brand-headline span {
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-brand-sub {
    font-size: var(--fs-lg);
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.65;
    max-width: 380px;
}

.auth-features {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    z-index: 1;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--r-xl);
    backdrop-filter: blur(10px);
    transition: all var(--t-base);
}

.auth-feature:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateX(4px);
}

.auth-feature-icon {
    width: 38px;
    height: 38px;
    background: var(--grad-primary);
    border-radius: var(--r-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-feature-icon svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

.auth-feature-text strong {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: #fff;
}

.auth-feature-text span {
    font-size: var(--fs-xs);
    color: rgba(255, 255, 255, 0.5);
}

/* Right form panel */
.auth-form-panel {
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-12);
    overflow-y: auto;
    transition: background var(--t-slow);
}

.auth-form-inner {
    width: 100%;
    max-width: 420px;
    animation: fadeSlideUp 0.5s ease both;
}

.auth-top-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-4) var(--sp-6);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.auth-heading {
    font-size: var(--fs-3xl);
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.025em;
    margin-bottom: var(--sp-2);
}

.auth-subheading {
    font-size: var(--fs-base);
    color: var(--text-2);
    margin-bottom: var(--sp-8);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.auth-footer-link {
    text-align: center;
    margin-top: var(--sp-5);
    font-size: var(--fs-sm);
    color: var(--text-2);
}

.auth-footer-link a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.auth-footer-link a:hover {
    opacity: 0.75;
}

/* "or continue with" divider between form and OAuth buttons */
.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin: var(--sp-5) 0;
    color: var(--text-3);
    font-size: var(--fs-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* OAuth provider buttons */
.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.btn-oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-3);
    width: 100%;
    padding: 0.7rem 1.25rem;
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: var(--fs-sm);
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--t-base), border-color var(--t-base);
    white-space: nowrap;
}

.btn-oauth:hover {
    background: var(--bg-hover);
    border-color: var(--border-3);
    color: var(--text);
    opacity: 1;
}

.btn-oauth svg {
    flex-shrink: 0;
}

.auth-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3);
}

/* Auth top-right controls group (theme + lang switcher) */
.auth-controls {
    position: fixed;
    top: var(--sp-5);
    right: var(--sp-5);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    z-index: 100;
}

/* Theme toggle on auth page */
.auth-theme-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-2);
    border-radius: var(--r-full);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-xs);
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    transition: all var(--t-base);
}

.auth-theme-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* Language switcher */
.auth-lang-switcher {
    display: flex;
    background: var(--bg-elevated);
    border: 1px solid var(--border-2);
    border-radius: var(--r-full);
    overflow: hidden;
}

.auth-lang-btn {
    padding: 0.45rem 0.85rem;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-2);
    text-decoration: none;
    transition: all var(--t-base);
    line-height: 1;
    display: flex;
    align-items: center;
}

.auth-lang-btn:hover {
    color: var(--text);
    background: var(--bg-hover);
    opacity: 1;
}

.auth-lang-btn.is-active {
    background: var(--primary);
    color: #fff;
}

/* -------------------------------------------------------------
   15. APP LAYOUT (Dashboard)
   ------------------------------------------------------------- */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    transition: width var(--t-base), transform var(--t-slow), background var(--t-slow);
    overflow: visible;
}

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

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-5) var(--sp-5);
    text-decoration: none;
    min-height: var(--header-h);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-logo .logo-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: var(--grad-primary);
    border-radius: var(--r-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.sidebar-logo .logo-icon svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

.sidebar-logo .logo-text {
    font-size: var(--fs-lg);
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    transition: opacity var(--t-base);
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-nav {
    flex: 1;
    padding: var(--sp-4) var(--sp-3);
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section-label {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: var(--sp-3) var(--sp-3) var(--sp-2);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--t-base);
}

/* Collapsible group toggle */
button.nav-section-label {
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
}

button.nav-section-label:hover {
    color: var(--text-2);
}

.nav-section-chevron {
    flex-shrink: 0;
    opacity: 0.5;
    transition: transform 0.22s ease, opacity var(--t-base);
    margin-right: var(--sp-1);
}

button.nav-section-label.group-collapsed .nav-section-chevron {
    transform: rotate(-90deg);
}

.nav-group-items {
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    max-height: 600px;
    opacity: 1;
}

.nav-group-items.group-collapsed {
    max-height: 0 !important;
    opacity: 0;
}

/* In collapsed sidebar: show group buttons as a small clickable divider */
.sidebar.collapsed button.nav-section-label {
    height: 24px;
    padding: 0 4px;
    margin: var(--sp-2) auto !important;
    width: 52px;
    flex-direction: row;
    gap: 4px;
    justify-content: center;
    align-items: center;
    opacity: 0.35;
    border-radius: var(--r-md);
    transition: opacity var(--t-fast);
}

.sidebar.collapsed button.nav-section-label:hover {
    opacity: 0.8;
    background: var(--surface-2);
}

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

.nav-section-icon {
    display: block;
    flex-shrink: 0;
    opacity: 0.5;
}

.sidebar.collapsed .nav-section-chevron {
    opacity: 1;
    transform: rotate(-90deg);
    width: 10px;
    height: 10px;
}

.sidebar.collapsed button.nav-section-label.group-collapsed .nav-section-chevron {
    transform: rotate(90deg);
}

.sidebar.collapsed .nav-group-items {
    max-height: 600px !important;
    opacity: 1 !important;
}

.sidebar.collapsed .nav-group-items.group-collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
}

.sidebar.collapsed .nav-section-label {
    opacity: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 0.625rem var(--sp-3);
    border-radius: var(--r-lg);
    color: var(--text-2);
    font-size: var(--fs-sm);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--t-fast);
    position: relative;
    margin-bottom: 2px;
    overflow: hidden;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    min-width: 18px;
    flex-shrink: 0;
    transition: color var(--t-fast);
}

.nav-item-text {
    transition: opacity var(--t-base);
}

.sidebar.collapsed .nav-item-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    bottom: 25%;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.nav-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--r-full);
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--t-base);
}

.sidebar.collapsed .nav-badge {
    opacity: 0;
}

/* Sidebar tooltip on collapsed */
.sidebar.collapsed .nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--border-2);
    color: var(--text);
    font-size: var(--fs-xs);
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: var(--r-md);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--t-base);
    box-shadow: var(--sh-md);
    z-index: 500;
}

.sidebar.collapsed .nav-item:hover::after {
    opacity: 1;
}

.sidebar-footer {
    padding: var(--sp-4) var(--sp-3);
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border-radius: var(--r-lg);
    cursor: pointer;
    transition: background var(--t-fast);
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-user:hover {
    background: var(--bg-hover);
}

.sidebar-user-info {
    overflow: hidden;
    transition: opacity var(--t-base);
}

.sidebar.collapsed .sidebar-user-info {
    opacity: 0;
    width: 0;
}

.sidebar-user-name {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-plan {
    font-size: var(--fs-xs);
    color: var(--text-3);
}

/* Sidebar collapse btn */
.sidebar-toggle {
    position: absolute;
    right: -13px;
    top: calc(var(--header-h) + var(--sp-6));
    width: 26px;
    height: 26px;
    background: var(--primary);
    border: 2px solid var(--bg-base);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: all var(--t-base);
    z-index: 10;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.45);
}

.sidebar-toggle:hover {
    background: var(--primary-hover, #4F46E5);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.6);
    transform: scale(1.12);
}

.sidebar-toggle svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    transition: transform var(--t-base);
    stroke-width: 2.2;
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* Main content area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--t-base);
    min-width: 0;
    overflow-x: hidden;
}

.main-content.collapsed {
    margin-left: var(--sidebar-sm);
}

/* Header */
.app-header {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-6);
    background: var(--bg-overlay);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background var(--t-slow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}

.page-title {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar input {
    width: 240px;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    color: var(--text);
    font-size: var(--fs-sm);
    transition: all var(--t-base);
    outline: none;
}

.search-bar input::placeholder {
    color: var(--text-3);
}

.search-bar input:focus {
    width: 300px;
    border-color: var(--primary);
    background: var(--bg-input);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-bar .search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-3);
    pointer-events: none;
    width: 16px;
    height: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.header-notif {
    position: relative;
}

.notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg);
}

.header-user-btn {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 0.375rem 0.75rem 0.375rem 0.375rem;
    border: 1px solid var(--border-2);
    border-radius: var(--r-full);
    background: transparent;
    cursor: pointer;
    transition: all var(--t-base);
    color: var(--text);
}

.header-user-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-2);
}

.header-user-name {
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dropdown menu */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-2);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-xl);
    padding: var(--sp-2);
    z-index: 500;
    display: none;
    animation: fadeSlideDown 0.18s ease both;
}

.dropdown-menu.open {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 0.5rem var(--sp-3);
    border-radius: var(--r-md);
    color: var(--text-2);
    font-size: var(--fs-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--t-fast);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text);
    opacity: 1;
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: var(--sp-2) 0;
}

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-item.danger:hover {
    background: var(--danger-light);
}

/* Page content */
.page-content {
    flex: 1;
    padding: var(--sp-8) var(--sp-8);
    max-width: 1000px;
    width: 100%;
    align-self: center;
}

/* Welcome banner */
.welcome-banner {
    background: var(--grad-primary);
    border-radius: var(--r-2xl);
    padding: var(--sp-8) var(--sp-10);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-6);
    position: relative;
    overflow: hidden;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 250px;
    height: 250px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    bottom: -80px;
    right: 100px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
}

.welcome-text h2 {
    font-size: var(--fs-2xl);
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    margin-bottom: var(--sp-1);
}

.welcome-text p {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--fs-base);
}

.welcome-badge {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: var(--r-xl);
    padding: var(--sp-4) var(--sp-6);
    text-align: center;
    z-index: 1;
    flex-shrink: 0;
}

.welcome-badge .plan-name {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.welcome-badge .plan-detail {
    font-size: var(--fs-xs);
    color: rgba(255, 255, 255, 0.65);
    margin-top: 2px;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}

/* Content grid */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: var(--sp-6);
}

/* Activity list */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-4);
    padding: var(--sp-4) 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--r-lg);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.activity-icon svg {
    width: 16px;
    height: 16px;
}

.activity-info {
    flex: 1;
}

.activity-title {
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text);
}

.activity-time {
    font-size: var(--fs-xs);
    color: var(--text-3);
    margin-top: 2px;
}

.activity-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-3);
    padding: var(--sp-10) 0;
    color: var(--text-3);
    text-align: center;
}

.activity-empty svg {
    width: 40px;
    height: 40px;
    opacity: 0.3;
}

/* Quick actions */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-4);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--bg-card);
    color: var(--text);
    font-size: var(--fs-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--t-fast);
    text-decoration: none;
    text-align: left;
}

.quick-action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-2);
    color: var(--text);
    transform: translateX(3px);
    opacity: 1;
}

.quick-action-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--r-lg);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.quick-action-icon svg {
    width: 16px;
    height: 16px;
}

/* Premium banner */
.premium-banner {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--r-2xl);
    padding: var(--sp-6) var(--sp-8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-6);
    margin-top: var(--sp-6);
}

.premium-banner-text h3 {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--sp-1);
}

.premium-banner-text p {
    font-size: var(--fs-sm);
    color: var(--text-2);
}

.premium-banner-stars {
    display: flex;
    gap: 2px;
    margin-bottom: var(--sp-2);
    color: var(--warning);
}

.premium-banner-stars svg {
    width: 16px;
    height: 16px;
}

/* Mobile menu overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    backdrop-filter: blur(2px);
}

/* Mobile hamburger */
.hamburger {
    display: none;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text);
}

.hamburger svg {
    width: 22px;
    height: 22px;
}

/* -------------------------------------------------------------
   16. SETUP WIZARD
   ------------------------------------------------------------- */
.setup-page {
    height: 100dvh;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(var(--sp-3), 2vh, var(--sp-6));
    background: var(--grad-hero);
    position: relative;
    overflow: hidden;
}

.setup-page::before {
    content: '';
    position: absolute;
    top: -200px;
    left: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 60%);
    pointer-events: none;
}

.setup-page::after {
    content: '';
    position: absolute;
    bottom: -150px;
    right: -150px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 60%);
    pointer-events: none;
}

.setup-card {
    width: 100%;
    max-width: 580px;
    max-height: calc(100dvh - clamp(1.5rem, 4vh, 3rem));
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-2xl);
    box-shadow: var(--sh-xl);
    overflow: hidden;
    z-index: 1;
    animation: fadeSlideUp 0.5s ease both;
}

.setup-header {
    padding: clamp(var(--sp-4), 4vh, var(--sp-8)) var(--sp-8) 0;
    flex-shrink: 0;
}

.setup-progress {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-6);
}

.progress-step {
    height: 4px;
    border-radius: var(--r-full);
    background: var(--bg-elevated);
    flex: 1;
    transition: background var(--t-slow);
    overflow: hidden;
    position: relative;
}

.progress-step.done {
    background: var(--primary);
}

.progress-step.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--primary);
    animation: progressFill 0.4s ease forwards;
}

.setup-step-label {
    font-size: var(--fs-xs);
    color: var(--text-3);
    font-weight: 500;
    white-space: nowrap;
}

.setup-body {
    padding: 0 var(--sp-8) var(--sp-6);
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.setup-step {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: var(--sp-6) var(--sp-8);
    opacity: 0;
    pointer-events: none;
    transform: translateX(40px);
    transition: opacity var(--t-slow), transform var(--t-slow);
}

.setup-step.active {
    opacity: 1;
    pointer-events: all;
    transform: translateX(0);
    position: relative;
}

.setup-step.leaving {
    opacity: 0;
    transform: translateX(-40px);
}

.setup-step-icon {
    width: clamp(40px, 7vh, 64px);
    height: clamp(40px, 7vh, 64px);
    background: var(--primary-light);
    border-radius: var(--r-2xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: clamp(var(--sp-2), 2vh, var(--sp-5));
    color: var(--primary);
}

.setup-step-icon svg {
    width: 30px;
    height: 30px;
}

.setup-step-icon.emoji {
    background: none;
    font-size: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}

.setup-step-title {
    font-size: clamp(1.15rem, 3.5vh, var(--fs-2xl));
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.025em;
    margin-bottom: var(--sp-2);
}

.setup-step-sub {
    font-size: var(--fs-base);
    color: var(--text-2);
    margin-bottom: clamp(var(--sp-3), 3vh, var(--sp-6));
}

/* Theme selector */
.theme-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-3);
}

.theme-card {
    border: 2px solid var(--border);
    border-radius: var(--r-xl);
    padding: var(--sp-4);
    cursor: pointer;
    text-align: center;
    transition: all var(--t-base);
    background: var(--bg-elevated);
}

.theme-card:hover {
    border-color: var(--primary);
}

.theme-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.theme-preview {
    width: 100%;
    height: 56px;
    border-radius: var(--r-md);
    margin-bottom: var(--sp-3);
    overflow: hidden;
    position: relative;
}

.theme-preview.dark-prev {
    background: #020617;
}

.theme-preview.light-prev {
    background: #F1F5F9;
}

.theme-preview.sys-prev {
    background: linear-gradient(90deg, #020617 50%, #F1F5F9 50%);
}

.theme-preview::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    height: 8px;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.4);
}

.theme-card-label {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text);
}

.theme-card.selected .theme-card-label {
    color: var(--primary);
}

/* Accent color picker */
.accent-colors {
    display: flex;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

.accent-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--t-base);
    position: relative;
}

.accent-dot:hover {
    transform: scale(1.1);
}

.accent-dot.selected {
    border-color: var(--text);
    transform: scale(1.15);
}

.accent-dot.selected::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
}

/* Language cards */
.lang-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3);
}

.lang-card {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border: 2px solid var(--border);
    border-radius: var(--r-xl);
    cursor: pointer;
    transition: all var(--t-base);
    background: var(--bg-elevated);
}

.lang-card:hover {
    border-color: var(--primary);
}

.lang-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.lang-flag {
    font-size: 1.75rem;
    line-height: 1;
}

.lang-name {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text);
}

.lang-native {
    font-size: var(--fs-xs);
    color: var(--text-3);
}

/* Plan cards */
.plan-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
}

.plan-card {
    border: 2px solid var(--border);
    border-radius: var(--r-xl);
    padding: var(--sp-5);
    cursor: pointer;
    transition: all var(--t-base);
    background: var(--bg-elevated);
    position: relative;
}

.plan-card:hover {
    border-color: var(--primary);
}

.plan-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.plan-card.featured {
    border-color: var(--primary);
}

.plan-card-badge {
    position: absolute;
    top: -10px;
    right: var(--sp-4);
    background: var(--grad-primary);
    color: #fff;
    font-size: var(--fs-xs);
    font-weight: 700;
    padding: 2px 10px;
    border-radius: var(--r-full);
    letter-spacing: 0.04em;
}

.plan-card-name {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--sp-1);
}

.plan-card-price {
    font-size: var(--fs-3xl);
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: var(--sp-1);
}

.plan-card-price span {
    font-size: var(--fs-sm);
    font-weight: 400;
    color: var(--text-3);
}

.plan-card-desc {
    font-size: var(--fs-xs);
    color: var(--text-3);
    margin-bottom: var(--sp-4);
}

.plan-features {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.plan-feature-item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-xs);
    color: var(--text-2);
}

.plan-feature-item svg {
    width: 14px;
    height: 14px;
    color: var(--success);
    flex-shrink: 0;
}

/* Setup done */
.setup-done {
    text-align: center;
    padding: var(--sp-8) 0;
}

.setup-done-emoji {
    font-size: 4rem;
    margin-bottom: var(--sp-4);
    display: block;
    animation: bounceIn 0.6s var(--t-spring) both;
}

/* Setup footer */
.setup-footer {
    padding: clamp(var(--sp-3), 2.5vh, var(--sp-5)) var(--sp-8) clamp(var(--sp-4), 3.5vh, var(--sp-8));
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    border-top: 1px solid var(--border);
}

.setup-footer-left {
    display: flex;
    gap: var(--sp-3);
    align-items: center;
}

/* -------------------------------------------------------------
   17. MODAL
   ------------------------------------------------------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-6);
    animation: fadeIn var(--t-base) ease;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-2);
    border-radius: var(--r-2xl);
    box-shadow: var(--sh-xl);
    width: 100%;
    max-width: 480px;
    animation: modalIn var(--t-spring) both;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-6) var(--sp-6) var(--sp-4);
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text);
}

.modal-body {
    padding: var(--sp-6);
}

.modal-footer {
    padding: var(--sp-4) var(--sp-6) var(--sp-6);
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-3);
}

/* -------------------------------------------------------------
   18. LOADING
   ------------------------------------------------------------- */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

.spinner-lg {
    width: 36px;
    height: 36px;
    border-width: 3px;
}

.page-loader {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
    gap: var(--sp-4);
}

.page-loader .logo-icon {
    width: 56px;
    height: 56px;
    background: var(--grad-primary);
    border-radius: var(--r-2xl);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 1.5s ease infinite;
    box-shadow: 0 0 30px var(--primary-glow);
}

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg,
            var(--bg-elevated) 25%,
            var(--bg-hover) 50%,
            var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--r-md);
}

/* -------------------------------------------------------------
   SETTINGS PAGE
   ------------------------------------------------------------- */
.settings-page {
    display: flex;
    flex-direction: column;
    gap: var(--sp-6);
    width: 100%;
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-2xl);
    overflow: hidden;
}

.settings-section-header {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-5) var(--sp-6);
    border-bottom: 1px solid var(--border);
}

.settings-section-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: var(--r-lg);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-section-icon svg {
    width: 18px;
    height: 18px;
}

.settings-section-title {
    font-size: var(--fs-base);
    font-weight: 700;
    color: var(--text);
}

.settings-section-sub {
    font-size: var(--fs-sm);
    color: var(--text-3);
    margin-top: 2px;
}

.settings-body {
    padding: 0;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-6);
    padding: var(--sp-4) var(--sp-6);
    transition: background var(--t-fast);
}

.settings-row:hover {
    background: var(--bg-elevated);
}

.settings-row-label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.settings-row-label span {
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text);
}

.settings-row-label small {
    font-size: var(--fs-xs);
    color: var(--text-3);
    line-height: 1.4;
}

.settings-row-control {
    flex-shrink: 0;
}

.settings-divider {
    height: 1px;
    background: var(--border);
    margin: 0 var(--sp-6);
}

.settings-footer {
    padding: var(--sp-4) var(--sp-6);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    background: var(--bg-elevated);
}

/* Button group (theme / font) */
.btn-group {
    display: flex;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 3px;
    gap: 2px;
}

.btn-group-item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 6px 14px;
    border-radius: calc(var(--r-lg) - 2px);
    border: none;
    background: transparent;
    color: var(--text-2);
    font-size: var(--fs-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--t-fast);
    white-space: nowrap;
}

.btn-group-item:hover {
    color: var(--text);
    background: var(--bg-card);
}

.btn-group-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px var(--primary-glow);
}

/* Accent dot grid */
.accent-grid {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.accent-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}

.accent-dot svg {
    width: 14px;
    height: 14px;
    opacity: 0;
    transition: opacity var(--t-fast);
}

.accent-dot.selected {
    border-color: var(--text);
    transform: scale(1.15);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

.accent-dot.selected svg {
    opacity: 1;
}

.accent-dot:hover {
    transform: scale(1.1);
}

/* Language cards */
.lang-grid {
    display: flex;
    gap: var(--sp-3);
}

.lang-card {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--r-lg);
    border: 1.5px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-2);
    font-size: var(--fs-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--t-fast);
}

.lang-card:hover {
    border-color: var(--primary);
    color: var(--text);
}

.lang-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.lang-flag {
    font-size: 1.2em;
}

/* Responsive settings */
@media (max-width: 640px) {
    .settings-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sp-3);
        padding: var(--sp-4);
    }

    .settings-section-header {
        padding: var(--sp-4);
    }

    .settings-divider {
        margin: 0 var(--sp-4);
    }

    .settings-footer {
        padding: var(--sp-3) var(--sp-4);
    }

    .btn-group-item {
        padding: 6px 10px;
        font-size: var(--fs-xs);
    }
}

/* -------------------------------------------------------------
   19. ANIMATIONS / KEYFRAMES
   ------------------------------------------------------------- */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(12px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(120%);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.75;
        transform: scale(0.96);
    }
}

@keyframes shimmer {
    to {
        background-position: -200% 0;
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes progressFill {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

/* Stagger animation for dashboard cards */
.stagger>*:nth-child(1) {
    animation: fadeSlideUp 0.4s 0.05s ease both;
}

.stagger>*:nth-child(2) {
    animation: fadeSlideUp 0.4s 0.10s ease both;
}

.stagger>*:nth-child(3) {
    animation: fadeSlideUp 0.4s 0.15s ease both;
}

.stagger>*:nth-child(4) {
    animation: fadeSlideUp 0.4s 0.20s ease both;
}

/* -------------------------------------------------------------
   20. RESPONSIVE
   ------------------------------------------------------------- */
@media (max-width: 1280px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .auth-page {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        display: none;
    }

    .auth-form-panel {
        padding: var(--sp-8) var(--sp-6);
    }

    .auth-controls {
        display: flex;
    }

    .page-content {
        padding: var(--sp-6);
    }

    .search-bar input {
        width: 180px;
    }

    .search-bar input:focus {
        width: 220px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-w)));
        box-shadow: var(--sh-xl);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        width: var(--sidebar-w);
    }

    /* Always show full labels when sidebar is open on mobile */
    .sidebar.mobile-open .logo-text {
        opacity: 1;
        width: auto;
        overflow: visible;
    }

    .sidebar.mobile-open .nav-section-label {
        opacity: 1;
    }

    .sidebar.mobile-open .nav-item-text {
        opacity: 1;
        width: auto;
        overflow: visible;
    }

    .sidebar.mobile-open .nav-badge {
        opacity: 1;
    }

    .sidebar.mobile-open .sidebar-user-info {
        opacity: 1;
        width: auto;
    }

    .sidebar-overlay {
        display: block;
    }

    .sidebar-overlay:not(.active) {
        display: none;
    }

    .sidebar-toggle {
        display: none;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .hamburger {
        display: flex;
    }

    .header-user-name {
        display: none;
    }

    .search-bar {
        display: none;
    }

    .page-content {
        padding: var(--sp-4);
    }

    .welcome-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sp-4);
        padding: var(--sp-6);
    }

    .welcome-badge {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .auth-page {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        display: none;
    }

    .auth-form-panel {
        padding: var(--sp-6) var(--sp-5);
    }

    .auth-form-inner {
        max-width: 100%;
    }

    .auth-heading {
        font-size: var(--fs-2xl);
    }

    .setup-card {
        border-radius: var(--r-xl);
    }

    .setup-header,
    .setup-footer {
        padding-left: var(--sp-6);
        padding-right: var(--sp-6);
    }

    .setup-step {
        padding: var(--sp-5) var(--sp-6);
    }

    .theme-cards {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .plan-cards {
        grid-template-columns: 1fr;
    }

    .premium-banner {
        flex-direction: column;
        align-items: flex-start;
        padding: var(--sp-5);
    }

    .premium-banner .btn {
        width: 100%;
    }
}

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

    .auth-form-row {
        grid-template-columns: 1fr;
    }

    .setup-progress {
        gap: var(--sp-1);
    }

    .theme-cards {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .lang-cards {
        grid-template-columns: 1fr;
    }
}

/* ── Landscape phone: sidebar fits in reduced viewport height ─────────── */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar-logo {
        padding: var(--sp-2) var(--sp-5);
    }

    .nav-item {
        height: 36px;
        padding: 0 var(--sp-3);
    }

    .sidebar-footer {
        padding: var(--sp-2) var(--sp-3);
    }
}

/* =====================================================================
   TODO LIST TOOL
   ===================================================================== */

/* Toolbar */
.todo-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--border);
    gap: var(--sp-4);
    flex-wrap: wrap;
}

.todo-filters {
    display: flex;
    gap: 2px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 3px;
    border-radius: var(--r-lg);
}

.todo-filter-btn {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 5px 14px;
    border-radius: calc(var(--r-lg) - 2px);
    border: none;
    background: transparent;
    color: var(--text-2);
    font-size: var(--fs-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--t-base);
    white-space: nowrap;
}

.todo-filter-btn.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: var(--sh-sm);
}

.todo-filter-btn .tab-count {
    background: var(--bg-elevated);
    border-radius: 999px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 600;
}

.todo-filter-btn.active .tab-count {
    background: var(--primary-light);
    color: var(--primary);
}

.todo-filter-btn.locked {
    opacity: 0.55;
    cursor: not-allowed;
}

.todo-sort-select {
    padding: 5px 10px;
    border-radius: var(--r-lg);
    border: 1px solid var(--border-2);
    background: var(--bg-elevated);
    color: var(--text-2);
    font-size: var(--fs-xs);
    cursor: pointer;
    outline: none;
}

/* Notification bell button */
.todo-notif-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-2);
    background: var(--bg-elevated);
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t-base);
    flex-shrink: 0;
}

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

.todo-notif-btn.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.4);
    color: #10B981;
}

.todo-notif-btn.denied {
    opacity: 0.45;
    cursor: not-allowed;
}

.todo-count-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: var(--fs-xs);
    font-weight: 600;
    background: var(--bg-elevated);
    color: var(--text-3);
    white-space: nowrap;
}

.todo-count-badge.near-limit {
    background: rgba(245, 158, 11, 0.12);
    color: #F59E0B;
}

.todo-count-badge.at-limit {
    background: rgba(239, 68, 68, 0.12);
    color: #EF4444;
}

/* Add bar */
.todo-add-bar {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.todo-add-input {
    flex: 1;
    padding: 9px 14px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-2);
    border-radius: var(--r-lg);
    color: var(--text);
    font-size: var(--fs-sm);
    outline: none;
    transition: border-color var(--t-base);
}

.todo-add-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.todo-add-input::placeholder {
    color: var(--text-3);
}

.todo-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.todo-input-wrap .todo-add-input {
    width: 100%;
}

.todo-input-overlay {
    position: absolute;
    inset: 0;
    cursor: pointer;
    z-index: 2;
}

.todo-add-input:disabled {
    opacity: 0.45;
    cursor: pointer;
}

/* Search */
.todo-search-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.todo-search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-3);
    pointer-events: none;
    flex-shrink: 0;
}

.todo-search-input {
    width: 100%;
    padding: 8px 12px 8px 30px;
    border-radius: var(--r-lg);
    border: 1.5px solid var(--border-2);
    background: var(--bg-card);
    color: var(--text-1);
    font-size: var(--fs-sm);
    outline: none;
    transition: border-color var(--t-base);
}

.todo-search-input:focus {
    border-color: var(--primary);
}

.todo-add-extras {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.todo-priority-select,
.todo-date-input {
    padding: 8px 10px;
    border-radius: var(--r-lg);
    border: 1.5px solid var(--border-2);
    background: var(--bg-card);
    color: var(--text-2);
    font-size: var(--fs-xs);
    cursor: pointer;
    outline: none;
    transition: border-color var(--t-base);
}

.todo-priority-select:focus,
.todo-date-input:focus {
    border-color: var(--primary);
}

/* Todo list */
.todo-list {
    min-height: 60px;
}

/* Todo item */
.todo-item {
    display: flex;
    flex-direction: column;
    padding: 0;
    border-bottom: 1px solid var(--border);
    transition: background var(--t-fast);
}

.todo-main-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
}

.todo-item:last-child {
    border-bottom: none;
}

.todo-item:hover {
    background: var(--bg-hover);
}

.todo-item.completed .todo-title-text {
    text-decoration: line-through;
    color: var(--text-3);
}

.todo-item.completed .todo-meta-row {
    opacity: 0.75;
}

/* Custom checkbox */
.todo-check-label {
    position: relative;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
}

.todo-check-label input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.todo-check-box {
    position: absolute;
    inset: 0;
    border: 2px solid var(--border-2);
    border-radius: 6px;
    background: transparent;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.todo-check-label:hover .todo-check-box {
    border-color: var(--primary);
}

.todo-check-label input:checked+.todo-check-box {
    background: var(--primary);
    border-color: var(--primary);
}

.todo-check-label input:checked+.todo-check-box::after {
    content: '';
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
    display: block;
}

/* Todo content */
.todo-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.todo-title-text {
    font-size: var(--fs-sm);
    color: var(--text);
    font-weight: 500;
    cursor: text;
    transition: color var(--t-base);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.todo-title-input {
    font-size: var(--fs-sm);
    color: var(--text);
    font-weight: 500;
    background: var(--bg-input);
    border: 1.5px solid var(--primary);
    border-radius: var(--r-md);
    padding: 2px 8px;
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
    width: 100%;
}

.todo-meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Priority badge */
.prio-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: opacity var(--t-fast);
}

.prio-badge:hover {
    opacity: 0.8;
}

.prio-badge.high {
    background: rgba(239, 68, 68, 0.12);
    color: #EF4444;
}

.prio-badge.medium {
    background: rgba(245, 158, 11, 0.12);
    color: #F59E0B;
}

.prio-badge.low {
    background: rgba(16, 185, 129, 0.12);
    color: #10B981;
}

/* Due date chip */
.due-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-elevated);
    color: var(--text-3);
    white-space: nowrap;
}

.due-chip.overdue {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

.due-chip.today {
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
}

/* Action buttons */
.todo-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--t-base);
    flex-shrink: 0;
}

.todo-item:hover .todo-actions {
    opacity: 1;
}

.todo-action-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--r-md);
    border: none;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t-base);
}

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

.todo-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

/* Empty state */
.todo-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem var(--sp-6);
    text-align: center;
    gap: var(--sp-3);
}

.todo-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
    margin-bottom: var(--sp-2);
}

.todo-empty-title {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--text-2);
}

.todo-empty-sub {
    font-size: var(--fs-sm);
    color: var(--text-3);
}

/* Recurring badge */
.rec-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(139, 92, 246, 0.1);
    color: #8B5CF6;
    white-space: nowrap;
}

.rec-badge .rec-sep {
    opacity: 0.4;
    font-size: 10px;
    font-weight: 300;
    margin: 0 1px;
}

.rec-badge .rec-next {
    font-weight: 400;
    opacity: 0.8;
    color: var(--text-2);
}

.next-rec-badge {
    display: none;
    /* merged into rec-badge */
}

/* Subtask toggle button */
.subtask-toggle-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--r-md);
    border: none;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all var(--t-base);
}

.subtask-toggle-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-2);
}

.subtask-toggle-btn.open {
    color: var(--primary);
}

.subtask-count {
    background: var(--bg-elevated);
    padding: 1px 5px;
    border-radius: 999px;
    font-size: 10px;
}

.subtask-count.done {
    background: rgba(16, 185, 129, 0.12);
    color: #10B981;
}

/* Subtask panel */
.subtask-panel {
    padding: 0 var(--sp-5) var(--sp-3) 48px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.subtask-item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 4px 6px;
    border-radius: var(--r-md);
    transition: background var(--t-fast);
}

.subtask-item:hover {
    background: var(--bg-hover);
}

.subtask-item.completed .subtask-title {
    text-decoration: line-through;
    color: var(--text-3);
}

.subtask-check-label {
    position: relative;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

.subtask-check-label input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.subtask-check-box {
    position: absolute;
    inset: 0;
    border: 2px solid var(--border-2);
    border-radius: 4px;
    background: transparent;
    transition: all 0.15s ease;
}

.subtask-check-label:hover .subtask-check-box {
    border-color: var(--primary);
}

.subtask-check-label input:checked+.subtask-check-box {
    background: var(--primary);
    border-color: var(--primary);
}

.subtask-check-label input:checked+.subtask-check-box::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 4px;
    height: 7px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
    display: block;
}

.subtask-title {
    flex: 1;
    font-size: var(--fs-sm);
    color: var(--text-2);
}

.subtask-delete-btn {
    opacity: 0;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-sm);
    transition: all var(--t-fast);
}

.subtask-item:hover .subtask-delete-btn {
    opacity: 1;
}

.subtask-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

.subtask-add-row {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-top: 4px;
}

.subtask-add-input {
    flex: 1;
    padding: 5px 10px;
    border-radius: var(--r-md);
    border: 1.5px solid var(--border-2);
    background: var(--bg-card);
    color: var(--text-1);
    font-size: var(--fs-xs);
    outline: none;
    transition: border-color var(--t-base);
}

.subtask-add-input:focus {
    border-color: var(--primary);
}

.subtask-add-btn {
    width: 26px;
    height: 26px;
    border-radius: var(--r-md);
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--t-fast);
    flex-shrink: 0;
}

.subtask-add-btn:hover {
    opacity: 0.85;
}

/* Upgrade banner */
.todo-upgrade-banner {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-5);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(139, 92, 246, 0.06) 100%);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.todo-upgrade-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--grad-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.todo-upgrade-text {
    flex: 1;
    min-width: 180px;
}

.todo-upgrade-title {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text);
}

.todo-upgrade-sub {
    font-size: var(--fs-xs);
    color: var(--text-3);
    margin-top: 2px;
}

/* =====================================================================
   PREMIUM TEASER CARD
   ===================================================================== */
.premium-teaser-card {
    margin-top: var(--sp-5);
    padding: var(--sp-6);
    background: linear-gradient(135deg,
            rgba(99, 102, 241, 0.05) 0%,
            rgba(139, 92, 246, 0.05) 100%);
    border: 1.5px solid rgba(99, 102, 241, 0.18);
}

.premium-teaser-header {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
}

.premium-teaser-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #8B5CF6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.premium-teaser-title {
    font-size: var(--fs-base);
    font-weight: 700;
    color: var(--text);
}

.premium-teaser-sub {
    font-size: var(--fs-sm);
    color: var(--text-3);
    margin-top: 2px;
}

.premium-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-3);
    margin-bottom: var(--sp-5);
}

@media (min-width: 680px) {
    .premium-feature-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.premium-feature-item {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border-radius: var(--r-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: border-color var(--t-base);
}

.premium-feature-item:hover {
    border-color: rgba(99, 102, 241, 0.35);
}

.pf-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pf-title {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.pf-desc {
    font-size: 11px;
    color: var(--text-3);
    line-height: 1.45;
}

.premium-teaser-cta {
    display: flex;
    justify-content: center;
}

/* =====================================================================
   TODO — RESPONSIVE
   ===================================================================== */

@media (max-width: 768px) {
    .todo-toolbar {
        gap: var(--sp-3);
    }

    .todo-toolbar-controls {
        width: 100%;
        flex-wrap: wrap;
    }

    .todo-search-wrap {
        flex: 1;
        min-width: 140px;
    }
}

@media (max-width: 640px) {
    .todo-add-bar {
        flex-wrap: wrap;
        gap: var(--sp-2);
    }

    .todo-input-wrap {
        width: 100%;
        flex: none;
    }

    .todo-add-extras {
        width: 100%;
        flex-wrap: wrap;
    }

    .todo-priority-select,
    .todo-date-input {
        flex: 1;
        min-width: 100px;
    }

    #btn-add-submit {
        width: 100%;
        justify-content: center;
    }

    .todo-sort-select {
        flex: 1;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .todo-filter-btn {
        padding: 4px 10px;
        font-size: 12px;
    }

    .todo-count-badge {
        display: none;
    }

    .todo-main-row {
        padding: var(--sp-3) var(--sp-4);
    }

    .subtask-panel {
        padding-left: var(--sp-8);
    }

    .premium-feature-grid {
        grid-template-columns: 1fr;
    }

    .todo-upgrade-banner {
        gap: var(--sp-3);
    }

    .todo-upgrade-text {
        min-width: 0;
    }
}

/* =====================================================================
   PREMIUM EXPIRY NOTICE BANNER
   ===================================================================== */
.expiry-notice {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-5);
    margin: var(--sp-4) auto 0;
    width: 100%;
    max-width: 1000px;
    align-self: center;
    background: rgba(245, 158, 11, 0.08);
    border: 1.5px solid rgba(245, 158, 11, 0.30);
    border-left: 3px solid #F59E0B;
    border-radius: var(--r-xl);
}

.expiry-notice-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.15);
    color: #F59E0B;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.expiry-notice-body {
    flex: 1;
    min-width: 0;
}

.expiry-notice-title {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: #F59E0B;
    margin-bottom: 3px;
}

.expiry-notice-sub {
    font-size: var(--fs-xs);
    color: var(--text-2);
    line-height: 1.5;
}

.expiry-notice-sub strong {
    color: var(--text);
}

.expiry-notice-close {
    width: 28px;
    height: 28px;
    border-radius: var(--r-md);
    border: none;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--t-base);
}

.expiry-notice-close:hover {
    background: rgba(245, 158, 11, 0.15);
    color: #F59E0B;
}

/* =====================================================================
   EXPENSES TRACKER
   ===================================================================== */

/* ── Page layout ── */
.exp-page {
    display: flex;
    flex-direction: column;
    gap: var(--sp-6);
    width: 100%;
}

/* ── Nav row (month/year nav + view toggle) ── */
.exp-nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

/* ── View toggle (Monat | Jahr) ── */
.exp-view-toggle {
    display: flex;
    align-items: center;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
}

.exp-view-btn {
    background: none;
    border: none;
    border-radius: calc(var(--r-lg) - 2px);
    padding: 5px 14px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
    transition: background var(--t-base), color var(--t-base);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.exp-view-btn.active {
    background: var(--primary);
    color: #fff;
}

.exp-view-btn:not(.active):hover {
    background: var(--bg-card);
    color: var(--text);
}

.exp-view-btn-locked {
    opacity: .65;
}

/* ── Month navigator ── */
.exp-month-nav {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.exp-month-nav h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    flex: 1;
    text-align: center;
    text-transform: capitalize;
}

.exp-month-btn {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: background var(--t-base), color var(--t-base);
}

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

/* ── Summary cards ── */
.exp-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-4);
}

@media (max-width: 600px) {
    .exp-summary-grid {
        grid-template-columns: 1fr;
    }
}

.exp-summary-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--r-xl);
    padding: var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.exp-summary-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
}

.exp-summary-amount {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1;
}

.exp-summary-card.income .exp-summary-amount {
    color: #22c55e;
}

.exp-summary-card.expense .exp-summary-amount {
    color: #ef4444;
}

.exp-summary-card.balance .exp-summary-amount {
    color: var(--primary);
}

.exp-summary-card.balance.negative .exp-summary-amount {
    color: #ef4444;
}

/* ── Add-entry form card ── */
.exp-form-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--r-xl);
    padding: var(--sp-5) var(--sp-6);
}

.exp-form-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--sp-4);
}

.exp-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    align-items: flex-end;
}

.exp-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    flex: 1;
    min-width: 120px;
}

.exp-form-group label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
}

.exp-form-group input,
.exp-form-group select {
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    color: var(--text);
    font-size: 0.88rem;
    padding: var(--sp-2) var(--sp-3);
    height: 38px;
    outline: none;
    transition: border-color var(--t-base);
    width: 100%;
}

.exp-form-group input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    color-scheme: dark;
    text-align: left;
}

.exp-form-group input:focus,
.exp-form-group select:focus {
    border-color: var(--primary);
}

.exp-type-toggle {
    display: flex;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    height: 38px;
}

.exp-type-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0 var(--sp-3);
    transition: background var(--t-base), color var(--t-base);
}

.exp-type-btn.active-expense {
    background: rgba(239, 68, 68, 0.18);
    color: #ef4444;
}

.exp-type-btn.active-income {
    background: rgba(34, 197, 94, 0.18);
    color: #22c55e;
}

.exp-submit-btn {
    background: var(--primary);
    border: none;
    border-radius: var(--r-lg);
    color: #fff;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    height: 38px;
    padding: 0 var(--sp-5);
    white-space: nowrap;
    transition: opacity var(--t-base);
}

.exp-submit-btn:hover {
    opacity: 0.88;
}

/* ── Form group desktop size hints (replaces inline styles) ── */
.exp-fg-type {
    max-width: 160px;
}

.exp-fg-amount {
    max-width: 130px;
}

.exp-fg-desc {
    flex: 2;
}

.exp-fg-cat {
    max-width: 180px;
}

.exp-fg-date {
    max-width: 155px;
}

.exp-fg-submit {
    max-width: 130px;
}

/* ── Chart card ── */
.exp-chart-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--r-xl);
    padding: var(--sp-5) var(--sp-6);
}

.exp-chart-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--sp-4);
}

.exp-chart-wrap {
    position: relative;
    height: 200px;
}

/* ── Bottom grid: breakdown + entries ── */
.exp-bottom-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--sp-4);
    align-items: start;
}

@media (max-width: 700px) {
    .exp-bottom-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Category breakdown ── */
.exp-breakdown-card,
.exp-entries-card,
.exp-annual-months-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--r-xl);
    padding: var(--sp-5) var(--sp-5);
}

.exp-breakdown-card h3,
.exp-entries-card h3,
.exp-annual-months-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--sp-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Annual months table ── */
.exp-annual-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
}

.exp-annual-table thead th {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-3);
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 1.5px solid var(--border);
    text-align: left;
}

.exp-annual-table thead th:not(:first-child) {
    text-align: right;
}

.exp-annual-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--t-base);
}

.exp-annual-table tbody tr:last-child {
    border-bottom: none;
}

.exp-annual-table tbody tr:hover {
    background: var(--bg-elevated);
}

.exp-annual-table tbody tr.exp-ann-row-empty td {
    color: var(--text-3);
}

.exp-annual-table td {
    padding: var(--sp-2) var(--sp-3);
    color: var(--text);
}

.exp-ann-month {
    font-weight: 600;
    color: var(--text) !important;
}

.exp-ann-income {
    text-align: right;
    color: #22c55e !important;
}

.exp-ann-expense {
    text-align: right;
    color: #ef4444 !important;
}

.exp-ann-balance {
    text-align: right;
    font-weight: 600;
}

.exp-ann-balance.positive {
    color: #22c55e !important;
}

.exp-ann-balance.negative {
    color: #ef4444 !important;
}

.exp-cat-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.exp-cat-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.exp-cat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.exp-cat-name {
    font-size: 0.83rem;
    color: var(--text-2);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.exp-cat-amount {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text);
}

.exp-cat-bar-wrap {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    margin-top: 3px;
    overflow: hidden;
}

.exp-cat-bar {
    height: 100%;
    border-radius: 2px;
}

/* ── Entries list ── */
.exp-entries-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    max-height: 400px;
    overflow-y: auto;
}

.exp-entry-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-3);
    border-radius: var(--r-lg);
    transition: background var(--t-base);
}

.exp-entry-item:hover {
    background: var(--bg-elevated);
}

.exp-entry-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--r-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.exp-entry-info {
    flex: 1;
    min-width: 0;
}

.exp-entry-desc {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exp-entry-meta {
    font-size: 0.72rem;
    color: var(--text-3);
    margin-top: 1px;
}

.exp-entry-amount {
    font-size: 0.9rem;
    font-weight: 700;
    flex-shrink: 0;
}

.exp-entry-amount.expense {
    color: #ef4444;
}

.exp-entry-amount.income {
    color: #22c55e;
}

.exp-entry-edit {
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    padding: var(--sp-1);
    border-radius: var(--r-md);
    opacity: 0;
    transition: opacity var(--t-base), color var(--t-base);
}

.exp-entry-item:hover .exp-entry-edit {
    opacity: 1;
}

.exp-entry-edit:hover {
    color: var(--primary);
}

.exp-entry-delete {
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    padding: var(--sp-1);
    border-radius: var(--r-md);
    opacity: 0;
    transition: opacity var(--t-base), color var(--t-base);
}

.exp-entry-item:hover .exp-entry-delete {
    opacity: 1;
}

.exp-entry-delete:hover {
    color: #ef4444;
}

/* ── Empty state ── */
.exp-empty {
    text-align: center;
    padding: var(--sp-8) 0;
}

.exp-empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--sp-3);
    color: var(--text-3);
    opacity: .45;
}

.exp-empty h4 {
    font-size: 0.95rem;
    color: var(--text-2);
    margin-bottom: var(--sp-1);
}

.exp-empty p {
    font-size: 0.8rem;
    color: var(--text-3);
}

/* ── Category manage button ── */
.exp-cat-manage-btn {
    background: none;
    border: 1.5px dashed var(--border);
    border-radius: var(--r-lg);
    color: var(--text-3);
    cursor: pointer;
    font-size: 0.78rem;
    padding: var(--sp-2) var(--sp-3);
    transition: color var(--t-base), border-color var(--t-base);
    white-space: nowrap;
}

.exp-cat-manage-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .exp-page {
        gap: var(--sp-4);
    }

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

    .exp-form-card {
        padding: var(--sp-4);
    }

    .exp-chart-card {
        padding: var(--sp-4);
    }

    .exp-breakdown-card,
    .exp-entries-card {
        padding: var(--sp-4);
    }
}

@media (max-width: 640px) {
    .exp-summary-grid {
        grid-template-columns: 1fr;
    }

    .exp-bottom-grid {
        grid-template-columns: 1fr;
    }

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

    /* reset desktop max-width hints inside the grid */
    .exp-fg-type,
    .exp-fg-amount,
    .exp-fg-desc,
    .exp-fg-cat,
    .exp-fg-date,
    .exp-fg-submit {
        max-width: none;
        min-width: 0;
        flex: none;
    }

    /* type toggle and submit span both columns */
    .exp-fg-type {
        grid-column: 1 / -1;
    }

    .exp-fg-submit {
        grid-column: 1 / -1;
    }

    .exp-fg-submit .exp-submit-btn {
        width: 100%;
        height: 42px;
    }

    .exp-entries-list {
        max-height: none;
    }

    .exp-chart-wrap {
        height: 160px;
    }
}

@media (max-width: 420px) {
    .exp-form-row {
        grid-template-columns: 1fr;
    }

    .exp-fg-type,
    .exp-fg-submit {
        grid-column: auto;
    }

    .exp-month-nav h2 {
        font-size: 0.95rem;
    }

    .exp-summary-amount {
        font-size: 1.25rem;
    }

    .exp-chart-wrap {
        height: 140px;
    }
}

/* ── JS-driven breakpoint classes ───────────────────────────────── */
/* exp-narrow: 640px < content-width <= 900px  (2-col form)         */
/* exp-xs    : content-width <= 640px          (1-col everything)   */

/* --- narrow: form becomes 2-col grid, grids stay multi-col --- */
.exp-page.exp-narrow .exp-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: flex-end;
}

.exp-page.exp-narrow .exp-fg-type,
.exp-page.exp-narrow .exp-fg-amount,
.exp-page.exp-narrow .exp-fg-desc,
.exp-page.exp-narrow .exp-fg-cat,
.exp-page.exp-narrow .exp-fg-date,
.exp-page.exp-narrow .exp-fg-submit {
    max-width: none;
    min-width: 0;
    flex: none;
}

.exp-page.exp-narrow .exp-fg-type,
.exp-page.exp-narrow .exp-fg-submit {
    grid-column: 1 / -1;
}

.exp-page.exp-narrow .exp-fg-submit .exp-submit-btn {
    width: 100%;
    height: 42px;
}

.exp-page.exp-narrow .exp-entries-list {
    max-height: none;
}

.exp-page.exp-narrow .exp-chart-wrap {
    height: 160px;
}

/* --- xs: 1-col everything (stacks on top of narrow) --- */
.exp-page.exp-xs .exp-form-row {
    grid-template-columns: 1fr;
}

.exp-page.exp-xs .exp-fg-type,
.exp-page.exp-xs .exp-fg-submit {
    grid-column: auto;
}

.exp-page.exp-xs .exp-summary-grid {
    grid-template-columns: 1fr;
}

.exp-page.exp-xs .exp-bottom-grid {
    grid-template-columns: 1fr;
}

.exp-page.exp-xs .exp-month-nav h2 {
    font-size: 0.95rem;
}

.exp-page.exp-xs .exp-summary-amount {
    font-size: 1.25rem;
}

.exp-page.exp-xs .exp-chart-wrap {
    height: 140px;
}

/* ═══════════════════════════════════════════════
   NOTES TOOL
   ═══════════════════════════════════════════════ */

/* ── Toolbar ── */
.notes-toolbar {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-6);
    flex-wrap: wrap;
}

.notes-search-wrap {
    position: relative;
    flex: 1;
    min-width: 180px;
}

.notes-search-icon {
    position: absolute;
    left: var(--sp-3);
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-3);
    pointer-events: none;
}

.notes-search-input {
    width: 100%;
    padding: var(--sp-2) var(--sp-3) var(--sp-2) calc(var(--sp-3) + 22px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    color: var(--text);
    font-size: var(--fs-sm);
    font-family: inherit;
    transition: border-color var(--t-base);
}

.notes-search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.notes-search-input::placeholder {
    color: var(--text-3);
}

.notes-search-input[readonly] {
    cursor: not-allowed;
    color: var(--text-3);
}

.notes-search-wrap.locked {
    opacity: 0.55;
    cursor: not-allowed;
}

.notes-search-wrap.locked input {
    cursor: not-allowed;
}

.notes-search-lock {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-3);
    pointer-events: none;
}

/* ── Loading ── */
.notes-loading-state {
    display: flex;
    justify-content: center;
    padding: var(--sp-12);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

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

/* ── Section label ── */
.notes-section {
    margin-bottom: var(--sp-8);
}

.notes-section-label {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--sp-4);
}

.notes-section-label svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ── Masonry grid ── */
.notes-masonry {
    columns: 3 260px;
    column-gap: var(--sp-4);
}

/* ── Note card ── */
.note-card {
    break-inside: avoid;
    display: block;
    margin-bottom: var(--sp-4);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-4);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
}

.note-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* Note color variants — light mode */
.note-card[data-color="yellow"] {
    background: #fef9c3;
    border-color: #fde68a;
    color: #422006;
}

.note-card[data-color="green"] {
    background: #dcfce7;
    border-color: #bbf7d0;
    color: #052e16;
}

.note-card[data-color="blue"] {
    background: #dbeafe;
    border-color: #bfdbfe;
    color: #1e3a5f;
}

.note-card[data-color="purple"] {
    background: #ede9fe;
    border-color: #ddd6fe;
    color: #2e1065;
}

.note-card[data-color="pink"] {
    background: #fce7f3;
    border-color: #fbcfe8;
    color: #500724;
}

.note-card[data-color="orange"] {
    background: #ffedd5;
    border-color: #fed7aa;
    color: #431407;
}

/* Note color variants — dark mode */
[data-theme="dark"] .note-card[data-color="yellow"] {
    background: #2d2a10;
    border-color: #4a4218;
    color: var(--text);
}

[data-theme="dark"] .note-card[data-color="green"] {
    background: #0d2217;
    border-color: #1a4a2a;
    color: var(--text);
}

[data-theme="dark"] .note-card[data-color="blue"] {
    background: #0d1e35;
    border-color: #1a3055;
    color: var(--text);
}

[data-theme="dark"] .note-card[data-color="purple"] {
    background: #1a1035;
    border-color: #2d1a5a;
    color: var(--text);
}

[data-theme="dark"] .note-card[data-color="pink"] {
    background: #2d1025;
    border-color: #4a1a3a;
    color: var(--text);
}

[data-theme="dark"] .note-card[data-color="orange"] {
    background: #2d1a08;
    border-color: #4a2c10;
    color: var(--text);
}

.note-card-body {
    margin-bottom: var(--sp-3);
}

.note-card-title {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: inherit;
    margin: 0 0 var(--sp-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-card-preview {
    font-size: var(--fs-xs);
    color: inherit;
    opacity: 0.75;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    white-space: pre-wrap;
}

.note-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--sp-3);
    min-height: 24px;
}

.note-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.note-tag {
    display: inline-block;
    padding: 1px 7px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    border-radius: var(--r-full);
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-card[data-color="default"] .note-tag {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
}

.note-card:not([data-color="default"]) .note-tag {
    background: rgba(0, 0, 0, 0.1);
    color: inherit;
}

[data-theme="dark"] .note-card:not([data-color="default"]) .note-tag {
    background: rgba(255, 255, 255, 0.12);
}

.note-tag-clickable {
    cursor: pointer;
    transition: filter 0.12s, opacity 0.12s;
}

.note-tag-clickable:hover {
    filter: brightness(1.2);
    opacity: 0.9;
}

.note-tag-active {
    outline: 1.5px solid var(--primary);
    outline-offset: 1px;
}

.notes-tag-filter {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.28);
    border-radius: var(--r-full);
    color: var(--primary);
    font-size: var(--fs-sm);
    font-weight: 500;
    margin-bottom: var(--sp-4);
}

.notes-tag-filter-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    line-height: 1;
}

.notes-tag-filter-clear:hover {
    opacity: 1;
}

.note-card-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.note-card:hover .note-card-actions {
    opacity: 1;
}

.note-action-btn {
    background: rgba(0, 0, 0, 0.06);
    border: none;
    border-radius: var(--r-md);
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.12s, background 0.12s;
}

.note-action-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.12);
}

.note-pin-active {
    opacity: 1;
    color: var(--primary);
}

[data-theme="dark"] .note-action-btn {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .note-action-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

/* ── Empty state ── */
.notes-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--sp-12) var(--sp-4);
    color: var(--text-3);
    text-align: center;
}

.notes-empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: var(--sp-4);
    opacity: 0.3;
}

.notes-empty-state p {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--text-2);
    margin: 0 0 var(--sp-1);
}

.notes-empty-state span {
    font-size: var(--fs-sm);
    color: var(--text-3);
}

/* ── Note modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 900;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--sp-6);
    animation: fadeIn var(--t-base) ease;
}

.note-modal {
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.note-modal-body {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-5);
    overflow-y: auto;
    flex: 1;
}

.note-editor-title {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: var(--fs-lg);
    font-weight: 600;
    font-family: inherit;
    padding: var(--sp-1) 0;
    outline: none;
    transition: border-color var(--t-base);
}

.note-editor-title:focus {
    border-color: var(--primary);
}

.note-editor-title::placeholder {
    color: var(--text-3);
    font-weight: 400;
}

/* Tabs + color row */
.note-editor-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

.note-editor-tabs {
    display: flex;
    gap: var(--sp-1);
    background: var(--bg-elevated);
    border-radius: var(--r-full);
    padding: 3px;
}

.note-tab {
    background: transparent;
    border: none;
    border-radius: var(--r-full);
    padding: 4px 14px;
    font-size: var(--fs-xs);
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    transition: background var(--t-base), color var(--t-base);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: var(--sp-1);
}

.note-tab.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.note-tab-locked {
    opacity: 0.55;
    cursor: not-allowed;
}

.note-tab-locked:hover {
    background: transparent;
    color: var(--text-2);
}

/* Color picker */
.note-color-picker {
    display: flex;
    align-items: center;
    gap: 6px;
}

.color-dot {
    display: block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    transition: transform 0.12s;
}

.color-dot:hover {
    transform: scale(1.15);
}

.color-dot.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--primary);
}

.color-default {
    background: var(--bg-elevated);
    border-color: var(--border) !important;
}

.color-yellow {
    background: #fef08a;
}

.color-green {
    background: #bbf7d0;
}

.color-blue {
    background: #bfdbfe;
}

.color-purple {
    background: #ddd6fe;
}

.color-pink {
    background: #fbcfe8;
}

.color-orange {
    background: #fed7aa;
}

[data-theme="dark"] .color-yellow {
    background: #4a4218;
}

[data-theme="dark"] .color-green {
    background: #1a4a2a;
}

[data-theme="dark"] .color-blue {
    background: #1a3055;
}

[data-theme="dark"] .color-purple {
    background: #2d1a5a;
}

[data-theme="dark"] .color-pink {
    background: #4a1a3a;
}

[data-theme="dark"] .color-orange {
    background: #4a2c10;
}

/* Content textarea */
.note-editor-textarea {
    width: 100%;
    min-height: 200px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text);
    font-size: var(--fs-sm);
    font-family: inherit;
    padding: var(--sp-3);
    resize: vertical;
    line-height: 1.6;
    outline: none;
    transition: border-color var(--t-base);
}

.note-editor-textarea:focus {
    border-color: var(--primary);
}

.note-editor-textarea::placeholder {
    color: var(--text-3);
}

/* Markdown preview */
.note-preview-content {
    min-height: 200px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-3);
    font-size: var(--fs-sm);
    line-height: 1.7;
    color: var(--text);
    overflow-y: auto;
}

.note-preview-content h1,
.note-preview-content h2,
.note-preview-content h3 {
    margin: 0.75em 0 0.35em;
    font-weight: 700;
}

.note-preview-content p {
    margin: 0 0 0.6em;
}

.note-preview-content ul,
.note-preview-content ol {
    padding-left: 1.4em;
    margin: 0 0 0.6em;
}

.note-preview-content code {
    background: var(--bg-card);
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.9em;
    font-family: monospace;
}

.note-preview-content pre {
    background: var(--bg-card);
    border-radius: var(--r-md);
    padding: var(--sp-3);
    overflow-x: auto;
}

.note-preview-content blockquote {
    border-left: 3px solid var(--primary);
    padding-left: var(--sp-3);
    color: var(--text-2);
    margin: 0 0 0.6em;
}

/* Tags section */
.note-tags-section {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.note-tags-label {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.tags-lock-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    padding: 1px 8px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: none;
    letter-spacing: 0;
    cursor: default;
}

.note-tags-input-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-2) var(--sp-3);
    min-height: 40px;
}

.note-tags-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.note-tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--r-full);
    padding: 2px 8px 2px 10px;
    font-size: var(--fs-xs);
    font-weight: 500;
}

.note-tag-pill button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
    display: flex;
    align-items: center;
}

.note-tag-pill button:hover {
    opacity: 1;
}

.note-tag-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: var(--fs-xs);
    font-family: inherit;
    flex: 1;
    min-width: 120px;
}

.note-tag-input::placeholder {
    color: var(--text-3);
}

.note-tags-hint {
    font-size: var(--fs-xs);
    color: var(--text-3);
}

/* Modal footer buttons */
.modal-footer-left {
    display: flex;
    align-items: center;
}

.modal-footer-right {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.btn-danger-ghost {
    background: transparent;
    border: 1px solid transparent;
    color: var(--danger);
    border-radius: var(--r-md);
    padding: var(--sp-2) var(--sp-3);
    cursor: pointer;
    font-size: var(--fs-sm);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    transition: background var(--t-base), border-color var(--t-base);
}

.btn-danger-ghost:hover {
    background: var(--danger-light);
    border-color: var(--danger);
}

.btn-danger-ghost svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* ── Responsive ── */
@media (max-width: 700px) {
    .notes-masonry {
        columns: 2 200px;
    }
}

@media (max-width: 480px) {
    .notes-masonry {
        columns: 1;
    }

    .note-modal {
        max-width: 100%;
        max-height: 95vh;
    }
}
}

/* ── Dev Plan Bar ─────────────────────────────────────────────────── */
.dev-plan-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 12px;
    margin: 6px 10px;
    border-radius: 8px;
    background: rgba(99, 102, 241, .08);
    border: 1px dashed rgba(99, 102, 241, .35);
    font-size: 11px;
    color: var(--text-3);
}

.dev-plan-label strong {
    color: var(--text);
}

.dev-plan-btns {
    display: flex;
    gap: 4px;
}

.dev-plan-btn {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: var(--bg-hover);
    color: var(--text-2);
    cursor: pointer;
    transition: background .15s;
}

.dev-plan-btn:hover:not(:disabled) {
    background: var(--bg-active);
    color: var(--text);
}

.dev-plan-btn:disabled {
    opacity: .4;
    cursor: default;
}

.dev-plan-btn--premium:not(:disabled) {
    border-color: rgba(99, 102, 241, .5);
    color: var(--primary);
}

/* ── Notifications Dropdown ─────────────────────────────────────────── */
.notif-dropdown-panel {
    padding: 0;
    overflow: hidden;
}

.notif-dropdown-panel.open {
    display: flex;
    flex-direction: column;
}

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-4);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.notif-panel-header>span {
    font-weight: 700;
    font-size: var(--fs-sm);
    color: var(--text);
}

.notif-mark-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--r-sm);
    transition: background var(--t-fast);
    white-space: nowrap;
}

.notif-mark-all-btn:hover {
    background: var(--bg-hover);
}

.notif-center-state {
    padding: var(--sp-8);
    text-align: center;
    color: var(--text-3);
    font-size: var(--fs-sm);
}

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

.notif-spin {
    animation: notif-spin .9s linear infinite;
    display: block;
    margin: 0 auto;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    text-decoration: none;
    color: var(--text);
    transition: background var(--t-fast);
    border-bottom: 1px solid var(--border);
    position: relative;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: var(--bg-hover);
}

.notif-item-icon {
    flex-shrink: 0;
    margin-top: 2px;
    display: flex;
    align-items: center;
}

.notif-item-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.notif-item-title {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.notif-item-desc {
    font-size: var(--fs-xs);
    color: var(--text-3);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.notif-dismiss-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    border-radius: 50%;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-3);
    opacity: 0;
    transition: opacity var(--t-fast), background var(--t-fast);
}

.notif-item:hover .notif-dismiss-btn {
    opacity: 1;
}

.notif-dismiss-btn:hover {
    background: var(--bg-active);
    color: var(--text);
}