/* ============ LOADING ============ */
#loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1a2234 0%, #2d3f5e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content { text-align: center; }

.loading-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: #f59e0b;
    color: white;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 16px;
    animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%       { opacity: .65; transform: scale(.95); }
}

.loading-text {
    color: rgba(255,255,255,.5);
    font-size: 14px;
}

/* ============ TOASTS ============ */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
    animation: toast-in .2s ease;
    max-width: 340px;
    line-height: 1.4;
}

.toast.error   { background: #ef4444; }
.toast.success { background: #22c55e; }
.toast.info    { background: #1e293b; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============ RESET & BASE ============ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --sidebar-bg:    #1a2234;
    --sidebar-w:     240px;
    --accent:        #f59e0b;
    --accent-dark:   #d97706;
    --success:       #22c55e;
    --danger:        #ef4444;
    --text:          #1e293b;
    --text-muted:    #94a3b8;
    --bg:            #f1f5f9;
    --card:          #ffffff;
    --border:        #e2e8f0;
    --radius:        10px;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

.hidden { display: none !important; }

/* ============ LOGIN ============ */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #1a2234 0%, #2d3f5e 100%);
}

.login-card {
    background: var(--card);
    border-radius: 16px;
    padding: 40px;
    width: 400px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.4);
    text-align: center;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--accent);
    color: white;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -1px;
}

.login-card h1 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 28px;
}

.login-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .2s;
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.login-tab-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tab-desc {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.error-text {
    color: var(--danger);
    font-size: 13px;
    margin-top: 4px;
}

/* ============ LAYOUT ============ */
#app {
    display: flex;
    height: 100vh;
}

/* ============ SIDEBAR ============ */
#sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 20px 0 16px;
}

.sidebar-brand {
    color: white;
    font-size: 17px;
    font-weight: 700;
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 12px;
    letter-spacing: -.2px;
}

.mode-badge {
    margin: 0 16px 20px;
    padding: 5px 0;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    background: rgba(245,158,11,.15);
    color: var(--accent);
    border: 1px solid rgba(245,158,11,.25);
}

.mode-badge.admin {
    background: rgba(34,197,94,.15);
    color: var(--success);
    border-color: rgba(34,197,94,.25);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 0 10px;
    gap: 2px;
    margin-bottom: 28px;
}

.nav-btn {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: none;
    border: none;
    border-radius: 8px;
    color: rgba(255,255,255,.55);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all .2s;
    width: 100%;
}

.nav-btn:hover {
    background: rgba(255,255,255,.08);
    color: white;
}

.nav-btn.active {
    background: rgba(245,158,11,.18);
    color: var(--accent);
    font-weight: 600;
}

/* ============ YEAR SECTION ============ */
.year-section {
    flex: 1;
    padding: 0 10px;
    min-height: 0;
}

.year-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    margin-bottom: 6px;
    color: rgba(255,255,255,.3);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
}

.btn-add-year {
    background: none;
    border: 1px solid rgba(255,255,255,.2);
    color: rgba(255,255,255,.4);
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
}

.btn-add-year:hover {
    background: rgba(255,255,255,.1);
    color: white;
}

.year-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 8px;
    color: rgba(255,255,255,.55);
    cursor: pointer;
    font-size: 14px;
    transition: all .2s;
    margin-bottom: 2px;
}

.year-item:hover {
    background: rgba(255,255,255,.08);
    color: white;
}

.year-item.active {
    background: rgba(245,158,11,.18);
    color: var(--accent);
    font-weight: 600;
}

.year-del {
    background: none;
    border: none;
    color: transparent;
    cursor: pointer;
    font-size: 11px;
    padding: 2px 5px;
    border-radius: 4px;
    transition: all .2s;
    line-height: 1;
}

.year-item:hover .year-del { color: rgba(239,68,68,.5); }
.year-del:hover { background: rgba(239,68,68,.2); color: var(--danger) !important; }

.btn-logout {
    margin: 16px 10px 0;
    padding: 9px;
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.18);
    border-radius: 8px;
    color: rgba(239,68,68,.65);
    cursor: pointer;
    font-size: 13px;
    transition: all .2s;
}

.btn-logout:hover {
    background: rgba(239,68,68,.18);
    color: var(--danger);
}

/* ============ MAIN CONTENT ============ */
#main-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 36px;
}

/* ============ VIEW HEADER ============ */
.view-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}

.view-title {
    font-size: 22px;
    font-weight: 700;
}

.view-sub {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 3px;
}

