/* ===== Variáveis ===== */
:root {
  --bg: #f5f6fa;
  --card: #fff;
  --text: #1c1f2a;
  --muted: #6b7280;
  --line: #e7e9f0;
  --ac: #5b6cff;
  --on-ac: #fff;
  --on-ac-dk: #10131c;
  --primary: var(--ac);
  --on-primary: var(--on-ac);
  --soft: color-mix(in srgb, var(--ac) 12%, var(--card));
  --danger: #e5484d;
  --r: 14px;
  --rs: 10px;
  --pad: 1.1rem;
  --gap: 1rem;
  --fs: 1;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --sh: 0 1px 2px #1c1f2a0d, 0 6px 20px #1c1f2a0a;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
[data-theme=dark] {
  color-scheme: dark;
  --bg: #0f1117;
  --card: #181b24;
  --text: #e8eaf2;
  --muted: #9aa1b2;
  --line: #262a36;
  --primary: color-mix(in srgb, var(--ac) 65%, #fff);
  --on-primary: var(--on-ac-dk);
  --soft: color-mix(in srgb, var(--ac) 24%, var(--card));
  --sh: 0 1px 2px #0006;
}

/* ===== Preferências do usuário (definidas em js/prefs.js e js/boot.js) ===== */
[data-fs=s] { --fs: .9; }
[data-fs=l] { --fs: 1.15; }
[data-font=serif] { --font: Georgia, "Times New Roman", serif; }
[data-font=mono] { --font: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace; }
[data-radius=sharp] { --r: 4px; --rs: 3px; }
[data-radius=pill] { --r: 24px; --rs: 16px; }
[data-density=compact] { --pad: .7rem; --gap: .6rem; }
[data-width=narrow] main { max-width: 860px; }
[data-width=wide] main { max-width: 1600px; }

/* ===== Base ===== */
html { font-size: calc(16px * var(--fs)); }
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  display: flex;
  min-height: 100vh;
  font: .9375rem/1.55 var(--font);
  background: var(--bg);
  color: var(--text);
  transition: background .2s;
  overscroll-behavior-y: none;
  -webkit-text-size-adjust: 100%;
}
h3 {
  margin: 0 0 .6rem;
  font-size: 1rem;
}
a {
  color: var(--primary);
  font-weight: 600;
}
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
#nav,
header,
button,
.tabs,
.cal {
  -webkit-user-select: none;
  user-select: none;
}
button,
[role=button] {
  touch-action: manipulation;
}
.muted {
  color: var(--muted);
  font-size: .85rem;
}
.ic {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== Botões ===== */

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  padding: .55rem 1rem;
  border-radius: var(--rs);
  transition: .15s;
}
button:hover:not(:disabled) {
  border-color: var(--primary);
  transform: translateY(-1px);
}
button:disabled {
  opacity: .5;
  cursor: not-allowed;
}
button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}
button.danger {
  color: var(--danger);
}
button.ghost {
  padding: .55rem;
  background: none;
  border-color: transparent;
  font-size: 1.2rem;
}
button.ghost .ic {
  width: 1.3em;
  height: 1.3em;
}
button.add {
  width: 100%;
  border-style: dashed;
  color: var(--muted);
  background: none;
}

/* ===== Formulários ===== */
input,
select,
textarea {
  width: 100%;
  padding: .65rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--rs);
  background: var(--bg);
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
  background: var(--card);
}
input[type=color] {
  height: 42px;
  padding: 3px;
}
textarea {
  resize: vertical;
}
label {
  display: block;
  margin: .8rem 0;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
}
label > * {
  margin-top: .3rem;
  font-weight: 400;
}
.err {
  color: var(--danger);
  font-size: .85rem;
  min-height: 1.2em;
  margin: 0;
}

