/* ============================================
   Organizei Design System v3.1
   Primary: #7B61FF | Accent: #00E0A4
   Dark-first, Mobile-first, Inter font family
   ============================================ */

/* -- Reset -- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* -- Design Tokens -- */
:root {
    /* Primary (Roxo Organizei) */
    --primary:            #7B61FF;
    --primary-hover:      #6B51EF;
    --primary-light:      #1A1535;
    --primary-gradient:   linear-gradient(135deg, #7B61FF, #00D4FF);

    /* Accent (Verde Organizei) */
    --accent:             #00E0A4;
    --accent-hover:       #00C994;
    --accent-light:       #0D2B1F;
    --accent-gradient:    linear-gradient(135deg, #00E0A4, #00D4FF);

    /* Background */
    --bg:                 #0B0E14;
    --bg-card:            #121722;
    --bg-surface:         #1A1F2E;
    --bg-input:           #1A1F2E;
    --bg-hover:           #222838;
    --bg-elevated:        #151A25;

    /* Aliases (backwards compat) */
    --surface:            var(--bg-card);
    --color-primary:      var(--primary);
    --color-primary-dark: var(--primary-hover);
    --color-accent:       var(--accent);
    --color-accent-hover: var(--accent-hover);
    --accent-glow:        rgba(123, 97, 255, 0.20);
    --accent-dark:        var(--primary-hover);

    /* Text */
    --text:               #FFFFFF;
    --text-secondary:     #9AA0A6;
    --text-muted:         #6B7280;
    --text-inverse:       #0B0E14;

    /* Borders */
    --border:             #1E2633;
    --border-light:       #151A25;
    --border-focus:       var(--primary);

    /* Status */
    --success:            #00E0A4;
    --success-light:      rgba(0, 224, 164, 0.10);
    --warning:            #F59E0B;
    --warning-light:      rgba(245, 158, 11, 0.10);
    --error:              #EF4444;
    --error-light:        rgba(239, 68, 68, 0.10);
    --info:               #3B82F6;
    --info-light:         rgba(59, 130, 246, 0.10);

    /* Semantic aliases */
    --green:              #00E0A4;
    --red:                #EF4444;
    --yellow:             #F59E0B;
    --blue:               #3B82F6;

    /* Category Colors */
    --cat-notas:          #7B61FF;
    --cat-contatos:       #00E0A4;
    --cat-documentos:     #3B82F6;
    --cat-receitas:       #10B981;
    --cat-gastos:         #EF4444;
    --cat-materiais:      #F59E0B;
    --cat-outros:         #6B7280;

    /* Typography */
    --font:               'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono:          'JetBrains Mono', 'Fira Code', monospace;

    /* Font sizes */
    --fs-xs:              11px;
    --fs-sm:              13px;
    --fs-base:            14px;
    --fs-md:              16px;
    --fs-lg:              18px;
    --fs-xl:              20px;
    --fs-2xl:             24px;
    --fs-3xl:             28px;
    --fs-4xl:             32px;

    /* Font weights */
    --fw-normal:          400;
    --fw-medium:          500;
    --fw-semibold:        600;
    --fw-bold:            700;
    --fw-extrabold:       800;
    --fw-black:           900;

    /* Spacing (4px base grid) */
    --space-1:            4px;
    --space-2:            8px;
    --space-3:            12px;
    --space-4:            16px;
    --space-5:            20px;
    --space-6:            24px;
    --space-8:            32px;
    --space-12:           48px;

    /* Radius */
    --radius-xs:          6px;
    --radius-sm:          8px;
    --radius-md:          12px;
    --radius:             12px;
    --radius-lg:          16px;
    --radius-xl:          24px;
    --radius-full:        9999px;

    /* Shadows */
    --shadow-sm:          0 1px 2px rgba(0, 0, 0, 0.20);
    --shadow-md:          0 4px 12px rgba(0, 0, 0, 0.30);
    --shadow-lg:          0 8px 24px rgba(0, 0, 0, 0.40);
    --shadow-xl:          0 16px 40px rgba(0, 0, 0, 0.50);
    --shadow-primary:     0 6px 20px rgba(123, 97, 255, 0.30);
    --shadow-accent:      0 6px 20px rgba(0, 224, 164, 0.20);

    /* Layout */
    --header-height:      56px;
    --tab-bar-height:     56px;
    --max-width:          480px;
    --fab-size:           56px;

    /* Transitions */
    --transition-fast:    150ms ease;
    --transition-base:    200ms ease;
    --transition-slow:    300ms ease;

    /* Z-index scale */
    --z-base:             1;
    --z-header:           50;
    --z-tab-bar:          50;
    --z-dropdown:         100;
    --z-overlay:          200;
    --z-modal:            300;
    --z-toast:            400;
    --z-loading:          500;
}

/* -- Light Mode -- */
[data-theme="light"] {
    --primary:            #7B61FF;
    --primary-hover:      #6B51EF;
    --primary-light:      #F0EAFF;
    --primary-gradient:   linear-gradient(135deg, #7B61FF, #00D4FF);

    --accent:             #00D9A5;
    --accent-hover:       #00C294;
    --accent-light:       #E6FFF8;
    --accent-gradient:    linear-gradient(135deg, #00D9A5, #00F0B5);

    --bg:                 #FAFAFA;
    --bg-card:            #FFFFFF;
    --bg-surface:         #F3F4F6;
    --bg-input:           #F3F4F6;
    --bg-hover:           #ECECF0;
    --bg-elevated:        #FFFFFF;

    --surface:            var(--bg-card);
    --color-primary:      var(--primary);
    --color-primary-dark: var(--primary-hover);
    --color-accent:       var(--accent);
    --color-accent-hover: var(--accent-hover);
    --accent-glow:        rgba(123, 97, 255, 0.15);

    --text:               #1A1A2E;
    --text-secondary:     #6B7280;
    --text-muted:         #9CA3AF;
    --text-inverse:       #FFFFFF;

    --border:             #E5E7EB;
    --border-light:       #F3F4F6;
    --border-focus:       var(--primary);

    --success:            #00D9A5;
    --success-light:      #E6FFF8;
    --warning:            #F59E0B;
    --warning-light:      #FFFBEB;
    --error:              #EF4444;
    --error-light:        #FEF2F2;
    --info:               #3B82F6;
    --info-light:         #EFF6FF;

    --green:              #00D9A5;
    --red:                #EF4444;
    --yellow:             #F59E0B;
    --blue:               #3B82F6;

    --shadow-sm:          0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md:          0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg:          0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-xl:          0 16px 40px rgba(0, 0, 0, 0.12);
    --shadow-primary:     0 6px 20px rgba(123, 97, 255, 0.25);
    --shadow-accent:      0 6px 20px rgba(0, 217, 165, 0.20);
}

/* -- Typography -- */
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: var(--fs-base);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1 { font-size: 2rem;    font-weight: var(--fw-bold);     line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem;  font-weight: var(--fw-semibold); line-height: 1.2;  letter-spacing: -0.01em; }
h3 { font-size: 1.125rem;font-weight: var(--fw-semibold); line-height: 1.3; }
h4 { font-size: 1rem;    font-weight: var(--fw-semibold); }
h5 { font-size: 0.875rem;font-weight: var(--fw-semibold); color: var(--text-secondary); }
h6 { font-size: 0.75rem; font-weight: var(--fw-semibold); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

small, .text-sm { font-size: var(--fs-sm); }
.caption { font-size: var(--fs-xs); color: var(--text-muted); letter-spacing: 0.02em; }

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

.text-accent   { color: var(--accent); }
.text-primary  { color: var(--primary); }
.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }
.text-green    { color: var(--green); }
.text-red      { color: var(--red); }
.text-center   { text-align: center; }
.text-right    { text-align: right; }

/* -- Buttons -- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: var(--fs-base);
    font-weight: var(--fw-semibold);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    line-height: 1.4;
    min-height: 44px;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: var(--shadow-primary);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(123,97,255,0.4); }
.btn-primary:active:not(:disabled) { transform: translateY(0) scale(0.98); }

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-secondary:hover:not(:disabled) { background: var(--primary-light); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover:not(:disabled) { background: var(--primary-light); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
}
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }

.btn-danger {
    background: var(--error);
    color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #DC2626; }

.btn-accent {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: var(--shadow-accent);
}
.btn-accent:hover:not(:disabled) { transform: translateY(-1px); }

/* Sizes */
.btn-sm  { padding: 6px 14px; font-size: var(--fs-sm); min-height: 36px; }
.btn-md  { padding: 10px 20px; font-size: var(--fs-base); min-height: 44px; }
.btn-lg  { padding: 14px 28px; font-size: var(--fs-md); min-height: 48px; border-radius: var(--radius-md); }
.btn-block { width: 100%; }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* -- Cards -- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-interactive { cursor: pointer; }
.card-interactive:hover { border-color: var(--primary); }
.card-interactive:active { transform: scale(0.98); transition: transform 100ms; }

/* Stat card */
.card-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: var(--space-4);
    min-width: 140px;
    flex-shrink: 0;
}
.card-stat-icon { font-size: 20px; margin-bottom: 8px; }
.card-stat-value { font-size: var(--fs-3xl); font-weight: var(--fw-extrabold); color: var(--text); line-height: 1.1; }
.card-stat-value.primary { color: var(--primary); }
.card-stat-value.accent { color: var(--accent); }
.card-stat-label { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }

/* Category card */
.card-category {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.card-category::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--category-color, var(--primary));
    border-radius: 0 4px 4px 0;
}
.card-category:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.card-category:active { transform: scale(0.98); }

/* Item card */
.card-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.card-item:hover { border-color: var(--primary); }

/* -- Forms -- */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--fs-base);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    min-height: 44px;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder { color: var(--text-muted); }
textarea.form-input,
.form-textarea { resize: vertical; min-height: 80px; }
.form-error { font-size: 12px; color: var(--error); margin-top: 4px; }
.form-input.error { border-color: var(--error); }
.form-hint { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; }

/* -- Modal (bottom-sheet on mobile) -- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: var(--z-modal);
    padding: 0;
}
.modal-backdrop.active { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: var(--space-6);
    max-width: var(--max-width);
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideUp 300ms ease-out;
}
.modal-handle {
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto var(--space-4);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-6); }
.modal-header h3 { margin: 0; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover { color: var(--text); }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--border); }

@keyframes modalSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Desktop: center the modal */
@media (min-width: 481px) {
    .modal-backdrop { align-items: center; padding: 20px; }
    .modal { border-radius: var(--radius-lg); animation: modalFadeScale 250ms ease-out; }
    @keyframes modalFadeScale {
        from { transform: scale(0.95); opacity: 0; }
        to   { transform: scale(1);    opacity: 1; }
    }
}

/* -- Toast -- */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: calc(var(--max-width) - 32px);
    width: 100%;
    padding: 0 16px;
}
.toast {
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--fs-base);
    box-shadow: var(--shadow-lg);
    animation: toastIn 300ms ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    max-width: 360px;
    margin: 0 auto;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--error); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info    { border-left: 3px solid var(--primary); }
