@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #0088b8;
  --accent: #3ccece;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

/* ── Login ─────────────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px;
  width: 360px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p { color: var(--text-secondary); font-size: 13px; margin: 0 0 24px; }

/* ── Layout ────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  flex-shrink: 0;
}
.sidebar h2 { font-size: 16px; margin: 0 0 4px; color: var(--primary); }
.sidebar .role-tag { font-size: 11px; color: var(--text-secondary); margin-bottom: 24px; text-transform: uppercase; letter-spacing: .05em; }
.nav-item {
  display: block;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  cursor: pointer;
}
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--primary); color: white; }
.main { flex: 1; display: flex; flex-direction: column; }
.topbar {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.topbar .user-info { font-size: 13px; color: var(--text-secondary); }
.content { padding: 24px; flex: 1; overflow-y: auto; }

/* ── Campana de notificaciones ────────────────────────────── */
.notif-bell { position: relative; cursor: pointer; font-size: 20px; line-height: 1; user-select: none; }
.notif-badge {
  position: absolute; top: -8px; right: -10px;
  background: var(--danger); color: white; font-size: 10px; font-weight: 700;
  border-radius: 999px; min-width: 16px; height: 16px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
}
.notif-dropdown {
  position: absolute; top: 32px; right: -8px; width: 320px; max-height: 400px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 200; cursor: default;
}
.notif-dropdown .notif-header {
  padding: 12px 16px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  color: var(--text-secondary); border-bottom: 1px solid var(--border);
}
.notif-dropdown .notif-item { padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--border); }
.notif-dropdown .notif-item:last-child { border-bottom: none; }
.notif-dropdown .notif-item.unread { background: #eff6ff; }
.notif-dropdown .notif-time { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.notif-dropdown .notif-empty { padding: 20px 16px; text-align: center; font-size: 13px; color: var(--text-secondary); }

/* ── Componentes ───────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card h3 { margin: 0 0 16px; font-size: 16px; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #006f94; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
}
label { font-size: 12px; font-weight: 600; color: var(--text-secondary); display: block; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 8px; color: var(--text-secondary); font-weight: 600; border-bottom: 2px solid var(--border); font-size: 12px; text-transform: uppercase; }
td { padding: 10px 8px; border-bottom: 1px solid var(--border); }
td input { width: 80px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.badge-draft { background: #e2e8f0; color: #475569; }
.badge-submitted { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-paid { background: #dbeafe; color: #1e40af; }
.badge-partially_paid { background: #fef3c7; color: #92400e; }
.badge-payment_processing { background: #ede9fe; color: #5b21b6; }

.alert { padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-warning { background: #fef3c7; color: #92400e; }

.total-box { text-align: right; font-size: 20px; font-weight: 800; color: var(--primary); margin-top: 12px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; }
.checkbox-row input { width: auto; margin-top: 3px; }
.checkbox-row label { font-size: 13px; font-weight: 400; color: var(--text); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 20px; }
.stat .label { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; font-weight: 600; }
.stat .value { font-size: 28px; font-weight: 800; margin-top: 4px; }

/* ── Perfil ────────────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(0,136,184,.25);
}
.profile-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,.22);
  border: 2px solid rgba(255,255,255,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
  flex-shrink: 0;
  letter-spacing: -.02em;
}
.profile-header h2 { margin: 0 0 6px; font-size: 21px; }
.profile-header .profile-sub { font-size: 13px; opacity: .92; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-header .badge-role { background: rgba(255,255,255,.25); color: white; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.info-item {
  background: var(--bg);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 12px 14px;
}
.info-item .info-label {
  font-size: 10.5px; color: var(--text-secondary); text-transform: uppercase;
  font-weight: 700; letter-spacing: .04em; margin-bottom: 5px;
  display: flex; align-items: center; gap: 6px;
}
.info-item .info-value { font-size: 14.5px; font-weight: 700; color: var(--text); word-break: break-word; }
.info-item .info-value.muted { color: var(--text-secondary); font-weight: 500; }
.info-item.accent  { border-left-color: var(--accent); }
.info-item.success { border-left-color: var(--success); }
.info-item.warning { border-left-color: var(--warning); }

/* ── Tarjetas de perfil (info personal + cuenta de cobro) ─────────────── */
.profile-cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.profile-card { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 20px; }
.profile-card-header {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white; padding: 24px;
}
.profile-card-header .profile-avatar { width: 56px; height: 56px; font-size: 19px; }
.profile-card-header h2 { margin: 0 0 6px; font-size: 18px; }
.profile-card-header .badge-role { background: rgba(255,255,255,.25); color: white; }
.profile-card-body { padding: 20px 24px; }
.profile-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.profile-row:last-child { border-bottom: none; }
.profile-row .profile-row-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }
.profile-row .profile-row-value { font-size: 14.5px; font-weight: 700; color: var(--text); text-align: right; word-break: break-word; }
.profile-row .profile-row-value.muted { color: var(--text-secondary); font-weight: 500; }
.profile-card-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { max-width: 420px; width: 90%; }
.status-msg { font-size: 13px; margin-top: 8px; min-height: 16px; }
