/* PagoJusto — Premium UI · letra grande · accesible */
:root {
    --primary: #0f766e;
    --primary-hover: #0d9488;
    --primary-dark: #115e59;
    --primary-soft: #ccfbf1;
    --accent: #f59e0b;
    --accent-soft: #fef3c7;
    --danger: #b91c1c;
    --danger-soft: #fee2e2;
    --success: #047857;
    --success-soft: #d1fae5;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #0f172a;
    --text-muted: #475569;
    --border: #e2e8f0;
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 1px 3px rgba(15,23,42,0.05), 0 6px 16px rgba(15,23,42,0.05);
    --shadow-lg: 0 12px 40px rgba(15,23,42,0.1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --fs-base: 1.0625rem;   /* 17px */
    --fs-sm: 0.95rem;
    --fs-lg: 1.2rem;
    --fs-xl: 1.45rem;
    --fs-2xl: 1.75rem;
    --fs-3xl: 2.1rem;
    --lh: 1.6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: var(--fs-base);
    line-height: var(--lh);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary-hover); }

.container { max-width: 980px; margin: 0 auto; padding: 0 18px; }
.main-content { padding-top: 28px; padding-bottom: 56px; }

/* Header */
.header {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none !important;
}
.logo-img {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: block;
    flex-shrink: 0;
}
.logo-mark {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: white;
    font-weight: 800;
    font-size: 0.95rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.5px;
    box-shadow: 0 2px 10px rgba(15,118,110,0.3);
}
.logo-mark.sm { width: 32px; height: 32px; font-size: 0.75rem; border-radius: 9px; }
.logo-text {
    font-size: 1.35rem;
    font-weight: 750;
    color: var(--text);
    letter-spacing: -0.4px;
}
.nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nav a {
    font-size: 1rem;
    font-weight: 550;
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 10px;
}
.nav a:hover { color: var(--primary); background: var(--primary-soft); text-decoration: none; }
.nav-admin {
    background: var(--accent-soft) !important;
    color: #92400e !important;
    font-weight: 650 !important;
}
.nav-user { font-size: 0.95rem; color: var(--text-muted); padding: 0 8px; }

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}
.card-title {
    font-size: var(--fs-lg);
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    letter-spacing: -0.3px;
    line-height: 1.35;
}

/* Buttons — larger touch targets */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 22px;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 650;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none !important;
    font-family: inherit;
    min-height: 48px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
    background: linear-gradient(135deg, #0f766e, #0d9488);
    color: white !important;
    box-shadow: 0 3px 12px rgba(15,118,110,0.28);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    box-shadow: 0 5px 16px rgba(15,118,110,0.38);
}
.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); color: white !important; }
.btn-sm { padding: 10px 16px; font-size: 0.95rem; min-height: 42px; }
.btn-block { width: 100%; }

/* Forms — bigger inputs */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 1.05rem;
    font-weight: 650;
    margin-bottom: 8px;
    color: var(--text);
}
.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    transition: all 0.15s;
    background: white;
    font-family: inherit;
    color: var(--text);
    min-height: 52px;
    line-height: 1.4;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15,118,110,0.14);
}
.form-control::placeholder { color: #94a3b8; }
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 42px;
}

/* Alerts */
.alert {
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 1.05rem;
    font-weight: 550;
    line-height: 1.45;
}
.alert-success { background: var(--success-soft); color: #065f46; border: 1px solid #6ee7b7; }
.alert-error { background: var(--danger-soft); color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: #e0f2fe; color: #075985; border: 1px solid #7dd3fc; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 1.05rem; }
th, td { padding: 16px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

.balance-positive { color: var(--success); font-weight: 700; font-size: 1.1rem; }
.balance-negative { color: var(--danger); font-weight: 700; font-size: 1.1rem; }
.balance-zero { color: var(--text-muted); font-size: 1.1rem; }

/* Split options */
.split-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.split-option {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 1rem;
    font-weight: 600;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.split-option:hover, .split-option.active {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-dark);
}
.split-option input { display: none; }

.member-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.member-chip {
    background: var(--primary-soft);
    color: var(--primary-dark);
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 1rem;
    font-weight: 650;
}

.empty-state { text-align: center; padding: 52px 20px; color: var(--text-muted); }
.empty-state h3 { margin-bottom: 10px; color: var(--text); font-weight: 700; font-size: var(--fs-xl); }
.empty-state p { font-size: 1.05rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 680px) {
    .grid-2 { grid-template-columns: 1fr; }
    .header-inner { flex-wrap: wrap; }
    .split-options { grid-template-columns: 1fr; }
    :root { --fs-base: 1.1rem; }
}

.invite-box {
    background: linear-gradient(135deg, #f0fdfa, #ccfbf1);
    border: 2px dashed #5eead4;
    border-radius: var(--radius-sm);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.invite-code {
    font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace;
    font-size: 1.5rem;
    font-weight: 750;
    letter-spacing: 3px;
    color: var(--primary-dark);
}

.footer {
    text-align: center;
    padding: 44px 20px;
    color: var(--text-muted);
    font-size: 1rem;
    border-top: 1px solid var(--border);
    background: white;
}
.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}
.footer-logo { border-radius: 10px; vertical-align: middle; }
.footer-tagline { margin: 8px 0 12px; font-size: 1rem; }
.footer-credit { font-size: 0.95rem; color: var(--text-muted); }
.footer-link {
    color: var(--primary);
    font-weight: 650;
    text-decoration: none;
}
.footer-link:hover { text-decoration: underline; color: var(--primary-hover); }
.footer-install { margin-bottom: 10px; font-size: 1.05rem; }

/* Auth */
.auth-container { max-width: 440px; margin: 40px auto; padding: 0 16px; }
.auth-card {
    background: var(--card);
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
    padding: 36px 28px;
    border: 1px solid var(--border);
}
.auth-brand { text-align: center; margin-bottom: 8px; }
.auth-brand .brand-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: white;
    font-weight: 800;
    font-size: 1.25rem;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 18px rgba(15,118,110,0.3);
}
.auth-card h1 {
    font-size: var(--fs-2xl);
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
    line-height: 1.25;
}
.auth-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 28px;
    font-size: 1.05rem;
    line-height: 1.5;
}
.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 1.05rem;
    color: var(--text-muted);
}

.amount-big { font-size: 1.75rem; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }

.settlement-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    font-size: 1.05rem;
    gap: 10px;
    flex-wrap: wrap;
}
.settlement-item:last-child { border-bottom: none; }
.arrow { color: var(--text-muted); margin: 0 8px; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 26px;
    flex-wrap: wrap;
    gap: 14px;
}
.page-header h1 {
    font-size: var(--fs-3xl);
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.group-card {
    text-decoration: none !important;
    color: inherit;
    transition: all 0.2s;
    display: block;
}
.group-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: #99f6e4;
}

