:root{
  --bg:#0f1724;
  --card:#0b1220;
  --accent:#0ea5ff;
  --muted:#94a3b8;
  --glass: rgba(255,255,255,0.03);
  --success:#10b981;
  --danger:#ef4444;
  --warning:#f59e0b;
  --info:#3b82f6;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

html, body {
  height: 100%;
  margin: 0;
  background: linear-gradient(180deg, #071028 0%, #071a2a 100%);
  color: #e6eef8;
}

.app {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 20px;
  padding: 28px;
  max-width: 1400px;
  margin: 0 auto;
  height: 100vh;
}

.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(2,6,23,0.6);
  overflow: hidden;
}

.left {
  display: flex;
  flex-direction: column;
  max-height: 100%;
}

.right {
  display: flex;
  flex-direction: column;
  max-height: 100%;
  overflow-y: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #7dd3fc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #04263b;
  font-size: 18px;
}

h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

p.small {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.01), transparent);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.msg {
  display: flex;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user {
  justify-content: flex-end;
}

.bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--glass);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
}

.bubble.user {
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  color: #04263b;
  font-weight: 500;
}

.bubble.success {
  background: rgba(16, 185, 129, 0.1);
  border-left: 3px solid var(--success);
  color: #d1fae5;
}

.bubble.warning {
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid var(--warning);
  color: #fef08a;
}

.bubble.error {
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid var(--danger);
  color: #fecaca;
}

.bubble.info {
  background: rgba(59, 130, 246, 0.1);
  border-left: 3px solid var(--info);
  color: #bfdbfe;
}

.controls {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.input {
  flex: 1;
  display: flex;
  gap: 8px;
}

input[type="text"], input, select {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  color: inherit;
  font-size: 13px;
  transition: all 0.2s;
}

input[type="text"]:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,0.05);
  box-shadow: 0 0 0 2px rgba(14, 165, 255, 0.1);
}

button {
  background: var(--accent);
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  color: #04263b;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

button:hover {
  background: #06b6d4;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(14, 165, 255, 0.3);
}

.section {
  margin-bottom: 14px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.card {
  padding: 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
}

strong {
  color: #f0f9ff;
  font-weight: 600;
}

.ledger {
  overflow-x: auto;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.01), transparent);
  max-height: 400px;
}

table {
  width: 100%;
  border-collapse: collapse;
  color: #cfe9ff;
  font-size: 12px;
}

thead {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.05);
  z-index: 10;
}

th, td {
  padding: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  text-align: left;
}

th {
  font-weight: 600;
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

.small-muted {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.templates {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.template {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.01);
  border: 1px solid rgba(255,255,255,0.04);
  transition: all 0.2s;
}

.template:hover {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.08);
}

.model-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field {
  display: flex;
  gap: 8px;
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  font-size: 11px;
  color: var(--muted);
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-ghost:hover {
  background: rgba(255,255,255,0.05);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-report {
  background: linear-gradient(135deg, var(--info), #3b82f6);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-report:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-db {
  background: linear-gradient(135deg, var(--accent), #06b6d4);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-db:hover {
  background: linear-gradient(135deg, #0891b2, #0e7490);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.btn-db.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
}

.btn-db.btn-danger:hover {
  background: linear-gradient(135deg, #b91c1c, #991b1b);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-info {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-info:hover {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.status {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 600;
}

.balanced {
  background: linear-gradient(90deg, var(--success), #34d399);
  color: #04263b;
}

.unbalanced {
  background: linear-gradient(90deg, var(--danger), #fb7185);
  color: #04263b;
}

footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.05);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

@media(max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  
  .left { max-height: 50vh; }
  .right { max-height: 50vh; }
}

/* ESTILOS PARA REPORTES PDF */
.report-container {
  background: white;
  color: #000;
  padding: 20px;
  font-family: Arial, sans-serif;
  line-height: 1.6;
}

.report-header {
  text-align: center;
  border-bottom: 2px solid #333;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.report-title {
  font-size: 20px;
  font-weight: bold;
  margin: 5px 0;
}

.report-subtitle {
  font-size: 12px;
  color: #666;
  margin: 5px 0;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.report-table th {
  background: #f0f0f0;
  border: 1px solid #ccc;
  padding: 8px;
  text-align: left;
  font-weight: bold;
  color: #333;
  font-size: 12px;
}

.report-table td {
  border: 1px solid #ccc;
  padding: 8px;
  font-size: 12px;
  color: #333;
}

.report-table tr:nth-child(even) {
  background: #f9f9f9;
}

.report-section {
  margin-bottom: 30px;
}

.report-section-title {
  font-size: 14px;
  font-weight: bold;
  background: #f0f0f0;
  padding: 8px;
  margin-bottom: 10px;
  border-left: 3px solid #0ea5ff;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.text-bold {
  font-weight: bold;
}

.total-row {
  background: #e8e8e8;
  font-weight: bold;
}

.subtotal-row {
  background: #f5f5f5;
  font-weight: bold;
}
