/* ========================================
   Business Management System — Theme
   Blue/Purple gradient aesthetic
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
    --primary-start: #4F46E5;
    --primary-end: #7C3AED;
    --primary: #6366F1;
    --primary-light: #818CF8;
    --primary-dark: #4338CA;
    --accent: #A78BFA;
    --accent-light: #C4B5FD;

    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-gradient-hover: linear-gradient(135deg, #7c8ff5 0%, #8a5db5 100%);
    --sidebar-gradient: linear-gradient(180deg, #0f0a2e 0%, #1e1554 50%, #2d1f7a 100%);
    --card-gradient: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);

    --bg-page: #f0f0f7;
    --bg-card: #ffffff;
    --bg-input: #f8f7ff;

    --text-primary: #1e1b4b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-white: #ffffff;
    --text-sidebar: #c7d2fe;
    --text-sidebar-active: #ffffff;

    --border: #e2e0f0;
    --border-focus: #818CF8;

    --success: #10B981;
    --success-bg: #ecfdf5;
    --warning: #F59E0B;
    --warning-bg: #fffbeb;
    --danger: #EF4444;
    --danger-bg: #fef2f2;
    --info: #6366F1;
    --info-bg: #eef2ff;

    --shadow-sm: 0 1px 2px rgba(99, 102, 241, 0.05);
    --shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.08), 0 2px 4px -2px rgba(99, 102, 241, 0.05);
    --shadow-lg: 0 10px 25px -3px rgba(99, 102, 241, 0.12), 0 4px 10px -4px rgba(99, 102, 241, 0.06);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;

    --sidebar-width: 260px;
    --topbar-height: 70px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

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

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

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-gradient);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(15, 10, 46, 0.3);
}

.sidebar-header {
    padding: 20px 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
}

.logo-container {
    flex-shrink: 0;
}

.logo-img {
    height: 36px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.4)) brightness(1.15);
}

.logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -0.5px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.logo-text {
    color: var(--text-white);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

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

.nav-section-title {
    display: block;
    padding: 0 12px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(199, 210, 254, 0.45);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius);
    color: var(--text-sidebar);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}

.nav-link:hover {
    color: var(--text-sidebar-active);
    background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
    color: var(--text-sidebar-active);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.35) 0%, rgba(124, 58, 237, 0.3) 100%);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15), inset 0 1px 0 rgba(255,255,255,0.1);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--bg-gradient);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-footer-text {
    color: rgba(199, 210, 254, 0.3);
    text-align: center;
}

/* --- Main wrapper --- */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin 0.3s ease;
}

/* --- Topbar --- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 32px;
    gap: 16px;
}

.topbar-title h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.menu-toggle:hover { background: var(--card-gradient); }

/* --- Content area --- */
.content {
    padding: 32px;
    animation: fadeIn 0.4s ease;
}

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

/* --- Flash messages --- */
.flash-container {
    padding: 16px 32px 0;
}

.flash-message {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    animation: slideDown 0.3s ease;
    border-left: 4px solid;
}

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

