/* Hub de dashboards — Human Interface Guidelines da Apple aplicadas com a paleta Live.
   Clareza (hierarquia tipográfica), deferência (o conteúdo manda, sem enfeite) e
   profundidade (material translúcido só onde há conteúdo passando por baixo: a barra). */

:root {
  /* Segue o sistema; o botão de tema força um dos dois via data-theme (ver theme.js). */
  color-scheme: light dark;

  /* Superfícies e texto (tokens do Guia de Design Live, seção 20.2): light-dark(claro, escuro) */
  --bg: light-dark(#eef0f6, #0c0a10);
  --surface: light-dark(#ffffff, #17141d);
  --label: light-dark(#26242b, #e8e6ec);
  --label-2: light-dark(rgb(38 36 43 / 0.62), rgb(232 230 236 / 0.62));
  --label-3: light-dark(rgb(38 36 43 / 0.4), rgb(232 230 236 / 0.4));
  --fill: light-dark(rgb(60 60 67 / 0.1), rgb(235 235 245 / 0.1));
  --fill-hover: light-dark(rgb(60 60 67 / 0.16), rgb(235 235 245 / 0.16));
  --hairline: light-dark(rgb(38 36 43 / 0.12), rgb(255 255 255 / 0.1));

  /* Cor de destaque: --accent para texto/ícone, --accent-fill para fundo com texto branco */
  --accent: light-dark(#8e2694, #c46bc9);
  --accent-fill: #8e2694;
  --danger: light-dark(#d70015, #ff6961);

  --shadow-card: light-dark(0 1px 2px rgb(38 36 43 / 0.05), none);
  --shadow-lift: light-dark(0 14px 32px -12px rgb(38 36 43 / 0.22), 0 14px 32px -12px rgb(0 0 0 / 0.7));

  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', system-ui,
    'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --gutter: clamp(20px, 5vw, 32px);
}

:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark'] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 400 17px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- marca ---------- */
.mark {
  flex: none;
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent-fill);
}
.mark svg { width: 17px; height: 17px; fill: #fff; }
.mark-lg { width: 64px; height: 64px; border-radius: 15px; margin: 0 auto; }
.mark-lg svg { width: 32px; height: 32px; }

/* ---------- barra de navegação ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top);
  transition: background-color 0.3s, box-shadow 0.3s;
}
.bar.scrolled {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0.5px 0 var(--hairline);
}
@media (prefers-reduced-transparency: reduce) {
  .bar.scrolled { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

.bar-in {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1080px;
  min-height: 60px;
  margin: 0 auto;
  padding: 10px var(--gutter);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.022em;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(260px, 100%);
  height: 38px;
  padding: 0 6px 0 11px;
  border-radius: 10px;
  background: var(--fill);
  color: var(--label-2);
  cursor: text;
  transition: width 0.35s var(--ease), background-color 0.2s;
}
.search:focus-within { width: min(340px, 100%); background: var(--fill-hover); }
.search > svg { flex: none; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: none;
  border: 0;
  outline: 0;
  color: var(--label);
  font: inherit;
  font-size: 16px;
}
.search input::placeholder { color: var(--label-2); }
.search input::-webkit-search-cancel-button { display: none; }

/* botões circulares de ícone (limpar, copiar link, sair): 32px visíveis, alvo de 44px */
.round {
  position: relative;
  flex: none;
  display: grid; place-items: center;
  width: 32px; height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  color: var(--label-2);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, opacity 0.2s, transform 0.2s var(--ease);
}
.round::after { content: ''; position: absolute; inset: -6px; }
.round svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.round:hover { background: var(--fill-hover); color: var(--label); }
.round:active { transform: scale(0.92); }
.search .round { width: 24px; height: 24px; background: none; }
.search .round svg { width: 14px; height: 14px; }
.round.done { color: var(--accent); }

/* botão de tema: um ícone por modo (sistema, claro, escuro) */
.theme svg { display: none; }
.theme[data-mode='auto'] .i-auto,
.theme[data-mode='light'] .i-light,
.theme[data-mode='dark'] .i-dark { display: block; }
.theme-corner { position: fixed; top: calc(14px + env(safe-area-inset-top)); right: var(--gutter); z-index: 5; }

/* ---------- página ---------- */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px var(--gutter) calc(64px + env(safe-area-inset-bottom));
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--label-2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.title {
  margin-bottom: 28px;
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.026em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 24px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease);
}
.card.enter { animation: rise 0.55s var(--ease) both; }
@media (hover: hover) {
  .card:not(.soon):hover { transform: scale(1.02); box-shadow: var(--shadow-lift); }
}
.card:not(.soon):active { transform: scale(0.98); }
.card:has(.card-link:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; }

.app-icon {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--c);
}
.app-icon svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.card .round { position: relative; z-index: 1; }
@media (hover: hover) {
  .card .round { opacity: 0; }
  .card:hover .round, .card:focus-within .round, .card .round:focus-visible { opacity: 1; }
}

.card-body { padding-top: 24px; }
.card-link { color: inherit; text-decoration: none; outline: 0; }
.card-link::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.card h2 { font-size: 20px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
.card p { margin-top: 6px; color: var(--label-2); font-size: 15px; line-height: 1.4; text-wrap: pretty; }

.card.soon { opacity: 0.55; }
.pill { padding: 4px 10px; border-radius: 999px; background: var(--fill); color: var(--label-2); font-size: 12px; font-weight: 600; }

.empty { padding: 48px 0; color: var(--label-2); text-align: center; font-size: 15px; }

/* ---------- login ---------- */
.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px var(--gutter);
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 360px;
  animation: rise 0.6s var(--ease) both;
}
.login-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; text-align: center; }
.login-head .mark { margin-bottom: 14px; }
.login-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.024em; }
.login-head p { color: var(--label-2); font-size: 15px; }

.group {
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s;
}
.group:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent); }

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 12px 0 16px;
  cursor: text;
}
.row + .row::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--hairline); }
.row > span { flex: none; width: 68px; color: var(--label-2); font-size: 15px; font-weight: 500; }
.row input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: none;
  border: 0;
  outline: 0;
  color: var(--label);
  font: inherit;
  font-size: 17px;
}
.row input:-webkit-autofill {
  -webkit-text-fill-color: var(--label);
  transition: background-color 9999s;
}
.row .round { background: none; }
.eye .off { display: none; }
.eye[aria-pressed='true'] .on { display: none; }
.eye[aria-pressed='true'] .off { display: block; }

.login-error { margin-top: -4px; color: var(--danger); font-size: 13px; font-weight: 500; text-align: center; }

.btn {
  height: 50px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-fill);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s var(--ease), filter 0.2s, opacity 0.2s;
}
@media (hover: hover) { .btn:hover:not(:disabled) { filter: brightness(1.1); } }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: progress; }

.login-form.shake { animation: shake 0.4s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* curvas contínuas (squircle) onde o navegador suporta */
@supports (corner-shape: squircle) {
  .card, .app-icon, .mark, .group, .search { corner-shape: squircle; }
}

@media (max-width: 640px) {
  .bar-in { flex-wrap: wrap; row-gap: 10px; }
  .search { order: 3; flex: 1 0 100%; width: 100%; }
  .search:focus-within { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
}