.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 0 0 0 8px;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
@keyframes toastIn {
    from { transform: translateY(-20px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}
.toast-exit { animation: toastOut 200ms ease-in forwards; }
@keyframes toastOut {
    to { transform: translateY(-20px); opacity: 0; }
}

/* -- Progress Bar -- */
.progress {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 4px;
    transition: width 300ms ease;
}
.progress-bar.green  { background: var(--success); }
.progress-bar.red    { background: var(--error); }
.progress-bar.yellow { background: var(--warning); }
.progress-bar.accent { background: var(--accent-gradient); }

/* -- Badge -- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: var(--fw-semibold);
    white-space: nowrap;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-accent  { background: var(--accent-light);  color: var(--accent); }
.badge-green   { background: rgba(0, 224, 164, 0.10); color: var(--green); }
.badge-red     { background: rgba(239, 68, 68, 0.10); color: var(--red); }
.badge-yellow  { background: rgba(245, 158, 11, 0.10); color: var(--yellow); }
.badge-blue    { background: rgba(59, 130, 246, 0.10); color: var(--blue); }
.badge-gray    { background: var(--bg-input); color: var(--text-muted); }

/* -- Avatar -- */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-input);
    border: 2px solid var(--border);
}
.avatar-sm { width: 28px; height: 28px; }
.avatar-md { width: 40px; height: 40px; }
.avatar-lg { width: 56px; height: 56px; }

