/* =========================================================
   Clientes — design ao estilo Apple (macOS / iOS)
   ========================================================= */

/* ---------- Cores: modo escuro (por defeito) ---------- */
:root {
  --bg: #0d0d0f;
  --sidebar: rgba(30, 30, 32, .78);
  --card: #1c1c1e;
  --card-2: #2c2c2e;
  --elevated: #2c2c2e;
  --fill: rgba(118, 118, 128, .24);
  --fill-2: rgba(118, 118, 128, .16);
  --fill-3: rgba(118, 118, 128, .10);
  --sep: rgba(84, 84, 88, .55);
  --sep-soft: rgba(84, 84, 88, .32);
  --label: #f5f5f7;
  --label-2: rgba(235, 235, 245, .62);
  --label-3: rgba(235, 235, 245, .34);
  --thumb: #636366;
  --accent: #0a84ff;
  --accent-hover: #3396ff;
  --accent-tint: rgba(10, 132, 255, .18);
  --on-accent: #ffffff;
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --red-tint: rgba(255, 69, 58, .16);
  --ring: rgba(10, 132, 255, .45);
  --hud: rgba(58, 58, 60, .86);
  --hud-text: #ffffff;
  --shadow-card: 0 0 0 .5px rgba(255, 255, 255, .04);
  --shadow-pop: 0 0 0 .5px rgba(255, 255, 255, .08), 0 24px 70px rgba(0, 0, 0, .6);
  --thumb-shadow: 0 3px 8px rgba(0, 0, 0, .2), 0 0 0 .5px rgba(0, 0, 0, .1);
  --backdrop: rgba(0, 0, 0, .5);
  --sel: rgba(255, 255, 255, .10);
  --sel-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .06), 0 1px 2px rgba(0, 0, 0, .3);
  --ink: #f5f5f7;
  --ink-text: #111113;
  --ink-hover: #ffffff;

  --p-google: #4c8dff;
  --p-pinterest: #ff4d5e;
  --t-purple: #d48bff;    --t-purple-bg: rgba(191, 90, 242, .16);
  --t-mint: #66e0d8;      --t-mint-bg: rgba(99, 230, 226, .14);
  --t-orange: #ffb340;    --t-orange-bg: rgba(255, 159, 10, .16);
  --t-indigo: #9d9bff;    --t-indigo-bg: rgba(94, 92, 230, .22);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;

  --r-xs: 6px;
  --r-sm: 8px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --ease: cubic-bezier(.25, .1, .25, 1);
  --spring: cubic-bezier(.32, .72, 0, 1);
  color-scheme: dark;
}

/* ---------- Cores: modo claro ---------- */
[data-theme="light"] {
  --bg: #f5f5f7;
  --sidebar: rgba(236, 236, 240, .82);
  --card: #ffffff;
  --card-2: #f2f2f7;
  --elevated: #ffffff;
  --fill: rgba(118, 118, 128, .14);
  --fill-2: rgba(118, 118, 128, .10);
  --fill-3: rgba(118, 118, 128, .06);
  --sep: rgba(60, 60, 67, .2);
  --sep-soft: rgba(60, 60, 67, .12);
  --label: #1d1d1f;
  --label-2: rgba(60, 60, 67, .68);
  --label-3: rgba(60, 60, 67, .38);
  --thumb: #ffffff;
  --accent: #007aff;
  --accent-hover: #0068d9;
  --accent-tint: rgba(0, 122, 255, .12);
  --green: #28a745;
  --orange: #e08600;
  --red: #ff3b30;
  --red-tint: rgba(255, 59, 48, .1);
  --ring: rgba(0, 122, 255, .35);
  --hud: rgba(255, 255, 255, .92);
  --hud-text: #1d1d1f;
  --shadow-card: 0 0 0 .5px rgba(0, 0, 0, .05), 0 1px 3px rgba(0, 0, 0, .04);
  --shadow-pop: 0 0 0 .5px rgba(0, 0, 0, .06), 0 24px 70px rgba(0, 0, 0, .18);
  --thumb-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04);
  --backdrop: rgba(0, 0, 0, .25);
  --sel: #ffffff;
  --sel-shadow: 0 0 0 .5px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .08);
  --ink: #1d1d1f;
  --ink-text: #ffffff;
  --ink-hover: #000000;

  --p-google: #1a73e8;
  --p-pinterest: #e60023;
  --t-purple: #9a3fcf;    --t-purple-bg: rgba(175, 82, 222, .12);
  --t-mint: #00857e;      --t-mint-bg: rgba(0, 199, 190, .13);
  --t-orange: #b35c00;    --t-orange-bg: rgba(255, 149, 0, .14);
  --t-indigo: #4b49c8;    --t-indigo-bg: rgba(88, 86, 214, .12);
  color-scheme: light;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 15px/1.47 var(--font);
  letter-spacing: -.008em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--accent); text-decoration: none; }