/* ===== Layout ===== */
#nav {
  width: 240px;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  padding: 1.2rem;
  border-right: 1px solid var(--line);
  background: var(--card);
}
.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.brand h1 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1;
}
.logo {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #5b6cff, #a46bff);
}
/* O <i> inline deslocava o SVG do logo */
.logo i {
  display: grid;
  place-items: center;
  line-height: 0;
  font-style: normal;
}
.logo .ic {
  display: block;
  width: 20px;
  height: 20px;
  margin: 0;
  stroke-width: 2.2;
}
#nav nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
#nav nav button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .75rem;
  text-align: left;
  border: 0;
  background: none;
  padding: .65rem .8rem;
  color: var(--muted);
  font-weight: 500;
}
#nav nav button i {
  display: grid;
  place-items: center;
  width: 1.4rem;
  flex: none;
  font-style: normal;
}
#nav nav button i .ic {
  width: 1.3em;
  height: 1.3em;
}
#nav nav button.on {
  background: var(--soft);
  color: var(--primary);
  font-weight: 700;
}
#userBox {
  display: grid;
  gap: .6rem;
  padding: .8rem;
  border-radius: var(--r);
  background: var(--bg);
}
#userBox p {
  margin: 0;
}
#userBox b {
  color: var(--text);
}
#userBox .ic {
  vertical-align: -.25em;
}
main {
  flex: 1;
  min-width: 0;
  max-width: 1200px;
  margin-inline: auto;
  padding: 0 2rem 2rem;
}
header {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: max(1rem, env(safe-area-inset-top)) 0 1rem;
  margin-bottom: .5rem;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
}
header h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* ===== Componentes ===== */
.grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--pad);
  box-shadow: var(--sh);
}
.item {
  display: flex;
  gap: .6rem;
  align-items: center;
  padding: calc(var(--pad) * .5) .75rem;
  margin: .4rem 0;
  border-radius: var(--rs);
  border-left: 4px solid var(--primary);
  background: var(--bg);
  cursor: pointer;
  transition: .15s;
}
.item:hover {
  transform: translateX(2px);
}
.item .sub {
  display: block;
}
.card[role=button] {
  cursor: pointer;
}
.row {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}
.row.start {
  justify-content: flex-start;
  flex-wrap: wrap;
}
.row.between {
  justify-content: space-between;
  align-items: center;
}
.row > .danger:first-child {
  margin-right: auto;
}
.top {
  margin-bottom: 1rem;
}
.badge {
  display: inline-block;
  padding: .15rem .6rem;
  border-radius: 99px;
  background: var(--soft);
  color: var(--primary);
  font-size: .8rem;
  font-weight: 700;
}

/* Início */
.hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding: 1.4rem;
  border-radius: var(--r);
  color: var(--on-ac);
  background: linear-gradient(135deg, var(--ac), color-mix(in srgb, var(--ac) 65%, #a46bff));
}
.hero h3 {
  font-size: 1.4rem;
}
.hero p {
  margin: 0;
  opacity: .9;
}
.stats {
  display: flex;
  gap: .6rem;
}
.stats div {
  display: grid;
  text-align: center;
  min-width: 76px;
  padding: .6rem;
  border-radius: 12px;
  background: #ffffff26;
}
.stats b {
  font-size: 1.4rem;
  line-height: 1.2;
}
.stats span {
  font-size: .72rem;
  opacity: .9;
}

/* Horário */
.week {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .7rem;
}
.day.is-today {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--soft);
}
.day .empty {
  margin: .5rem 0 1rem;
}
.cls b,
.cls .muted {
  display: block;
}

