/* ==========================================================================
   common.css — tokens, reset, tipografia, botões, formulários, chips
   Compartilhado pelo site público e pelo painel.
   ========================================================================== */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  color-scheme: light dark;

  /* superfícies e texto — base branca com cinzas neutros */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --ink: #1d1f23;
  --ink-2: #3d434b;
  --muted: #5a626d;
  --line: #e4e6ea;
  --line-strong: #cbd0d6;

  /* marca — vermelho de destaque + grafite */
  --primary: #cf2030;
  --primary-600: #a91826;
  --primary-50: #fdecee;
  --on-primary: #ffffff;
  --accent: #cf2030;
  --accent-600: #a91826;
  --accent-light: #ff6b77;   /* sobre fundos escuros */
  --on-accent: #ffffff;
  --charcoal: #1d1f23;

  /* estados (sempre acompanhados de texto/ícone) */
  --good: #1a6f47;   --good-bg: #e2f3ea;
  --warn: #855400;   --warn-bg: #fff0d1;
  --late: #ad3b26;   --late-bg: #fde6e0;
  --info: #24507a;   --info-bg: #e3edf8;
  --danger: #b3261e; --danger-600: #8f1f18;

  /* gráficos (categórico validado + marca) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a;
  --bar-a: #cf2030; --bar-b: #2a78d6;

  --radius-s: 8px; --radius: 12px; --radius-l: 16px;
  --shadow-s: 0 1px 2px rgba(20, 22, 26, .06), 0 1px 1px rgba(20, 22, 26, .04);
  --shadow: 0 8px 26px -10px rgba(20, 22, 26, .22), 0 2px 6px rgba(20, 22, 26, .05);
  --shadow-l: 0 24px 60px -20px rgba(20, 22, 26, .32);
  --ring: 0 0 0 3px rgba(207, 32, 48, .25);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: var(--font);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131417; --surface: #1b1d21; --surface-2: #22252a;
    --ink: #eef0f2; --ink-2: #ccd1d7; --muted: #a2aab4;
    --line: #2b2f35; --line-strong: #3b4048;
    --primary: #ff5a67; --primary-600: #ff7b85; --primary-50: rgba(255, 90, 103, .12);
    --on-primary: #2a0509; --accent: #ff5a67; --accent-600: #ff7b85; --on-accent: #2a0509;
    --charcoal: #0e0f11;
    --good: #6fd9a3; --good-bg: rgba(111, 217, 163, .14);
    --warn: #f0be5c; --warn-bg: rgba(240, 190, 92, .14);
    --late: #ff9b86; --late-bg: rgba(255, 155, 134, .14);
    --info: #8db9ec; --info-bg: rgba(141, 185, 236, .14);
    --danger: #ff8a80; --danger-600: #ffa79f;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70;
    --bar-a: #ff5a67; --bar-b: #3987e5;
    --shadow-s: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 8px 28px -10px rgba(0, 0, 0, .6);
    --shadow-l: 0 24px 60px -20px rgba(0, 0, 0, .7);
    --ring: 0 0 0 3px rgba(255, 90, 103, .35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1rem/1.6 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font: 500 .85em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); padding: .15em .45em; border-radius: 6px; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.hidden { display: none; }
.icon { flex: none; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 200; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; text-decoration: none; font-weight: 600; transition: top .2s; }
.skip:focus { top: 12px; }

/* ------------------------------ Botões -------------------------------- */
.btn {
  --h: 46px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--h); padding: 0 20px; border-radius: 12px; border: 1.5px solid transparent;
  font-weight: 600; font-size: .95rem; line-height: 1; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .12s var(--ease), box-shadow .18s var(--ease), color .18s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-sm { --h: 36px; padding: 0 14px; font-size: .875rem; border-radius: 10px; }
.btn-lg { --h: 54px; padding: 0 28px; font-size: 1rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-s); }
.btn-primary:hover { background: var(--primary-600); }
.btn-accent { background: var(--accent); color: var(--on-accent); box-shadow: 0 10px 26px -10px rgba(207, 32, 48, .75); }
.btn-accent:hover { background: var(--accent-600); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost.danger, .icon-btn.danger { color: var(--danger); }
.btn-ghost.danger:hover, .icon-btn.danger:hover { background: var(--late-bg); border-color: transparent; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-600); }
.btn-glass { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .38); backdrop-filter: blur(6px); }
.btn-glass:hover { background: rgba(255, 255, 255, .22); }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 1.5px solid transparent;
  background: transparent; cursor: pointer; color: var(--ink-2); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.sm { width: 36px; height: 36px; border-radius: 10px; }