::selection { background: var(--accent-tint); }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--label-2); }
.small { font-size: 12.5px; word-break: break-word; }
svg { flex: none; }

kbd {
  font: 500 11px/1 var(--font);
  min-width: 20px; padding: 3px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .2);
  text-align: center;
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 15px;
  border: 0; border-radius: var(--r);
  background: var(--fill); color: var(--label);
  font-weight: 500; font-size: 14px;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s var(--ease), transform .1s var(--ease), opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--fill-2); }
.btn-ghost:hover { background: var(--fill); }
.btn-plain { background: none; color: var(--accent); padding: 0 8px; }
.btn-plain:hover { background: var(--accent-tint); }
.btn-danger { background: var(--red); color: #fff; }
.btn-tinted-danger { background: var(--red-tint); color: var(--red); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13.5px; border-radius: var(--r-sm); }
.btn-lg { height: 44px; font-size: 16px; font-weight: 600; border-radius: 12px; width: 100%; }
.btn-block { width: 100%; justify-content: space-between; height: 36px; }
.sidebar .btn-primary { background: var(--ink); color: var(--ink-text); }
.sidebar .btn-primary:hover { background: var(--ink-hover); }
.sidebar .btn-primary kbd { background: rgba(128, 128, 128, .22); color: inherit; opacity: .8; }

.icon-btn {
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--label-2);
  cursor: pointer;
  transition: background-color .15s, color .15s, transform .1s;
}
.icon-btn:hover { background: var(--fill-2); color: var(--label); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.danger:hover { color: var(--red); background: var(--red-tint); }
.icon-btn svg, .search svg {
  width: 17px; height: 17px;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

.link-quiet, .link-btn {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--accent); font-size: 13.5px;
}
.link-quiet:hover, .link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-btn.center { align-self: center; }
.sidebar .link-quiet { color: var(--label-2); font-weight: 500; }
.sidebar .link-quiet:hover { color: var(--label); text-decoration: none; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: 100vh; height: 100dvh; }

.sidebar {
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px 14px 14px;
  padding-top: max(18px, env(safe-area-inset-top));
  background: var(--sidebar);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  border-right: .5px solid var(--sep);
  min-height: 0;
}
.side-top { display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; }
.wordmark { font: 700 22px/1.1 var(--font-display); letter-spacing: -.022em; }
.side-spacer { flex: 1; }
.role-badge {
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  color: var(--accent); background: var(--accent-tint);
  padding: 3px 8px; border-radius: 999px;
}
.theme-toggle .i-moon { display: none; }
[data-theme="light"] .theme-toggle .i-sun { display: none; }
[data-theme="light"] .theme-toggle .i-moon { display: block; }

/* Navegação lateral (ícones em quadrado colorido, como nas Definições do iPhone) */
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 8px;
  border: 0; border-radius: var(--r);
  background: none; cursor: pointer; text-align: left;
  font-size: 14.5px; font-weight: 500;
  transition: background-color .15s;
}
.nav-item:hover { background: var(--fill-3); }
.nav-item.is-on { background: var(--sel); box-shadow: var(--sel-shadow); }
.nav-item svg {
  width: 28px; height: 28px; padding: 6px; border-radius: 7px;
  background: linear-gradient(180deg, #ff9f0a, #ff7a00);
  fill: none; stroke: #fff; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round;
}
#navUsers svg { background: linear-gradient(180deg, #7d7aff, #5856d6); }
.nav-late { margin-left: auto; font-size: 12.5px; font-weight: 500; color: var(--red); }
.nav-count {
  min-width: 22px; padding: 0 7px; height: 20px; line-height: 20px;
  border-radius: 999px; text-align: center;
  font-size: 12px; font-weight: 600; color: var(--label-2); background: var(--fill-2);
  font-variant-numeric: tabular-nums;
}
.nav-count:empty { display: none; }
.nav-late:empty + .nav-count { margin-left: auto; }

/* Pesquisa */
.search {
  display: flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 9px;
  border-radius: var(--r-sm);
  background: var(--fill-2);
  color: var(--label-3);
  transition: box-shadow .15s;
}
.search:focus-within { box-shadow: 0 0 0 3.5px var(--ring); color: var(--label-2); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--label); font-size: 14px; }
.search input::placeholder { color: var(--label-3); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { background: var(--fill); color: var(--label-2); }

/* Controlo segmentado (filtros, tabs, estado) */
.filters, .tabs, .status-switch {
  display: inline-flex; gap: 2px; padding: 2px;
  background: var(--fill-2); border-radius: 9px;
}
.filters { display: flex; }
.filters button, .tabs button, .status-switch button {
  flex: 1 1 auto;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; background: none; cursor: pointer; white-space: nowrap;
  border-radius: 7px; color: var(--label);
  transition: background-color .2s var(--ease), box-shadow .2s var(--ease), color .15s;
}
.filters button { padding: 5px 2px; font-size: 12.5px; font-weight: 500; }
.filters button span, .tabs button span, .sw-count { color: var(--label-3); font-variant-numeric: tabular-nums; font-weight: 500; }
.filters button span:empty { display: none; }
.filters button.is-on, .tabs button.is-on, .status-switch button.is-on {
  background: var(--thumb); box-shadow: var(--thumb-shadow);
}

/* Lista de clientes */
.client-list { list-style: none; margin: 0 -4px; padding: 0 0 4px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.client-item {
  width: 100%; display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; margin-bottom: 1px;
  border: 0; border-radius: var(--r);
  background: none; cursor: pointer; text-align: left;
  transition: background-color .12s;
}
.client-item:hover { background: var(--fill-3); }
.client-item.is-on { background: var(--sel); box-shadow: var(--sel-shadow); }
.client-item.is-on .ci-name { color: var(--label); }
.ci-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ci-name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-meta { font-size: 12.5px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-item.st-inactive:not(.is-on) .ci-name { color: var(--label-2); }
.list-empty { padding: 24px 10px; color: var(--label-3); font-size: 14px; text-align: center; }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-active { background: var(--green); }
.dot-paused { background: var(--orange); }
.dot-inactive { background: none; box-shadow: inset 0 0 0 1.5px var(--label-3); }

.ci-plats { display: flex; gap: 4px; }
.plat-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.p-google { background: var(--p-google); }
.p-pinterest { background: var(--p-pinterest); }

.select {
  height: 34px; padding: 0 30px 0 11px; min-width: 0;
  border: 0; border-radius: var(--r-sm);
  background: var(--fill-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 9px center / 13px;
  appearance: none; -webkit-appearance: none;
  font-size: 14px; color: var(--label); cursor: pointer;
}
.select:focus-visible { box-shadow: 0 0 0 3.5px var(--ring); }

/* Rodapé da barra lateral */
.side-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 2px 0; border-top: .5px solid var(--sep);
  padding-bottom: env(safe-area-inset-bottom);
}
.me {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 6px; margin: -2px 0; border: 0; border-radius: var(--r);
  background: none; text-align: left;
}
button.me { cursor: pointer; transition: background-color .15s; }
button.me:hover { background: var(--fill-3); }
button.me.is-on { background: var(--sel); box-shadow: var(--sel-shadow); }
.avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #a3a3ab, #6e6e76);
  color: #fff; font-weight: 600; font-size: 14px;
}
.avatar.xl { width: 84px; height: 84px; font-size: 36px; font-weight: 500; }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-sub { font-size: 12px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Área principal ---------- */
.main { overflow-y: auto; min-height: 0; scroll-behavior: smooth; }
.sheet { max-width: 940px; margin: 0 auto; padding: 44px 48px 96px; animation: fade-in .35s var(--ease); }
.sheet.narrow { max-width: 640px; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }

.blank {
  min-height: 100%; display: grid; place-content: center; justify-items: center; text-align: center; gap: 8px;
  padding: 40px; color: var(--label-2);
  animation: fade-in .35s var(--ease);
}
.blank::before {
  content: ""; width: 64px; height: 64px; border-radius: 16px; margin-bottom: 10px;
  background: var(--fill-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='4'/%3E%3Cpath d='M8 9h8M8 12h8M8 15h5'/%3E%3C/svg%3E") no-repeat center / 30px;
}
.blank h2 { font: 700 24px/1.15 var(--font-display); letter-spacing: -.02em; color: var(--label); margin: 0; }
.blank p { margin: 0 0 12px; max-width: 360px; }

.back { display: none; }
.sheet-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 18px 24px; }
.sheet-title {
  font: 700 34px/1.12 var(--font-display);
  letter-spacing: -.026em;
  margin: 0 0 8px; word-break: break-word;
}
.sheet-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; color: var(--label-2); font-size: 14px; }
.sheet-meta b { font-weight: 500; color: var(--label); }
.sheet-tools { display: flex; align-items: center; gap: 4px; }
.sheet-tools .status-switch { margin-right: 6px; }
.status-switch button { padding: 5px 12px; font-size: 13px; font-weight: 500; }
.status-switch .dot { width: 8px; height: 8px; }
.status-switch .sw-count { margin-left: 2px; }

/* Plataformas */
.platforms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.plat {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 12px;
  border: .5px solid var(--sep); border-radius: 999px;
  background: none; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--label-3);
  transition: background-color .15s, color .15s, border-color .15s, transform .1s;
}
.plat:active { transform: scale(.96); }
.plat .plat-dot { opacity: .35; transition: opacity .15s; }
.plat:hover { color: var(--label-2); }
.plat.is-on { background: var(--fill-2); border-color: transparent; color: var(--label); }
.plat.is-on .plat-dot { opacity: 1; }
.plat.is-static { cursor: default; }
.plat.is-static:active { transform: none; }

/* Tabs (controlo segmentado) */
.tabs { margin: 30px 0 20px; }
.tabs button { padding: 6px 16px; font-size: 13.5px; font-weight: 500; }

.section-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-bar p { margin: 0; color: var(--label-2); font-size: 14px; }

/* ---------- Lojas (cartões) ---------- */
.stores { display: flex; flex-direction: column; gap: 12px; }
.store {
  background: var(--card); border-radius: var(--r-lg);
  padding: 16px 18px 14px;
  box-shadow: var(--shadow-card);
}
.store-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 16px; }
.store-row.admin { grid-template-columns: minmax(0, 1fr) auto; }
.store-name { font-size: 17px; font-weight: 600; letter-spacing: -.016em; margin: 0 0 2px; }
.store-url { font-size: 13.5px; color: var(--accent); display: inline-flex; gap: 4px; align-items: center; word-break: break-all; }
span.store-url { color: var(--label-3); }
.store-url:hover { text-decoration: underline; text-underline-offset: 3px; }
.store-url svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
.ads {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 4px 0 12px;
  border-radius: var(--r-sm); background: var(--fill-3);
  font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: .01em;
}
.ads small { color: var(--label-3); font-size: 12px; font-weight: 500; letter-spacing: 0; }
.ads .icon-btn { width: 26px; height: 26px; }
.ads .icon-btn svg { width: 15px; height: 15px; }
.ads.none { color: var(--label-3); padding-right: 12px; font-weight: 400; font-size: 13px; }
.store-actions { display: flex; gap: 0; }

