/* =============================================
   Portal de Usuario — Procurador SCW
   ============================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --sidebar-w: 230px;
    --header-h: 56px;
    --bg: #f1f5f9;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #1e40af;
    --text: #1f2937;
    --text-muted: #6b7280;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --accent: #1e40af;
    --accent-hover: #1d4ed8;
    --accent-light: #eff6ff;
    --green: #10b981;
    --red: #ef4444;
    --yellow: #f59e0b;
    --purple: #8b5cf6;
    --radius: 10px;
    --shadow: 0 1px 4px rgba(0,0,0,.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,.12);
    font-family: 'Segoe UI', system-ui, sans-serif;
}

body { background: var(--bg); color: var(--text); min-height: 100vh; }

/* ===== LOGIN PAGE ===== */
#login-page {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #1e3a5f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.login-box {
    background: #fff;
    border-radius: 20px;
    padding: 44px 40px;
    width: 380px;
    max-width: 95vw;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-logo {
    font-size: 42px;
    margin-bottom: 10px;
}

.login-box h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.login-box .login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 30px;
}

.login-links {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    font-size: 13px;
}

.login-links a {
    color: var(--accent);
    text-decoration: none;
}

.login-links a:hover { text-decoration: underline; }

/* ===== REMEMBERED USERS ===== */
.remembered-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.remembered-user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f9fafb;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 6px;
    transition: border-color .15s, background .15s;
}

.remembered-user-btn:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.remembered-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

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

.remembered-user-email {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.remembered-user-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.remembered-user-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-muted);
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
}

.remembered-user-remove:hover { color: var(--red); background: #fef2f2; }

.btn-other-account {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--accent);
    padding: 2px 0;
    margin-bottom: 4px;
}

.btn-other-account:hover { text-decoration: underline; }

.remember-row {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
}

.remember-check {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.remember-check input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    cursor: pointer;
}

#login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: var(--red);
    font-size: 13px;
    padding: 10px 14px;
    margin-bottom: 16px;
    display: none;
}

/* ===== DASHBOARD LAYOUT ===== */
#app {
    display: none;
    min-height: 100vh;
}

#app.visible {
    display: flex;
}

/* ===== SIDEBAR ===== */
#sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform .3s ease;
}

.sidebar-logo {
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-logo h1 {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.sidebar-logo small {
    font-size: 11px;
    color: #475569;
}

#sidebar nav {
    flex: 1;
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
    border-radius: 0;
    transition: background .15s, color .15s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item .nav-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,.07);
    font-size: 12px;
    color: #475569;
}

/* ===== MAIN AREA ===== */
#main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

/* ===== TOPBAR ===== */
#topbar {
    height: var(--header-h);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
    gap: 12px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

#btn-hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text);
    padding: 4px;
}

#topbar h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-email {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-badge {
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

/* ===== CONTENT ===== */
#content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.section { display: none; }
.section.active { display: block; }

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.section-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ===== CARDS ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

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

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.card-body { padding: 20px; }

/* ===== FORM ===== */
.form-group { margin-bottom: 16px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    transition: border-color .15s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(30,64,175,.12);
}

.form-group textarea { resize: vertical; min-height: 90px; }

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: var(--red);
}

.field-error {
    font-size: 12px;
    color: var(--red);
    margin-top: 4px;
    display: none;
}

.field-error.visible { display: block; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all .15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(.9); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.9); }

.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: #d1d5db; }

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1.5px solid var(--accent);
}

