:root {
  --ink: #12151c;
  --ink-soft: #1c2230;
  --canvas: #f4f5f7;
  --surface: #ffffff;
  --border: #e3e5ea;
  --muted: #667085;
  --accent: #ff7a18;
  --accent-ink: #ffffff;
  --success-bg: #e8f5ee;
  --success-ink: #1a7f4e;
  --error-bg: #fdecea;
  --error-ink: #b42318;
  --info-bg: #eef2ff;
  --info-ink: #3730a3;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--canvas);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 24px; margin: 0 0 4px; font-weight: 700; }
h2 { font-size: 17px; margin: 0; font-weight: 700; }
h3 { font-size: 15px; margin: 24px 0 8px; font-weight: 700; color: var(--muted); }

/* App shell: sidebar + content */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--ink-soft);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; margin-top: 28px; flex: 1; }
.sidebar nav a {
  color: #cfd3dc;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 500;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }

.sidebar-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #9aa0ac;
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 14px;
}
.sidebar-foot a { color: #cfd3dc; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 15px; }

.content { flex: 1; padding: 32px 40px; max-width: 1080px; }

.page-head { margin-bottom: 20px; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 700; }

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.panel-actions { display: flex; gap: 8px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12.5px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 10px 10px; border-bottom: 1px solid var(--border); }
.table tfoot td { border-bottom: none; padding-top: 12px; }
.table tbody tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #eef0f3;
  color: var(--muted);
}
.badge-paid, .badge-accepted { background: var(--success-bg); color: var(--success-ink); }
.badge-sent, .badge-viewed { background: var(--info-bg); color: var(--info-ink); }
.badge-declined, .badge-void { background: var(--error-bg); color: var(--error-ink); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-grid label, form > label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.form-grid .full { grid-column: 1 / -1; }
input, select, textarea {
  font-family: var(--font);
  font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
form > label { margin-bottom: 14px; }
.form-actions { margin-top: 18px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: 9px;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { background: #e86c0c; text-decoration: none; }
.btn-secondary { background: var(--ink-soft); color: #fff; }
.btn-secondary:hover { background: #2a3143; }
.btn-large { padding: 14px 20px; font-size: 15px; width: 100%; }
.btn-remove {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.btn-remove:hover { color: var(--error-ink); }
.action-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.inline { display: inline; }

/* Alerts */
.alert { padding: 12px 14px; border-radius: 9px; font-size: 14px; margin: 0 0 16px; }
.alert-error { background: var(--error-bg); color: var(--error-ink); }
.alert-info { background: var(--info-bg); color: var(--info-ink); }
.alert-success { background: var(--success-bg); color: var(--success-ink); }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; }

/* Auth page */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--ink-soft);
  padding: 20px;
}
.auth-card {
  width: min(380px, 100%);
  background: var(--surface);
  border-radius: 16px;
  padding: 32px 28px;
  text-align: center;
}
.auth-card .brand { justify-content: center; margin-bottom: 18px; }
.auth-card h1 { font-size: 19px; margin-bottom: 18px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; text-align: left; }

/* Public pay page */
.pay-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--canvas);
}
.pay-card {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 34px;
}
.pay-card .brand { margin-bottom: 20px; }
.total-line { font-size: 18px; text-align: right; margin: 14px 0 22px; }

@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 12px 16px; }
  .sidebar nav { flex-direction: row; margin-top: 0; }
  .sidebar-foot { display: none; }
  .content { padding: 20px; }
  .stat-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* Menú: ícono + nombre en desktop, solo ícono en celular */
.sidebar nav a, .sidebar-foot a {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-icon { flex-shrink: 0; opacity: 0.9; }
.sidebar-foot { flex-direction: column; align-items: flex-start; gap: 8px; }
.sidebar-foot span.nav-label { padding: 0 12px; color: #9aa0ac; font-size: 13px; }

@media (max-width: 720px) {
  .sidebar { width: 100%; flex-direction: row; align-items: center; justify-content: space-around; padding: 8px 6px; }
  .sidebar .brand { display: none; }
  .sidebar nav { flex-direction: row; margin-top: 0; justify-content: space-around; width: 100%; gap: 0; }
  .sidebar nav a { flex-direction: column; gap: 3px; padding: 6px 8px; border-radius: 8px; }
  .nav-icon { width: 22px !important; height: 22px !important; }
  .nav-label { display: none; }
  .sidebar-foot { display: none; }
}