/* Calendário */
.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.bar b {
  font-size: 1.1rem;
}
.bar > div {
  display: flex;
  gap: .4rem;
}
.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.cal > b {
  text-align: center;
  font-size: .75rem;
  padding: .3rem 0;
}
.cal .d {
  min-height: 92px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--rs);
  font-size: .8rem;
  cursor: pointer;
  overflow: hidden;
  transition: .15s;
}
.cal .d:hover {
  border-color: var(--primary);
}
.cal .d.today {
  border-color: var(--primary);
  background: var(--soft);
  font-weight: 700;
}
.chip {
  display: block;
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: .72rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.t-Prova { background: #e5484d; }
.t-Trabalho { background: #f59e0b; color: #1c1f2a; }
.t-Evento { background: #10b981; color: #052e1f; }

/* Notas (linha do tempo) */
.timeline {
  max-width: 640px;
  margin-inline: auto;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh);
}
.ntabs {
  display: flex;
  border-bottom: 1px solid var(--line);
}
.ntabs button {
  position: relative;
  flex: 1;
  padding: .9rem;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font-weight: 600;
}
.ntabs button:hover:not(:disabled) {
  background: var(--soft);
  transform: none;
}
.ntabs button.on {
  color: var(--text);
}
.ntabs button.on::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 56px;
  height: 4px;
  border-radius: 99px;
  background: var(--primary);
  transform: translateX(-50%);
}
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  color: var(--on-ac);
  background: linear-gradient(135deg, var(--ac), color-mix(in srgb, var(--ac) 65%, #a46bff));
}
.avatar span {
  font-weight: 700;
  font-size: .95em;
}
.avatar.has-photo { background: var(--photo) center / cover no-repeat; }
.avatar .ic {
  width: 1.3em;
  height: 1.3em;
}
.composer,
.post {
  display: flex;
  gap: .8rem;
  padding: var(--pad);
  border-bottom: 1px solid var(--line);
}
.cbody,
.pbody {
  flex: 1;
  min-width: 0;
}
.composer textarea,
.post textarea {
  min-height: 3.2rem;
  max-height: 50vh;
  overflow-y: auto;
  resize: none;
}
.composer textarea {
  padding: .4rem 0;
  border: 0;
  background: none;
  font-size: 1.1rem;
}
.composer textarea:focus {
  outline: 0;
  background: none;
}
.cbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .6rem;
  margin-top: .6rem;
  padding-top: .6rem;
  border-top: 1px solid var(--line);
}
.cbar select {
  width: auto;
  max-width: 55%;
  padding: .35rem .8rem;
  border-radius: 99px;
  font-size: .85rem;
  color: var(--primary);
}
.cbar .primary {
  padding: .5rem 1.3rem;
  border-radius: 99px;
}
.cbar .row {
  margin: 0;
}
.post {
  transition: background-color .15s;
}
.post:last-child {
  border-bottom: 0;
}
.post:not(.editing):hover {
  background: color-mix(in srgb, var(--soft) 45%, transparent);
}
.post.editing input {
  margin-bottom: .4rem;
  font-weight: 600;
}
.phead {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .4rem;
}
.pinned {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-left: auto;
  color: var(--muted);
  font-size: .8rem;
}
.pinned .ic {
  width: 1em;
  height: 1em;
}
.ptitle {
  margin-top: .2rem;
  font-weight: 700;
}
.ptext {
  margin: .2rem 0 .5rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tag {
  color: var(--primary);
}
.subj {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .15rem .65rem;
  border-radius: 99px;
  background: var(--soft);
  color: var(--primary);
  font-size: .8rem;
  font-weight: 600;
}
.subj::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot);
}
.pacts {
  display: flex;
  gap: .2rem;
  margin: .4rem 0 0 -.5rem;
}
.pacts button {
  padding: .45rem;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
}
.pacts button:hover:not(:disabled) {
  background: var(--soft);
  color: var(--primary);
  transform: none;
}
.pacts [data-act=del]:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}
.pacts [aria-pressed=true] {
  color: var(--primary);
}
.pacts [aria-pressed=true] .ic {
  fill: currentColor;
}
.empty-feed {
  margin: 0;
  padding: 2.5rem 1rem;
  text-align: center;
}