/* -- FAB (Camera) -- */
.fab {
    width: var(--fab-size);
    height: var(--fab-size);
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    border: 4px solid var(--bg-card);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-primary);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
    z-index: 2;
}
.fab:hover  { transform: scale(1.05); box-shadow: 0 8px 28px rgba(123,97,255,0.45); }
.fab:active { transform: scale(0.92); }

/* Pulse animation for FAB */
.fab-pulse::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    opacity: 0;
    animation: fabPulse 3s ease-out infinite;
}
@keyframes fabPulse {
    0%   { transform: scale(0.9); opacity: 0.6; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* -- Tab Bar -- */
.tab-bar-component {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    height: var(--tab-bar-height);
    padding: 0 8px;
}
.tab-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 10px;
    font-weight: var(--fw-medium);
    cursor: pointer;
    transition: color var(--transition-fast);
    min-width: 56px;
    min-height: 44px;
    justify-content: center;
}
.tab-bar-item.active { color: var(--primary); }
.tab-bar-item:hover  { color: var(--text); }
.tab-bar-icon { font-size: 22px; line-height: 1; }

/* -- Search Bar -- */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-bar input {
    flex: 1;
    border: none;
    background: none;
    font-family: var(--font);
    font-size: var(--fs-base);
    color: var(--text);
    outline: none;
    min-height: 28px;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-icon { font-size: 18px; color: var(--text-muted); flex-shrink: 0; }

/* -- Charts (CSS-only) -- */

/* Pie chart via conic-gradient */
.chart-pie {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(
        var(--cat-notas, #7B61FF) 0% var(--pie-1, 25%),
        var(--cat-contatos, #00E0A4) var(--pie-1, 25%) var(--pie-2, 50%),
        var(--cat-documentos, #3B82F6) var(--pie-2, 50%) var(--pie-3, 75%),
        var(--bg-input) var(--pie-3, 75%) 100%
    );
    position: relative;
    flex-shrink: 0;
}
.chart-pie-hole {
    position: absolute;
    inset: 20px;
    border-radius: 50%;
    background: var(--bg-card);
}
.chart-pie-center {
    position: absolute;
    inset: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
    color: var(--text);
}

/* Bar chart via flex */
.chart-bar {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 80px;
    padding-top: 8px;
}
.chart-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
    justify-content: flex-end;
}
.chart-bar-fill {
    width: 100%;
    max-width: 24px;
    border-radius: 4px 4px 0 0;
    background: var(--primary-gradient);
    transition: height 300ms ease;
    min-height: 2px;
}
.chart-bar-label {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* -- Empty State -- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}
.empty-state-title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.empty-state-text {
    font-size: var(--fs-base);
    margin-bottom: var(--space-6);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* -- Loading Skeleton -- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
.skeleton-text  { height: 14px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: 12px; border-radius: 4px; }
.skeleton-circle { border-radius: 50%; }
.skeleton-card  { height: 80px; border-radius: var(--radius-md); margin-bottom: 8px; }
@keyframes skeletonShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* -- Spinner -- */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }
.spinner-accent { border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-loading);
    transition: opacity 300ms;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }

/* -- Containers -- */
.container    { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 600px;  margin: 0 auto; padding: 0 20px; }

/* -- Utilities: Flex -- */
.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.flex-wrap       { flex-wrap: wrap; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.items-end       { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.flex-1          { flex: 1; }
.flex-shrink-0   { flex-shrink: 0; }

/* -- Utilities: Grid -- */
.grid        { display: grid; }
.grid-2      { grid-template-columns: repeat(2, 1fr); }
.grid-3      { grid-template-columns: repeat(3, 1fr); }

/* -- Utilities: Gap -- */
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }

/* -- Utilities: Spacing -- */
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.p-4   { padding: 4px; }
.p-8   { padding: 8px; }
.p-12  { padding: 12px; }
.p-16  { padding: 16px; }
.p-24  { padding: 24px; }

/* -- Utilities: Visibility -- */
.hidden     { display: none !important; }
.sr-only    { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* -- Responsive -- */
@media (max-width: 768px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.25rem; }
    .modal { padding: var(--space-6); }
}

@media (max-width: 480px) {
    h1 { font-size: 1.5rem; }
    .container { padding: 0 16px; }
    .btn-lg { padding: 12px 24px; font-size: 15px; }
}
