/* Diário da Ellie — base, tokens e componentes globais.
   Direção visual: caderno de artista, papel, tinta, formas abstratas. */

:root {
  --bg: #e8e9e4;          /* papel */
  --card: #f6f6f3;
  --text: #1e1c19;       /* tinta */
  --muted: #6f6a61;
  --line: #cfd1c8;
  --accent: #c2552f;     /* terracota */
  --ochre: #d6a13a;
  --teal: #2e5e5f;
  --olive: #7d8754;
  --plum: #5a3a52;
  --radius: 8px;
  --shadow: 0 1px 0 rgba(0,0,0,.04), 0 10px 30px -18px rgba(30,28,25,.35);

  /* aliases de compatibilidade */
  --pink: var(--accent);
  --lavender: var(--teal);

  /* humor (MOODS) */
  --mood-1: #5a3a52;
  --mood-2: #a8553a;
  --mood-3: #d6a13a;
  --mood-4: #7d8754;
  --mood-5: #2e5e5f;

  --display: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --serif: var(--display);
  --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* grão de papel sobre tudo (não intercepta cliques) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .32;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .12  0 0 0 0 .11  0 0 0 0 .1  0 0 0 .14 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.05;
  margin: 0;
}
em { font-family: inherit; }
h1 em, h2 em, h3 em, .display em { font-family: var(--serif); font-style: italic; color: var(--accent); }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font-family: inherit; }

.kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}
.display { font-size: clamp(48px, 7vw, 88px); line-height: .95; letter-spacing: -0.02em; }
.lede { font-size: 17px; color: var(--muted); max-width: 52ch; margin-top: 18px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.rule { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot {
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  color: var(--muted);
  padding: 40px;
  text-align: center;
}
.loading {
  font-family: var(--serif);
  font-style: italic;
  font-size: 26px;
  color: var(--muted);
  padding: 24px 0;
}
.view-error { display: grid; gap: 8px; padding: 24px 0; }
.view-error p:first-child { font-family: var(--serif); font-size: 32px; }

/* ---------- layout: coluna lateral (desktop) / barra inferior (mobile) ---------- */
#app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}
.nav {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 44px 28px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 48px;
}
.brand {
  font-family: var(--serif);
  font-style: italic;
  font-size: 30px;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  transition: color .2s;
}
.nav-item:hover { color: var(--text); }
.nav-item.is-active { color: var(--text); font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1.1; }
.nav-glyph { width: 14px; text-align: center; font-family: var(--sans); font-style: normal; font-size: 12px; color: var(--muted); flex: none; }
.nav-item.is-active .nav-glyph { color: var(--accent); }
.nav-item:focus-visible, .brand:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; }

.view-wrap { min-width: 0; position: relative; }
.view-page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 56px 56px 120px;
  animation: rise .45s cubic-bezier(.2,.7,.2,1) both;
}
.page-head { margin-bottom: 48px; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s, opacity .2s, transform .1s;
}
.btn:hover { background: rgba(30,28,25,.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: #3a3631; }
.btn-ghost { border-color: transparent; padding-left: 0; padding-right: 0; text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }
.btn-ghost:hover { background: none; color: var(--accent); }
.btn-danger { background: var(--accent); border-color: var(--accent); color: var(--card); }
.btn-danger:hover { background: #a84726; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

/* ---------- formulários: linha fina ---------- */
.field { display: grid; gap: 6px; }
.field-label { font-size: 13px; color: var(--muted); letter-spacing: .01em; }
.input, .textarea, .select {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 0;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input::placeholder, .textarea::placeholder { color: #a39c8f; }
.input:focus, .textarea:focus, .select:focus { border-bottom-color: var(--text); box-shadow: 0 1px 0 0 var(--text); }
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.select { cursor: pointer; }
.form-error { margin: 0; color: var(--accent); font-size: 14px; }
.form-ok { margin: 0; color: var(--teal); font-size: 14px; }

/* ---------- superfícies e chips ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color .2s, background .2s, color .2s;
}
.chip:hover { border-color: var(--text); }
.chip[aria-pressed="true"], .chip.is-on { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip-static { cursor: default; }
.chip-static:hover { border-color: var(--line); }

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 32px));
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--text);
  color: var(--bg);
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: toastIn .3s cubic-bezier(.2,.7,.2,1) both;
  transition: opacity .3s, transform .3s;
}
.toast-error { background: var(--accent); color: var(--card); }
.toast-ok, .toast-success { background: var(--teal); color: var(--card); }
.toast.is-out { opacity: 0; transform: translateY(6px); }

/* ---------- modal de confirmação ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(30,28,25,.42);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fadeIn .2s ease both;
}
.modal {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  gap: 24px;
  animation: rise .25s cubic-bezier(.2,.7,.2,1) both;
}
.modal-msg { font-family: var(--serif); font-size: 26px; line-height: 1.2; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }

/* ---------- telas de entrada (login e troca de senha) ---------- */
.auth {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 40px 16px;
}
.auth-art { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.blob { position: absolute; mix-blend-mode: multiply; opacity: .9; }
.b1 { width: 62vmax; height: 62vmax; left: -22vmax; top: -24vmax; background: var(--accent); border-radius: 58% 42% 61% 39% / 47% 56% 44% 53%; }
.b2 { width: 46vmax; height: 46vmax; right: -18vmax; top: 4vh; background: var(--ochre); border-radius: 50%; }
.b3 { width: 58vmax; height: 40vmax; left: 10vmax; bottom: -22vmax; background: var(--teal); border-radius: 44% 56% 38% 62% / 60% 35% 65% 40%; }
.b4 { width: 24vmax; height: 24vmax; right: 6vmax; bottom: 6vh; background: var(--plum); border-radius: 50%; opacity: .72; }
.b5 { width: 13vmax; height: 13vmax; left: 4vmax; top: 56vh; background: var(--olive); border-radius: 50%; opacity: .8; }

.auth-card { position: relative; width: min(440px, 100%); display: grid; gap: 28px; }
.auth-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(64px, 16vw, 124px);
  line-height: .86;
  letter-spacing: -0.03em;
  color: var(--text);
}
.auth-title em { display: block; font-style: italic; color: var(--accent); }
.auth-sub { font-size: 16px; color: var(--text); max-width: 34ch; background: var(--bg); align-self: start; padding: 2px 0; }
.auth-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  gap: 20px;
}
.auth-panel h2 { font-size: 34px; }
.auth-form { display: grid; gap: 22px; }
.auth-steps { display: grid; gap: 14px; }
.auth-note { font-size: 14px; color: var(--muted); line-height: 1.5; }
.auth-note strong { color: var(--text); font-weight: 600; }

/* ---------- Ajustes (v-config) ---------- */
.set-section {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 40px;
  padding: 36px 0;
  border-top: 1px solid var(--line);
}
.set-section:first-of-type { border-top: 0; padding-top: 0; }
.set-num { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .08em; }
.set-aside h2 { font-size: 36px; margin-top: 8px; }
.set-aside p { font-size: 14px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.set-body { display: grid; gap: 18px; align-content: start; max-width: 520px; }
.set-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.set-radio {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  align-items: start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.set-radio:hover { border-color: var(--muted); }
.set-radio.is-on { border-color: var(--text); background: var(--card); }
.set-radio input { margin-top: 4px; accent-color: var(--text); }
.set-radio strong { font-weight: 500; }
.set-radio small { grid-column: 2; color: var(--muted); font-size: 13px; line-height: 1.45; }
.file-pick {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px dashed var(--muted);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.file-pick:hover, .file-pick:focus-within { border-color: var(--text); color: var(--text); }
.file-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-name { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.set-note { font-size: 13px; color: var(--muted); line-height: 1.5; }
.set-status { font-size: 14px; color: var(--teal); min-height: 1.2em; }

/* ---------- animações ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- mobile: barra inferior fixa ---------- */
@media (max-width: 767.98px) {
  #app { display: block; }
  .nav {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    height: auto;
    z-index: 20;
    flex-direction: row;
    gap: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--line);
    background: rgba(243,239,230,.94);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
  .brand { display: none; }
  .nav-list { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav-list li { flex: 1; display: flex; }
  .nav-item {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    padding: 6px 2px;
    font-size: 11px;
    text-align: center;
    justify-content: center;
  }
  .nav-item.is-active { font-family: var(--sans); font-style: normal; font-size: 11px; font-weight: 600; }
  .nav-item.is-active .nav-label { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 6px; }
  .nav-glyph { font-size: 14px; width: auto; }

  .view-page { padding: 28px 16px calc(112px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 32px; }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .auth { padding: 32px 16px 48px; }

  .set-section { grid-template-columns: 1fr; gap: 16px; padding: 28px 0; }
  .set-aside h2 { font-size: 30px; }
}

/* ===== refinamento: tipografia grotesca + ícones desenhados ===== */
h1, h2, h3, .display { font-weight: 600; letter-spacing: -0.035em; }
h1 em, h2 em, h3 em, .display em { font-style: italic; font-weight: 500; }
@media (min-width: 768px) { .nav-item.is-active { font-style: normal; font-weight: 600; font-size: 15px; } }
.brand { font-style: normal; font-weight: 700; font-size: 22px; letter-spacing: -0.03em; white-space: nowrap; }
.nav-glyph { display: inline-flex; align-items: center; justify-content: center; width: 20px; }
.nav-glyph .ico { width: 18px; height: 18px; }
.ico { display: inline-block; vertical-align: middle; flex: none; }
::selection { background: color-mix(in srgb, var(--ochre) 45%, transparent); color: var(--text); }
textarea, input { caret-color: var(--accent); }

/* Login: as formas nunca passam por trás do título (legibilidade do "da Ellie" em terracota). */
.b1 { left: calc(50% - 250px - 62vmax); }
@media (max-width: 767px) {
  .auth { place-items: end center; padding-bottom: 56px; }
  .b1 { left: -40vmax; top: -40vmax; }
  .b2 { width: 34vmax; height: 34vmax; right: -16vmax; top: -12vmax; }
  .b3 { left: -10vmax; bottom: -30vmax; }
  .b4 { width: 16vmax; height: 16vmax; right: -4vmax; bottom: auto; top: 30vh; }
  .b5 { top: auto; bottom: 8vh; left: -5vmax; }
}
@media (max-width: 767px) {
  .auth-title, .auth-sub { text-align: center; justify-self: center; }
  .auth-sub { margin-inline: auto; text-wrap: balance; }
}
.auth-title, .auth-sub { text-align: center; justify-self: center; }
.auth-sub { margin-inline: auto; text-wrap: balance; }
