/* ==========================================================================
   IActions Smart Hub — Design System
   Pure CSS, sin Bulma. Font: Inter via Google Fonts.
   ========================================================================== */

/* ── Design Tokens ── */
:root {
    /* Colors */
    --primary: #58bcd3;
    --primary-hover: #4aa8be;
    --secondary: #0d0d42;
    --secondary-light: #1a1a5e;
    --accent: #6366f1;

    /* Surfaces */
    --bg-page: #f5f7fa;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-topbar: rgba(255, 255, 255, 0.85);
    --bg-modal-overlay: rgba(0, 0, 0, 0.45);

    /* Text */
    --text-primary: #1a1a2e;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    /* Borders */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-sidebar: #e8ecf1;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 56px;

    /* Semantic */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
}

/* ── Reset / Base ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background: var(--bg-page);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

img { max-width: 100%; display: block; }

button {
    font-family: inherit;
    cursor: pointer;
}

table {
    border-collapse: collapse;
    width: 100%;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ── Layout: Sidebar + Topbar + Content ── */
.app-layout {
    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-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 40;
    overflow-y: auto;
    transition: transform var(--transition-slow);
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--secondary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-brand-text .ia {
    color: var(--secondary);
    font-weight: 900;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.sidebar-section-label {
    padding: 0.75rem 1.5rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    color: var(--text-primary);
    background: var(--bg-page);
}

.sidebar-link.active {
    color: var(--secondary);
    background: rgba(13, 13, 66, 0.06);
    border-left-color: var(--secondary);
    font-weight: 600;
}

.sidebar-link i, .sidebar-link .sidebar-icon {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--secondary);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sidebar-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    padding: 0.25rem;
    transition: color var(--transition);
    flex-shrink: 0;
}

.sidebar-logout:hover {
    color: var(--danger);
}

/* Topbar */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-topbar);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    z-index: 30;
    transition: left var(--transition-slow);
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 0.75rem;
}

.topbar-spacer { flex: 1; }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Burger toggle (mobile) */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-primary);
    padding: 0.25rem;
    margin-right: 0.75rem;
}

/* Main content area */
.main-content {
    margin-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
    min-height: 100vh;
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
    transition: margin-left var(--transition-slow);
}

.content-area {
    padding: 1.5rem 2rem;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 35;
}

/* Mobile responsive */
@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.open ~ .sidebar-overlay {
        display: block;
    }

    .topbar {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .content-area {
        padding: 1rem;
    }
}

/* ── Grid System ── */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1280px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1023px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── Page Header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header-left h1 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-header-left p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.15rem;
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-body {
    padding: 1.25rem;
}

.card-static {
    transition: none;
}
.card-static:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* Card variants */
.card-full-height {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card-full-height .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Admin card header (title + management icons) */
.card-header-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.card-header-row h5 {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.card-mgmt-icons {
    display: flex;
    gap: 0.1rem;
    flex-shrink: 0;
    align-items: center;
}

.icon-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 5px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--border-medium);
    transition: all 0.15s ease;
}

.icon-btn:hover {
    background: var(--bg-page);
    border-color: var(--border-light);
}

.icon-btn-edit:hover { color: #e67e22; }
.icon-btn-delete:hover { color: #e74c3c; }

/* Card description (truncated) */
.card-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

/* Card meta info */
.card-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-meta i {
    font-size: 0.7rem;
    margin-right: 0.2rem;
}

.meta-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--border-medium);
    flex-shrink: 0;
}

/* Card actions */
.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1rem;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--secondary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--secondary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-accent {
    background: var(--primary);
    color: white;
}

.btn-accent:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning);
    color: #1a1a2e;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border: 1.5px solid var(--border-medium);
}

.btn-ghost:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(88, 188, 211, 0.05);
}

.btn-light {
    background: var(--border-light);
    color: var(--text-primary);
}

.btn-light:hover:not(:disabled) {
    background: var(--border-medium);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 6px;
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
}

.btn-block { width: 100%; }

/* ── Form Elements ── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.form-label .required {
    color: var(--danger);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-primary);
    background: white;
    transition: all var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(13, 13, 66, 0.08);
}

.form-input.is-error,
.form-textarea.is-error {
    border-color: var(--danger);
}

.form-input.is-error:focus,
.form-textarea.is-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-select {
    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 0.75rem center;
    padding-right: 2rem;
}

.form-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.form-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.3rem;
    display: none;
}

/* Input with icon */
.input-icon-wrap {
    position: relative;
}

.input-icon-wrap .form-input {
    padding-left: 2.5rem;
}

