:root {
    --primary: #2c5282;
    --primary-dark: #1a365d;
    --bg: #f7fafc;
    --sidebar: #1a202c;
    --text: #2d3748;
    --muted: #718096;
    --border: #e2e8f0;
    --success: #38a169;
    --error: #e53e3e;
    --warn: #d69e2e;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--sidebar); color: #fff; display: flex; flex-direction: column; flex-shrink: 0; }
.brand { padding: 20px; font-weight: 700; font-size: 1.1rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar nav { flex: 1; padding: 12px 0; }
.sidebar nav a { display: block; padding: 10px 20px; color: rgba(255,255,255,.75); }
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); font-size: .85rem; }
.sidebar-footer a { color: rgba(255,255,255,.6); margin-left: 8px; }

.main-content { flex: 1; padding: 24px 32px; overflow-x: auto; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { margin: 0; font-size: 1.6rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel { background: #fff; border-radius: 8px; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.panel h2 { margin: 0 0 16px; font-size: 1.1rem; color: var(--primary-dark); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.stat-card span { display: block; font-size: .85rem; color: var(--muted); }
.stat-card strong { font-size: 1.8rem; color: var(--primary); }
.stat-card.highlight strong { color: var(--warn); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .sidebar { width: 200px; } }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: .8rem; text-transform: uppercase; color: var(--muted); }
.table.compact th, .table.compact td { padding: 6px 8px; font-size: .9rem; }

.btn { display: inline-block; padding: 8px 16px; border-radius: 6px; border: none; cursor: pointer; font-size: .9rem; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }
.btn-secondary { background: #edf2f7; color: var(--text); }
.btn-danger { background: var(--error); color: #fff; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; }
.btn-link.danger { color: var(--error); }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; }
.alert-success { background: #c6f6d5; color: #22543d; }
.alert-error { background: #fed7d7; color: #742a2a; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: .8rem; background: #edf2f7; }
.badge.ok { background: #c6f6d5; color: #22543d; }
.badge.warn { background: #fefcbf; color: #744210; }

.status { padding: 3px 8px; border-radius: 4px; font-size: .8rem; background: #edf2f7; }
.status-nueva, .status-lista { background: #bee3f8; }
.status-incompleta, .status-pendiente_precio { background: #fefcbf; }
.status-respuesta_generada { background: #e9d8fd; }
.status-enviada, .status-aprobada { background: #c6f6d5; }
.status-rechazada, .status-expirada { background: #fed7d7; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; }
textarea { resize: vertical; }

.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 180px; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.login-card { background: #fff; padding: 40px; border-radius: 12px; width: 100%; max-width: 400px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.login-card h1 { margin: 0 0 8px; color: var(--primary); }
.login-card p { color: var(--muted); margin-bottom: 24px; }

.install-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.install-card { background: #fff; padding: 32px; border-radius: 12px; max-width: 640px; width: 100%; box-shadow: 0 4px 20px rgba(0,0,0,.1); }
.steps { display: flex; gap: 8px; margin-bottom: 24px; }
.step { width: 32px; height: 32px; border-radius: 50%; background: #edf2f7; display: flex; align-items: center; justify-content: center; font-size: .85rem; }
.step.active { background: var(--primary); color: #fff; }

.help-box { background: #edf2f7; padding: 16px; border-radius: 6px; margin-bottom: 16px; font-size: .9rem; }
.help { font-size: .85rem; color: var(--muted); }

.status-bar { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity-list small { display: block; color: var(--muted); }

.email-preview { background: #f7fafc; padding: 12px; border-radius: 6px; max-height: 200px; overflow-y: auto; font-size: .9rem; margin-bottom: 16px; }
.action-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; align-items: center; }
.price-box { background: #edf2f7; padding: 12px; border-radius: 6px; margin: 12px 0; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.status-banner { padding: 12px 16px; border-radius: 6px; margin-bottom: 20px; background: #edf2f7; }

.menu-card { border: 1px solid var(--border); border-radius: 6px; padding: 12px; margin-bottom: 12px; }
.menu-card h3 { margin: 0 0 8px; font-size: 1rem; }

.log-view { background: #1a202c; color: #e2e8f0; padding: 16px; border-radius: 6px; max-height: 400px; overflow: auto; font-size: .8rem; }

.or-model-picker { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: #fafafa; margin-bottom: 16px; }
.or-picker-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.or-picker-toolbar .or-search { flex: 1; min-width: 220px; }
.or-selected-card { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 12px; margin-bottom: 12px; }
.or-selected-main { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.or-selected-main code, .or-model-sub code { font-size: .78rem; color: var(--muted); }
.or-selected-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.or-price { color: var(--primary-dark); font-weight: 600; white-space: nowrap; }
.or-list { max-height: 360px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.or-model-item { text-align: left; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; cursor: pointer; }
.or-model-item:hover { border-color: var(--primary); background: #ebf8ff; }
.or-model-item.active { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: #ebf8ff; }
.or-model-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.or-model-sub { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: 4px; }
.or-desc { margin: 6px 0 0; font-size: .82rem; color: var(--muted); }
.or-picker-label { margin-top: 8px; }

.editor-shell { display: grid; grid-template-columns: 200px 1fr 280px; gap: 16px; min-height: 600px; }
.editor-palette { background: #fff; border-radius: 8px; padding: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.palette-item { padding: 8px 10px; margin-bottom: 6px; background: #edf2f7; border-radius: 4px; cursor: grab; font-size: .85rem; }
.palette-item:hover { background: #e2e8f0; }
.editor-canvas { background: #fff; border-radius: 8px; padding: 16px; min-height: 500px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.editor-block { border: 2px dashed var(--border); padding: 12px; margin-bottom: 8px; border-radius: 6px; cursor: move; position: relative; }
.editor-block.drag-over { border-color: var(--primary); background: #ebf8ff; }
.editor-block .remove { position: absolute; top: 4px; right: 4px; background: var(--error); color: #fff; border: none; border-radius: 3px; cursor: pointer; font-size: .7rem; padding: 2px 6px; }
.editor-preview { max-height: 600px; overflow-y: auto; }

.muted { color: var(--muted); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