/* Diálogo e aviso */
dialog {
  border: 0;
  border-radius: 18px;
  background: var(--card);
  color: var(--text);
  width: min(440px, 92vw);
  padding: 1.4rem;
  box-shadow: 0 20px 60px #0005;
}
dialog::backdrop {
  background: #0008;
  backdrop-filter: blur(3px);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.2rem;
  border-radius: 99px;
  background: var(--text);
  color: var(--bg);
  font-size: .9rem;
  z-index: 20;
}
.toast .ic {
  display: grid;
  place-items: center;
}
.toast button {
  padding: 0 0 0 .6rem;
  border: 0;
  background: none;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

/* Configurações */
.settings h3 {
  margin-bottom: 1rem;
}
.settings section {
  padding: .9rem 0;
  border-top: 1px solid var(--line);
}
.settings section:first-of-type {
  padding-top: 0;
  border-top: 0;
}
.settings h4 {
  margin: 0 0 .6rem;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.settings .muted {
  margin: 0;
}
.settings .row {
  margin-top: .4rem;
}
.seg {
  display: grid;
  grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
  gap: .4rem;
}
.seg button {
  min-width: 0;
  padding: .55rem .3rem;
  gap: .3rem;
  font-size: .85rem;
}
.seg button[aria-checked=true] {
  background: var(--soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.about {
  display: grid;
  gap: .5rem;
  margin: 0;
}
.about div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.about dt {
  color: var(--muted);
}
.about dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}
.msg {
  margin: .6rem 0 0;
  font-size: .85rem;
}
.msg:empty { display: none; }
.msg.good { color: #10b981; }
.msg.bad { color: var(--danger); }

/* ===== Animações e transições ===== */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes slide { from { opacity: 0; transform: translateX(calc(var(--dir, 1) * 28px)); } }
@keyframes dlgin { from { opacity: 0; transform: translateY(10px); } }
@keyframes dlgout { to { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes sheet { from { transform: translateY(100%); } }
@keyframes sheetout { to { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeout { to { opacity: 0; } }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px) scale(.97); } }
@keyframes toastout { to { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes grow { from { transform: scale(.5); opacity: 0; } }

/* Entrada da tela (escalonada) */
#view.enter > *,
#view.enter :is(.grid, .week) > * {
  animation: rise .4s var(--ease) both;
}
#view.enter > :nth-child(2),
#view.enter :is(.grid, .week) > :nth-child(2) { animation-delay: .05s; }
#view.enter > :nth-child(3),
#view.enter :is(.grid, .week) > :nth-child(3) { animation-delay: .1s; }
#view.enter > :nth-child(4),
#view.enter :is(.grid, .week) > :nth-child(4) { animation-delay: .15s; }
#view.enter :is(.grid, .week) > :nth-child(n+5) { animation-delay: .2s; }

.slide { animation: slide .3s var(--ease); }
dialog[open] { animation: dlgin .24s var(--ease); }
dialog[open]::backdrop { animation: fade .24s; }
dialog.out { animation: dlgout .18s ease forwards; }
dialog.out::backdrop { animation: fadeout .18s forwards; }
.toast { animation: toastin .2s; }
.toast.bye { animation: toastout .2s forwards; }
#setBtn .ic { transition: transform .4s var(--ease); }
@media (hover: hover) {
  #setBtn:hover .ic { transform: rotate(60deg); }
}
.fab { animation: grow .3s var(--ease); }

/* Troca de tema */
.card,
#nav,
header,
input,
select,
textarea,
dialog,
#userBox {
  transition: background-color .25s, border-color .25s, color .25s;
}

/* Toque */
button:active:not(:disabled) { transform: scale(.96); }
.item:active,
.cal .d:active { transform: scale(.98); }
@media (hover: none) {
  button:hover:not(:disabled),
  .item:hover { transform: none; }
}

/* Animações desligadas nas preferências */
[data-motion=off] *,
[data-motion=off] *::before,
[data-motion=off] *::after {
  animation: none !important;
  transition: none !important;
}

/* ===== Responsivo ===== */
@media (min-width: 801px) {
  .tabs,
  .fab,
  #meHdr { display: none; }

  /* Menu no lado direito */
  [data-side=right] body { flex-direction: row-reverse; }
  [data-side=right] #nav {
    border-right: 0;
    border-left: 1px solid var(--line);
  }

  /* Menu só com ícones */
  [data-nav=compact] #nav {
    width: 76px;
    align-items: center;
    padding-inline: .6rem;
  }
  [data-nav=compact] #nav nav { align-self: stretch; }
  [data-nav=compact] .brand h1,
  [data-nav=compact] #nav nav button span,
  [data-nav=compact] .me-text,
  [data-nav=compact] #userBox > p { display: none; }
  [data-nav=compact] #nav nav button {
    justify-content: center;
    padding: .7rem;
  }
  [data-nav=compact] #userBox { padding: .4rem; }
}

@media (max-width: 1100px) {
  .week { grid-template-columns: repeat(3, 1fr); }
}

/* Celular: navegação inferior, bottom sheet e um dia por vez */
@media (max-width: 800px) {
  body { display: block; }
  main { padding: 0 1rem 6rem; }
  header h2 { font-size: 1.3rem; }
  #installBtn { display: none; }

  #nav {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    height: auto;
    z-index: 10;
    flex-direction: row;
    padding: .3rem .4rem calc(.3rem + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--line);
  }
  .brand,
  #userBox { display: none; }
  #nav nav {
    flex-direction: row;
    gap: 0;
  }
  #nav nav button {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 0;
    padding: .35rem 0;
    text-align: center;
    font-size: .68rem;
    border-radius: var(--rs);
  }
  #nav nav button i { width: auto; }
  [data-nav=compact] #nav nav button span { display: none; }
  [data-nav=compact] #nav nav button { padding: .6rem 0; }

  .week {
    display: block;
    touch-action: pan-y;
  }
  .day:not(.sel),
  .day .add,
  .day h3 { display: none; }
  .cls {
    padding: .85rem 1rem;
    min-height: 60px;
  }
  .tabs {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: .35rem;
    margin-bottom: .9rem;
  }
  .tabs button {
    position: relative;
    flex-direction: column;
    gap: 0;
    padding: .55rem 0;
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted);
  }
  .tabs button.on {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-primary);
  }
  .tabs em {
    font-style: normal;
    font-size: .65rem;
    opacity: .8;
  }
  .tabs .dot {
    position: absolute;
    top: 5px;
    right: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
  }
  .tabs .on .dot { background: var(--on-primary); }
  .fab {
    display: grid;
    place-items: center;
    position: fixed;
    right: 1rem;
    bottom: calc(76px + env(safe-area-inset-bottom));
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-primary);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--ac) 40%, transparent);
    z-index: 9;
  }
  .fab .ic {
    width: 1.6em;
    height: 1.6em;
  }

  .timeline {
    margin-inline: -1rem;
    border-inline: 0;
    border-radius: 0;
  }
  .hero { padding: 1.1rem; }
  .stats { width: 100%; }
  .stats div { flex: 1; }
  .cal { gap: 3px; }
  .cal .d {
    min-height: 58px;
    padding: 4px;
    text-align: center;
  }
  .chip {
    display: inline-block;
    width: 7px;
    height: 7px;
    padding: 0;
    margin: 3px 1px 0;
    border-radius: 50%;
    font-size: 0;
  }

  dialog {
    margin: auto 0 0;
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding-bottom: calc(1.4rem + env(safe-area-inset-bottom));
  }
  dialog[open] { animation-name: sheet; }
  dialog.out { animation-name: sheetout; }
  .toast { bottom: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Perfil (barra lateral e cabeçalho do celular) */
.me {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .3rem;
  border: 0;
  background: none;
  text-align: left;
}
.me .avatar {
  width: 40px;
  height: 40px;
}
.me-text {
  display: grid;
  min-width: 0;
}
.me-text b,
.me-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.me-text small {
  color: var(--muted);
  font-size: .78rem;
}
#meHdr {
  padding: 0;
  border: 0;
  border-radius: 50%;
}
#meHdr .avatar {
  width: 34px;
  height: 34px;
  font-size: .85rem;
}