.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.store-plats { display: contents; }
.store .plat { height: 24px; padding: 0 10px; font-size: 12px; gap: 6px; }
.store .plat .plat-dot { width: 7px; height: 7px; }
.store-plats + .tag { margin-left: 4px; }
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: 999px; background: var(--fill-2);
  font-size: 12px; font-weight: 600; color: var(--label-2);
}
.tag-trackatlas { color: var(--t-purple); background: var(--t-purple-bg); }
.tag-wetracked  { color: var(--t-mint);   background: var(--t-mint-bg); }
.tag-agency     { color: var(--t-orange); background: var(--t-orange-bg); }
.tag-personal   { color: var(--t-indigo); background: var(--t-indigo-bg); }

.store-toggles {
  display: flex; flex-wrap: wrap; gap: 4px 20px;
  margin-top: 14px; padding-top: 12px; border-top: .5px solid var(--sep-soft);
}
.notes-toggle {
  border: 0; background: none; cursor: pointer; padding: 2px 0;
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--label-2); font-size: 13.5px; font-weight: 500;
}
.notes-toggle:hover { color: var(--label); }
.notes-toggle svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--spring); }
.notes-toggle[aria-expanded="true"] { color: var(--label); }
.notes-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.store .panel { margin-top: 14px; animation: fade-in .25s var(--ease); }
.late-txt { color: var(--red); }

