:root {
  --black: #000;
  --white: #f4f4f4;
  --muted: #8a8a8a;
  --muted-2: #5c5c5c;
  --glass: linear-gradient(145deg, rgba(255,255,255,.085), rgba(255,255,255,.025));
  --glass-strong: linear-gradient(145deg, rgba(255,255,255,.13), rgba(255,255,255,.045));
  --stroke: rgba(255,255,255,.12);
  --stroke-2: rgba(255,255,255,.2);
  --r: 22px;
  --r-sm: 14px;
  --pad: clamp(16px, 3vw, 40px);
  --font: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  font-weight: 400;
  background: var(--black);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; }

/* ---------- background: soft black & white gradients ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background:
  radial-gradient(120% 90% at 50% -10%, #1d1d1d 0%, #070707 55%, #000 100%); }
.bg span { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .9; }
.bg .b1 { width: 52vw; height: 52vw; left: -14vw; top: -18vw; background: radial-gradient(circle, rgba(255,255,255,.34), transparent 65%); animation: flutua 22s ease-in-out infinite alternate; }
.bg .b2 { width: 44vw; height: 44vw; right: -12vw; top: 28vh; background: radial-gradient(circle, rgba(200,200,200,.22), transparent 65%); animation: flutua 28s ease-in-out infinite alternate-reverse; }
.bg .b3 { width: 60vw; height: 36vw; left: 20vw; bottom: -22vw; background: radial-gradient(circle, rgba(255,255,255,.16), transparent 65%); animation: flutua 34s ease-in-out infinite alternate; }
@keyframes flutua { to { transform: translate(4vw, 3vw) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .bg span { animation: none; } }

/* ---------- glass ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--r);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 20px 50px -20px rgba(0,0,0,.7);
}

.label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.logo { display: inline-flex; color: var(--white); }
.logo-svg { height: 18px; width: auto; display: block; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px; font-size: 14px; font-weight: 400;
  transition: background .2s, border-color .2s, transform .15s, opacity .2s; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: linear-gradient(180deg, #fff, #d6d6d6); color: #000; font-weight: 500; box-shadow: 0 8px 24px -10px rgba(255,255,255,.5); }
.btn.primary:hover { background: #fff; }
.btn.ghost { border: 1px solid var(--stroke-2); }
.btn.ghost:hover { background: rgba(255,255,255,.08); }
.btn.glass-btn { background: var(--glass); border: 1px solid var(--stroke); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); }
.btn.glass-btn:hover, .btn.glass-btn[aria-expanded="true"] { background: var(--glass-strong); border-color: var(--stroke-2); }
.btn.danger { border: 1px solid rgba(255,255,255,.2); color: #ff8b8b; }
.btn.danger:hover { background: rgba(255,90,90,.12); }
.btn.sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }
.plus { font-size: 20px; font-weight: 300; line-height: 1; margin-top: -2px; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: #fff; color: #000; font-size: 11px; font-weight: 500; display: inline-grid; place-items: center; }

/* ---------- segmented ---------- */
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255,255,255,.04); border: 1px solid var(--stroke); }
.seg button { height: 36px; padding: 0 16px; border-radius: 999px; font-size: 13px; color: var(--muted); transition: background .2s, color .2s; white-space: nowrap; }
.seg button:hover { color: var(--white); }
.seg button[aria-checked="true"], .seg button[aria-selected="true"] { background: linear-gradient(180deg, #fff, #d9d9d9); color: #000; }
.seg.mini button { height: 30px; padding: 0 12px; font-size: 12px; }
.seg.wrap { flex-wrap: wrap; border-radius: 20px; }

/* ---------- chips / tags ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12px; color: var(--muted);
  border: 1px solid var(--stroke); background: rgba(255,255,255,.03); display: inline-flex; align-items: center; gap: 6px;
  transition: all .2s;
}
.chip:hover { color: var(--white); border-color: var(--stroke-2); }
.chip[aria-pressed="true"] { background: #fff; color: #000; border-color: #fff; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 11px; letter-spacing: .02em; white-space: nowrap; }
.tom-0 { background: #f4f4f4; color: #000; }
.tom-1 { background: #a9a9a9; color: #000; }
.tom-2 { background: #3a3a3a; color: #f4f4f4; }
.tom-3 { background: transparent; color: #f4f4f4; box-shadow: inset 0 0 0 1px rgba(255,255,255,.45); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { font-size: 12px; color: var(--muted); }
input:not([type="checkbox"]), textarea {
  width: 100%; height: 46px; padding: 0 16px; border-radius: var(--r-sm);
  background: rgba(0,0,0,.35); border: 1px solid var(--stroke); outline: none; font-size: 15px;
  transition: border-color .2s, background .2s;
}
textarea { height: auto; padding: 12px 16px; resize: vertical; line-height: 1.45; }
input:focus, textarea:focus { border-color: rgba(255,255,255,.5); background: rgba(0,0,0,.5); }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
.prefix { position: relative; }
.prefix i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); }
.prefix input { padding-left: 30px; }
.erro { min-height: 1em; font-size: 13px; color: #ff8b8b; }
.erro:empty { display: none; }
.meta { font-size: 12px; color: var(--muted-2); }
.meta:empty { display: none; }

/* ---------- login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); padding: 40px 32px 32px; display: flex; flex-direction: column; gap: 20px; border-radius: 30px; }
.login-card .logo { justify-content: center; }
.login-card .logo-svg { height: 30px; }
.login-card .label { text-align: center; margin-top: -6px; }
.login-card .seg { width: 100%; }
.login-card .seg button { flex: 1; }
#login-senha { text-align: center; letter-spacing: .5em; font-size: 20px; height: 54px; }

/* ---------- app layout ---------- */
#app { max-width: 1320px; margin: 0 auto; padding: 16px var(--pad) 80px; }
.topbar { position: sticky; top: 12px; z-index: 5; display: flex; align-items: center; justify-content: space-between; height: 62px; padding: 0 12px 0 24px; border-radius: 999px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand .label { padding-left: 14px; border-left: 1px solid var(--stroke-2); color: var(--white); }
.user { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(145deg, #fff, #9a9a9a); color: #000; font-weight: 500; font-size: 13px; }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 48px 0 24px; }
.head h1 { font-size: clamp(34px, 5vw, 56px); font-weight: 300; letter-spacing: -.035em; line-height: 1.05; margin-top: 8px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { padding: 18px 20px; text-align: left; transition: border-color .2s, background .2s; }
.stat:hover { border-color: var(--stroke-2); }
.stat.on { background: var(--glass-strong); border-color: rgba(255,255,255,.35); }
.stat b { display: block; font-size: 32px; font-weight: 300; letter-spacing: -.03em; margin-top: 6px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.search { flex: 1 1 220px; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px; border-radius: 999px; }
.search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; }
.search input { border: 0; background: none; height: 100%; padding: 0; font-size: 14px; }
.search input:focus { background: none; }
.cats { border-radius: 999px; }
.tool-btns { display: flex; gap: 10px; }

.filtros { padding: 22px 24px; display: grid; grid-template-columns: 1.4fr 1.2fr auto auto; gap: 24px; margin-bottom: 16px; align-items: start; animation: entra .2s ease; }
.f-group { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.f-group .seg { align-self: flex-start; }
.f-foot { grid-column: 1 / -1; display: flex; justify-content: flex-end; border-top: 1px solid var(--stroke); padding-top: 14px; }
.vazio-mini { font-size: 12px; color: var(--muted-2); }
@keyframes entra { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- cards ---------- */
.lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { padding: 22px; display: flex; flex-direction: column; gap: 14px; cursor: pointer; text-align: left; transition: transform .2s, border-color .2s, background .2s; min-width: 0; }
.card:hover { transform: translateY(-2px); border-color: var(--stroke-2); background: var(--glass-strong); }
.card:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.card .top { display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 12px; }
.card h3 { font-size: 20px; font-weight: 400; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.card .cat { font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--stroke); border-radius: 999px; padding: 5px 10px; white-space: nowrap; flex: none; }
.contatos { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #cfcfcf; }
.contatos a { display: flex; align-items: center; gap: 8px; text-decoration: none; min-width: 0; }
.contatos a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contatos a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.contatos svg { width: 15px; height: 15px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.obs { font-size: 13px; line-height: 1.45; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.card .rodape { font-size: 11px; color: var(--muted-2); border-top: 1px solid var(--stroke); padding-top: 12px; }

.vazio { grid-column: 1 / -1; padding: 64px 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 14px; align-items: center; }
.vazio h3 { color: var(--white); font-weight: 300; font-size: 26px; letter-spacing: -.02em; }

/* ---------- modals ---------- */
dialog.modal {
  margin: auto; width: min(620px, calc(100% - 24px)); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 28px; color: var(--white); border-radius: 28px;
  background: linear-gradient(145deg, rgba(40,40,40,.82), rgba(12,12,12,.88));
}
dialog.modal.small { width: min(420px, calc(100% - 24px)); }
dialog::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
dialog[open] { animation: abre .22s ease; }
@keyframes abre { from { opacity: 0; transform: translateY(10px) scale(.98); } }
#form-cliente { display: flex; flex-direction: column; gap: 18px; }
.m-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.modal h2 { font-size: 26px; font-weight: 300; letter-spacing: -.03em; }
.modal.small p { color: var(--muted); margin: 10px 0 22px; line-height: 1.45; }
.x { width: 38px; height: 38px; border-radius: 50%; font-size: 22px; font-weight: 300; color: var(--muted); border: 1px solid var(--stroke); }
.x:hover { color: #fff; background: rgba(255,255,255,.08); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.m-foot { display: flex; gap: 10px; align-items: center; padding-top: 6px; }
.sp { flex: 1; }
.nova-tag { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.nova-tag input { height: 40px; font-size: 14px; }

#dlg-tags .nova-tag { margin: 18px 0 8px; flex-wrap: wrap; }
#dlg-tags .nova-tag input { flex: 1 1 200px; }
.tons { display: flex; gap: 6px; }
.tons button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; }
.tons button[aria-checked="true"] { border-color: #fff; box-shadow: 0 0 0 2px #000 inset; }
.tag-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.tag-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: rgba(255,255,255,.035); border: 1px solid var(--stroke); flex-wrap: wrap; }
.tag-list li .n { flex: 1; font-size: 13px; color: var(--muted); }
.tag-list li input { height: 34px; flex: 1 1 140px; font-size: 14px; }
.tag-list .acoes { display: flex; gap: 6px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 12px 20px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 50; background: var(--glass-strong); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .filtros { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .topbar { height: 56px; padding: 0 8px 0 18px; top: 8px; }
  .user #user-nome { display: none; }
  .head { margin: 32px 0 18px; }
  .head .btn { height: 42px; padding: 0 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat { padding: 14px 16px; }
  .stat b { font-size: 26px; }
  .cats { display: none; }
  .tool-btns { width: 100%; }
  .tool-btns .btn { flex: 1; }
  .filtros { grid-template-columns: 1fr; padding: 18px; gap: 18px; }
  .lista { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  dialog.modal { padding: 22px 18px; border-radius: 24px; }
  .m-foot { flex-wrap: wrap; }
}
.chip .dot { box-shadow: 0 0 0 1px rgba(140,140,140,.7); }
