/* Aurora — tema "albada": clar, serè, llegible */
:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --ink: #2b2833;
  --muted: #7d7789;
  --line: #eae6e0;
  --accent: #6d5aa8;
  --accent-soft: #efeaf9;
  --rose: #c2707e;
  --rose-soft: #fbeef0;
  --gold: #b98a4a;
  --gold-soft: #f9f1e4;
  --green: #4e8f6b;
  --green-soft: #e9f4ee;
  --sky: linear-gradient(135deg, #2c2a55 0%, #57518f 35%, #9d6d9e 65%, #d99d7f 90%, #eec389 100%);
  --shadow: 0 1px 2px rgba(43,40,51,.05), 0 8px 24px rgba(43,40,51,.07);
  --radius: 18px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  min-height: 100dvh; font-size: 17px; line-height: 1.45;
}
.hidden { display: none !important; }
.serif { font-family: "New York", "Iowan Old Style", Georgia, "Times New Roman", serif; }

/* ── Login ── */
#login {
  min-height: 100dvh; display: grid; place-items: center;
  background: var(--sky);
}
.login-box {
  width: min(88vw, 22.5rem); background: rgba(255,255,255,.96);
  border-radius: 28px; padding: 2.6rem 2.2rem 2.2rem; text-align: center;
  box-shadow: 0 24px 60px rgba(20,16,50,.35);
}
.login-box .mark { width: 64px; height: 64px; margin: 0 auto .9rem; display: block; }
.login-box h1 {
  font-family: "New York", "Iowan Old Style", Georgia, serif;
  font-size: 2.3rem; font-weight: 600; letter-spacing: .02em; color: #37325c;
}
.sub { color: var(--muted); margin: .2rem 0 1.8rem; font-size: .95rem; }
input, select {
  width: 100%; padding: .85rem 1rem; font-size: 1.05rem;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink); outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
#password { text-align: center; letter-spacing: .12em; margin-bottom: .9rem; }
button {
  border: 0; cursor: pointer; font-size: 1.02rem; font-weight: 600;
  border-radius: 12px; padding: .85rem 1.3rem;
  background: #f0edf7; color: var(--accent);
}
button.primary, #btn-login {
  background: linear-gradient(120deg, #57518f, #9d6d9e); color: #fff;
  box-shadow: 0 6px 18px rgba(87,81,143,.35);
}
#btn-login { width: 100%; }
button.danger { background: var(--rose-soft); color: var(--rose); }
.error { color: var(--rose); margin-top: .9rem; font-size: .95rem; }

/* ── Capçalera amb cel d'albada ── */
#hero {
  background: var(--sky);
  padding: calc(env(safe-area-inset-top, 0px) + 1rem) 1.4rem 3.4rem;
  color: #fff; border-radius: 0 0 34px 34px;
}
#hero .top { display: flex; justify-content: space-between; align-items: center; }
#hero .wordmark {
  font-family: "New York", "Iowan Old Style", Georgia, serif;
  font-size: 1.25rem; letter-spacing: .04em; opacity: .95;
  display: flex; align-items: center; gap: .5rem;
}
#hero .wordmark svg { width: 22px; height: 22px; }
#btn-notif {
  position: relative; background: rgba(255,255,255,.16); color: #fff;
  width: 42px; height: 42px; border-radius: 50%; padding: 0;
  display: grid; place-items: center;
}
#btn-notif svg { width: 20px; height: 20px; }
.badge {
  position: absolute; top: -3px; right: -3px; background: var(--rose); color: #fff;
  font-size: .68rem; font-weight: 700; border-radius: 999px;
  min-width: 1.25rem; height: 1.25rem; display: grid; place-items: center;
  border: 2px solid #6f5d96;
}
#greeting {
  margin-top: 1.6rem; font-size: 1.75rem; font-weight: 650; letter-spacing: -.01em;
  font-family: "New York", "Iowan Old Style", Georgia, serif;
}
#hero .date { opacity: .85; font-size: .95rem; margin-top: .2rem; text-transform: capitalize; }

/* ── Contingut ── */
main.content {
  max-width: 42rem; margin: -2rem auto 0;
  padding: 0 1.1rem calc(env(safe-area-inset-bottom, 0px) + 6.2rem);
}
.tab > h2 {
  font-family: "New York", "Iowan Old Style", Georgia, serif;
  font-size: 1.5rem; margin: 1.6rem .2rem .9rem;
}
h3 {
  font-size: .8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: var(--muted); margin: 1.7rem .3rem .6rem;
}
.row-between { display: flex; justify-content: space-between; align-items: center; margin: 1.6rem .2rem .9rem; }
.row-between h2 { margin: 0; }
.row-end { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }
.pill {
  background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  font-size: .72rem; font-weight: 700; padding: .2em .8em; vertical-align: 2px;
  text-transform: none; letter-spacing: 0;
}