/* ---------- Notas ---------- */
.composer { margin-bottom: 16px; }
.composer textarea, .note-edit textarea {
  width: 100%; min-height: 88px; resize: vertical; display: block;
  padding: 12px 14px; border: 0; border-radius: var(--r);
  background: var(--card); box-shadow: var(--shadow-card);
  line-height: 1.5; transition: box-shadow .15s;
}
.store .composer textarea, .store .note-edit textarea { background: var(--fill-3); box-shadow: none; }
.composer textarea:focus, .note-edit textarea:focus { box-shadow: 0 0 0 3.5px var(--ring); }
.composer textarea::placeholder { color: var(--label-3); }
.composer-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12.5px; color: var(--label-3); }

.note-list { display: flex; flex-direction: column; }
.sheet > .note-list, .sheet > .composer + .note-list {
  background: var(--card); border-radius: var(--r-lg); padding: 4px 18px; box-shadow: var(--shadow-card);
}
.note { padding: 13px 0; border-top: .5px solid var(--sep-soft); }
.note:first-child { border-top: 0; }
.note-body { white-space: pre-wrap; word-break: break-word; max-width: 72ch; }
.note-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 5px; font-size: 12.5px; color: var(--label-3); }
.note-foot .edited { font-style: italic; }
.note-act { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.note:hover .note-act, .note:focus-within .note-act { opacity: 1; }
.note-act button { border: 0; background: none; cursor: pointer; color: var(--accent); font-size: 12.5px; font-weight: 500; padding: 3px 7px; border-radius: 6px; }
.note-act button:hover { background: var(--accent-tint); }
.note-act button.danger { color: var(--red); }
.note-act button.danger:hover { background: var(--red-tint); }
.note-edit .row { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; }
.notes-empty { color: var(--label-3); font-size: 14px; margin: 4px 0; }

/* ---------- Tarefas (estilo Lembretes) ---------- */
.todo-add, .todo-edit { display: flex; gap: 6px; align-items: center; }
.todo-add { margin-bottom: 6px; }
.todo-add input, .todo-edit input {
  height: 34px; padding: 0 11px; min-width: 0;
  border: 0; border-radius: var(--r-sm);
  background: var(--fill-3); font-size: 14px;
  transition: box-shadow .15s;
}
.todo-add input[type="text"], .todo-edit input[type="text"] { flex: 1; }
.todo-add input[type="date"], .todo-edit input[type="date"] { width: 150px; flex: none; color: var(--label-2); }
.todo-add input:focus, .todo-edit input:focus { box-shadow: 0 0 0 3.5px var(--ring); color: var(--label); }
.todo-add input::placeholder { color: var(--label-3); }
.todo-edit { width: 100%; }

.todo-list { display: flex; flex-direction: column; }
.todos-page .todo-list, .sheet > .todo-list {
  background: var(--card); border-radius: var(--r-lg); padding: 2px 16px; box-shadow: var(--shadow-card);
}
.todo {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  padding: 10px 0; border-top: .5px solid var(--sep-soft);
}
.todo:first-child, .todo-group + .todo { border-top: 0; }
.todo.is-editing { display: block; }
.check {
  width: 22px; height: 22px; padding: 0; flex: none;
  display: grid; place-items: center;
  border: 1.5px solid var(--label-3); border-radius: 50%;
  background: none; cursor: pointer; color: transparent;
  transition: background-color .2s var(--ease), border-color .2s, transform .15s var(--spring);
}
.check:hover { border-color: var(--accent); }
.check:active { transform: scale(.85); }
.check svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.todo.is-done .check { background: var(--accent); border-color: var(--accent); color: #fff; }
.todo-main { min-width: 0; }
.todo-title { word-break: break-word; }
.todo.is-done .todo-title { color: var(--label-3); }
.todo-where { display: flex; flex-wrap: wrap; gap: 4px; font-size: 12.5px; color: var(--label-3); margin-top: 1px; }
.todo-where .sep { opacity: .7; }
.todo-link { border: 0; background: none; padding: 0; cursor: pointer; color: var(--label-2); font-size: inherit; font-weight: 500; }
.todo-link:hover { color: var(--accent); }
.due { font-size: 13px; color: var(--label-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.due.none { color: var(--label-3); }
.due.today { color: var(--orange); font-weight: 500; }
.due.late { color: var(--red); font-weight: 500; }
.todo.is-done .due { color: var(--label-3); font-weight: 400; }
.todo-act { display: flex; opacity: 0; transition: opacity .15s; }
.todo:hover .todo-act, .todo:focus-within .todo-act { opacity: 1; }
.todo-act .icon-btn { width: 28px; height: 28px; }
.todo-act .icon-btn svg { width: 15px; height: 15px; }

.todo-group {
  margin: 14px 0 2px; padding: 0;
  font-size: 12.5px; font-weight: 600; color: var(--label-3);
}
.todo-group span { margin-left: 6px; font-weight: 500; }
.todo-section { margin-bottom: 26px; }
h3.todo-group { font: 600 20px/1.2 var(--font-display); letter-spacing: -.018em; color: var(--label); margin: 0 0 10px 2px; }
h3.todo-group span { color: var(--label-3); }
h3.todo-group.late-txt { color: var(--red); }
.todos-page { margin-top: 32px; }
.hint { margin: 18px 0 0; font-size: 13px; color: var(--label-3); }

/* ---------- Formulários de diálogo ---------- */
.plat-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.plat-pick label {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 13px;
  border-radius: 999px; background: var(--fill-2);
  font-size: 13.5px; font-weight: 500; color: var(--label-2);
  cursor: pointer; user-select: none;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.plat-pick input { position: absolute; opacity: 0; pointer-events: none; }
.plat-pick label .plat-dot { opacity: .4; }
.plat-pick label:has(input:checked) { background: var(--ink); color: var(--ink-text); }
.plat-pick label:has(input:checked) .plat-dot { opacity: 1; }
.plat-pick label:has(input:focus-visible) { box-shadow: 0 0 0 4px var(--ring); }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 500; color: var(--label-2); margin-bottom: 6px; }
.field input, .user-add input, .group-row input {
  width: 100%; height: 40px; padding: 0 12px;
  border: 0; border-radius: var(--r);
  background: var(--fill-2);
  transition: box-shadow .15s;
}
.field input:focus, .user-add input:focus { box-shadow: 0 0 0 3.5px var(--ring); }
.field input::placeholder, .user-add input::placeholder, .group-row input::placeholder { color: var(--label-3); }

/* ---------- Diálogos (folhas) ---------- */
.dlg {
  width: min(460px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 24px;
  border: 0; border-radius: var(--r-xl);
  background: var(--elevated); color: var(--label);
  box-shadow: var(--shadow-pop);
}
.dlg-sm { width: min(340px, calc(100% - 32px)); text-align: center; }
.dlg::backdrop { background: var(--backdrop); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dlg[open] { animation: sheet-in .38s var(--spring); }
.dlg[open]::backdrop { animation: fade .3s var(--ease); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes fade { from { opacity: 0; } }
.dlg h2 { font: 700 22px/1.2 var(--font-display); letter-spacing: -.02em; margin: 0 0 20px; }
.dlg-sm h2 { font-size: 17px; font-weight: 600; margin: 4px 0 8px; letter-spacing: -.01em; }
.dlg-sm p { margin: 0 0 4px; font-size: 13.5px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.dlg-sm .dlg-actions { margin-top: 20px; }
.dlg-sm .dlg-actions .btn { flex: 1; height: 38px; }

/* ---------- Toast (HUD) ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px) scale(.96);
  padding: 11px 18px; border-radius: 999px;
  background: var(--hud); color: var(--hud-text);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25), 0 0 0 .5px rgba(0, 0, 0, .06);
  font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none; z-index: 50;
  transition: opacity .25s var(--ease), transform .4s var(--spring);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast.err { background: var(--red); color: #fff; }

/* ---------- Admin ---------- */
.sheet-tools.column { flex-direction: column; align-items: flex-end; gap: 10px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 13px; border-radius: 999px;
  background: var(--fill-2); font-size: 13px; font-weight: 500;
}
.owner-pick { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--label-2); }
.owner-pick .select { min-width: 190px; }
.stores.no-top { margin-top: 0; }

.user-add { display: flex; gap: 8px; margin: 28px 0 20px; max-width: 540px; }
.user-add input { flex: 1; min-width: 0; height: 38px; background: var(--card); box-shadow: var(--shadow-card); }
.user-add .btn { height: 38px; }

.banner {
  margin: 0 0 22px; padding: 14px 16px;
  border-radius: var(--r-lg);
  background: var(--t-orange-bg);
  font-size: 14px;
}
.banner p { margin: 0 0 10px; color: var(--label); }
.banner b { font-weight: 600; }
.banner-row { display: flex; flex-wrap: wrap; gap: 8px; }
.banner .select { background-color: var(--card); }

.users { background: var(--card); border-radius: var(--r-lg); padding: 0 18px; box-shadow: var(--shadow-card); }
.users:empty { display: none; }
.user-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 18px;
  padding: 13px 0; border-top: .5px solid var(--sep-soft);
}
.user-row:first-child { border-top: 0; }
.user-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.user-name .pending { color: var(--orange); font-weight: 500; font-size: 14px; }
.user-meta { font-size: 13px; color: var(--label-2); word-break: break-all; }
.user-stats { display: flex; flex-direction: column; align-items: flex-end; font-size: 12.5px; color: var(--label-3); }
.user-actions { display: flex; align-items: center; gap: 6px; }

/* ---------- Conta (estilo Definições) ---------- */
.account-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; margin: 6px 0 30px; }
.account-head .avatar { margin-bottom: 10px; }
.account-head .sheet-title { margin: 0; font-size: 28px; }
.account-head p { margin: 0; }
.group { margin-bottom: 30px; }
.group-title {
  margin: 0 0 7px 16px;
  font-size: 13px; font-weight: 500; color: var(--label-2);
  text-transform: uppercase; letter-spacing: .02em;
}
.group-card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-card); overflow: hidden; }
.group-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 46px; padding: 0 16px;
  position: relative;
}
.group-row + .group-row::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0;
  border-top: .5px solid var(--sep-soft);
}
.group-row.input-row > span { flex: none; width: 90px; color: var(--label); }
.group-row input {
  height: 44px; padding: 0; border-radius: 0; background: none;
  text-align: right; flex: 1; min-width: 0;
}
.group-row input:focus { box-shadow: none; }
.row-btn {
  width: 100%; border: 0; background: none; cursor: pointer;
  color: var(--accent); font-size: 15px; text-align: left;
}
.row-btn:hover { background: var(--fill-3); }
.row-btn svg { width: 13px; height: 13px; fill: none; stroke: var(--label-3); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.group-foot {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 8px 16px 0;
}
.group-foot p { margin: 0; font-size: 12.5px; color: var(--label-2); line-height: 1.4; }
.group-foot .btn { margin-left: auto; flex: none; }
.group-foot .btn ~ .btn { margin-left: 0; }
.badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px;
  border-radius: 999px; background: var(--fill-2);
  font-size: 12.5px; font-weight: 600; color: var(--label-2);
}
.badge-on { background: rgba(48, 209, 88, .16); color: var(--green); }
.badge.sm { height: 19px; padding: 0 7px; font-size: 11px; }

.twofa { padding: 18px; display: grid; gap: 18px; justify-items: center; }
.steps { margin: 0; padding-left: 20px; justify-self: stretch; color: var(--label-2); font-size: 14px; display: grid; gap: 4px; }
.qr {
  width: 196px; height: 196px; padding: 10px;
  border-radius: 16px; background: #fff;
  display: grid; place-items: center;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .1);
}
.qr svg { width: 100%; height: 100%; display: block; }
.secret { display: grid; justify-items: center; gap: 4px; font-size: 12.5px; color: var(--label-2); }
.secret code {
  font: 600 14.5px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--label); letter-spacing: .04em; word-break: break-all; text-align: center;
}
.code-row { width: 100%; display: flex; justify-content: center; }

