:root { --c-primary: #4f6ef7; --c-dark: #1a1a2e; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', sans-serif; background: #f0f2f5; color: var(--c-dark); min-height: 100vh; }
a { color: inherit; }

/* ── HEADER / NAV ── */
header.app-header { background: var(--c-dark); color: white; padding: 13px 28px; display: flex; align-items: center; gap: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
header.app-header h1 { font-size: 1.05rem; font-weight: 700; }
header.app-header span.sub { font-size: 0.75rem; opacity: 0.4; margin-left: 8px; }
header.app-header .spacer { flex: 1; }
header.app-header .user-chip { font-size: 0.8rem; opacity: 0.8; display: flex; align-items: center; gap: 10px; }
header.app-header .user-chip button { background: none; border: 1px solid rgba(255,255,255,0.25); color: white; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 0.75rem; }
header.app-header .user-chip button:hover { background: rgba(255,255,255,0.1); }
header.app-header .empresa-select { background: #2d3a6e; color: white; border: none; border-radius: 6px; padding: 4px 8px; font-size: 0.78rem; }

.tabs-bar { background: var(--c-dark); padding: 0 28px; display: flex; align-items: stretch; }
.tab-btn { padding: 9px 22px; border: none; background: transparent; color: rgba(255,255,255,0.4); cursor: pointer; font-size: 0.84rem; border-bottom: 3px solid transparent; transition: all 0.15s; display: flex; align-items: center; gap: 6px; text-decoration: none; }
.tab-btn:hover { color: white; }
.tab-btn.active { color: white; border-bottom-color: var(--c-primary); }
.tab-btn-admin { margin-left: auto; color: rgba(255,255,255,0.35); }
.tab-btn-admin.active { border-bottom-color: #f59e0b; color: #f59e0b; }

.container { padding: 24px 28px; max-width: 1600px; margin: 0 auto; }

/* ── BTNS ── */
.btn { padding: 7px 14px; border-radius: 8px; border: 1px solid #dde1ea; background: white; cursor: pointer; font-size: 0.82rem; display: inline-flex; align-items: center; gap: 5px; color: #333; transition: all 0.15s; white-space: nowrap; text-decoration: none; }
.btn:hover { background: #f5f7ff; border-color: var(--c-primary); color: var(--c-primary); }
.btn-primary { background: var(--c-primary); color: white; border-color: var(--c-primary); font-weight: 600; }
.btn-primary:hover { background: #3d5ce5; color: white; }
.btn-success { background: #15803d; color: white; border-color: #15803d; font-weight: 700; }
.btn-success:hover { background: #166534; color: white; }
.btn-danger { border-color: #dc2626; color: #dc2626; }
.btn-danger:hover { background: #fff5f5; }
.btn-amber { background: #f59e0b; color: white; border-color: #f59e0b; font-weight: 600; }
.btn-amber:hover { background: #d97706; color: white; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; border-radius: 6px; }
.btn:disabled { opacity: 0.4; cursor: default; pointer-events: none; }

/* ── LOGIN ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--c-dark) 0%, #2d3a6e 100%); }
.login-box { background: white; border-radius: 16px; padding: 40px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
.login-box .logo { text-align: center; font-size: 1.3rem; font-weight: 800; margin-bottom: 4px; }
.login-box .logo span { color: var(--c-primary); }
.login-box p.sub { text-align: center; color: #888; font-size: 0.82rem; margin-bottom: 24px; }
.login-box .form-field { margin-bottom: 14px; }
.login-box label { font-size: 0.72rem; color: #666; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 4px; }
.login-box input { width: 100%; padding: 10px 14px; border: 1px solid #dde1ea; border-radius: 8px; font-size: 0.92rem; outline: none; }
.login-box input:focus { border-color: var(--c-primary); }
.login-box button { width: 100%; margin-top: 8px; justify-content: center; padding: 11px; font-size: 0.92rem; }
.login-error { background: #fff5f5; color: #dc2626; border: 1px solid #fecaca; border-radius: 8px; padding: 10px 14px; font-size: 0.82rem; margin-bottom: 14px; }

/* ── CARDS / GRID / TABLE / FORM (compartido entre vistas) ── */
.card { background: white; border-radius: 12px; box-shadow: 0 1px 5px rgba(0,0,0,0.08); padding: 20px; margin-bottom: 16px; }
.card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.card .subtitle { font-size: 0.8rem; color: #888; margin-bottom: 18px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 0.72rem; color: #666; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.form-field input, .form-field select, .form-field textarea { padding: 9px 12px; border: 1px solid #dde1ea; border-radius: 8px; font-size: 0.88rem; outline: none; font-family: inherit; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--c-primary); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; padding-top: 16px; border-top: 1px solid #f0f0f0; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
table.data-table thead tr { background: #f8f9fb; }
table.data-table th { padding: 8px 14px; text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: #888; border-bottom: 2px solid #eef0f4; }
table.data-table td { padding: 10px 14px; border-bottom: 1px solid #f0f2f5; }
table.data-table tbody tr:hover td { background: #f8faff; }
.role-badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; }
.role-badge.superadmin { background: #ede9fe; color: #6d28d9; }
.role-badge.admin { background: #fef3c7; color: #92400e; }
.role-badge.user { background: #eff6ff; color: #1d4ed8; }

.empty-state { text-align: center; padding: 56px 20px; color: #aaa; background: white; border-radius: 12px; }
.empty-state .ei { font-size: 3rem; margin-bottom: 10px; }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--c-dark); color: white; padding: 12px 18px; border-radius: 10px; font-size: 0.85rem; box-shadow: 0 8px 24px rgba(0,0,0,0.25); z-index: 2000; opacity: 0; transform: translateY(10px); transition: all 0.25s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #dc2626; }
.toast.success { background: #15803d; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal-box { background: white; border-radius: 14px; max-width: 820px; width: 100%; max-height: 93vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
.modal-box.wide { max-width: 98vw; width: 98vw; }
.modal-topbar { position: sticky; top: 0; background: #f8f9fb; padding: 10px 16px; display: flex; gap: 8px; justify-content: flex-end; border-bottom: 1px solid #eee; z-index: 10; align-items: center; }
.modal-topbar-left { margin-right: auto; font-size: 0.8rem; color: #666; display: flex; align-items: center; gap: 8px; }
.mu-box { max-width: 460px; }
.mu-body { padding: 26px; }
.mu-body h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }
.mu-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.mu-field label { font-size: 0.74rem; color: #666; font-weight: 600; }
.mu-field input, .mu-field select { padding: 8px 12px; border: 1px solid #dde1ea; border-radius: 8px; font-size: 0.9rem; outline: none; }
.mu-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

@media print {
  header.app-header, .tabs-bar, .no-print { display: none !important; }
}