/* Google */
.btn-google {
    background: #fff !important;
    color: #3c4043 !important;
    border: 2px solid #dadce0 !important;
    box-shadow: none !important;
    font-weight: 600;
    gap: 12px;
    font-size: 1.05rem;
}
.btn-google:hover {
    background: #f8f9fa !important;
    border-color: #c6c8cc !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08) !important;
}
.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 22px 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Admin */
.admin-body { background: #0f172a; }
.admin-body .header {
    background: #1e293b;
    border-bottom-color: #334155;
}
.admin-body .logo-text { color: #f1f5f9; }
.admin-body .nav a { color: #94a3b8; }
.admin-body .nav a:hover { color: #5eead4; background: rgba(45,212,191,0.1); }
.admin-body .nav-user { color: #64748b; }
.admin-body .main-content { color: #e2e8f0; }
.admin-body .card {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}
.admin-body .card-title { color: #f1f5f9; }
.admin-body th { color: #94a3b8; }
.admin-body td { border-bottom-color: #334155; color: #cbd5e1; }
.admin-body tr:hover td { background: #334155; }
.admin-body .footer { background: #0f172a; border-top-color: #1e293b; color: #64748b; }
.admin-body .footer-credit { color: #64748b; }
.admin-body .footer-link { color: #5eead4; }
.admin-body .page-header h1 { color: #f1f5f9; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid #334155;
    border-radius: var(--radius);
    padding: 24px 18px;
    text-align: center;
}
.stat-card .stat-value {
    font-size: 2.1rem;
    font-weight: 800;
    color: #5eead4;
    letter-spacing: -1px;
    line-height: 1.2;
}
.stat-card .stat-label {
    font-size: 0.9rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 8px;
    font-weight: 650;
}
.admin-badge {
    display: inline-block;
    background: var(--accent-soft);
    color: #92400e;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* PWA Install — hidden when installed */
.pj-standalone .pj-install-banner,
.pj-standalone .footer-install,
html.pj-standalone .pj-install-banner,
html.pj-standalone .footer-install {
    display: none !important;
}

.pj-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 30px rgba(15,23,42,0.12);
  animation: pjSlideUp 0.35s ease;
}
@keyframes pjSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.pj-install-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}
.pj-install-icon { border-radius: 12px; flex-shrink: 0; }
.pj-install-text { flex: 1; min-width: 180px; font-size: 1.05rem; color: var(--text); }
.pj-install-text strong { display: block; font-size: 1.15rem; margin-bottom: 4px; }
.pj-install-text p { color: var(--text-muted); margin: 0 0 6px; font-size: 1rem; }
.pj-install-steps {
  margin: 6px 0 0;
  padding-left: 20px;
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.pj-install-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.pj-install-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
}
.pj-install-close:hover { color: var(--text); }

.pj-how-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15,23,42,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.pj-how-card {
  background: #fff;
  border-radius: 22px;
  padding: 28px 24px;
  max-width: 580px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}
.pj-how-card h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 18px;
  letter-spacing: -0.3px;
}
.pj-how-card .pj-install-close {
  position: absolute;
  top: 12px;
  right: 12px;
}
.pj-how-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 560px) {
  .pj-how-grid { grid-template-columns: 1fr; }
}
.pj-how-col h3 {
  font-size: 1.1rem;
  font-weight: 750;
  color: var(--primary);
  margin-bottom: 8px;
}
.pj-how-hint {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 8px;
}