.input-icon-wrap .input-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.input-icon-wrap .input-icon-right {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    pointer-events: auto;
}

.input-icon-wrap .input-icon-right:hover {
    color: var(--secondary);
}

/* ── Tables ── */
.table-wrap {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
}

.table th {
    padding: 0.85rem 1rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    background: #f8f9fb;
    border-bottom: 2px solid var(--border-light);
    text-align: left;
}

.table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--bg-page);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Modals ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal-overlay);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-overlay .modal {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    width: 600px;
    max-width: 100%;
    box-shadow: var(--shadow-lg);
}

.modal-overlay .modal-lg { width: 900px; }
.modal-overlay .modal-sm { width: 480px; }

.modal-overlay .modal-header {
    background: var(--secondary);
    color: white;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-overlay .modal-header-danger { background: var(--danger); }
.modal-overlay .modal-header-neutral { background: #f8f9fb; color: var(--text-primary); border-bottom: 1px solid var(--border-light); }

.modal-overlay .modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-overlay .modal-close {
    background: rgba(255, 255, 255, 0.25);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: background var(--transition);
}

.modal-overlay .modal-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

.modal-overlay .modal-header-neutral .modal-close {
    background: var(--border-light);
    color: var(--text-secondary);
}

.modal-overlay .modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-overlay .modal-footer {
    padding: 1rem 1.5rem;
    background: #f8f9fb;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-shrink: 0;
    border-top: 1px solid var(--border-light);
}

/* ── Badges / Tags ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}

.badge-primary { background: rgba(13, 13, 66, 0.1); color: var(--secondary); }
.badge-accent { background: rgba(88, 188, 211, 0.15); color: #0e7490; }
.badge-success { background: rgba(16, 185, 129, 0.12); color: #065f46; }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: #92400e; }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: #991b1b; }
.badge-info { background: rgba(59, 130, 246, 0.12); color: #1e40af; }
.badge-neutral { background: #f1f5f9; color: var(--text-secondary); border: 1px solid var(--border-light); }

.badge-sm {
    padding: 0.1rem 0.4rem;
    font-size: 0.65rem;
}

/* Status badges (pill) */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.status-active {
    background: var(--success);
    color: white;
}

.status-inactive {
    background: var(--danger);
    color: white;
}

.status-pill:hover {
    opacity: 0.85;
    transform: scale(1.03);
}

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 1rem;
}

.tab-item {
    padding: 0.6rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: 2px solid transparent;
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: -2px;
}

.tab-item:hover {
    background: var(--bg-page);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.tab-item.active {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

.tab-item.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ── Toggle Switch ── */
.toggle {
    position: relative;
    display: inline-block;
    width: 0;
    height: 0;
    opacity: 0;
}

.toggle + label {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding-left: 3.25rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.toggle + label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2.75rem;
    height: 1.5rem;
    background: #d1d5db;
    border-radius: 1rem;
    transition: background 0.15s;
}

.toggle + label::after {
    content: '';
    position: absolute;
    left: 0.15rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.2rem;
    height: 1.2rem;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.15s;
}

.toggle:checked + label::before {
    background: var(--success);
}

.toggle:checked + label::after {
    left: 1.4rem;
}

/* ── Notifications / Alerts ── */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-warning {
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert-danger {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.alert-info {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1e40af;
}

.alert-success {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
}

/* ── Utility classes ── */
/* Spacing */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.5rem; }
.mt-6 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.5rem; }
.mb-6 { margin-bottom: 2rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.p-0 { padding: 0; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.5rem; }
.p-6 { padding: 2rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 2rem; padding-bottom: 2rem; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

/* 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; }
.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; }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-flex { display: inline-flex; }

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c1c8cd;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8b2b8;
}

/* ── Animations ── */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeUp {
    animation: fadeUp 0.4s ease-out forwards;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ── Auth pages (standalone, no sidebar) ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-page-blue { background: var(--primary); }
.auth-page-red { background: linear-gradient(135deg, #dc2626, #991b1b); }

.auth-card {
    max-width: 420px;
    width: 100%;
    margin: 2rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.auth-card-body {
    padding: 2.5rem;
}

.auth-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-brand-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 2rem;
    color: white;
    position: relative;
}

.auth-brand-icon-blue {
    background: var(--secondary);
    box-shadow: 0 8px 24px rgba(13, 13, 66, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

.auth-brand-icon-blue::before {
    content: '';
    position: absolute;
    inset: -5px;
    background: linear-gradient(45deg, var(--secondary), var(--primary), var(--secondary));
    border-radius: 25px;
    z-index: -1;
    animation: rotate 3s linear infinite;
    opacity: 0.6;
}

@keyframes rotate {
    to { transform: rotate(360deg); }
}

.auth-brand-icon-red {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.3);
}

.auth-brand-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.auth-brand-title .ia { color: var(--secondary); font-weight: 900; }
.auth-brand-title .light { font-weight: 400; }

.auth-brand-subtitle {
    color: #6b7280;
    font-size: 1rem;
}

.auth-brand-subtitle strong {
    color: #1f2937;
    font-weight: 700;
}

.auth-input {
    width: 100%;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-slow);
    background: white;
    color: #374151;
}

.auth-input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(13, 13, 66, 0.1);
}

.auth-input-red:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.auth-btn {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 0.8rem;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-slow);
}

.auth-btn-blue {
    background: var(--secondary);
    box-shadow: 0 4px 12px rgba(13, 13, 66, 0.3);
}

.auth-btn-blue:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 13, 66, 0.4);
}

.auth-btn-red {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.auth-btn-red:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
}

.auth-divider {
    position: relative;
    text-align: center;
    margin: 2rem 0;
    color: #9ca3af;
    font-size: 0.9rem;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, #e5e7eb, transparent);
}

.auth-divider span {
    background: rgba(255, 255, 255, 0.95);
    padding: 0 1rem;
    position: relative;
}

.auth-link {
    text-align: center;
    margin-top: 1.5rem;
}

.auth-link a {
    color: #6b7280;
    font-size: 0.9rem;
    transition: color var(--transition-slow);
}

.auth-link a:hover {
    color: var(--primary);
}

/* Admin notice (login page) */
.auth-notice {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-notice .notice-icon {
    color: #dc2626;
    margin-bottom: 0.25rem;
}

.auth-notice .notice-title {
    color: #dc2626;
    font-size: 0.9rem;
    font-weight: 600;
}

.auth-notice .notice-subtitle {
    color: #6b7280;
    font-size: 0.8rem;
}

/* ── Demo pages ── */
.demo-page {
    background: linear-gradient(135deg, #f6f9fc 0%, #ffffff 100%);
    min-height: 100vh;
    padding: 2rem 1rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.demo-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    max-width: 1200px;
    margin: 0 auto;
}

.demo-header {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.demo-header-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.demo-header h1 { font-size: 1.8rem; color: white; margin-bottom: 0.5rem; }
.demo-header p { opacity: 0.9; }

.demo-body {
    padding: 3rem 2rem;
    text-align: center;
}

.demo-content {
    max-width: 800px;
    margin: 0 auto;
}

.demo-description {
    font-size: 1.1rem;
    color: #6b7280;
    margin-bottom: 3rem;
    line-height: 1.6;
}

.demo-hint {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #bae6fd;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    text-align: left;
}

.demo-hint h3 {
    color: var(--secondary);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.demo-hint p {
    color: #374151;
    line-height: 1.5;
    margin: 0;
}

/* ── User dashboard (simplified sidebar) ── */
.user-layout {
    min-height: 100vh;
    background: var(--bg-page);
}

.user-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--secondary);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 30;
    color: white;
}

.user-topbar-brand {
    font-weight: 700;
    font-size: 1.05rem;
    margin-right: 2rem;
}

.user-topbar-brand .ia { font-weight: 900; }
.user-topbar-brand .light { font-weight: 400; }

.user-topbar-nav {
    display: flex;
    gap: 0.25rem;
}

.user-topbar-link {
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.user-topbar-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.user-topbar-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.user-topbar-spacer { flex: 1; }

.user-topbar-user {
    position: relative;
}

.user-topbar-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: background var(--transition);
}

.user-topbar-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    min-width: 220px;
    background: var(--secondary);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 50;
}

.user-dropdown-menu.open {
    display: block;
}

.user-dropdown-info {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-dropdown-info strong {
    color: white;
    display: block;
    font-size: 0.88rem;
}

.user-dropdown-info small {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.78rem;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.88rem;
    transition: background var(--transition);
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}

.user-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.user-main-content {
    padding-top: calc(var(--topbar-height) + 1.5rem);
    padding-left: 2rem;
    padding-right: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Bot cards (user dashboard) */
.bot-card {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.bot-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.bot-card-icon {
    font-size: 2.5rem;
    color: var(--secondary);
    text-align: center;
    margin-bottom: 1rem;
}

.bot-card-title {
    color: var(--secondary);
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

.bot-card-desc {
    color: #6b7280;
    font-size: 0.9rem;
    flex: 1;
    margin-bottom: 1rem;
}

.bot-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

/* ── Loading spinner ── */
.spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ── Toast container ── */
.toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
}
