/* ITO — Asistente IA para CONTPAQi | IT2GO® */
:root {
  --bg-primary: #0f1117;
  --bg-secondary: #13151f;
  --bg-card: #1a1c28;
  --border: #1e2030;
  --border-light: #2a2d3a;
  --text-primary: #e2e4e9;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-dim: #4b5563;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --comercial: #2563eb;
  --comercial-start: #7c3aed;
  --nominas: #059669;
  --contabilidad: #dc2626;
  --radius: 10px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif; background: var(--bg-primary); color: var(--text-primary); height: 100vh; overflow: hidden; }
input, select, textarea, button { font-family: inherit; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ═══ LOGIN ═══ */
.login-container { display: flex; align-items: center; justify-content: center; height: 100vh; background: var(--bg-primary); }
.login-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px; width: 380px; text-align: center; }
.login-box h1 { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.login-box .subtitle { color: var(--text-muted); font-size: 12px; letter-spacing: 0.08em; margin-bottom: 28px; }
.login-box .logo { font-size: 48px; margin-bottom: 12px; }

/* ═══ LAYOUT ═══ */
.app-layout { display: flex; height: 100vh; }
.sidebar { width: 230px; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--bg-secondary); flex-shrink: 0; }
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ═══ SIDEBAR ═══ */
.sidebar-header { padding: 18px 16px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sidebar-header .brand { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.sidebar-header .tagline { font-size: 9px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

.company-section { padding: 10px; border-bottom: 1px solid var(--border); }
.section-label { font-size: 10px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding: 0 8px; margin-bottom: 6px; }

.company-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: none; border-radius: 8px; cursor: pointer; text-align: left; background: transparent; color: var(--text-secondary); transition: background 0.15s; }
.company-btn:hover { background: var(--bg-card); }
.company-btn.active { background: var(--border); color: #fff; }
.company-btn .name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.company-btn .sys { font-size: 10px; }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot.on { background: var(--success); box-shadow: 0 0 6px rgba(34,197,94,.4); }
.dot.off { background: var(--text-dim); }

.add-btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 7px 10px; border: 1px dashed var(--border-light); border-radius: 8px; cursor: pointer; background: transparent; color: var(--text-muted); font-size: 11px; margin-top: 4px; transition: border-color 0.15s; }
.add-btn:hover { border-color: var(--accent); color: var(--text-secondary); }

.nav-section { flex: 1; padding: 10px; }
.nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: none; border-radius: 8px; cursor: pointer; background: transparent; color: var(--text-secondary); font-size: 13px; font-weight: 500; transition: all 0.15s; margin-bottom: 2px; }
.nav-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-btn.active { background: var(--border); color: #fff; }
.nav-btn .icon { font-size: 16px; width: 22px; text-align: center; }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-muted); }

/* ═══ HEADER ═══ */
.content-header { padding: 14px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--bg-secondary); }
.content-header h2 { font-size: 15px; font-weight: 700; }
.content-header .meta { font-size: 12px; }