/* Configurações em abas */
.stabs {
  display: flex;
  gap: .25rem;
  margin: 0 0 1rem;
  padding-bottom: .2rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.stabs button {
  flex: none;
  padding: .4rem .7rem;
  border-radius: 99px;
  font-size: .82rem;
}
.stabs button[aria-selected=true] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
}
.swatches button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: inset 0 0 0 2px var(--card);
}
.swatches button[aria-checked=true] { border-color: var(--text); }
.swatches input[type=color] {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.swatches input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.swatches input[type=color]::-webkit-color-swatch {
  border: 2px solid var(--line);
  border-radius: 50%;
}
.swatches input[type=color]::-moz-color-swatch {
  border: 2px solid var(--line);
  border-radius: 50%;
}
.photo-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: .8rem;
}
.photo-row .avatar {
  width: 72px;
  height: 72px;
  font-size: 1.5rem;
}
.field { display: grid; gap: .3rem; margin-bottom: .7rem; }
.field > span { font-size: .85rem; color: var(--muted); }

/* Chave Pix */
.pix {
  display: block;
  margin: 0 0 .6rem;
  padding: .55rem .75rem;
  border: 1px dashed var(--line);
  border-radius: var(--rs);
  background: var(--bg);
  font-size: .8rem;
  word-break: break-all;
  user-select: all;
}

/* Agenda do mês (calendário) */
.agenda { margin-top: 1rem; }
.agenda .item { margin-bottom: .4rem; }