.flash-success { background: var(--success-bg); color: #065f46; border-color: var(--success); }
.flash-info { background: var(--info-bg); color: #3730a3; border-color: var(--info); }
.flash-warning { background: var(--warning-bg); color: #92400e; border-color: var(--warning); }
.flash-danger, .flash-error { background: var(--danger-bg); color: #991b1b; border-color: var(--danger); }

.flash-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
    padding: 0 4px;
    line-height: 1;
}

.flash-close:hover { opacity: 1; }

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
    overflow: hidden;
}

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

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

.card-header h2, .card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

/* --- Stat cards (dashboard) --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--bg-gradient);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    background: var(--card-gradient);
}

.stat-card .stat-icon svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -1px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

.stat-card.stat-primary::before { background: var(--bg-gradient); }
.stat-card.stat-success::before { background: linear-gradient(135deg, #10B981, #34D399); }
.stat-card.stat-warning::before { background: linear-gradient(135deg, #F59E0B, #FBBF24); }
.stat-card.stat-danger::before { background: linear-gradient(135deg, #EF4444, #F87171); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--bg-gradient);
    color: var(--text-white);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: var(--bg-gradient-hover);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
    color: var(--text-white);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--card-gradient);
    border-color: var(--primary-light);
    color: var(--primary);
}

.btn-success {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
    color: white;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn-sm svg {
    width: 15px;
    height: 15px;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* --- Tables --- */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

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

thead th {
    padding: 14px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    background: var(--card-gradient);
    border-bottom: 2px solid var(--border);
}

tbody td {
    padding: 14px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

tbody tr {
    transition: var(--transition-fast);
}

tbody tr:hover {
    background: rgba(99, 102, 241, 0.03);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* --- Status badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-draft { background: #f1f5f9; color: #64748b; }
.badge-active, .badge-sent { background: #dbeafe; color: #2563eb; }
.badge-completed, .badge-paid { background: #dcfce7; color: #16a34a; }
.badge-cancelled { background: #fef2f2; color: #ef4444; }
.badge-overdue { background: #fef3c7; color: #d97706; }
.badge-published { background: #ddd6fe; color: #7c3aed; }
.badge-unpublished { background: #f1f5f9; color: #64748b; }

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 11px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-input);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: var(--bg-card);
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

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

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

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

.page-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* --- Filter bar --- */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.filter-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: var(--info-bg);
}

.filter-btn.active {
    background: var(--bg-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

/* --- Detail page --- */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.detail-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

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

.detail-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.detail-value {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;
}

/* --- Empty states --- */
.empty-state {
    text-align: center;
    padding: 64px 32px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--card-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-icon svg {
    width: 36px;
    height: 36px;
    color: var(--primary-light);
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

/* --- Form Builder --- */
.builder-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
}

.field-palette {
    position: sticky;
    top: calc(var(--topbar-height) + 32px);
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.palette-item:hover {
    border-color: var(--primary-light);
    background: var(--card-gradient);
    box-shadow: var(--shadow);
    transform: translateX(4px);
}

.palette-item svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.builder-canvas {
    min-height: 400px;
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
}

.builder-canvas.drag-over {
    border-color: var(--primary);
    background: var(--card-gradient);
}

.builder-canvas-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--text-muted);
}

.builder-canvas-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.field-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    transition: var(--transition);
    position: relative;
}

.field-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-light);
}

.field-card.sortable-ghost {
    opacity: 0.4;
    background: var(--card-gradient);
}

.field-card.sortable-chosen {
    box-shadow: var(--shadow-lg);
}

.field-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.field-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
}

.field-drag-handle:active { cursor: grabbing; }

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

.field-type-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--card-gradient);
    color: var(--primary);
}

.field-card-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.field-card-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.field-card-actions button:hover {
    background: var(--card-gradient);
    color: var(--primary);
}

.field-card-actions button.delete-btn:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.field-edit-panel {
    display: none;
    padding-top: 16px;
    margin-top: 12px;
    border-top: 1px solid var(--border);
}

.field-edit-panel.open {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* --- Form fill page --- */
.form-fill-container {
    max-width: 720px;
    margin: 0 auto;
}

.form-fill-header {
    text-align: center;
    padding: 32px;
    background: var(--bg-gradient);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    color: white;
    margin: -24px -24px 24px;
}

.form-fill-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.form-fill-header p {
    opacity: 0.85;
    font-size: 15px;
}

/* --- Success page --- */
.success-container {
    text-align: center;
    padding: 80px 32px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.success-icon svg {
    width: 40px;
    height: 40px;
    color: var(--success);
}

/* --- Sidebar overlay for mobile --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    backdrop-filter: blur(4px);
}

/* --- Confirm dialog --- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.confirm-dialog {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.confirm-dialog h3 {
    margin-bottom: 8px;
}

.confirm-dialog p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 14px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* --- Builder toolbar --- */
.builder-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.builder-toolbar .form-control {
    max-width: 400px;
}

.builder-toolbar .btn {
    flex-shrink: 0;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

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

.toggle-slider {
    width: 44px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    transition: var(--transition);
    position: relative;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--bg-gradient);
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(20px);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .builder-layout {
        grid-template-columns: 1fr;
    }

    .field-palette {
        position: static;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

    .palette-item {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .content {
        padding: 20px 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 12px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

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

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

/* --- Utility classes --- */
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 13px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
