/* MacHub Sensi — base: tokens, fundo, tipografia, botões, formulários */

@font-face { font-family: Inter; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fontes/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fontes/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fontes/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fontes/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 800; font-display: swap; src: url("/assets/fontes/inter-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 900; font-display: swap; src: url("/assets/fontes/inter-latin-900-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fontes/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fontes/jetbrains-mono-latin-700-normal.woff2") format("woff2"); }

:root {
  --page: #05060c;
  --screen: #080a13;
  --frame: #0c0f1a;
  --text: #f3f5ff;
  --muted: #8d93ad;
  --dim: #5b6180;
  --line: rgba(110, 145, 255, .14);
  --blue: #2f6bff;
  --blue-hi: #6f9bff;
  --blue-soft: rgba(47, 107, 255, .12);
  --glass: rgba(10, 12, 22, .55);
  --ok: #19d27c;
  --alerta: #f5c542;
  --perigo: #ff5a6e;
  --raio: 18px;
}

body.claro {
  --page: #eef1f8;
  --screen: #f8f9fd;
  --frame: #ffffff;
  --text: #0b1024;
  --muted: #5a6280;
  --dim: #7b8299;
  --line: rgba(40, 60, 140, .13);
  --blue: #2457e6;
  --blue-hi: #2457e6;
  --blue-soft: rgba(36, 87, 230, .09);
  --glass: rgba(255, 255, 255, .7);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden; touch-action: pan-x pan-y; }
html, body { margin: 0; }

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  background: var(--page);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background .3s ease, color .3s ease;
}

a { color: inherit; }
button { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
code { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- fundo ---------- */
.fundo { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.fundo i { position: absolute; border-radius: 50%; display: block; }
.fundo .arte {
  position: absolute; inset: -10%; border-radius: 0;
  background: url("/images/icon-web.jpg") center / cover no-repeat;
  filter: blur(46px) saturate(1.35);
  opacity: .2;
}
body.claro .fundo .arte { opacity: .1; }
.fundo .brilho-a {
  width: 70vmax; height: 70vmax; left: -26vmax; top: -32vmax;
  background: radial-gradient(circle, rgba(47,107,255,.28), transparent 62%);
  animation: deriva 24s ease-in-out infinite alternate;
}
.fundo .brilho-b {
  width: 62vmax; height: 62vmax; right: -26vmax; bottom: -32vmax;
  background: radial-gradient(circle, rgba(20,60,200,.3), transparent 62%);
  animation: deriva 30s ease-in-out infinite alternate-reverse;
}
.fundo .pontos {
  position: absolute; inset: 0; border-radius: 0;
  background-image: radial-gradient(rgba(140,170,255,.16) 1px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 40%, #000 20%, transparent 80%);
  mask-image: radial-gradient(ellipse 75% 65% at 50% 40%, #000 20%, transparent 80%);
}
.fundo .grao {
  position: absolute; inset: 0; border-radius: 0; opacity: .06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
body.claro .fundo .brilho-a { background: radial-gradient(circle, rgba(47,107,255,.16), transparent 62%); }
body.claro .fundo .brilho-b { background: radial-gradient(circle, rgba(47,107,255,.12), transparent 62%); }
body.claro .fundo .pontos { background-image: radial-gradient(rgba(36,87,230,.14) 1px, transparent 1.4px); }
@keyframes deriva { to { transform: translate(6vmax, 4vmax); } }

/* ---------- botões ---------- */
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--glass); color: var(--text);
  font-size: 13px; font-weight: 700; text-decoration: none;
  cursor: pointer; white-space: nowrap;
  transition: transform .18s, background .18s, border-color .18s, box-shadow .18s;
}
.botao:hover { background: var(--blue-soft); border-color: rgba(47,107,255,.4); }
.botao svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.botao.cheio {
  border: 0;
  background: linear-gradient(100deg, var(--blue), #1b4de0);
  color: #fff;
  box-shadow: 0 10px 22px -12px rgba(47,107,255,.8);
}
.botao.cheio:hover { box-shadow: 0 14px 26px -12px rgba(47,107,255,.95); }
.botao.pequeno { height: 31px; padding: 0 11px; font-size: 11.5px; border-radius: 9px; }
.botao.largo { width: 100%; }
.botao.perigo { color: #ff8793; border-color: rgba(255,90,110,.3); }
.botao.perigo:hover { background: rgba(255,90,110,.12); border-color: rgba(255,90,110,.5); }
.botao[disabled], .botao.ocupado { opacity: .55; pointer-events: none; }

.icone-botao {
  display: grid; place-items: center; flex: none;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--glass); color: var(--text); cursor: pointer;
  transition: background .18s, border-color .18s;
}
.icone-botao:hover { background: var(--blue-soft); border-color: rgba(47,107,255,.4); }
.icone-botao svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- formulários ---------- */
.campo { display: flex; flex-direction: column; gap: 5px; }
.campo > span { color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.campo em { color: var(--dim); font-size: 10.5px; font-style: normal; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--glass); color: var(--text);
  font: inherit; font-size: 13px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(47,107,255,.55); box-shadow: 0 0 0 3px var(--blue-soft); }
input::placeholder, textarea::placeholder { color: var(--dim); }
select { appearance: none; -webkit-appearance: none; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 17px, calc(100% - 12px) 17px; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 38px; }

.etiqueta {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%;
  padding: 4px 9px; border-radius: 999px;
  background: var(--blue-soft); color: var(--blue-hi);
  font-size: 10.5px; font-weight: 800; letter-spacing: .04em; line-height: 1.35;
}
.etiqueta.ok { background: rgba(25,210,124,.13); color: var(--ok); }
.etiqueta.alerta { background: rgba(245,197,66,.13); color: var(--alerta); }
.etiqueta.perigo { background: rgba(255,90,110,.13); color: var(--perigo); }
.etiqueta.neutra { background: rgba(127,150,230,.1); color: var(--muted); }

/* ---------- avisos / toasts ---------- */
.avisos { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.aviso {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--frame) 94%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 24px 50px -24px rgba(0,0,0,.9);
  font-size: 13.5px; font-weight: 600;
  animation: sobe .25s ease;
}
.aviso.ok { border-color: rgba(25,210,124,.35); color: var(--ok); }
.aviso.erro { border-color: rgba(255,90,110,.35); color: #ff8793; }
@keyframes sobe { from { opacity: 0; transform: translateY(12px); } }

/* ---------- carregando ---------- */
.girando { width: 18px; height: 18px; border: 2px solid rgba(127,150,230,.25); border-top-color: var(--blue-hi); border-radius: 50%; animation: girar .7s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.vazio { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 14px; }
.vazio b { display: block; margin-bottom: 4px; color: var(--text); font-size: 15px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 150; display: none; place-items: center; padding: 18px; background: rgba(3,5,12,.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal.aberto { display: grid; }
.modal-caixa {
  position: relative; width: min(400px, 100%);
  max-height: calc(100dvh - 36px); overflow: auto;
  padding: 22px;
  border: 1px solid var(--line); border-radius: 18px;
  background: linear-gradient(165deg, color-mix(in srgb, var(--screen) 88%, #1d3a9a), var(--screen));
  box-shadow: 0 50px 90px -40px rgba(0,0,0,.95);
  animation: entra .22s ease;
}
body.claro .modal-caixa { background: #fff; }
@keyframes entra { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-fechar { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--glass); color: var(--muted); cursor: pointer; }
.modal-fechar:hover { color: var(--text); background: rgba(255,90,110,.12); border-color: rgba(255,90,110,.35); }
.modal-fechar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.modal h2 { font-size: 18px; font-weight: 800; }
.modal .modal-sub { margin-top: 5px; color: var(--muted); font-size: 12.5px; }

/* ---------- utilidades ---------- */
.linha { display: flex; align-items: center; gap: 10px; }
.linha.fim { justify-content: flex-end; }
.linha.entre { justify-content: space-between; }
.cresce { flex: 1; min-width: 0; }
.so-admin[hidden] { display: none !important; }
.corte { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- proteção: sem seleção, sem arrastar imagem, sem destaque de toque ---------- */
body { -webkit-user-select: none; -moz-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, select, [contenteditable="true"] { -webkit-user-select: text; -moz-user-select: text; user-select: text; -webkit-touch-callout: default; }
img { -webkit-user-drag: none; user-drag: none; pointer-events: none; }
a, button, label, select, [role="button"] { -webkit-tap-highlight-color: transparent; }

/* ---------- fundo travado com card, modal ou menu aberto ---------- */
html.travado, html.travado body { overflow: hidden !important; overscroll-behavior: none; }
html.travado body { position: fixed; left: 0; right: 0; width: 100%; }
.modal, .cs-fundo, .lateral { overscroll-behavior: contain; }

/* ---------- campos: sem X nativo, sem anel duplicado, fonte que não dá zoom no iPhone ---------- */
input[type=search]::-webkit-search-decoration,
input[type=search]::-webkit-search-cancel-button,
input[type=search]::-webkit-search-results-button,
input[type=search]::-webkit-search-results-decoration { -webkit-appearance: none; appearance: none; display: none; }
input[type=search] { -webkit-appearance: none; appearance: none; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input, select, textarea { caret-color: var(--blue-hi); }
input:-webkit-autofill, input:-webkit-autofill:focus { -webkit-text-fill-color: var(--text); -webkit-box-shadow: 0 0 0 1000px var(--frame) inset; transition: background-color 9999s; }
@media (max-width: 900px) {
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea { font-size: 16px; }
}
