/* ===== Tokens =====
   Modo: <html data-theme="light|dark"> (sin atributo = sigue al sistema).
   Acento: <html data-accent="indigo|rose|emerald|amber|ocean|violet">.
   Ambos los aplica js/theme.js antes de cargar Blazor (sin parpadeo). */
:root {
    --accent-l: #4f46e5; --accent-d: #8b93ff;
}
:root[data-accent="rose"]    { --accent-l: #be185d; --accent-d: #f472b6; }
:root[data-accent="emerald"] { --accent-l: #047857; --accent-d: #34d399; }
:root[data-accent="amber"]   { --accent-l: #b45309; --accent-d: #fbbf24; }
:root[data-accent="ocean"]   { --accent-l: #0369a1; --accent-d: #38bdf8; }
:root[data-accent="violet"]  { --accent-l: #6d28d9; --accent-d: #a78bfa; }

:root {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --surface-2: #f0f2f7;
    --border: #e2e5ee;
    --text: #1b2232;
    --muted: #6a7286;
    --accent: var(--accent-l);
    --on-accent: #ffffff;
    --shared: #0d9488;
    --danger: #dc2626;
    --danger-weak: #fdecec;
    --warn: #b45309;
    --warn-weak: #fff4e0;
    --ok: #15803d;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 6px rgba(16, 24, 40, .06);
    --shadow-lg: 0 12px 40px rgba(16, 24, 40, .22);
    color-scheme: light;
}

/* Modo oscuro: forzado, o automático si el sistema lo pide. Mismos valores en ambos bloques. */
:root[data-theme="dark"] {
    --bg: #0e1220;
    --surface: #161b2b;
    --surface-2: #1d2336;
    --border: #2a3149;
    --text: #e6e9f3;
    --muted: #98a1b8;
    --accent: var(--accent-d);
    --on-accent: #0e1220;
    --shared: #2dd4bf;
    --danger: #f87171;
    --danger-weak: #3a1d24;
    --warn: #fbbf24;
    --warn-weak: #3a2e14;
    --ok: #4ade80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg: #0e1220;
        --surface: #161b2b;
        --surface-2: #1d2336;
        --border: #2a3149;
        --text: #e6e9f3;
        --muted: #98a1b8;
        --accent: var(--accent-d);
        --on-accent: #0e1220;
        --shared: #2dd4bf;
        --danger: #f87171;
        --danger-weak: #3a1d24;
        --warn: #fbbf24;
        --warn-weak: #3a2e14;
        --ok: #4ade80;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3);
        --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
        color-scheme: dark;
    }
}

/* Derivado del acento, funciona en ambos modos. */
:root { --accent-weak: color-mix(in srgb, var(--accent) 14%, var(--surface)); }

/* ===== Base ===== */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    background: var(--bg);
    color: var(--text);
}
h1 { font-size: 1.6rem; margin: 0; letter-spacing: -.02em; }
h1:focus { outline: none; } /* FocusOnNavigate enfoca el h1 al cambiar de página */
h2 { font-size: 1.15rem; margin: 0; }
h3 { font-size: .95rem; margin: 0; }
p { margin: .25rem 0 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.icon { flex-shrink: 0; vertical-align: middle; }

/* ===== Shell ===== */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1rem .75rem;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem; font-weight: 700; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--accent); color: var(--on-accent);
    display: grid; place-items: center; font-size: .8rem; letter-spacing: .02em;
}
.nav { display: flex; flex-direction: column; gap: .2rem; }
.nav a {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem .75rem; border-radius: 9px;
    color: var(--muted); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-weak); color: var(--accent); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: .7rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.whoami { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.whoami select { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: .3rem .5rem; }
.content { padding: 1.5rem; width: 100%; max-width: 1440px; }

/* ===== Controls ===== */
.btn {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .5rem .9rem; border-radius: 9px;
    border: 1px solid var(--border); background: var(--surface);
    font-weight: 500; font-size: .9rem; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn.danger:hover { background: var(--danger-weak); }
.btn.small { padding: .3rem .65rem; font-size: .82rem; }
.icon-btn {
    display: inline-grid; place-items: center;
    width: 32px; height: 32px; border-radius: 8px;
    border: 0; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 500; font-size: .85rem; padding: .25rem; }

.seg {
    display: inline-flex; padding: 3px; gap: 2px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
.seg button {
    border: 0; background: transparent; padding: .38rem .9rem; border-radius: 7px;
    font-weight: 500; font-size: .88rem; color: var(--muted);
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg.small button { padding: .3rem .75rem; font-size: .85rem; }

.tag {
    display: inline-block; font-size: .72rem; font-weight: 600;
    padding: .1rem .45rem; border-radius: 999px;
    background: var(--surface-2); color: var(--muted);
}
.tag.accent { background: var(--accent-weak); color: var(--accent); }
.badge {
    display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 .35rem;
    border-radius: 999px; background: var(--surface-2); font-size: .72rem; font-weight: 600; color: var(--muted);
}

/* ===== Avatars ===== */
.avatar {
    --s: 28px;
    width: var(--s); height: var(--s); border-radius: 50%;
    background: var(--c); color: #fff;
    display: inline-grid; place-items: center; flex-shrink: 0;
    font-size: calc(var(--s) * .4); font-weight: 600;
    box-shadow: 0 0 0 2px var(--surface);
}
.avatar.more { background: var(--surface-2); color: var(--muted); }
.avatar-stack { display: inline-flex; flex-shrink: 0; }
.avatar-stack .avatar + .avatar { margin-left: -6px; }
.view-toggle { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.group-select {
    max-width: 11rem; padding: .35rem .6rem; border: 1px solid var(--border); border-left: 4px solid var(--g);
    border-radius: 9px; background: var(--surface); font-size: .88rem; font-weight: 600;
}

/* ===== Page header ===== */
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* ===== Home ===== */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.stat {
    display: flex; flex-direction: column; gap: .15rem;
    padding: .9rem 1rem; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border);
    color: inherit; text-decoration: none;
}
.stat:hover { border-color: var(--accent); }
.stat-num { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .82rem; color: var(--muted); }
.stat.warn { background: var(--warn-weak); border-color: transparent; }
.stat.warn .stat-num { color: var(--warn); }

.days5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; align-items: start; }
.day-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: .75rem; display: flex; flex-direction: column; gap: .6rem; min-height: 220px;
}
.day-card.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.day-head { display: flex; justify-content: space-between; align-items: flex-start; }
.day-rel { font-weight: 600; }
.day-card.today .day-rel { color: var(--accent); }
.day-date { font-size: .82rem; }
.day-free {
    margin-top: auto; padding-top: .5rem; border-top: 1px dashed var(--border);
    display: flex; align-items: center; justify-content: space-between; font-size: .78rem;
}

/* ===== Items (eventos/tareas) ===== */
.day-items { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.item {
    --c: var(--accent);
    display: flex; align-items: center; gap: .4rem; width: 100%; min-width: 0;
    text-align: left; border: 0; border-left: 3px solid var(--c); border-radius: 6px;
    padding: .35rem .45rem; font-size: .83rem;
    background: color-mix(in srgb, var(--c) 12%, var(--surface));
}
button.item:hover, .item.task:hover { background: color-mix(in srgb, var(--c) 20%, var(--surface)); }
.item.shared {
    background: repeating-linear-gradient(135deg,
        color-mix(in srgb, var(--c) 16%, var(--surface)) 0 6px,
        color-mix(in srgb, var(--c) 7%, var(--surface)) 6px 12px);
}
.item.busy { cursor: default; color: var(--muted); font-style: italic; background: var(--surface-2); border-left-color: color-mix(in srgb, var(--c) 50%, var(--border)); }
.item-time { font-size: .74rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-title.link { border: 0; background: none; padding: 0; text-align: left; display: flex; align-items: center; gap: .25rem; }
.item.task input { margin: 0; accent-color: var(--c); flex-shrink: 0; }
.item.task.done .item-title { text-decoration: line-through; color: var(--muted); }
.day-items .more { border: 0; background: none; color: var(--muted); font-size: .75rem; text-align: left; padding: 0 .3rem; }
.day-items .more:hover { color: var(--accent); }
.day-items .empty { font-size: .82rem; color: var(--muted); padding: .4rem 0; }
.day-items.compact .item { padding: .2rem .35rem; font-size: .75rem; gap: .3rem; }
.day-items.compact .item-time { font-size: .68rem; }

/* ===== Calendar ===== */
.cal-toolbar { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .9rem; }
.period { margin-left: .5rem; }
.legend { margin-left: auto; display: flex; gap: 1rem; font-size: .8rem; }
.legend-item { display: inline-flex; align-items: center; gap: .35rem; }
.swatch-mini { width: 14px; height: 10px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 30%, var(--surface)); border-left: 3px solid var(--accent); }
.swatch-mini.shared { border-left-color: var(--shared); background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--shared) 35%, var(--surface)) 0 3px, var(--surface) 3px 6px); }

.month {
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
    background: var(--border); gap: 1px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.dow { background: var(--surface-2); padding: .45rem .6rem; font-size: .78rem; font-weight: 600; color: var(--muted); }
.cell { background: var(--surface); min-height: 112px; padding: .3rem; display: flex; flex-direction: column; gap: .2rem; cursor: pointer; min-width: 0; }
.cell:hover { background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.cell.other { background: var(--surface-2); }
.cell.other .cell-num { color: var(--muted); opacity: .6; }
.cell-num {
    align-self: flex-start; border: 0; background: none; font-size: .8rem; font-weight: 600;
    width: 24px; height: 24px; border-radius: 50%; padding: 0;
}
.cell-num:hover { background: var(--surface-2); }
.cell.today .cell-num { background: var(--accent); color: var(--on-accent); }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
.week-col {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: .5rem; display: flex; flex-direction: column; gap: .5rem; min-height: 360px; min-width: 0;
}
.week-col.today { border-color: var(--accent); }
.week-head { display: flex; align-items: baseline; gap: .4rem; }
.week-num { font-size: 1.3rem; font-weight: 700; }
.week-col.today .week-num { color: var(--accent); }
.add-slot {
    margin-top: auto; border: 1px dashed var(--border); background: none; border-radius: 8px;
    padding: .3rem; color: var(--muted); display: grid; place-items: center;
}
.add-slot:hover { border-color: var(--accent); color: var(--accent); }

.lanes-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.lanes { display: grid; grid-template-columns: 150px repeat(7, minmax(120px, 1fr)); background: var(--border); gap: 1px; min-width: 990px; }
.lane-corner, .lane-head { background: var(--surface-2); padding: .5rem .6rem; font-size: .82rem; }
.lane-head.today strong { color: var(--accent); }
.lane-user {
    background: var(--surface); padding: .6rem; display: flex; align-items: center; gap: .5rem; font-weight: 600;
    border-left: 4px solid var(--c); position: sticky; left: 0; z-index: 1;
}
.lane-cell { background: var(--surface); padding: .35rem; min-height: 90px; cursor: pointer; min-width: 0; }
.lane-cell.today { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.lane-cell:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }

/* ===== Tasks ===== */
.tabs { display: flex; align-items: center; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tab {
    border: 0; background: none; padding: .6rem .9rem; font-weight: 600; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: .4rem;
}
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab.on .badge { background: var(--accent-weak); color: var(--accent); }
.hint { font-size: .85rem; margin: -.4rem 0 1rem; }
.task-group { margin-bottom: 1.25rem; }
.group-title { display: flex; gap: .4rem; margin-bottom: .45rem; text-transform: uppercase; font-size: .75rem; letter-spacing: .05em; color: var(--muted); }
.group-title.danger { color: var(--danger); }
.task-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.task-row {
    display: flex; align-items: center; gap: .75rem; padding: .65rem .9rem;
    border-left: 3px solid var(--c);
}
.task-row + .task-row { border-top: 1px solid var(--border); }
.task-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--c); margin: 0; flex-shrink: 0; }
.task-row .pending-mark { width: 18px; height: 18px; font-size: .75rem; }
.task-main { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; display: flex; flex-direction: column; gap: .15rem; }
.task-title { font-weight: 500; }
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-meta { display: flex; flex-wrap: wrap; gap: .25rem .75rem; font-size: .78rem; color: var(--muted); }
.task-meta > span { display: inline-flex; align-items: center; gap: .25rem; }
.task-meta .overdue { color: var(--danger); font-weight: 600; }
.task-meta .notes { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.prio { font-size: .72rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; flex-shrink: 0; }
.prio.high { background: var(--danger-weak); color: var(--danger); }
.prio.medium { background: var(--surface-2); color: var(--muted); }
.prio.low { color: var(--muted); }
.empty-state { padding: 3rem 1rem; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

/* ===== Users ===== */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; min-width: 620px; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .7rem 1rem; background: var(--surface-2); }
.table td { padding: .65rem 1rem; border-top: 1px solid var(--border); font-size: .9rem; }
.table tr.inactive td { color: var(--muted); }
.table tr.inactive .avatar { filter: grayscale(1); opacity: .6; }
.user-cell { display: flex; align-items: center; gap: .6rem; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .btn + .btn { margin-left: .35rem; }
.status { font-size: .8rem; font-weight: 600; display: inline-flex; align-items: center; gap: .35rem; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.on { color: var(--ok); }
.status.off { color: var(--muted); }

/* ===== Modal & forms ===== */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(10, 14, 26, .5); display: grid; place-items: center; padding: 1rem;
    animation: fade .12s ease-out;
}
.modal {
    width: min(520px, 100%); max-height: calc(100vh - 2rem); overflow: auto;
    background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem .5rem; }
.modal-body { padding: .5rem 1.25rem 1rem; }
.modal-foot { display: flex; align-items: center; gap: .5rem; padding: .85rem 1.25rem; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }
@keyframes fade { from { opacity: 0; } }

.form { display: flex; flex-direction: column; gap: .85rem; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field > span { font-size: .8rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
    width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.check { display: inline-flex; align-items: center; gap: .45rem; font-size: .9rem; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.self-end { align-self: end; padding-bottom: .55rem; }
.form-error { display: flex; align-items: center; gap: .35rem; color: var(--danger); background: var(--danger-weak); padding: .45rem .65rem; border-radius: 8px; font-size: .85rem; margin: 0; }

.user-picker { display: flex; flex-wrap: wrap; gap: .4rem; }
.pick {
    display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .65rem .25rem .25rem;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: .85rem;
}
.pick.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); font-weight: 600; }
.pick:not(.on) .avatar { opacity: .5; }
.pick-order { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--c); color: #fff; font-size: .7rem; }

.user-preview { display: flex; align-items: center; gap: .75rem; padding: .5rem; background: var(--surface-2); border-radius: 10px; }
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--c); }
.swatch.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.swatches input[type=color] { width: 36px; height: 30px; padding: 0 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }

/* ===== Aprobaciones / solicitudes ===== */
.nav a { position: relative; }
.nav-badge {
    margin-left: auto; min-width: 20px; height: 20px; padding: 0 .35rem; border-radius: 999px;
    background: var(--accent); color: var(--on-accent); font-size: .72rem; font-weight: 700;
    display: inline-grid; place-items: center;
}
.badge.accent { background: var(--accent); color: var(--on-accent); }
.stat.accent { background: var(--accent-weak); border-color: transparent; }
.stat.accent .stat-num { color: var(--accent); }

.appr { font-size: .7rem; font-weight: 600; padding: .05rem .45rem; border-radius: 999px; white-space: nowrap; }
.appr.pending { background: var(--warn-weak); color: var(--warn); }
.appr.accepted { background: color-mix(in srgb, var(--ok) 15%, var(--surface)); color: var(--ok); }
.appr.declined { background: var(--danger-weak); color: var(--danger); }

.participants .pa { display: inline-flex; position: relative; }
.participants .pa + .pa { margin-left: -6px; }
.pa.pending .avatar { opacity: .5; outline: 2px dashed var(--warn); outline-offset: 1px; }
.pa.declined .avatar { opacity: .3; filter: grayscale(1); }
.pa.declined::after {
    content: "✕"; position: absolute; inset: 0; display: grid; place-items: center;
    color: var(--danger); font-size: .7rem; font-weight: 800;
}

.item.pending { border-left-style: dashed; opacity: .75; background: var(--surface); outline: 1px dashed color-mix(in srgb, var(--c) 60%, transparent); outline-offset: -1px; }
.pending-mark {
    width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
    background: var(--warn); color: #fff; font-size: .65rem; font-weight: 800;
}
.swatch-mini.pending { background: var(--surface); border: 1px dashed var(--warn); border-left: 3px dashed var(--warn); }

.section-title { display: flex; align-items: center; gap: .5rem; font-size: 1rem; margin-bottom: .6rem; }
.requests { margin-bottom: 1.25rem; }
.request-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .75rem; margin-bottom: .5rem; }
.request {
    display: flex; flex-direction: column; gap: .75rem; padding: .85rem 1rem;
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: var(--radius);
}
.request-from { display: flex; align-items: center; gap: .45rem; font-size: .82rem; color: var(--muted); }
.request-from strong { color: var(--text); }
.request-title { border: 0; background: none; padding: 0; text-align: left; font-weight: 600; font-size: 1rem; margin: .3rem 0 .2rem; }
.request-title:hover { color: var(--accent); }
.request-conflict {
    display: flex; gap: .35rem; align-items: flex-start; margin-top: .5rem; padding: .4rem .55rem;
    font-size: .8rem; border-radius: 8px; background: var(--warn-weak); color: var(--warn);
}
.request-actions { display: flex; justify-content: flex-end; gap: .4rem; margin-top: auto; }

.warn-box {
    border-radius: 10px; padding: .7rem .85rem; background: var(--warn-weak);
    border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); font-size: .85rem;
}
.warn-title { display: flex; align-items: center; gap: .4rem; font-weight: 700; color: var(--warn); margin-bottom: .45rem; }
.warn-box ul { list-style: none; margin: 0 0 .4rem; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.warn-box li { display: flex; gap: .5rem; align-items: flex-start; }
.warn-line { color: var(--text); }
.warn-box small { color: var(--muted); }
.info-box { margin: 0; padding: .55rem .75rem; border-radius: 10px; background: var(--accent-weak); font-size: .87rem; }
.field > small { font-size: .78rem; }

.details { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: .55rem .75rem; margin: .9rem 0; font-size: .9rem; }
.details dt { color: var(--muted); font-weight: 600; font-size: .8rem; padding-top: .1rem; }
.details dd { margin: 0; }
.details dd.inline { display: flex; align-items: center; gap: .4rem; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.people li { display: flex; align-items: center; gap: .45rem; }

/* ===== Invitaciones / registro ===== */
.mb { margin-bottom: 1.25rem; }
.small-text { font-size: .78rem; }
.request-name { font-weight: 600; font-size: 1rem; margin: .3rem 0 .2rem; }
.request-msg { margin: .5rem 0 0; font-size: .87rem; font-style: italic; color: var(--muted); }
.inv-status { font-size: .8rem; font-weight: 600; }
.inv-status.on { color: var(--ok); }
.inv-status.used { color: var(--accent); }
.inv-status.off { color: var(--muted); }
.copy-row { display: flex; gap: .5rem; }
.copy-row input {
    flex: 1; min-width: 0; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 9px;
    background: var(--surface-2); font-family: ui-monospace, Consolas, monospace; font-size: .82rem;
}

.public-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.auth-card {
    width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; box-shadow: var(--shadow); padding: 1.75rem 1.5rem;
    display: flex; flex-direction: column; gap: .75rem;
}
.auth-card .brand { padding: 0 0 .5rem; }
.auth-card h1 { font-size: 1.35rem; }
.btn.block { width: 100%; justify-content: center; padding: .65rem; }
.center { text-align: center; }

/* ===== Sesión / avisos ===== */
.whoami-name { font-weight: 600; font-size: .9rem; }
.toast {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 200; max-width: min(420px, calc(100vw - 2rem));
    display: flex; align-items: center; gap: .6rem; padding: .7rem .6rem .7rem .9rem;
    background: var(--surface); color: var(--text); border: 1px solid var(--border);
    border-left: 4px solid var(--danger); border-radius: 10px; box-shadow: var(--shadow-lg); font-size: .88rem;
}
.toast > .icon { color: var(--danger); }
.toast > span { flex: 1; }

/* ===== Apariencia / perfil ===== */
.theme-picker { position: relative; }
.icon-btn.bell { position: relative; }
.bell-badge {
    position: absolute; top: 0; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
    display: grid; place-items: center; background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700;
    box-shadow: 0 0 0 2px var(--surface);
}
.theme-panel .actions { display: flex; gap: .4rem; }
.theme-backdrop { position: fixed; inset: 0; z-index: 40; }
.theme-panel {
    position: absolute; right: 0; top: calc(100% + .4rem); z-index: 41; width: 260px;
    display: flex; flex-direction: column; gap: .8rem; padding: .9rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.whoami-link { display: flex; align-items: center; gap: .5rem; color: inherit; text-decoration: none; border: 0; background: none; border-radius: 999px; padding: 2px .4rem 2px 2px; cursor: pointer; }
.whoami-link:hover { background: var(--surface-2); }

.avatar.photo { background: var(--surface-2); overflow: hidden; }
.avatar.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.emoji { background: color-mix(in srgb, var(--c) 22%, var(--surface)); font-size: calc(var(--s) * .55); line-height: 1; }
.avatar-editor { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.avatar-actions { display: flex; flex-direction: column; gap: .5rem; flex: 1; min-width: 200px; }
.emoji-grid { display: flex; flex-wrap: wrap; gap: .3rem; }
.emoji-opt {
    width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
    font-size: 1.1rem; display: grid; place-items: center; padding: 0;
}
.emoji-opt.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ===== Indicadores de carga ===== */
.spinner {
    display: inline-block; width: 14px; height: 14px; flex-shrink: 0; vertical-align: -2px;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
    animation: spin .7s linear infinite; opacity: .85;
}
/* Grande: anillo tenue con un arco del color de acento girando. */
.spinner.lg {
    width: 56px; height: 56px; border-width: 5px; opacity: 1;
    border-color: color-mix(in srgb, var(--accent) 18%, transparent);
    border-top-color: var(--accent);
    animation-duration: .8s;
}
.btn .spinner { margin-right: .15rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Llamadas a la API en curso: tarjeta al centro de la pantalla. No bloquea clics y
   aparece con un pequeño retraso para no parpadear en respuestas rápidas. */
.busy-overlay {
    position: fixed; inset: 0; z-index: 300; display: grid; place-items: center;
    pointer-events: none; animation: fade .2s ease .3s both;
}
.busy-card {
    display: flex; flex-direction: column; align-items: center; gap: .85rem;
    max-width: min(320px, calc(100vw - 2rem)); padding: 1.4rem 1.6rem; border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg); text-align: center; font-size: .85rem; color: var(--muted);
}

.busy-note {
    position: fixed; top: .75rem; left: 50%; transform: translateX(-50%); z-index: 300;
    display: flex; align-items: center; gap: .5rem; max-width: calc(100vw - 2rem);
    padding: .5rem .85rem; border-radius: 999px; font-size: .85rem;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.page-loading {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
    min-height: 55vh; padding: 2rem 1rem; text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 2.5s; }
}

/* ===== Grupos ===== */
.group-tag {
    display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600;
    padding: .1rem .5rem; border-radius: 999px;
    background: color-mix(in srgb, var(--g) 16%, var(--surface)); color: color-mix(in srgb, var(--g) 80%, var(--text));
}
.group-filter { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.chip {
    display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .75rem; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    font-size: .82rem; font-weight: 500; text-decoration: none;
}
.chip.on { border-color: var(--g, var(--accent)); background: color-mix(in srgb, var(--g, var(--accent)) 14%, var(--surface)); }
.chip.ghost { border-style: dashed; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--g, var(--accent)); flex-shrink: 0; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; }
.group-card {
    display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; padding: 1rem;
    text-align: left; color: var(--text); background: var(--surface); border: 1px solid var(--border);
    border-left: 4px solid var(--g); border-radius: var(--radius); box-shadow: var(--shadow);
}
.group-card:hover { border-color: var(--g); }
.group-card-name { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; font-size: 1rem; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    .days5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .legend { display: none; }
}

@media (max-width: 800px) {
    .shell { flex-direction: column; }
    .sidebar {
        position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 50;
        width: auto; height: auto; padding: .3rem .5rem;
        flex-direction: row; border-right: 0; border-top: 1px solid var(--border);
    }
    .brand { display: none; }
    .nav { flex-direction: row; justify-content: space-around; width: 100%; }
    .nav a { flex-direction: column; gap: .15rem; font-size: .7rem; padding: .35rem .5rem; }
    .nav-badge { position: absolute; top: 0; right: 0; margin: 0; min-width: 16px; height: 16px; font-size: .62rem; }
    .details { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
    .details dd { margin-bottom: .4rem; }
    .topbar { padding: .6rem 1rem; gap: .6rem; }
    .whoami-name { display: none; }
    .toast { bottom: 4.5rem; }
    .content { padding: 1rem 1rem 5.5rem; }
    h1 { font-size: 1.35rem; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .days5 { grid-template-columns: minmax(0, 1fr); }
    .day-card { min-height: 0; }
    .week { grid-template-columns: minmax(0, 1fr); }
    .week-col { min-height: 0; }
    .month .item-time { display: none; }
    .cell { min-height: 76px; }
    .row { grid-template-columns: minmax(0, 1fr); }
    .task-row .prio { display: none; }
}

@media (max-width: 520px) {
    .day-items.compact .item { padding: .15rem .25rem; }
    .day-items.compact .item-title { font-size: .68rem; }
    .day-items.compact .item.task input { display: none; }
}

/* ===== Blazor loading / error ===== */
.boot-loading {
    position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1rem; background: var(--bg);
}
.loading-progress-text { font-weight: 600; color: var(--muted); font-size: .9rem; }
.loading-progress-text::after { content: var(--blazor-load-percentage-text, "Cargando"); }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; width: 100%; z-index: 1000;
    padding: .7rem 1.25rem; background: var(--warn-weak); color: var(--text); box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* ===== Bandeja de avisos (campana) ===== */
.theme-panel.inbox { width: min(360px, calc(100vw - 2rem)); gap: .5rem; padding: .75rem; }
.inbox-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.inbox-list { list-style: none; margin: 0; padding: 0; max-height: min(60vh, 420px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.inbox-item {
    width: 100%; text-align: left; border: 0; background: none; border-radius: 9px; padding: .5rem .6rem;
    display: flex; flex-direction: column; gap: .1rem; cursor: pointer; border-left: 3px solid transparent;
}
.inbox-item:hover { background: var(--surface-2); }
.inbox-item.unread { background: var(--accent-weak); border-left-color: var(--accent); }
.inbox-title { font-size: .88rem; font-weight: 600; }
.inbox-item:not(.unread) .inbox-title { font-weight: 500; }
.inbox-body, .inbox-time { font-size: .78rem; }
.inbox-empty { padding: 1rem; text-align: center; }
.inbox-settings { font-size: .8rem; align-self: center; }

/* ===== Menú de perfil ===== */
.theme-panel.profile-menu { width: 250px; gap: .2rem; padding: .5rem; }
.profile-head { display: flex; align-items: center; gap: .6rem; padding: .4rem .4rem .6rem; border-bottom: 1px solid var(--border); margin-bottom: .2rem; }
.profile-head > div { display: flex; flex-direction: column; min-width: 0; }
.profile-head small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item {
    display: flex; align-items: center; gap: .55rem; width: 100%; padding: .55rem .6rem; border: 0; border-radius: 8px;
    background: none; color: inherit; text-decoration: none; font-size: .9rem; text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); }

/* ===== Ajustes ===== */
.settings-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1rem 1.1rem; margin-bottom: 1rem; max-width: 640px; display: flex; flex-direction: column; gap: .6rem; align-items: flex-start;
}
.settings-card .section-title { display: flex; align-items: center; gap: .45rem; margin: 0; }
.settings-card p { margin: 0; }
.settings-card .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.tag.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }

/* ===== Hora clásica (HH : MM) ===== */
.time-field {
    display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .5rem; width: fit-content;
    border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--muted);
}
.field .time-field select, .time-field select {
    width: auto; border: 0; background: transparent; padding: .3rem .2rem; font-size: 1.05rem; font-weight: 600;
    font-variant-numeric: tabular-nums; color: var(--text); box-shadow: none; appearance: none; text-align: center;
}
.time-field select:focus { outline: 2px solid var(--accent-weak); border-radius: 6px; }
.time-sep { font-weight: 700; color: var(--text); }
.time-field.disabled { opacity: .5; }
.time-field .icon-btn { width: 26px; height: 26px; }

/* ===== Cumplimiento ===== */
.rater { gap: .45rem; }
.rater-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.rater-row input[type="range"] { flex: 1; min-width: 140px; accent-color: var(--accent); padding: 0; border: 0; box-shadow: none; }
.rater-pct { min-width: 3.2rem; text-align: right; font-variant-numeric: tabular-nums; }
.rater-date { min-width: 6.5rem; font-size: .82rem; }
.tag.completion { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); font-weight: 700; }
.people.inline { flex-direction: row; flex-wrap: wrap; gap: .4rem .9rem; }

@media (max-width: 800px) {
    .group-select { max-width: 8.5rem; }
    .topbar .theme-picker:has(.theme-panel.inbox) { position: static; }
    .theme-panel.inbox { right: .5rem; left: .5rem; width: auto; }
}

/* ===== Módulos ===== */
.sidebar .brand { display: none; }
.topbar > * { order: 3; }
.topbar > .module-switcher { order: 0; }
.topbar > .topbar-view { order: 1; min-width: 0; }
.topbar > .spacer { order: 2; }
.module-btn {
    display: flex; align-items: center; gap: .5rem; border: 0; background: none; color: var(--text);
    padding: .25rem .5rem .25rem .25rem; border-radius: 10px; font-weight: 700; cursor: pointer;
}
.module-btn:hover { background: var(--surface-2); }
.brand-mark.sm { width: 28px; height: 28px; border-radius: 8px; font-size: .7rem; }
.module-switcher .theme-panel { left: 0; right: auto; }
.theme-panel.module-panel { width: 290px; gap: .3rem; padding: .6rem; }
.module-opt {
    display: flex; align-items: center; gap: .65rem; padding: .55rem; border-radius: 10px;
    color: var(--text); text-decoration: none;
}
.module-opt:hover { background: var(--surface-2); }
.module-opt.on { background: var(--accent-weak); }
.module-opt .icon:last-child { color: var(--accent); }
.module-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); flex-shrink: 0; }
.module-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.module-text small { font-size: .76rem; }
.coming-soon {
    max-width: 460px; margin: 8vh auto 0; text-align: center; display: flex; flex-direction: column;
    align-items: center; gap: .75rem; padding: 2rem 1.25rem; background: var(--surface);
    border: 1px dashed var(--border); border-radius: 20px;
}
.coming-icon { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; background: var(--accent-weak); color: var(--accent); }
.whoami-link { position: relative; }

/* ===== Vista Yo / Grupo / Los demás ===== */
.view-toggle .seg button { white-space: nowrap; }
.view-toggle { position: relative; }
.group-btn { display: inline-flex; align-items: center; gap: .3rem; min-width: 0; }
.group-btn .dot { background: var(--g); }
.group-btn-name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-panel.group-menu { left: 0; right: auto; width: 240px; gap: .15rem; padding: .4rem; }
.group-menu .menu-item.on { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
a.btn { color: inherit; text-decoration: none; }
/* Nada puede ensanchar la página en el teléfono (evita tener que alejar con los dedos). */
.main, .content { overflow-x: clip; }
html, body { max-width: 100%; }

/* ===== Los demás ===== */
.others-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .9rem; }
.other-card {
    background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--c);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: .85rem; display: flex; flex-direction: column; gap: .6rem;
}
.other-head { display: flex; align-items: center; gap: .6rem; }
.other-who { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.other-who small { font-size: .78rem; }
.other-who .free { color: var(--ok); font-weight: 600; }
.other-empty { font-size: .85rem; margin: 0; }
.other-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.other-day { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: .5rem; align-items: start; }
.other-date { font-size: .78rem; font-weight: 600; color: var(--muted); padding-top: .2rem; }
.other-date.today { color: var(--accent); }
.other-items { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.other-item {
    display: flex; align-items: center; gap: .35rem; font-size: .85rem; padding: .25rem .5rem; border-radius: 7px;
    background: color-mix(in srgb, var(--c) 12%, var(--surface)); border-left: 3px solid var(--c); min-width: 0;
}
.other-item > span:last-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.other-item.private { background: var(--surface-2); border-left-color: var(--border); color: var(--muted); font-style: italic; }
.other-item.done > span:last-of-type { text-decoration: line-through; opacity: .7; }
.others-hint { margin: 1rem 0 0; }

/* ===== Cómo te fue (seguimiento) ===== */
.follow-up { margin-bottom: 1.25rem; }
.follow-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.follow-item {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .65rem .8rem;
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: var(--radius);
}
.follow-text { display: flex; flex-direction: column; flex: 1; min-width: 180px; }
.follow-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.quick-dates { display: flex; flex-wrap: wrap; gap: .4rem; }
.item.missed .item-title { text-decoration: line-through; color: var(--muted); }
button.item.done .item-title { text-decoration: line-through; color: var(--muted); }

/* ===== Editor: tipo, plantillas, visible ===== */
.kind-seg { align-self: flex-start; }
.kind-seg button { display: inline-flex; align-items: center; gap: .35rem; }
.template-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.template-chips .chip { cursor: pointer; }
.check-hint { margin-top: -.5rem; padding-left: 1.6rem; font-size: .78rem; }
.check .icon { color: var(--muted); }

/* ===== Perfil / administración ===== */
.profile-hero {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1.1rem; margin-bottom: 1rem;
    background: linear-gradient(135deg, color-mix(in srgb, var(--c) 16%, var(--surface)), var(--surface));
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.profile-hero-text { display: flex; flex-direction: column; gap: .2rem; flex: 1; min-width: 180px; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; align-items: start; }
.profile-grid .settings-card { max-width: none; margin: 0; }
.settings-card .menu-item { padding-left: .2rem; }
.session-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.session-list li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 10px; }
.session-info { display: grid; gap: .1rem; min-width: 0; }
.session-info strong { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.form.full { width: 100%; }
.link-btn.back { display: inline-flex; align-items: center; gap: .2rem; padding: 0; margin-bottom: .3rem; text-decoration: none; }
.member-list { display: flex; flex-direction: column; gap: .5rem; }
.member-card {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .7rem .85rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.member-card.inactive { opacity: .65; }
.member-card.inactive .avatar { filter: grayscale(1); }
.member-main { display: flex; flex-direction: column; gap: .15rem; flex: 1; min-width: 180px; }
.member-name { display: flex; align-items: center; gap: .4rem; }
.member-email { font-size: .85rem; overflow-wrap: anywhere; }
.member-tags { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .15rem; }
.member-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.menu-item .badge { margin-left: auto; }

/* ===== Métricas ===== */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .9rem; }
.metric-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1rem; display: flex; flex-direction: column; gap: .7rem;
}
.metric-card .section-title { margin: 0; }
.metric-card p { margin: 0; }
.metric-hero { display: flex; align-items: baseline; gap: .5rem; }
.meter { display: flex; flex-direction: column; gap: .3rem; }
.meter-head { display: flex; justify-content: space-between; gap: .75rem; font-size: .85rem; }
.meter-head .muted { font-variant-numeric: tabular-nums; white-space: nowrap; }
.meter-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 4px; background: var(--accent); transition: width .4s ease; }

/* ===== Carita de carga (servidor despertando) ===== */
.wake { display: flex; flex-direction: column; align-items: center; gap: .8rem; text-align: center; max-width: 300px; }
.wake-msg { margin: 0; font-weight: 600; color: var(--text); min-height: 1.4em; }
.wake .loading-progress-text { font-size: .8rem; }
.mascot {
    position: relative; width: 112px; height: 112px; border: 0; padding: 0; background: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.m-body {
    position: absolute; inset: 10px; border-radius: 46% 46% 42% 42%;
    background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 55%, #fff), var(--accent));
    box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 35%, transparent), inset 0 -6px 0 rgba(0, 0, 0, .08);
    animation: breathe 2.6s ease-in-out infinite;
}
.m-eye {
    position: absolute; top: 40%; width: 16px; height: 8px; border: 3px solid #1b2232; border-top: 0;
    border-radius: 0 0 16px 16px; transition: all .15s;
}
.m-eye.l { left: 24%; }
.m-eye.r { right: 24%; }
.m-cheek { position: absolute; top: 56%; width: 12px; height: 7px; border-radius: 50%; background: #ff8fab; opacity: .65; }
.m-cheek.l { left: 15%; }
.m-cheek.r { right: 15%; }
.m-mouth {
    position: absolute; left: 50%; top: 62%; width: 12px; height: 6px; margin-left: -6px;
    border: 3px solid #1b2232; border-top: 0; border-radius: 0 0 12px 12px; transition: all .15s;
}
.m-z {
    position: absolute; right: 2px; top: 18px; font-weight: 800; color: var(--accent); opacity: 0;
    animation: zzz 3s ease-in infinite;
}
.m-z.z2 { animation-delay: 1s; font-size: 1.1rem; }
.m-z.z3 { animation-delay: 2s; font-size: 1.35rem; }
/* Al tocarla despierta: salta, abre los ojos (parpadean) y abre la boca. */
.mascot.awake .m-eye { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #1b2232; animation: blink 1.6s infinite; }
.mascot.awake .m-mouth { width: 12px; height: 12px; border: 3px solid #1b2232; border-radius: 50%; }
.mascot.awake .m-z { display: none; }
.mascot.poke .m-body { animation: jump .6s cubic-bezier(.3, 1.6, .5, 1); }
.wake.compact .mascot { width: 84px; height: 84px; }
.wake.compact .m-eye { width: 12px; height: 6px; border-width: 2.5px; }
.wake.compact .wake-msg { font-size: .85rem; }
.busy-card.slow { pointer-events: auto; }
@keyframes breathe { 50% { transform: translateY(3px) scale(1.03, .97); } }
@keyframes jump { 0% { transform: none; } 40% { transform: translateY(-22px) scale(.95, 1.06); } 70% { transform: translateY(0) scale(1.08, .92); } 100% { transform: none; } }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(14px, -34px) scale(1.1); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@media (prefers-reduced-motion: reduce) {
    .m-body, .m-z { animation: none; }
    .m-z { opacity: .6; }
}

/* ===== Barra superior en el teléfono: avatar siempre arriba, la vista en una segunda fila ===== */
@media (max-width: 800px) {
    .topbar { row-gap: .5rem; column-gap: .35rem; flex-wrap: wrap; }
    .topbar > .tag { display: none; }
    .topbar > .spacer { min-width: 0; }
    .module-btn { gap: .35rem; padding-right: .3rem; }
    .topbar > .topbar-view { order: 10; flex-basis: 100%; }
    .topbar-view .view-toggle { width: 100%; }
    .topbar-view .seg { flex: 1; }
    .topbar-view .seg button { flex: 1; justify-content: center; }
    .topbar-view .seg button { padding: .35rem .65rem; font-size: .85rem; }
    .group-btn-name { max-width: 6rem; }
    .theme-panel.group-menu { left: 0; right: 0; width: auto; }
    .module-name { max-width: 6.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .topbar .theme-picker:has(.theme-panel:not(.module-panel):not(.group-menu)) { position: static; }
    .topbar .theme-panel:not(.module-panel):not(.group-menu) { right: .5rem; left: auto; top: 3.4rem; }
    .others-grid, .metrics-grid, .profile-grid { grid-template-columns: minmax(0, 1fr); }
    .nav a { padding: .35rem .3rem; }
    .page-head .actions .btn { padding: .45rem .7rem; font-size: .85rem; }
    .month .item .icon, .month .item .avatar-stack { display: none; }
    .month .cell, .month .item { min-width: 0; overflow: hidden; }
}

/* Tarjetas y filas nunca más anchas que la pantalla (un título largo se corta con "…"). */
.day-card, .other-card, .metric-card, .task-row, .follow-item, .request { min-width: 0; max-width: 100%; }
.vis-seg { align-self: flex-start; flex-wrap: wrap; }
.vis-seg button { display: inline-flex; align-items: center; gap: .35rem; }

/* ===== Cumplida / Fallida ===== */
.task-outcome { display: flex; gap: .35rem; flex-shrink: 0; }
.outcome-btn {
    display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .7rem; border-radius: 999px;
    font-size: .82rem; font-weight: 600; background: var(--surface); white-space: nowrap;
}
.outcome-btn.ok { color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 45%, var(--border)); }
.outcome-btn.fail { color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--border)); }
.outcome-btn.ok:hover, .outcome-btn.ok.on { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); }
.outcome-btn.fail:hover, .outcome-btn.fail.on { background: var(--danger-weak); }
.task-row.missed .task-title { text-decoration: line-through; color: var(--muted); }
.item.task.missed .item-title { text-decoration: line-through; color: var(--danger); opacity: .8; }
@media (max-width: 800px) {
    .task-row { flex-wrap: wrap; }
    .task-row .task-outcome { flex-basis: 100%; }
    .task-row .task-outcome .outcome-btn { flex: 1; justify-content: center; }
}

/* ===== Chips de grupo fijos (Mis grupos) ===== */
.view-toggle { flex-wrap: wrap; row-gap: .45rem; }
.group-chips { display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.group-chips::-webkit-scrollbar { display: none; }
.group-chips .chip { flex-shrink: 0; cursor: pointer; }
@media (max-width: 800px) {
    .topbar-view .group-chips { flex-basis: 100%; }
}
.item.busy.public { font-style: normal; color: var(--text); background: color-mix(in srgb, var(--c) 12%, var(--surface)); border-left-color: var(--c); }
.brand-mark svg { display: block; }
.brand-mark { background: linear-gradient(145deg, color-mix(in srgb, var(--accent-l) 85%, #fff), var(--accent-l)); box-shadow: 0 2px 6px color-mix(in srgb, var(--accent-l) 35%, transparent); }

/* ===== Novedades ===== */
.release-list { display: flex; flex-direction: column; gap: .9rem; max-width: 720px; }
.release-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .4rem;
}
.release-card.latest { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.release-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.release-section { font-size: .85rem; margin-top: .4rem; }
.release-items { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
.admin-list .check { gap: .5rem; }
.group-card-name .tag { margin-left: .25rem; }
.group-view-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.group-view-head .hint { margin: 0; }

/* ===== Cargando (operaciones): al centro, con el tema, y bloqueando la pantalla ===== */
.busy-overlay { pointer-events: auto; cursor: progress; animation: none; }
.busy-overlay::before {
    content: ""; position: absolute; inset: 0;
    background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(2px);
    animation: fade .2s ease .25s both;
}
.busy-overlay .busy-card {
    position: relative; padding: 1.4rem 1.8rem; gap: .9rem; min-width: 150px;
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
    box-shadow: var(--shadow-lg), 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent);
    animation: pop .25s cubic-bezier(.3, 1.4, .5, 1) .25s both;
}
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
.loader { position: relative; width: 64px; height: 64px; display: grid; place-items: center; }
.loader-ring {
    position: absolute; inset: 0; border-radius: 50%;
    border: 4px solid color-mix(in srgb, var(--accent) 15%, transparent);
    border-top-color: var(--accent); border-right-color: color-mix(in srgb, var(--accent) 55%, transparent);
    animation: spin .9s linear infinite;
}
.loader .brand-mark { width: 34px; height: 34px; border-radius: 10px; animation: beat 1.4s ease-in-out infinite; }
.loader-text { font-size: .88rem; font-weight: 600; color: var(--text); }
.page-loading .loader-text { color: var(--muted); }
@keyframes beat { 50% { transform: scale(.9); } }
@media (prefers-reduced-motion: reduce) {
    .loader-ring { animation-duration: 2.5s; }
    .loader .brand-mark { animation: none; }
}

/* =====================================================================
   Rediseño 1.5: superficies translúcidas, fondo con tinte del acento,
   transiciones entre secciones y ajustes táctiles para el teléfono.
   Va al final para sobrescribir lo anterior sin tocarlo.
   ===================================================================== */
:root {
    --radius: 14px;
    --glass: color-mix(in srgb, var(--surface) 72%, transparent);
    --card: color-mix(in srgb, var(--surface) 86%, transparent);
    --card-border: color-mix(in srgb, var(--border) 75%, transparent);
    --ease: cubic-bezier(.2, .8, .2, 1);
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px rgba(16, 24, 40, .06);
}
:root[data-theme="dark"] {
    --bg: #0b0f1a;
    --surface: #151a2b;
    --surface-2: #1b2135;
    --border: #283048;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .25);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg: #0b0f1a;
        --surface: #151a2b;
        --surface-2: #1b2135;
        --border: #283048;
        --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .25);
    }
}

body {
    background:
        radial-gradient(1200px 600px at -10% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--shared) 9%, transparent), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    -webkit-tap-highlight-color: transparent;
}

/* Barras de vidrio */
.topbar, .sidebar {
    background: var(--glass);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    backdrop-filter: blur(18px) saturate(1.5);
    border-color: var(--card-border);
}
.topbar { padding-top: max(.7rem, env(safe-area-inset-top)); }

/* Tarjetas translúcidas */
.day-card, .task-list, .request, .other-card, .week-col, .settings-card, .group-card, .metric-card,
.release-card, .member-card, .follow-item, .stat, .auth-card, .table-wrap, .lanes-wrap {
    background: var(--card);
    border-color: var(--card-border);
    box-shadow: var(--shadow);
}
.day-card.today, .release-card.latest { border-color: var(--accent); }
.request, .follow-item { border-left-color: var(--c); }
.group-card { border-left-color: var(--g); }
.other-card { border-top-color: var(--c); }
.empty-state { background: color-mix(in srgb, var(--surface) 55%, transparent); border-color: var(--card-border); }
.stat { transition: transform .15s var(--ease), border-color .15s; }
.stat:active { transform: scale(.98); }

/* Controles */
.btn { border-radius: 11px; transition: background .15s, transform .1s var(--ease), box-shadow .15s; }
.btn:active:not(:disabled), .icon-btn:active, .outcome-btn:active, .pill-tab:active { transform: scale(.96); }
.btn.primary {
    background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 82%, #fff), var(--accent));
    border-color: transparent;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn.danger.solid { background: var(--danger); color: #fff; }
.btn.danger.solid:hover { background: var(--danger); filter: brightness(1.08); }
.seg { background: color-mix(in srgb, var(--surface-2) 80%, transparent); border-color: var(--card-border); border-radius: 12px; }
.seg button { border-radius: 9px; transition: background .2s var(--ease), color .2s, box-shadow .2s; }
.seg button.on { background: var(--surface); color: var(--accent); }
.field input, .field select, .field textarea { background: color-mix(in srgb, var(--surface) 92%, transparent); border-radius: 11px; }

/* Entrada de cada sección y pestaña.
   "backwards" y no "both": al terminar no debe quedar un transform fijo, porque convertiría el
   elemento en contenedor de los position: fixed internos (un aviso dentro de un modal quedaría atrapado). */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.content > :not(.modal-backdrop) { animation: rise .32s var(--ease) backwards; }
.content > *:nth-child(2) { animation-delay: .03s; }
.content > *:nth-child(3) { animation-delay: .06s; }
.tab-panel { animation: rise .25s var(--ease) backwards; }
.nav a { transition: background .2s var(--ease), color .2s; }

/* Pestañas tipo píldora (Tareas): una fila que se desliza en el teléfono */
.pill-tabs {
    display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; margin: 0 0 1rem;
    padding: .2rem .1rem .35rem; scroll-snap-type: x proximity;
}
.pill-tabs::-webkit-scrollbar { display: none; }
.pill-tab {
    flex-shrink: 0; scroll-snap-align: start; display: inline-flex; align-items: center; gap: .4rem;
    padding: .5rem .85rem; border-radius: 999px; font-weight: 600; font-size: .88rem;
    border: 1px solid var(--card-border); background: var(--card); color: var(--muted);
    transition: background .2s var(--ease), color .2s, border-color .2s, transform .1s;
}
.pill-tab:hover { color: var(--text); }
.pill-tab.on {
    color: var(--on-accent); border-color: transparent;
    background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 82%, #fff), var(--accent));
    box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent);
}
.pill-tab .badge { background: color-mix(in srgb, currentColor 14%, transparent); color: inherit; }
.pill-tab .badge.accent { background: var(--accent); color: var(--on-accent); }
.pill-tab.on .badge, .pill-tab.on .badge.accent { background: color-mix(in srgb, var(--on-accent) 22%, transparent); color: var(--on-accent); }
.group-title { align-items: center; }
.group-title .count {
    font-weight: 700; min-width: 1.4rem; height: 1.2rem; padding: 0 .35rem; border-radius: 999px;
    display: inline-grid; place-items: center; background: color-mix(in srgb, currentColor 12%, transparent);
}
.group-title.ok { color: var(--ok); }
.group-title.accent { color: var(--accent); }

/* Filas de tareas */
.task-row { border-left-width: 4px; transition: background .15s; }
.task-row:hover { background: color-mix(in srgb, var(--c) 5%, transparent); }
.task-row + .task-row { border-top-color: var(--card-border); }

/* Ítems del calendario */
.item { border-radius: 7px; transition: background .15s, transform .1s; }
.item:active { transform: scale(.98); }
.month { border-color: var(--card-border); background: var(--card-border); box-shadow: var(--shadow); }
.dow { background: color-mix(in srgb, var(--surface-2) 85%, transparent); text-align: center; }
.cell { background: var(--card); }
.cell.other { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.cell.today { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.cell.today .cell-num { box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 45%, transparent); }

/* Detalle (solo lectura) */
.detail-hero {
    display: flex; align-items: center; gap: .75rem; padding: .8rem .9rem; margin-top: .25rem;
    border-radius: 14px; border: 1px solid color-mix(in srgb, var(--c) 30%, var(--border));
    background: linear-gradient(135deg, color-mix(in srgb, var(--c) 18%, var(--surface)), color-mix(in srgb, var(--c) 5%, var(--surface)));
}
.detail-icon {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center;
    background: var(--c); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--c) 40%, transparent);
}
.detail-when { display: flex; flex-direction: column; gap: .1rem; flex: 1; min-width: 0; }
.detail-when strong { font-size: 1rem; }
.detail-when small { font-size: .8rem; }
.notes-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.confirm-delete { display: inline-flex; align-items: center; gap: .2rem; animation: pop .2s var(--ease); }

/* Modal: vidrio y entrada suave */
.modal-backdrop {
    background: color-mix(in srgb, #050814 45%, transparent);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.modal { border: 1px solid var(--card-border); border-radius: 20px; animation: modal-in .28s var(--ease) backwards; }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ===== Teléfono ===== */
@media (max-width: 800px) {
    /* Menú inferior flotante tipo isla */
    .sidebar {
        left: .6rem; right: .6rem; bottom: calc(.5rem + env(safe-area-inset-bottom, 0px));
        border: 1px solid var(--card-border); border-radius: 22px; padding: .3rem;
        box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
        /* Capa propia: al ocultarse la barra del navegador al hacer scroll, el vidrio (backdrop-filter)
           no se repinta a medias y el menú no queda cortado. */
        transform: translateZ(0);
        will-change: transform;
    }
    /* Fondo fijo + vidrio fijo obligan a repintar todo en cada scroll del teléfono. */
    body { background-attachment: scroll; }
    .nav a { border-radius: 16px; padding: .4rem .2rem; flex: 1; align-items: center; }
    .nav a.active { background: color-mix(in srgb, var(--accent) 16%, transparent); }
    .nav a.active .icon { transform: translateY(-1px) scale(1.08); transition: transform .2s var(--ease); }
    .content { padding: .9rem .9rem calc(6.5rem + env(safe-area-inset-bottom)); }
    .toast { bottom: calc(5.5rem + env(safe-area-inset-bottom)); left: 1rem; right: 1rem; max-width: none; }

    /* Detalles y editores como hoja inferior */
    .modal-backdrop { place-items: end center; padding: 0; }
    .modal {
        width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; border-bottom: 0;
        animation: sheet-in .32s var(--ease) backwards;
    }
    .modal-head { position: relative; padding-top: 1.35rem; }
    .modal-head::before {
        content: ""; position: absolute; top: .55rem; left: 50%; width: 38px; height: 4px; margin-left: -19px;
        border-radius: 4px; background: var(--border);
    }
    .modal-foot { padding-bottom: calc(.85rem + env(safe-area-inset-bottom)); }

    /* Toques cómodos */
    .btn { min-height: 40px; }
    .btn.small { min-height: 34px; }
    .icon-btn { width: 38px; height: 38px; }
    .field input, .field select, .field textarea { min-height: 44px; font-size: 16px; }
    .page-head { margin-bottom: 1rem; align-items: center; }
    .cell { min-height: 84px; padding: .25rem .2rem; }
    .cell-num { align-self: center; margin-bottom: .1rem; }
    .dow { padding: .4rem .2rem; font-size: .72rem; }
    .cal-toolbar .period { font-size: 1.05rem; }
    .page-head .actions .seg button { padding: .38rem .6rem; }
    /* Celdas chicas: tocar en cualquier parte abre el día (los ítems se tocan desde su listado). */
    .month .day-items, .lane-cell .day-items { pointer-events: none; }
}

/* Día abierto */
.cell-num { display: inline-grid; place-items: center; }
.week-head { cursor: pointer; border-radius: 8px; }
.week-head:hover .week-num { color: var(--accent); }
.day-person {
    display: flex; align-items: center; gap: .55rem; padding: .55rem .7rem; margin-bottom: .75rem;
    border-radius: 12px; border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface));
}
.modal .day-items { gap: .45rem; }
.modal .day-items .item { padding: .55rem .65rem; font-size: .9rem; }
@keyframes sheet-in { from { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
    .content > *, .tab-panel, .modal, .confirm-delete { animation: none !important; }
}

/* Circulito de la persona en Integrantes (Mes, Semana y día) */
.item-owner { display: inline-flex; flex-shrink: 0; }
.item-owner .avatar { box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 60%, transparent); }

/* ===== Módulo Ventas ===== */
.shop-bar { display: flex; align-items: center; gap: .4rem; margin: -.25rem 0 1rem; min-width: 0; }
.shop-bar .group-chips { flex: 1; min-width: 0; }
.month-nav { display: flex; align-items: center; justify-content: center; gap: .75rem; margin: 0 0 1rem; }
.month-nav strong { min-width: 9rem; text-align: center; }
.row-amount { font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0; }
.row-amount.due, .due { color: var(--danger); }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; flex-shrink: 0; }
.top-gap { margin-top: 1.25rem; }
.pay-tag { font-size: .7rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; white-space: nowrap; }
.pay-tag.paid { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pay-tag.partial { background: var(--warn-weak); color: var(--warn); }
.pay-tag.pending { background: var(--danger-weak); color: var(--danger); }
.search-row { margin-bottom: .9rem; }
.search-row input {
    width: 100%; padding: .6rem .8rem; border: 1px solid var(--card-border); border-radius: 12px;
    background: var(--card); font-size: 16px;
}

.inline-pick { display: flex; gap: .3rem; align-items: center; }
.inline-pick select { flex: 1; min-width: 0; }
.sale-lines { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .5rem; }
.sale-line {
    display: flex; flex-direction: column; gap: .45rem; padding: .7rem; border-radius: 12px;
    border: 1px solid var(--card-border); background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}
.sale-line select, .sale-line input, .pay-form input, .field input[type=number] {
    width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); min-height: 44px; font-size: 16px;
}
.sale-line-top { display: flex; gap: .3rem; align-items: center; }
.sale-line-input { display: flex; gap: .5rem; align-items: center; }
.sale-line-input .seg { flex-shrink: 0; }
.sale-line-input input { flex: 1; min-width: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.sale-line-preview { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .4rem; }
.sale-line-preview strong { color: var(--text); }
.sale-line-preview .link-btn { padding: 0 .2rem; font-size: .78rem; }
.field.compact > span { font-size: .75rem; }
.sale-total {
    display: flex; justify-content: space-between; align-items: baseline; padding: .75rem .9rem; border-radius: 12px;
    background: var(--accent-weak); font-weight: 600;
}
.sale-total strong { font-size: 1.4rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.pay-seg { flex-wrap: wrap; }
.field .pay-seg + input { margin-top: .4rem; }

.sale-detail-lines { list-style: none; margin: .75rem 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.sale-detail-lines li {
    display: flex; justify-content: space-between; gap: .75rem; padding: .5rem .65rem; border-radius: 10px;
    background: color-mix(in srgb, var(--surface-2) 60%, transparent); font-variant-numeric: tabular-nums;
}
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.mini-stats > div {
    display: flex; flex-direction: column; gap: .1rem; padding: .55rem .6rem; border-radius: 12px;
    background: color-mix(in srgb, var(--surface-2) 60%, transparent); min-width: 0;
}
.mini-stats strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.mini-stats small { font-size: .72rem; }
.modal .month-nav { margin: 1rem 0 .6rem; }
.pay-form { display: flex; flex-direction: column; gap: .6rem; margin-top: .75rem; padding: .75rem; border-radius: 12px; border: 1px dashed var(--border); }
.pay-form .actions { justify-content: flex-end; }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.history-item {
    width: 100%; display: grid; grid-template-columns: 4.8rem minmax(0, 1fr) auto auto; align-items: center; gap: .5rem;
    padding: .5rem .6rem; border: 0; border-radius: 10px; text-align: left; font-size: .86rem;
    background: color-mix(in srgb, var(--surface-2) 50%, transparent);
}
button.history-item:hover { background: var(--surface-2); }
.history-date { color: var(--muted); font-size: .78rem; }
.history-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.history-amount.ok { color: var(--ok); }
.price-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; }
.price-history li { display: flex; justify-content: space-between; }

/* Ventas: selector de negocios y vista propia de cada uno */
.shop-header { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .6rem; }
.shop-header-main { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.shop-header-main strong { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-icon {
    width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
    background: var(--accent-weak); color: var(--accent);
}
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.shop-card {
    display: flex; align-items: center; gap: .85rem; padding: 1rem; text-align: left; color: var(--text); text-decoration: none;
    background: var(--card); border: 1px solid var(--card-border); border-radius: 18px; box-shadow: var(--shadow);
    transition: transform .15s var(--ease), border-color .15s;
}
.shop-card:hover { border-color: var(--accent); }
.shop-card:active { transform: scale(.98); }
.shop-card > .icon:last-child { color: var(--muted); }
.shop-card.new { border-style: dashed; background: transparent; box-shadow: none; }
.shop-card-icon {
    width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex-shrink: 0; color: #fff;
    background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent));
    box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}
.shop-card.new .shop-card-icon { background: var(--surface-2); color: var(--accent); box-shadow: none; }
.shop-card-text { display: flex; flex-direction: column; gap: .1rem; flex: 1; min-width: 0; }
.shop-card-text strong { font-size: 1.05rem; }

.period-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-bottom: .9rem; }
.period-totals > div {
    display: flex; flex-direction: column; gap: .1rem; padding: .6rem .75rem; border-radius: 14px; min-width: 0;
    background: var(--card); border: 1px solid var(--card-border);
}
/* Los montos nunca se cortan: en pantallas angostas la letra se ajusta al ancho. */
.period-totals strong { font-size: clamp(.95rem, 4.4vw, 1.1rem); font-variant-numeric: tabular-nums; white-space: nowrap; }
.period-totals small { font-size: .74rem; }
.sales-month .cell { min-height: 88px; align-items: flex-start; }
.day-sum { font-size: .82rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.day-count { font-size: .7rem; color: var(--muted); display: inline-flex; align-items: center; gap: .25rem; }
.due-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); display: inline-block; }
.sales-week { display: flex; flex-direction: column; gap: .5rem; }
.sales-day { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); overflow: hidden; }
.sales-day.today { border-color: var(--accent); }
.sales-day-head {
    width: 100%; display: flex; align-items: center; gap: .5rem; padding: .65rem .85rem; border: 0; background: none; text-align: left;
}
.sales-day-head > span:first-child { flex: 1; }
.sales-day.today .sales-day-head strong { color: var(--accent); }
.sales-day-list { list-style: none; margin: 0; padding: 0 .5rem .5rem; display: flex; flex-direction: column; gap: .25rem; }
.sales-day-item {
    width: 100%; display: flex; align-items: center; gap: .5rem; padding: .45rem .55rem; border: 0; border-radius: 9px; text-align: left;
    background: color-mix(in srgb, var(--surface-2) 55%, transparent); font-size: .87rem;
}
.sales-day-item .history-text { flex: 1; min-width: 0; }
.pay-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.pay-dot.paid { background: var(--ok); }
.pay-dot.partial { background: var(--warn); }
.pay-dot.pending { background: var(--danger); }
.history-item.day { grid-template-columns: minmax(0, 1fr) auto auto; }
.history-item.day .history-text { display: flex; flex-direction: column; white-space: normal; }
.history-item.day .history-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-customer { display: flex; gap: .35rem; align-items: center; margin-top: .4rem; }
.quick-customer input { flex: 1; min-width: 0; }
.quick-dup { display: flex; align-items: center; gap: .3rem; color: var(--warn); margin-top: .25rem; }
@media (max-width: 800px) {
    .sales-month .cell { min-height: 64px; }
    .day-sum { font-size: .66rem; }
    .day-count { font-size: 0; gap: 0; }
    .day-count .due-dot { margin-top: .15rem; }
}

/* Módulo de entrada (primera vez y Ajustes) */
.module-choices { display: flex; flex-direction: column; gap: .35rem; margin-top: .5rem; }
.module-choices .module-opt { width: 100%; border: 1px solid var(--border); background: var(--surface); font: inherit; text-align: left; cursor: pointer; }
.module-choices .module-opt:disabled { cursor: wait; opacity: .7; }

/* Contraseña temporal recién generada */
.temp-password code { display: block; padding: .6rem .8rem; border-radius: 10px; background: var(--surface-2); font-size: 1.25rem; letter-spacing: .08em; text-align: center; user-select: all; }

/* Anotaciones rápidas (mockup) */
.note-chip { display: inline-flex; align-items: center; gap: .25rem; text-decoration: none; margin-left: auto; white-space: nowrap; }
.note-banner { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; color: var(--text); text-decoration: none; }
.note-banner span { flex: 1; }
.quick-note-bar { display: flex; gap: .5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.quick-note-bar input { flex: 1 1 14rem; min-width: 0; }
.quick-note-bar .quick-note-amount { flex: 0 1 8rem; }
.note-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.note-row {
    display: flex; align-items: center; gap: .75rem; padding: .7rem .85rem; border-radius: 14px;
    background: var(--surface); border: 1px solid var(--card-border, var(--border)); border-left: 4px solid var(--accent);
}
.note-row.old { border-left-color: var(--danger); }
.note-row.done { opacity: .7; border-left-color: var(--border); }
.note-main { display: flex; flex-direction: column; gap: .2rem; flex: 1; min-width: 0; }
.note-text { font-weight: 600; overflow-wrap: anywhere; }
.note-actions { display: flex; gap: .4rem; flex-shrink: 0; }
@media (max-width: 560px) {
    .note-row { flex-direction: column; align-items: stretch; }
    .note-actions { justify-content: flex-end; }
}
.note-source { overflow-wrap: anywhere; }

/* Detalle de deuda del cliente (para imprimir o guardar como PDF) */
.statement-tools { display: flex; align-items: center; gap: .5rem 1rem; margin: 0 auto 1rem; max-width: 720px; flex-wrap: wrap; }
.statement-customer { margin: 0; font-size: 1.3rem; flex: 1; min-width: 0; }
.statement-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.statement-tools > p { flex-basis: 100%; margin: 0; }
.btn.whatsapp { background: #25d366; border-color: #25d366; color: #fff; }
.statement {
    max-width: 720px; margin: 0 auto; padding: 1.75rem; border-radius: 16px;
    background: #fff; color: #1f2430; box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
}
.statement .muted { color: #6b7280; }
.statement-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; padding-bottom: 1rem; border-bottom: 2px solid #1f2430; margin-bottom: 1rem; }
.statement-head h1 { margin: 0 0 .15rem; font-size: 1.4rem; }
.statement-meta { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; font-size: .9rem; }
.statement-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.statement-table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; padding: .4rem .3rem; border-bottom: 1px solid #d1d5db; }
.statement-table td { padding: .45rem .3rem; border-bottom: 1px solid #eef0f3; }
.statement-table .num { text-align: right; white-space: nowrap; }
.statement-table tfoot td { border-bottom: 0; padding-top: .55rem; }
.statement-total td { font-size: 1.1rem; font-weight: 700; border-top: 2px solid #1f2430; }
.statement-empty { padding: 1rem 0; }
.statement-abono td { color: #047857; }
@media (max-width: 560px) {
    .statement { padding: 1.1rem; border-radius: 12px; }
    .statement-meta { align-items: flex-start; }
}
@media print {
    .sidebar, .topbar, .toast, .no-print, .busy-bar { display: none !important; }
    body, .main, .content { background: #fff !important; padding: 0 !important; margin: 0 !important; }
    .statement { box-shadow: none; max-width: none; padding: 0; }
}

/* Resumen: lo más vendido hoy / semana */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 1.25rem; }
.section-head .section-title { margin: 0; }
.top-list { list-style: none; margin: .6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.top-row { display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--card-border, var(--border)); }
.top-rank { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-weight: 700; font-size: .85rem; background: var(--accent-weak); color: var(--accent); }
.top-row:first-child .top-rank { background: var(--accent); color: #fff; }
.top-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .25rem; }
.top-line { display: flex; justify-content: space-between; gap: .5rem; }
.top-line strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.top-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

/* Login: presentación de PlanFamilia junto al formulario */
.login-layout { width: 100%; max-width: 980px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 2.5rem; align-items: center; }
.login-layout .auth-card { width: 100%; max-width: none; margin: 0; }
.login-hero { display: flex; flex-direction: column; gap: 1.1rem; }
.login-hero .brand { padding: 0; }
.login-headline { margin: 0; font-size: clamp(1.5rem, 3.2vw, 2.15rem); line-height: 1.2; letter-spacing: -.01em; }
.login-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .7rem; }
.login-features li { display: flex; gap: .75rem; align-items: flex-start; }
.login-features li div { display: flex; flex-direction: column; gap: .1rem; }
.login-features small { color: var(--muted); font-size: .88rem; }
.login-features .tag { margin-left: .35rem; font-size: .7rem; vertical-align: middle; }
.login-features li.soon { opacity: .7; }
.login-feature-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; background: var(--accent-weak); color: var(--accent); }
@media (max-width: 800px) {
    .login-layout { grid-template-columns: 1fr; gap: 1.5rem; max-width: 460px; }
    .login-headline { font-size: 1.35rem; }
    .login-features { gap: .55rem; }
    .login-features small { font-size: .82rem; }
}

/* ===== Módulo Gastos ===== */
.pay-tag.upcoming { background: var(--surface-2); color: var(--muted); }
.cat-icon {
    width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center;
    background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c);
}
.cat-chip {
    display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .65rem; border-radius: 10px; font-size: .9rem;
    background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); font-weight: 600;
}
.task-row.settled .task-title { color: var(--muted); }
.top-gap-sm { margin-top: .6rem; }
.danger-box { display: flex; align-items: center; gap: .5rem; background: var(--danger-weak); color: var(--danger); }
.filter-row { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-row select {
    flex: 1; min-width: 160px; padding: .5rem .65rem; border-radius: 10px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font: inherit; font-size: .9rem;
}
.day-total { justify-content: space-between; }
.loan-bar { margin-top: .3rem; max-width: 260px; }
.loan-progress { display: flex; flex-direction: column; gap: .35rem; margin: .9rem 0 .25rem; }
.seg.wrap { flex-wrap: wrap; }

/* Aviso de confirmación de Eliminar y acciones dentro de una vista de detalle */
.confirm-host { display: contents; }
.confirm-what { font-weight: 600; font-size: 1rem; margin: 0 0 .35rem; overflow-wrap: anywhere; }
.view-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: .75rem 0 .25rem; }
@media (max-width: 560px) {
    /* El total va solo en su fila (puede tener millones); el resto, de a dos. */
    .period-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .period-totals > div:first-child { grid-column: 1 / -1; }
    .period-totals > div:first-child strong { font-size: 1.35rem; }
}

@media (max-width: 800px) {
    /* Barra superior compacta: menos alto, más lista a la vista. */
    .topbar { padding: max(.45rem, env(safe-area-inset-top)) .8rem .45rem; row-gap: .4rem; }
    .topbar .icon-btn { width: 34px; height: 34px; }
    .topbar-view .seg button { padding: .3rem .55rem; font-size: .84rem; }
    .topbar-view .group-chips .chip { padding: .22rem .65rem; font-size: .8rem; }
    .page-head { margin-bottom: .9rem; gap: .6rem; }
    .page-head p { font-size: .85rem; }

    /* Listados con botón de agregar (Gasto, Cliente, Artículo…): el encabezado de la página, con sus
       botones, queda fijo bajo la barra superior al hacer scroll. --topbar-h lo mide js/layout.js. */
    .content > .page-head:has(.page-add) {
        position: sticky; top: calc(var(--topbar-h, 3.5rem) - 1px); z-index: 9;
        margin-left: -.9rem; margin-right: -.9rem; padding: .55rem .9rem;
        background: var(--bg); border-bottom: 1px solid var(--card-border);
        animation: none;
    }
    .content > .page-head:first-child:has(.page-add) { margin-top: -.9rem; }
}

/* Íconos: la versión rellena solo se ve en la sección activa del menú (la de línea, en el resto).
   .solid se rellena con el color del ícono; .cut son los detalles "calados" con el fondo del menú. */
.icon .ic-fill { display: none; }
.icon .solid { fill: currentColor; }
.icon .cut { stroke: var(--surface); }
.nav a.active .icon .ic-line { display: none; }
.nav a.active .icon .ic-fill { display: inline; }

/* ===== Módulo Compras ===== */
a.task-main { color: inherit; text-decoration: none; }
.quick-add { display: flex; gap: .4rem; margin-bottom: 1rem; }
.quick-add input {
    min-width: 0; min-height: 44px; padding: .55rem .75rem; border-radius: 11px; font-size: 16px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.quick-add .quick-add-name { flex: 1 1 auto; }
.quick-add .quick-add-qty { flex: 0 0 5.5rem; }
.quick-add .btn { min-height: 44px; min-width: 44px; justify-content: center; }
/* Círculo para marcar "comprado": grande para tocarlo con el pulgar. */
.shop-check {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; margin-left: .2rem;
    border: 2px solid var(--border); background: transparent; color: transparent;
    transition: background .15s, border-color .15s, color .15s;
}
.shop-check:hover { border-color: var(--ok); color: color-mix(in srgb, var(--ok) 60%, transparent); }
.shop-check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.shop-qty { font-weight: 500; font-size: .85em; color: var(--muted); margin-left: .35rem; }
.shopping-row { --c: var(--accent); align-items: center; }
.shopping-row.bought { --c: var(--ok); }
.shopping-row.bought .task-title { text-decoration: line-through; color: var(--muted); }
.shopping-bought-head { display: flex; align-items: center; justify-content: space-between; margin: 1.1rem 0 .5rem; color: var(--ok); }

/* ===== Módulo Salidas ===== */
.ok-text { color: var(--ok); }
.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip.small { padding: .2rem .6rem; font-size: .78rem; }
.chip .chip-x { border: 0; background: none; color: inherit; padding: 0 0 0 .15rem; display: inline-grid; place-items: center; opacity: .6; }
.chip .chip-x:hover { opacity: 1; color: var(--danger); }
.people-row { margin-bottom: .6rem; }
.inline-input { display: flex; gap: .4rem; align-items: center; }
.inline-input input { flex: 1; min-width: 0; }
.split-grid { display: flex; flex-direction: column; gap: .35rem; margin-top: .5rem; }
.split-line { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.split-line > span { font-weight: 500; }
.split-line input { max-width: 9rem; }
.stepper { display: inline-flex; align-items: center; gap: .35rem; }
.stepper strong { min-width: 1.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.outing-items { display: flex; flex-direction: column; gap: .6rem; }
.outing-item { padding: .6rem; border: 1px solid var(--card-border); border-radius: 12px; display: flex; flex-direction: column; gap: .45rem; }
.outing-item-head { display: flex; gap: .4rem; align-items: center; }
.outing-item-head input { min-width: 0; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font-size: 16px; }
.outing-item-head input:first-child { flex: 1; }
.outing-item-head input[type="number"] { width: 6.5rem; flex: 0 0 auto; }
.split-preview {
    display: flex; flex-wrap: wrap; gap: .3rem .9rem; padding: .65rem .8rem; border-radius: 12px; font-size: .88rem;
    background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}
.split-preview > strong { flex-basis: 100%; font-size: .8rem; color: var(--muted); }
.balance-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.balance-table th, .balance-table td { padding: .55rem .7rem; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.balance-table th:first-child, .balance-table td:first-child { text-align: left; font-weight: 600; }
.balance-table th { font-size: .75rem; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.balance-table tr + tr td { border-top: 1px solid var(--card-border); }
.transfer-row { align-items: center; }
.transfer-row .task-title { display: inline-flex; align-items: center; gap: .3rem; }
.my-part { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.my-part span { flex: 1; min-width: 12rem; }
/* Aporte rápido de Salidas: quién · monto · en qué · día · Anotar (en el teléfono, en dos filas). */
.contribution { display: grid; grid-template-columns: minmax(0, 1fr) 8rem minmax(0, 1.4fr) 9.5rem auto; gap: .4rem; margin-bottom: .35rem; }
.contribution select, .contribution input {
    min-width: 0; min-height: 44px; padding: .5rem .65rem; border-radius: 11px; font-size: 16px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
@media (max-width: 800px) {
    .contribution { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .contribution .contribution-what { grid-column: 1 / -1; }
}
.contribution-alt { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin: .35rem 0 .2rem; font-size: .88rem; }
.contribution-alt .link-btn { display: inline-flex; align-items: center; gap: .3rem; font-size: .88rem; }
.computed-total { font-size: 1.25rem; font-variant-numeric: tabular-nums; min-height: 44px; display: flex; align-items: center; }
.entry-kind { margin-bottom: .6rem; }
.entry-kind button { display: inline-flex; align-items: center; gap: .35rem; }
.contribution.consumption .consumption-who { grid-column: 1 / -1; }
.common-box {
    display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin-top: .8rem; padding: .65rem .85rem; border-radius: 12px; font-size: .88rem;
    background: color-mix(in srgb, var(--shared) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--shared) 25%, var(--border));
}
.common-box.warn { background: var(--warn-weak); border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.common-box span { display: inline-flex; align-items: center; gap: .3rem; }
.share-bar { align-items: center; margin: -.4rem 0 1rem; }
.share-bar small { flex-basis: 100%; display: inline-flex; align-items: center; gap: .25rem; }
.balance-table .send-cell { width: 1%; padding: .2rem .35rem; }
.balance-table .send-cell .icon-btn { color: var(--accent); }
/* Salidas: la cuenta de cada persona (lo principal). */
.person-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .7rem; }
.person-card { background: var(--card); border: 1px solid var(--card-border); border-radius: 14px; padding: .7rem .8rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .45rem; }
.person-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.person-head strong:first-child { font-size: 1rem; }
.person-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .15rem; font-size: .88rem; }
.person-lines li { display: flex; justify-content: space-between; gap: .6rem; padding: .2rem 0; border-top: 1px dashed var(--card-border); }
.person-lines li:first-child { border-top: 0; }
.person-lines li > span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.person-lines button { border: 0; background: none; padding: 0; color: inherit; text-align: left; font: inherit; }
.person-lines button:hover { color: var(--accent); }
.person-add { display: flex; gap: .35rem; }
.person-add input { min-width: 0; min-height: 38px; padding: .4rem .6rem; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 16px; }
.person-add input:first-child { flex: 1; }
.person-add input[type="number"] { width: 6.5rem; flex: 0 0 auto; }
.person-add .btn { min-height: 38px; }
.kind-options { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.kind-option {
    display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; text-align: left; padding: .7rem .75rem;
    border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
}
.kind-option small { color: var(--muted); font-size: .78rem; line-height: 1.3; }
.kind-option .icon { color: var(--muted); }
.kind-option.on { border-color: var(--accent); background: var(--accent-weak); }
.kind-option.on .icon { color: var(--accent); }
/* Salidas: plato para compartir (qué · monto · Agregar, y debajo quiénes). */
.share-add { display: grid; grid-template-columns: minmax(0, 1fr) 8rem auto; gap: .4rem; margin-top: .5rem; }
.share-add input { min-width: 0; min-height: 44px; padding: .5rem .65rem; border-radius: 11px; font-size: 16px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.share-add .share-who { grid-column: 1 / -1; }
@media (max-width: 560px) { .share-add { grid-template-columns: minmax(0, 1fr) 6.5rem auto; } }
/* Salidas (comida): pago de la cuenta con propina opcional. */
.meal-pay { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.meal-pay .tip-row { grid-column: 1 / -1; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.meal-pay .tip-row input[type="number"] { width: 7.5rem; }
.meal-pay > button[type="submit"] { grid-column: 1 / -1; }
.meal-pay .tip-summary { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; margin: 0; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 10px; }
.meal-pay .tip-summary dt { color: var(--muted); }
.meal-pay .tip-summary dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.meal-pay .tip-summary .total { color: inherit; font-weight: 700; border-top: 1px solid var(--border); padding-top: .3rem; }
.vis-people { margin-top: .45rem; }

/* Insignia de módulo: con grupos (verde azulado) o privado (gris). */
.module-badge {
    display: inline-flex; align-items: center; gap: .2rem; margin-left: .35rem; padding: .05rem .4rem; border-radius: 999px;
    font-size: .68rem; font-weight: 600; vertical-align: middle; white-space: nowrap;
}
.module-badge.shared { background: color-mix(in srgb, var(--shared) 16%, transparent); color: var(--shared); }
.module-badge.private { background: var(--surface-2); color: var(--muted); }
.module-badge.icon-only { margin-left: .1rem; padding: .15rem; }
.meal-pay { align-items: end; }
.meal-pay .pay-total { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.meal-pay .pay-total small { font-size: .74rem; }
.meal-pay .pay-total input { font-weight: 700; }
.module-badge.both {
    background: linear-gradient(90deg, var(--surface-2), color-mix(in srgb, var(--shared) 16%, transparent));
    color: var(--shared);
}
.module-badge.both .icon:first-child { color: var(--muted); }
/* Avatar de grupo: cuadrado redondeado (las personas son círculos). */
.avatar.group-avatar { border-radius: 28%; }
.group-card-name .group-avatar { margin-right: .45rem; }
.chip .group-avatar { box-shadow: none; }