/* ═══ CHAT ═══ */
.chat-area { flex: 1; overflow-y: auto; padding: 20px 24px; }
.chat-welcome { text-align: center; padding-top: 60px; }
.chat-welcome .big-icon { font-size: 44px; margin-bottom: 10px; }
.chat-welcome h3 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.chat-welcome p { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 620px; margin: 0 auto; }
.suggestion-btn { padding: 10px 16px; border: 1px solid var(--border-light); border-radius: 20px; background: var(--bg-card); color: var(--text-secondary); font-size: 13px; cursor: pointer; transition: all 0.15s; }
.suggestion-btn:hover { border-color: var(--accent); color: #fff; }

.message { margin-bottom: 18px; display: flex; }
.message.user { justify-content: flex-end; }
.message.assistant { justify-content: flex-start; }
.message .bubble { max-width: 75%; padding: 12px 16px; border-radius: 16px; font-size: 14px; line-height: 1.6; }
.message.user .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.message.assistant .bubble { background: var(--bg-card); border: 1px solid var(--border-light); border-bottom-left-radius: 4px; }

.sql-toggle { font-size: 11px; color: var(--text-muted); background: none; border: none; cursor: pointer; text-decoration: underline; margin-top: 8px; display: inline-block; }
.sql-block { margin-top: 6px; padding: 10px; border-radius: 8px; background: var(--bg-primary); font-size: 11px; color: #8b9cf7; overflow-x: auto; border: 1px solid var(--border-light); font-family: 'Cascadia Code', 'Consolas', monospace; white-space: pre-wrap; word-break: break-all; }

.result-table { margin-top: 12px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border-light); }
.result-table table { width: 100%; border-collapse: collapse; font-size: 12px; }
.result-table th { padding: 8px 12px; text-align: left; font-weight: 600; color: var(--text-secondary); background: var(--bg-primary); border-bottom: 1px solid var(--border-light); text-transform: capitalize; }
.result-table td { padding: 7px 12px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.result-table tr:nth-child(even) { background: rgba(255,255,255,.02); }

.msg-meta { margin-top: 6px; font-size: 10px; color: var(--text-dim); }
.msg-error { color: var(--danger); font-weight: 600; }

.typing-indicator { display: flex; gap: 5px; padding: 12px 16px; background: var(--bg-card); border-radius: 16px; width: fit-content; border: 1px solid var(--border-light); }
.typing-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; opacity: .4; }
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { 0%,100%{opacity:.3;transform:scale(.8)} 50%{opacity:1;transform:scale(1.2)} }

.chat-input-area { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--bg-secondary); }
.chat-input-row { display: flex; gap: 10px; max-width: 800px; }
.chat-input { flex: 1; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border-light); background: var(--bg-card); color: #fff; font-size: 14px; outline: none; transition: border-color 0.15s; }
.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--text-dim); }
.send-btn { padding: 12px 22px; border-radius: 12px; border: none; cursor: pointer; background: var(--accent); color: #fff; font-weight: 600; font-size: 14px; transition: background 0.15s; }
.send-btn:hover { background: var(--accent-hover); }
.send-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ═══ SETTINGS PAGES ═══ */
.settings-page { padding: 32px; overflow-y: auto; flex: 1; }
.settings-page h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.settings-page > p { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }

.conn-card { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 10px; }
.conn-card .top { display: flex; justify-content: space-between; align-items: start; }
.conn-card .title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.conn-card .details { font-size: 12px; color: var(--text-muted); display: flex; gap: 14px; }
.conn-card .tables { margin-top: 10px; font-size: 11px; color: var(--text-dim); }
.sys-badge { font-size: 11px; padding: 2px 10px; border-radius: 6px; font-weight: 600; }
.btn-row { display: flex; gap: 6px; }

.form-card { background: var(--bg-card); border: 2px solid var(--accent); border-radius: var(--radius-lg); padding: 24px; margin-top: 14px; }
.form-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { }
.form-group label { font-size: 11px; color: var(--text-muted); font-weight: 600; display: block; margin-bottom: 4px; }
.form-group input, .form-group select { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border-light); background: var(--bg-primary); color: #fff; font-size: 13px; outline: none; }
.form-group input:focus, .form-group select:focus { border-color: var(--accent); }

.provider-card { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-radius: var(--radius-lg); cursor: pointer; border: 1px solid var(--border-light); background: var(--bg-secondary); margin-bottom: 8px; transition: all 0.15s; }
.provider-card:hover { border-color: var(--text-dim); }
.provider-card.selected { background: var(--bg-card); border-color: var(--accent); border-width: 2px; }
.provider-card .p-icon { font-size: 28px; }
.provider-card .p-info { flex: 1; }
.provider-card .p-name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.provider-card .p-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.provider-card .radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-light); display: flex; align-items: center; justify-content: center; }
.provider-card.selected .radio { border-color: var(--accent); }
.provider-card.selected .radio::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

.free-badge { font-size: 10px; padding: 2px 8px; border-radius: 6px; background: rgba(6,95,70,.15); color: var(--success); font-weight: 700; }
.config-box { margin-top: 24px; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 20px; }
.config-box h4 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.ok-box { padding: 14px 16px; background: rgba(6,95,70,.08); border: 1px solid rgba(6,95,70,.2); border-radius: var(--radius); margin-top: 10px; }
.ok-box .ok-title { font-size: 13px; color: var(--success); font-weight: 600; margin-bottom: 2px; }
.ok-box .ok-desc { font-size: 12px; color: var(--text-muted); }

.btn { padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer; font-weight: 600; font-size: 13px; transition: all 0.15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border: 1px solid var(--border-light); background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { border-color: var(--text-dim); }
.btn-danger { border: 1px solid #7f1d1d; background: transparent; color: #f87171; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* About */
.about-page { text-align: center; padding-top: 40px !important; }
.about-page .big-icon { font-size: 48px; margin-bottom: 10px; }
.about-page h2 { font-size: 28px !important; font-weight: 800 !important; }
.about-page .version { font-size: 13px; color: var(--text-muted); margin-bottom: 32px; }
.features { max-width: 500px; margin: 0 auto; text-align: left; }
.feature { display: flex; gap: 14px; margin-bottom: 18px; }
.feature .f-icon { font-size: 24px; }
.feature .f-title { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.feature .f-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.contact-box { margin: 32px auto 0; padding: 18px; background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid var(--border-light); max-width: 500px; font-size: 13px; color: var(--text-muted); }
