/* ===== Design System ===== */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-card: rgba(26, 26, 46, 0.8);
    --bg-card-hover: rgba(26, 26, 46, 0.95);
    --bg-input: rgba(255, 255, 255, 0.05);
    --bg-sidebar: #12122a;
    
    --text-primary: #e8e8f0;
    --text-secondary: #9a9ab8;
    --text-muted: #6b6b8d;
    --text-inverse: #fff;
    
    --accent: #6c63ff;
    --accent-hover: #5a52e0;
    --accent-light: rgba(108, 99, 255, 0.15);
    --accent-glow: rgba(108, 99, 255, 0.3);
    
    --success: #00c9a7;
    --success-light: rgba(0, 201, 167, 0.15);
    --danger: #ff6b6b;
    --danger-light: rgba(255, 107, 107, 0.15);
    --warning: #ffa726;
    --warning-light: rgba(255, 167, 38, 0.15);
    --info: #42a5f5;
    
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(108, 99, 255, 0.2);
    
    --sidebar-width: 260px;
    --header-height: 60px;
    
    --transition: 0.2s ease;
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Ensure hidden attribute works even with display:flex */
[hidden] { display: none !important; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

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

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

/* ===== Login Screen ===== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image: 
        radial-gradient(ellipse at 20% 50%, rgba(108, 99, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 201, 167, 0.06) 0%, transparent 50%);
    padding: 20px;
}

.login-container { width: 100%; max-width: 420px; }

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 56px;
    height: 56px;
    background: var(--accent-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--accent);
}

.login-logo svg { width: 28px; height: 28px; }

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.login-error {
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--danger-light);
    color: var(--danger);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    text-align: center;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 20px;
}

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

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

textarea { resize: vertical; min-height: 80px; }

/* Checkbox & Toggle */
.toggle-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 2px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
    background: var(--accent);
    border-color: var(--accent);
}

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

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--accent);
    color: white;
}
.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-glow);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    background: var(--bg-input);
    border-color: var(--border-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-input); }

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover { background: #e55a5a; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

.btn-full { width: 100%; justify-content: center; }

.btn-icon {
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.btn-icon:hover { color: var(--text-primary); background: var(--bg-input); }
.btn-icon svg { width: 18px; height: 18px; }

/* ===== App Layout ===== */
.app {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition-slow);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-logo svg {
    width: 28px;
    height: 28px;
    color: var(--accent);
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

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

.nav-item.active {
    color: var(--accent);
    background: var(--accent-light);
}

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

.logout-btn:hover { color: var(--danger) !important; }

/* ===== Mobile Header ===== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 90;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}

.menu-toggle svg { width: 24px; height: 24px; }

.mobile-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-slow);
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ===== Main Content ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px;
    min-height: 100vh;
}

/* ===== Pages ===== */
.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

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

.btn-back {
    margin-bottom: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

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

.stat-info { display: flex; flex-direction: column; }

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

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

/* ===== Charts Grid ===== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.chart-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.chart-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

/* ===== Tables ===== */
.table-responsive { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--bg-input);
}

/* ===== Search ===== */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    transition: var(--transition);
}

.search-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.search-bar svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-bar input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    padding: 0;
}

/* ===== Surveys List ===== */
.surveys-list { display: flex; flex-direction: column; gap: 8px; }

.survey-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
    gap: 16px;
}

.survey-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

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

.survey-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.survey-meta {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.survey-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.survey-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.badge {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

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

/* ===== Fields Editor ===== */
.fields-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition);
    cursor: grab;
}

.field-item:active { cursor: grabbing; }

.field-item:hover {
    border-color: var(--border-hover);
}

.field-item.dragging {
    opacity: 0.5;
    border-color: var(--accent);
}

.field-item.drag-over {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
}

.field-drag-handle {
    color: var(--text-muted);
    cursor: grab;
    flex-shrink: 0;
}

.field-drag-handle svg { width: 18px; height: 18px; }

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

.field-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.field-type-badge {
    padding: 2px 8px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.field-required-badge {
    padding: 2px 6px;
    background: var(--warning-light);
    color: var(--warning);
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
}

.field-details {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.field-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-sm { max-width: 400px; }

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

.modal-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close:hover { color: var(--text-primary); background: var(--bg-input); }
.modal-close svg { width: 20px; height: 20px; }

.modal-body { padding: 24px; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ===== Preview ===== */
.preview-overlay {
    background: rgba(0, 0, 0, 0.8);
}

.preview-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

.preview-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.preview-body { padding: 24px; }

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    box-shadow: var(--shadow);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 280px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }

.toast.removing { animation: slideOutRight 0.3s ease forwards; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    margin-bottom: 16px;
    font-size: 0.95rem;
}

/* ===== Survey Stats ===== */
.stats-field-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

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

.stats-field-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.stats-bar-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stats-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-bar-label {
    width: 120px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-bar-track {
    flex: 1;
    height: 22px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.stats-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #8b83ff);
    border-radius: 4px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    padding-left: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    min-width: fit-content;
}

.stats-number {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.stats-number-item {
    text-align: center;
}

.stats-number-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.stats-number-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ===== Embed Info ===== */
.embed-code {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--accent);
    word-break: break-all;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.embed-code:hover { border-color: var(--accent); }

.embed-code::after {
    content: 'Click para copiar';
    position: absolute;
    right: 8px;
    top: 8px;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(80px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(80px); }
}

/* ===== Options Editor ===== */
.options-editor { margin-top: 8px; }

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

.option-row input {
    flex: 1;
}

.btn-remove-option {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-remove-option:hover { background: var(--danger-light); }
.btn-remove-option svg { width: 16px; height: 16px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .mobile-header {
        display: flex;
    }
    
    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: calc(var(--header-height) + 16px);
    }
    
    .page-header {
        flex-direction: column;
    }
    
    .page-header h1 { font-size: 1.35rem; }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .survey-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .survey-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .header-actions .btn {
        flex: 1;
        justify-content: center;
    }
    
    .field-item { flex-wrap: wrap; }
    
    .toast-container {
        left: 16px;
        right: 16px;
    }
    
    .toast { min-width: auto; }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card { padding: 16px; }
    .stat-value { font-size: 1.4rem; }
    
    .login-card { padding: 28px 20px; }
    
    .card { padding: 16px; }
    
    .modal { margin: 10px; }
}

/* ===== Loading ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.page-loading {
    display: flex;
    justify-content: center;
    padding: 60px;
}