.btn-outline:hover:not(:disabled) { background: var(--accent-light); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.alert.visible { display: flex; align-items: center; gap: 8px; }

.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-info { background: var(--accent-light); border: 1px solid #bfdbfe; color: #1e3a8a; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.badge-open { background: #eff6ff; color: #1d4ed8; }
.badge-closed { background: #f3f4f6; color: #4b5563; }
.badge-in_progress { background: #fffbeb; color: #d97706; }
.badge-active { background: #f0fdf4; color: #166534; }
.badge-suspended { background: #fff7ed; color: #c2410c; }
.badge-expired { background: #fef2f2; color: #991b1b; }

/* ===== PLAN SECTION ===== */
.plan-card-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.plan-info-box {
    background: linear-gradient(135deg, var(--accent) 0%, #1d4ed8 100%);
    border-radius: var(--radius);
    padding: 24px;
    color: #fff;
}

.plan-info-box .plan-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.plan-info-box .plan-status {
    font-size: 13px;
    opacity: .8;
    margin-bottom: 16px;
}

.plan-info-box .plan-expiry {
    font-size: 13px;
    opacity: .85;
}

.plan-days-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.plan-days-number {
    font-size: 48px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.plan-days-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.progress-bar-wrap {
    background: #e5e7eb;
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    transition: width .4s ease;
}

.usage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.usage-table th {
    text-align: left;
    padding: 8px 12px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
    background: #f9fafb;
}

.usage-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.usage-table tr:last-child td { border-bottom: none; }

.usage-bar-cell { min-width: 140px; }

.usage-mini-bar {
    background: #e5e7eb;
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
    margin-top: 4px;
}

.usage-mini-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
}

.usage-mini-fill.warning { background: var(--yellow); }
.usage-mini-fill.danger { background: var(--red); }

/* ===== DOWNLOADS ===== */
.download-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.download-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f9fafb;
}

.download-item-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: 44px;
    text-align: center;
}

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

.download-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.download-item-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.download-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ===== MONITOR PARTES ===== */
.parte-counter {
    font-size: 12px;
    color: var(--text-muted);
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 10px;
    font-weight: 500;
}

.parte-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.parte-row:last-child { border-bottom: none; }

.parte-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.parte-nombre {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.parte-juris {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
    border-radius: 4px;
    padding: 2px 6px;
    flex-shrink: 0;
}

.btn-icon-danger {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 6px;
    line-height: 1;
    color: var(--text-muted);
    transition: background .15s, color .15s, border-color .15s;
    flex-shrink: 0;
}

.btn-icon-danger:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--red);
}

/* ===== BILLING PLACEHOLDER ===== */
.billing-placeholder {
    text-align: center;
    padding: 60px 24px;
}

.billing-placeholder .billing-icon { font-size: 64px; margin-bottom: 16px; }
.billing-placeholder h3 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.billing-placeholder p { color: var(--text-muted); font-size: 14px; max-width: 400px; margin: 0 auto; }

/* ===== TICKETS ===== */
.tickets-list { display: flex; flex-direction: column; gap: 12px; }

.ticket-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    cursor: pointer;
    transition: box-shadow .15s, border-color .15s;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.ticket-item:hover {
    box-shadow: var(--shadow-md);
    border-color: #c7d2fe;
}

.ticket-item-icon { font-size: 20px; flex-shrink: 0; padding-top: 2px; }

.ticket-item-body { flex: 1; min-width: 0; }

.ticket-item-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-item-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.ticket-item-status { flex-shrink: 0; }

.ticket-detail-back {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--accent);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 16px;
}

.ticket-detail-back:hover { text-decoration: underline; }

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.comment-item {
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
}

.comment-item.user-comment {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    margin-left: 20px;
}

.comment-item.agent-comment {
    background: #f9fafb;
    border: 1px solid var(--border);
    margin-right: 20px;
}

.comment-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* ===== AI CHAT ===== */
#ai-chat-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-h) - 130px);
    min-height: 400px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
}

.chat-message {
    display: flex;
    gap: 10px;
    max-width: 80%;
}

.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message.assistant { align-self: flex-start; }

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.chat-message.user .chat-avatar { background: var(--accent); }
.chat-message.assistant .chat-avatar { background: #e2e8f0; }

.chat-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 100%;
    word-break: break-word;
}

.chat-message.user .chat-bubble {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .chat-bubble {
    background: #f1f5f9;
    color: var(--text);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
}

.chat-input-area textarea {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    resize: none;
    height: 44px;
    max-height: 120px;
    font-family: inherit;
    line-height: 1.4;
    transition: border-color .15s;
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(30,64,175,.12);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--accent);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
    transition: background .15s;
}

.chat-send-btn:hover { background: var(--accent-hover); }
.chat-send-btn:disabled { opacity: .5; cursor: not-allowed; }

.chat-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    align-items: center;
}

.chat-typing span {
    width: 7px;
    height: 7px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing-bounce 1.2s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: .2s; }
.chat-typing span:nth-child(3) { animation-delay: .4s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal-overlay.hidden { display: none; }

.modal {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 { font-size: 17px; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    line-height: 1;
}

.modal-close:hover { color: var(--red); }

.modal-body { padding: 20px 24px; }

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

/* Plans Modal */
.plans-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.plan-option {
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    cursor: default;
    transition: border-color .15s;
}

.plan-option-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}

.plan-option-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.plan-option-limits {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.plan-upgrade-cta {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 16px;
    font-size: 13px;
    color: #92400e;
    margin-top: 8px;
    text-align: center;
}

.plan-upgrade-cta strong { display: block; font-size: 14px; margin-bottom: 4px; }

/* ===== EMPTY STATES ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .6; }
.empty-state p { font-size: 14px; }

/* ===== SPINNER ===== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    display: inline-block;
}

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

/* ===== OVERLAY SIDEBAR (mobile) ===== */
#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .plan-card-main { grid-template-columns: 1fr; }
}

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

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

    #sidebar-overlay.visible {
        display: block;
    }

    #main { margin-left: 0; }

    #btn-hamburger { display: flex; }

    #content { padding: 16px; }

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

    .chat-message { max-width: 90%; }

    .user-email { display: none; }

    .topbar-right { gap: 6px; }

    #ai-chat-wrap {
        height: calc(100vh - var(--header-h) - 100px);
    }
}

@media (max-width: 480px) {
    .login-box { padding: 32px 24px; }
    .modal { border-radius: 12px; }
    .plan-days-number { font-size: 36px; }
}