/* ── Targetes ── */
.cards { list-style: none; display: flex; flex-direction: column; gap: .65rem; }
.cards li {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .95rem 1.1rem; display: flex; gap: .9rem; align-items: center;
}
.cards li.clickable { cursor: pointer; }
.tag {
  width: 44px; height: 44px; border-radius: 13px; flex: none;
  display: grid; place-items: center;
}
.tag svg { width: 22px; height: 22px; }
.tag.birthday    { background: var(--rose-soft);  color: var(--rose); }
.tag.expiry      { background: var(--gold-soft);  color: var(--gold); }
.tag.renewal     { background: var(--accent-soft); color: var(--accent); }
.tag.appointment { background: var(--green-soft); color: var(--green); }
.tag.task        { background: #eef1f6; color: #5d7290; }
.tag.mail        { background: var(--accent-soft); color: var(--accent); }
.tag.bell        { background: var(--gold-soft); color: var(--gold); }
.cards li .body { flex: 1; min-width: 0; }
.cards li .title { font-weight: 600; font-size: 1.02rem; }
.cards li .meta {
  color: var(--muted); font-size: .88rem; margin-top: .1rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.when {
  flex: none; font-size: .8rem; font-weight: 700; color: var(--muted);
  background: #f2efe9; padding: .3em .75em; border-radius: 999px; white-space: nowrap;
}
.when.today { background: var(--rose); color: #fff; }
.when.soon { background: var(--gold-soft); color: var(--gold); }
.cards li.unseen { box-shadow: var(--shadow), inset 3px 0 0 var(--accent); }
.cards .empty {
  background: none; box-shadow: none; justify-content: center;
  color: var(--muted); font-size: .95rem; padding: 1.4rem 0;
}

/* ── Navegació inferior ── */
nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: rgba(255,255,255,.92); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: .5rem 0 calc(env(safe-area-inset-bottom, 0px) + .5rem);
}
nav button {
  background: none; border-radius: 14px; padding: .35rem .6rem;
  min-width: 4.2rem;
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  color: #a49dae; font-size: .66rem; font-weight: 600;
}
nav button svg { width: 24px; height: 24px; }
nav button.active { color: var(--accent); background: var(--accent-soft); }
#btn-mic {
  width: 62px; height: 62px; border-radius: 50%; padding: 0; flex: none;
  margin-top: -26px; display: grid; place-items: center;
  background: linear-gradient(135deg, #57518f, #b0688f); color: #fff;
  box-shadow: 0 8px 22px rgba(87,81,143,.45), 0 0 0 6px var(--bg);
}
#btn-mic svg { width: 28px; height: 28px; }
#btn-mic.recording { background: linear-gradient(135deg, #c2707e, #a93a52); animation: pulse 1.2s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 8px 22px rgba(169,58,82,.5), 0 0 0 6px var(--bg); }
  50% { box-shadow: 0 8px 22px rgba(169,58,82,.5), 0 0 0 14px rgba(194,112,126,.15); }
}
#btn-avisos-nav { position: relative; }

/* ── Full de veu ── */
#voice-sheet {
  position: fixed; inset: 0; z-index: 40;
  background: linear-gradient(170deg, rgba(30,27,58,.97), rgba(70,52,90,.97));
  backdrop-filter: blur(8px);
  display: grid; place-items: end center;
}
.voice-inner {
  width: 100%; max-width: 40rem; text-align: center; color: #fff;
  padding: 2rem 1.5rem calc(env(safe-area-inset-bottom, 0px) + 2.2rem);
  display: flex; flex-direction: column; align-items: center; gap: 1.1rem;
  min-height: 70dvh; justify-content: center;
}
#voice-status { font-size: 1.05rem; opacity: .85; min-height: 1.4em; }
#voice-orb {
  width: 110px; height: 110px; border-radius: 50%;
  background: linear-gradient(135deg, #7a6fc0, #c98aa8);
  display: grid; place-items: center;
  box-shadow: 0 0 60px rgba(160,130,220,.55);
  transition: transform .3s;
}
#voice-orb svg { width: 44px; height: 44px; color: #fff; }
#voice-orb.recording { animation: orb 1.4s infinite; }
#voice-orb.speaking { animation: orb 2.6s infinite; }
#voice-orb.thinking { animation: spinorb 1.2s linear infinite; }
@keyframes orb {
  0%, 100% { transform: scale(1); box-shadow: 0 0 60px rgba(160,130,220,.55); }
  50% { transform: scale(1.09); box-shadow: 0 0 90px rgba(200,150,220,.8); }
}
@keyframes spinorb { to { transform: rotate(360deg); } }
.voice-you { color: #cfc6e8; font-size: 1rem; min-height: 1.4em; }
.voice-you:not(:empty)::before { content: "Tú: "; opacity: .6; }
.voice-aurora {
  font-family: "New York", "Iowan Old Style", Georgia, serif;
  font-size: 1.25rem; line-height: 1.5; max-width: 34rem;
}
#btn-voice-close { background: rgba(255,255,255,.14); color: #fff; margin-top: .6rem; }

/* ── Diàleg ── */
dialog {
  border: 0; border-radius: 22px; background: var(--surface); color: var(--ink);
  width: min(92vw, 26rem); padding: 1.6rem; margin: auto;
  box-shadow: 0 30px 80px rgba(20,16,50,.3);
}
dialog::backdrop { background: rgba(30,25,50,.45); backdrop-filter: blur(3px); }
dialog h3 {
  font-family: "New York", "Iowan Old Style", Georgia, serif;
  font-size: 1.25rem; font-weight: 650; color: var(--ink);
  text-transform: none; letter-spacing: 0; margin: 0 0 1.1rem;
}
dialog label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: .7rem; }
dialog input, dialog select { margin-top: .3rem; }

@media (min-width: 640px) {
  body { font-size: 16px; }
  #hero { border-radius: 0; }
}