/* ============ STAT CARDS ============ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 18px 20px;
    border: 1px solid var(--border);
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
}

.stat-value.accent  { color: var(--accent); }
.stat-value.success { color: var(--success); }
.stat-value.normal  { font-size: 18px; }

/* ============ TABLE CONTAINER ============ */
.table-wrap {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.table-wrap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.table-wrap-title {
    font-size: 14px;
    font-weight: 600;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 10px 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 13px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

.td-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.td-num {
    color: var(--text-muted);
    font-size: 12px;
    width: 36px;
}

/* ============ BUTTONS ============ */
.btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all .2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover { background: var(--accent-dark); }

.btn-ghost {
    background: none;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-danger {
    background: rgba(239,68,68,.08);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,.18);
}

.btn-danger:hover { background: rgba(239,68,68,.18); }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; }

/* ============ BADGE ============ */
/* ============ FILTROS DE GASTOS ============ */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-search { flex: 1; min-width: 160px; }
.filter-payer  { min-width: 150px; }
.filter-sort   { display: flex; gap: 6px; align-items: center; }

.btn-sort-dir {
    padding: 8px 12px;
    font-size: 15px;
    min-width: 38px;
}

.filter-count {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 500;
}

/* ============ TAREAS ============ */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    padding: 14px 16px;
    transition: opacity .2s, border-color .2s;
}

.task-card.overdue { border-left-color: var(--danger); }
.task-card.urgent  { border-left-color: var(--accent); }
.task-card.soon    { border-left-color: #3b82f6; }
.task-card.task-done { opacity: .5; }

.task-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.task-check {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--success);
    margin-top: 2px;
    flex-shrink: 0;
}

.task-done-indicator {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
    margin-top: 2px;
}

.task-done-indicator.done {
    background: var(--success);
    border-color: var(--success);
}

.task-body { flex: 1; min-width: 0; }

.task-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.task-card.task-done .task-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 4px;
}

.task-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    gap: 8px;
}

.task-deadline {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.task-deadline.overdue { background: rgba(239,68,68,.1);  color: var(--danger); }
.task-deadline.urgent  { background: rgba(245,158,11,.1); color: var(--accent-dark); }
.task-deadline.soon    { background: rgba(59,130,246,.1); color: #2563eb; }
.task-deadline.normal  { background: var(--bg);           color: var(--text-muted); }
.task-deadline.done    { background: rgba(34,197,94,.1);  color: #16a34a; }

/* ============ BOTÓN CONFIRMAR LIQUIDACIÓN ============ */
.btn-success {
    background: rgba(34,197,94,.1);
    color: #16a34a;
    border: 1px solid rgba(34,197,94,.25);
}

.btn-success:hover { background: rgba(34,197,94,.2); }

.txn-confirm-btn { white-space: nowrap; }

/* ============ SELECTOR DE PARTICIPANTES ============ */
.participants-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.participants-toggle {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

.participants-toggle a {
    color: var(--accent-dark);
    text-decoration: none;
    font-weight: 500;
}

.participants-toggle a:hover { text-decoration: underline; }

.participants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 4px;
    padding: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
}

.participant-check {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    padding: 5px 7px;
    border-radius: 6px;
    transition: background .15s;
    user-select: none;
}

.participant-check:hover { background: var(--border); }

.participant-check input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.participant-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badges columna Participantes */
.badge-all {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(34,197,94,.1);
    color: #16a34a;
    font-size: 12px;
    font-weight: 600;
}

.badge-partial {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(100,116,139,.1);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: default;
}

/* Pagos realizados (verde) */
.badge-payment {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(34,197,94,.1);
    color: #16a34a;
    font-size: 13px;
    font-weight: 600;
}

/* Banner informativo en Saldos */
.payments-applied-banner {
    background: rgba(34,197,94,.08);
    border: 1px solid rgba(34,197,94,.2);
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 13px;
    color: #166534;
    margin-bottom: 20px;
}

.badge-paid {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(245,158,11,.1);
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 600;
}

/* ============ FORM ============ */
.input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    background: white;
    transition: border-color .2s;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245,158,11,.12);
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ============ MODAL ============ */
#modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-box {
    background: white;
    border-radius: 14px;
    width: 460px;
    max-width: 92vw;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: modal-in .18s ease;
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(.96) translateY(-8px); }
    to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    padding: 4px 6px;
    border-radius: 6px;
    transition: all .2s;
}

.modal-close:hover { background: var(--bg); color: var(--text); }

#modal-body { padding: 22px; }

/* ============ EMPTY STATE ============ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 56px 20px;
    color: var(--text-muted);
    text-align: center;
    gap: 8px;
}

.empty-icon {
    font-size: 36px;
    font-weight: 700;
    color: var(--border);
    margin-bottom: 4px;
}

.empty-title { font-size: 16px; font-weight: 600; color: #64748b; }
.empty-desc  { font-size: 13px; max-width: 280px; line-height: 1.5; }

/* ============ NO YEAR ============ */
.no-year-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 70vh;
    color: var(--text-muted);
    text-align: center;
    gap: 12px;
}