/* ---------------------------- Formulários ----------------------------- */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label, .field-label { font-weight: 600; font-size: .875rem; color: var(--ink); }
.field-row { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="search"],
input[type="number"], input[type="date"], input[type="datetime-local"], select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: 12px; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: var(--ring); outline: none; }
input:disabled { background: var(--surface-2); color: var(--muted); }
input[aria-invalid="true"], .field.has-error input, .field.has-error textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .8125rem; font-weight: 500; }
.hint { color: var(--muted); font-size: .8125rem; line-height: 1.45; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2358697a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.select-sm { min-height: 40px; width: auto; padding-block: 8px; }
.input-group { display: flex; align-items: stretch; position: relative; }
.input-group > input { flex: 1; min-width: 0; }
.input-group > .btn { margin-left: 8px; align-self: center; }
.input-group .input-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: grid; place-items: center; background: none; border: 0; color: var(--muted); cursor: pointer; border-radius: 10px; }
.input-group .input-btn:hover { color: var(--ink); background: var(--surface-2); }
.input-group .input-btn + *, .input-group:has(.input-btn) > input { padding-right: 48px; }
.input-group.prefix { border: 1.5px solid var(--line-strong); border-radius: 12px; background: var(--surface); overflow: hidden; }
.input-group.prefix:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.input-group.prefix input { border: 0; box-shadow: none; border-radius: 0; }
.prefix-txt { display: grid; place-items: center; padding: 0 4px 0 14px; color: var(--muted); font: 500 .9rem ui-monospace, Menlo, monospace; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: .9rem; color: var(--ink-2); cursor: pointer; line-height: 1.45; }
.check.sm { font-size: .8125rem; }
.check input { appearance: none; flex: none; width: 22px; height: 22px; margin: 1px 0 0; border: 1.5px solid var(--line-strong); border-radius: 7px; background: var(--surface); display: grid; place-items: center; cursor: pointer; transition: all .15s; }
.check input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::after { content: ""; width: 10px; height: 6px; border-left: 2.4px solid var(--on-primary); border-bottom: 2.4px solid var(--on-primary); transform: rotate(-45deg) translate(1px, -1px); }
.check input:focus-visible { box-shadow: var(--ring); }
input[type="file"] { font-size: .875rem; color: var(--muted); max-width: 100%; }

/* ------------------------------ Chips/pills --------------------------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 650; line-height: 1.4; vertical-align: middle; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.chip-good { background: var(--good-bg); color: var(--good); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-late { background: var(--late-bg); color: var(--late); }
.chip-neutral { background: var(--info-bg); color: var(--info); }

/* ------------------------------- Toasts ------------------------------- */
.toasts { position: fixed; z-index: 300; right: 16px; bottom: 16px; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-l); font-size: .9rem; font-weight: 500; animation: toast-in .28s var(--ease); }
.toast.err { background: var(--danger); color: #fff; }
.toast.leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Agenda — cores e símbolos das categorias (7 cores validadas + cinza neutro).
   Cada categoria usa COR + SÍMBOLO, para não depender só da cor.
   ========================================================================== */
:root {
  --ev1: #2a78d6; --ev2: #d9531e; --ev3: #148a5f; --ev4: #7a4fd0;
  --ev5: #a87400; --ev6: #c2185b; --ev7: #0e8fa3; --ev8: #5a626d;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ev1: #3987e5; --ev2: #e0622c; --ev3: #1fa377; --ev4: #8f6be0;
    --ev5: #b3830c; --ev6: #e0407a; --ev7: #1fa3b8; --ev8: #a2aab4;
  }
}
.ev-c1 { --evc: var(--ev1); } .ev-c2 { --evc: var(--ev2); } .ev-c3 { --evc: var(--ev3); } .ev-c4 { --evc: var(--ev4); }
.ev-c5 { --evc: var(--ev5); } .ev-c6 { --evc: var(--ev6); } .ev-c7 { --evc: var(--ev7); } .ev-c8 { --evc: var(--ev8); }
.ev-sym { flex: none; color: var(--evc, var(--muted)); }