.code-input {
  width: 100%; height: 56px; padding: 0 12px;
  border: 0; border-radius: 12px; background: var(--fill-2);
  text-align: center; font: 600 26px/1 var(--font-display);
  letter-spacing: .18em; font-variant-numeric: tabular-nums;
  transition: box-shadow .15s;
}
.code-input.sm { max-width: 220px; height: 50px; font-size: 22px; }
.code-input:focus { box-shadow: 0 0 0 3.5px var(--ring); }
.code-input::placeholder { color: var(--label-3); letter-spacing: .12em; }

/* ---------- Login ---------- */
.login {
  min-height: 100%; display: grid; place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(10, 132, 255, .14), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(191, 90, 242, .12), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(380px, 100%);
  display: flex; flex-direction: column; align-items: stretch; gap: 14px;
  text-align: center;
  animation: fade-in .45s var(--ease);
}
.login-card.shake { animation: shake .42s var(--ease); }
@keyframes shake {
  20% { transform: translateX(-8px); } 40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(3px); }
}
.app-icon {
  width: 76px; height: 76px; margin: 0 auto 6px;
  border-radius: 18px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #3d9bff 0%, #0a64e0 55%, #5b4ae0 100%);
  box-shadow: 0 10px 30px rgba(10, 100, 224, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.app-icon svg { width: 40px; height: 40px; fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.login-title { font: 700 30px/1.1 var(--font-display); letter-spacing: -.026em; margin: 0; }
.login-sub { margin: -4px 0 4px; color: var(--label-2); font-size: 15px; }
.login-step { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.login-step.is-busy .arrow { opacity: .5; }
.login-chip {
  align-self: center; margin: 0 0 2px;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 5px 6px 5px 14px; border-radius: 999px;
  background: var(--fill-2); font-size: 14px; color: var(--label);
}
.login-chip .link-btn { padding: 3px 10px; border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 500; }
.login-chip .link-btn:hover { text-decoration: none; }

.input-arrow { position: relative; }
.input-arrow input, .inset-group input {
  width: 100%; height: 50px; padding: 0 54px 0 16px;
  border: 0; border-radius: 12px;
  background: var(--card); box-shadow: var(--shadow-card), 0 0 0 .5px var(--sep);
  font-size: 16px; text-align: left;
  transition: box-shadow .15s;
}
.input-arrow input:focus, .inset-group input:focus { box-shadow: 0 0 0 3.5px var(--ring); position: relative; z-index: 1; }
.input-arrow input::placeholder, .inset-group input::placeholder { color: var(--label-3); }
.arrow {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; cursor: pointer;
  transition: background-color .15s, transform .1s, opacity .15s;
  z-index: 2;
}
.arrow:hover { background: var(--accent-hover); }
.arrow:active { transform: translateY(-50%) scale(.92); }
.arrow svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.inset-group {
  display: flex; flex-direction: column;
  border-radius: 12px; overflow: hidden;
  background: var(--card); box-shadow: var(--shadow-card), 0 0 0 .5px var(--sep);
}
.inset-group input { border-radius: 0; box-shadow: none; padding-right: 16px; background: none; }
.inset-group input + input { border-top: .5px solid var(--sep); }
.inset-group input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.inset-row { display: flex; align-items: center; gap: 12px; height: 50px; padding: 0 16px; text-align: left; }
.inset-row span { color: var(--label-2); font-size: 15px; flex: none; }
.inset-row input { height: 48px; padding: 0; text-align: right; font-weight: 500; }
.inset-row input:focus { box-shadow: none; }
.is-readonly { color: var(--label); cursor: default; }
.login-error {
  margin: 4px 0 0; padding: 10px 14px; border-radius: 12px;
  background: var(--red-tint); color: var(--red); font-size: 14px; font-weight: 500;
}

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .sheet { padding: 36px 32px 80px; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; height: auto; min-height: 100vh; min-height: 100dvh; }
  .sidebar {
    border-right: 0; min-height: 100vh; min-height: 100dvh;
    background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none;
    padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
  }
  .wordmark { font-size: 34px; letter-spacing: -.028em; }
  .side-top { padding-top: 8px; }
  .client-list { flex: none; overflow: visible; background: var(--card); border-radius: var(--r-lg); margin: 0; padding: 4px; box-shadow: var(--shadow-card); }
  .client-list:has(.list-empty) { background: none; box-shadow: none; }
  .search kbd, .btn-block kbd { display: none; }
  .btn-block { justify-content: center; height: 42px; font-size: 15px; border-radius: 12px; }
  .app.has-client .sidebar { display: none; }
  .app:not(.has-client) .main { display: none; }
  .main { overflow: visible; }

  .back {
    display: flex; align-items: center; gap: 2px;
    position: sticky; top: 0; z-index: 10;
    width: calc(100% + 36px); height: auto;
    margin: -12px -18px 10px; padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top));
    border-radius: 0; justify-content: flex-start;
    background: var(--bg);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    color: var(--accent); font-size: 16px; font-weight: 400;
  }
  .back svg { width: 20px; height: 20px; stroke-width: 2.4; }
  .back:active { transform: none; opacity: .6; }
  .sheet { padding: 12px 18px 80px; padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
  .sheet-title { font-size: 30px; }
  .sheet-tools { width: 100%; flex-wrap: wrap; }
  .sheet-tools .status-switch { flex: 1; margin-right: 0; }
  .sheet-tools.column { align-items: stretch; }
  .owner-pick .select { flex: 1; min-width: 0; }
  .tabs { display: flex; width: 100%; margin-top: 24px; }
  .tabs button { padding: 6px 4px; }

  .store { padding: 14px 14px 12px; }
  .store-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; }
  .store-row .ads { grid-column: 1 / -1; justify-self: start; grid-row: 2; }
  .store-row.admin .ads { grid-row: auto; }

  .note-act, .todo-act { opacity: 1; }
  .todo { grid-template-columns: auto minmax(0, 1fr) auto; }
  .todo-act { grid-column: 2 / -1; justify-content: flex-end; margin-top: -8px; }
  .todo-add, .todo-edit { flex-wrap: wrap; }
  .todo-add input[type="text"], .todo-edit input[type="text"] { flex-basis: 100%; }
  .todo-add input[type="date"], .todo-edit input[type="date"] { flex: 1; }

  .user-add { flex-wrap: wrap; }
  .user-add input, .user-add .btn { width: 100%; flex: none; }
  .user-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .user-stats { flex-direction: row; gap: 14px; align-items: flex-start; }
  .user-actions { flex-wrap: wrap; }

  .group-row.input-row > span { width: 76px; }
  .group-foot { flex-wrap: wrap; }
  .group-foot .btn { flex: 1; margin-left: 0; height: 40px; }
  .group-foot p { flex-basis: 100%; }

  .dlg { padding: 20px; }
  .dlg:not(.dlg-sm) {
    width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
  .dlg:not(.dlg-sm)[open] { animation: sheet-up .42s var(--spring); }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  .dlg-actions .btn { flex: 1; height: 42px; }
}

@media (hover: none) {
  .client-item:hover, .nav-item:hover:not(.is-on) { background: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