.no-year-wrap .big { font-size: 48px; color: var(--border); font-weight: 700; }
.no-year-wrap h2 { font-size: 20px; color: #64748b; }

/* ============ FRIENDS ============ */
.friends-list {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.friend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 20px;
    border-bottom: 1px solid var(--border);
    transition: background .1s;
}

.friend-row:last-child { border-bottom: none; }
.friend-row:hover { background: #f8fafc; }

.friend-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.friend-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.friend-name { font-size: 15px; font-weight: 500; }

/* ============ BALANCES ============ */
.balances-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.balance-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
}

.balance-card.pos { border-left-color: var(--success); }
.balance-card.neg { border-left-color: var(--danger); }
.balance-card.zer { border-left-color: var(--text-muted); }

.bc-name   { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.bc-amount { font-size: 24px; font-weight: 700; }
.bc-label  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.balance-card.pos .bc-amount { color: var(--success); }
.balance-card.neg .bc-amount { color: var(--danger); }
.balance-card.zer .bc-amount { color: var(--text-muted); }

/* ============ TRANSACTIONS ============ */
.txn-section {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.txn-section-title {
    font-size: 14px;
    font-weight: 600;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.txn-count {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 20px;
}

.txn-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    font-size: 14px;
}

.txn-row:last-child { border-bottom: none; }

.txn-from  { font-weight: 600; color: var(--danger); }
.txn-arrow { color: var(--text-muted); font-size: 13px; text-align: center; }
.txn-to-wrap { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.txn-to    { font-weight: 600; color: var(--success); }
.txn-amt   { font-weight: 700; font-size: 15px; background: var(--bg); padding: 4px 10px; border-radius: 8px; }

/* ============================================================
   MÓVIL — elementos base (ocultos en escritorio)
   ============================================================ */

/* Header móvil */
#mobile-header {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: var(--sidebar-bg);
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    z-index: 150;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.mh-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.mh-brand {
    color: white;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.5px;
    flex-shrink: 0;
}

.mh-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(245,158,11,.15);
    color: var(--accent);
    border: 1px solid rgba(245,158,11,.25);
    white-space: nowrap;
}

.mh-badge.admin {
    background: rgba(34,197,94,.15);
    color: var(--success);
    border-color: rgba(34,197,94,.25);
}

.mh-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.mh-year-select {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    padding: 5px 8px;
    cursor: pointer;
    outline: none;
}

.mh-year-select option {
    background: var(--sidebar-bg);
    color: white;
}

.mh-add-year-btn {
    background: rgba(245,158,11,.2);
    border: 1px solid rgba(245,158,11,.35);
    border-radius: 8px;
    color: var(--accent);
    font-size: 20px;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s;
}

.mh-add-year-btn:hover { background: rgba(245,158,11,.35); }

/* Nav inferior */
#mobile-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: var(--sidebar-bg);
    align-items: stretch;
    justify-content: space-around;
    z-index: 150;
    border-top: 1px solid rgba(255,255,255,.08);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mn-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: rgba(255,255,255,.4);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 4px;
    transition: color .2s;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.mn-btn.active { color: var(--accent); }
.mn-btn:hover  { color: rgba(255,255,255,.75); }

.mn-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ============================================================
   MEDIA QUERY — pantallas pequeñas (<=768px)
   ============================================================ */
@media (max-width: 768px) {

    /* Layout: ocultar sidebar, activar elementos móviles */
    #sidebar       { display: none; }
    #mobile-header { display: flex; }
    #mobile-nav    { display: flex; }

    #app { flex-direction: column; }

    #main-content {
        padding: 16px 14px;
        padding-top: calc(56px + 16px);   /* altura header */
        padding-bottom: calc(60px + 16px); /* altura nav */
    }

    /* Login responsive */
    .login-card {
        width: calc(100% - 32px);
        padding: 28px 20px;
    }

    /* Estadísticas: 2 columnas en lugar de 3 */
    .stats-row { grid-template-columns: repeat(2, 1fr); }

    /* Título de vista + botón acción */
    .view-header { align-items: flex-start; gap: 10px; }
    .view-title  { font-size: 18px; }

    /* Tablas: scroll horizontal (todas las columnas visibles) */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table       { min-width: 520px; }

    /* Modal: sube desde abajo como bottom sheet */
    #modal-overlay { align-items: flex-end; }
    .modal-box {
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 92vh;
        overflow-y: auto;
    }

    /* Inputs: 16px mínimo para evitar zoom en iOS */
    .input { font-size: 16px; padding: 11px 12px; }

    /* Botones más grandes (área táctil) */
    .btn { padding: 10px 16px; }

    /* Participantes: 2 columnas */
    .participants-grid { grid-template-columns: repeat(2, 1fr); }

    /* Balances: 2 columnas */
    .balances-grid { grid-template-columns: repeat(2, 1fr); }

    /* Tarjetas balance: tamaño ajustado */
    .bc-amount { font-size: 20px; }

    /* Transacciones: columnas más compactas */
    .txn-row {
        grid-template-columns: 1fr 60px 1fr;
        padding: 12px 14px;
        font-size: 13px;
    }
    .txn-arrow { font-size: 11px; }
    .txn-amt   { font-size: 13px; padding: 3px 8px; }

    /* Lista de amigos */
    .friend-name { font-size: 14px; }

    /* No-year wrapper */
    .no-year-wrap { height: 60vh; }

    /* Filtros: apilados en móvil */
    .filter-search { flex: 1 1 100%; }
    .filter-payer  { flex: 1; }

    /* Tareas */
    .task-meta { flex-wrap: wrap; gap: 6px; }
    .task-title { font-size: 14px; }

    /* Fila de liquidación con botón confirmar */
    .txn-to-wrap { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
    .txn-confirm-btn { font-size: 11px; padding: 4px 8px; }
}
