:root {
    --bg: #f6f7f9; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6ec;
    --primary: #2b7a78; --primary-text: #fff; --red: #d93025; --orange: #f08c00; --chip: #e8eef0;
}
@media (prefers-color-scheme: dark) {
    :root { --bg: #121417; --card: #1c1f26; --text: #eceff4; --muted: #9aa3b2; --line: #2b303a; --chip: #262b34; --primary: #3aa6a2; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
a { color: var(--primary); }
h2 { margin: 8px 0 12px; } h3 { margin: 0 0 8px; } h4 { margin: 14px 0 6px; }
.muted { color: var(--muted); font-size: .92em; }
em { color: var(--muted); font-style: normal; }

.top { background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; }
.brand { font-weight: 700; } .brand .team { margin-left: 10px; font-weight: 400; color: var(--muted); }
nav { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
nav a { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--text); }
nav a.on { background: var(--primary); color: var(--primary-text); }
main { max-width: 860px; margin: 0 auto; padding: 14px 14px 40px; }
footer { max-width: 860px; margin: 0 auto; padding: 0 14px 30px; color: var(--muted); font-size: .8em; text-align: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 0 0 12px; }
.card.hl { border-color: var(--primary); border-width: 2px; }
.expired-box { border-color: var(--red); }
.expired-box h3 { color: var(--red); }
.login { max-width: 380px; margin: 40px auto; }

.flash { padding: 10px 14px; border-radius: 10px; margin: 0 0 12px; background: var(--chip); }
.flash.ok { background: #d9f2e3; color: #14532d; } .flash.err { background: #fde2e0; color: #8a1c14; } .flash.warn { background: #fff0d1; color: #7a4b00; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; }
.chip { background: var(--chip); color: var(--text); border: 0; padding: 6px 12px; border-radius: 999px; text-decoration: none; font: inherit; cursor: pointer; }
.chip.on { background: var(--primary); color: var(--primary-text); }
.push { margin-left: auto; }
.nav-row { display: flex; justify-content: space-between; align-items: center; margin: 0 0 10px; }

.btn, button.primary, button.danger { display: inline-block; background: var(--chip); color: var(--text); border: 0; padding: 8px 14px; border-radius: 10px; text-decoration: none; font: inherit; cursor: pointer; }
.btn.small { padding: 4px 10px; font-size: .9em; }
button.primary, .btn.primary { background: var(--primary); color: var(--primary-text); }
button.danger { background: var(--red); color: #fff; }
button.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 6px 10px; }
button.step { background: var(--chip); color: var(--text); border: 0; width: 34px; height: 34px; border-radius: 50%; font-size: 1.1em; cursor: pointer; }
form.inline { display: inline; margin: 0; }

input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; }
label { display: block; font-size: .85em; color: var(--muted); }
label input, label select { margin-top: 3px; color: var(--text); font-size: 1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.grid .wide { grid-column: 1 / -1; }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; padding: 4px 0; }
.search { display: flex; gap: 8px; margin: 0 0 10px; }
.search input { flex: 1; }

.item { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 0 0 8px; }
.card .item { background: transparent; }
.item.expired { border: 2px solid var(--red); } .item.near { border-color: var(--orange); }
.item.done .info { opacity: .55; text-decoration: line-through; }
.icon { width: 42px; height: 42px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; font-size: 1.3em; overflow: hidden; flex: none; }
.icon img { width: 100%; height: 100%; object-fit: cover; }
.info { flex: 1; min-width: 0; }
.meta { color: var(--muted); font-size: .88em; }
.exp { font-size: .88em; color: var(--muted); }
.item.expired .exp { color: var(--red); font-weight: 700; } .item.near .exp { color: var(--orange); font-weight: 700; }
.tag-red { color: var(--red); font-weight: 600; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
details.del summary { cursor: pointer; color: var(--muted); font-size: .9em; list-style: none; padding: 4px 8px; }
details.del[open] { flex-basis: 100%; }
details.del form { background: var(--chip); border-radius: 10px; padding: 8px 12px; margin-top: 6px; }

h3.group { margin: 18px 0 8px; } .count { background: var(--chip); border-radius: 999px; font-size: .75em; padding: 1px 8px; margin-left: 6px; font-weight: 400; }

table.month { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 0 0 12px; }
.month th { color: var(--muted); font-size: .8em; padding: 4px; }
.month td { text-align: center; padding: 2px; }
.month td a { display: block; padding: 8px 0; border-radius: 10px; text-decoration: none; color: var(--text); position: relative; }
.month td.today a { background: var(--chip); } .month td.sel a { background: var(--primary); color: var(--primary-text); }
.month td a i { position: absolute; left: 50%; bottom: 3px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--red); }

@media (max-width: 560px) { .item { flex-wrap: wrap; } .actions { width: 100%; justify-content: flex-start; } }
@media print { .top, footer, .no-print, form, .chips, .btn { display: none !important; } body { background: #fff; color: #000; } }

.row input { width: auto; flex: 1; min-width: 0; }
.row input.w-emoji { flex: 0 0 72px; }
details.card > summary { cursor: pointer; }

/* Selector de emojis */
input[data-emoji] { cursor: pointer; }
.emoji-pop { position: absolute; z-index: 50; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); padding: 8px; max-height: 340px; overflow: auto; }
.emoji-pop[hidden] { display: none; }
.emoji-top { display: flex; gap: 6px; align-items: center; margin: 0 0 6px; }
.emoji-top .emoji-search { flex: 1; min-width: 0; }
.emoji-body h5 { margin: 10px 0 4px; font-size: .75em; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px; }
.emoji-grid button { background: none; border: 0; font-size: 1.5rem; line-height: 1; padding: 6px 0; border-radius: 8px; cursor: pointer; }
.emoji-grid button:hover, .emoji-grid button:focus { background: var(--chip); outline: none; }
@media print { .emoji-pop { display: none !important; } }
