/* ============================================================
   PRECIANO — Design System "Ink & Teal"
   base.css — tokens, tipografia, componentes compartilhados

   Novo sistema visual (adoção incremental). Independente de
   assets/css/global/{variables,base}.css, usado pelas telas ainda
   não migradas — não misturar os dois num mesmo layout.
   ============================================================ */

/* ---------- Fontes locais (sem dependência externa) ---------- */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  src: url('../../fonts/bricolage-grotesque-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../../fonts/inter-var.woff2') format('woff2');
}

/* ---------- Tokens ---------- */
:root {
  /* Tinta (navy do logotipo) */
  --ink-950: #071829;
  --ink-900: #0B2237;
  --ink-800: #11314E;
  --ink-700: #173F63;
  --ink-600: #1E4E79;

  /* Teal (acento do logotipo) */
  --teal-700: #0B7C72;
  --teal-600: #0E9486;
  --teal-500: #16AC9C;
  --teal-400: #3EC3B3;
  --teal-200: #A9E2DA;
  --teal-100: #D4F0EC;
  --teal-50:  #EBF7F5;

  /* Superfícies */
  --paper:   #F2F5F7;
  --card:    #FFFFFF;
  --line:    #E3EAF0;
  --line-2:  #D2DEE7;

  /* Texto */
  --t1: #12293E;
  --t2: #3E566C;
  --t3: #6E8399;
  --t4: #9DAEBF;

  /* Semânticas */
  --ok-bg: #DCF5E5;  --ok-tx: #0E7A3B;  --ok-bd: #B9E8C9;
  --warn-bg: #FDF0D2; --warn-tx: #915907; --warn-bd: #F3DCA5;
  --err-bg: #FDE3E1;  --err-tx: #B3261E;  --err-bd: #F6C2BE;
  --mut-bg: #E9EEF3;  --mut-tx: #55687C;  --mut-bd: #D5DFE8;
  --pink-bg: #FBE4EF; --pink-tx: #A63A6E; --pink-bd: #F2C4DB;
  --info-bg: #E1EDFB; --info-tx: #1E5AA8; --info-bd: #BFD8F2;

  --wpp: #21B858;
  --amber: #F5A524;

  /* Formas */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow-1: 0 1px 2px rgba(12, 35, 56, .06), 0 4px 18px rgba(12, 35, 56, .05);
  --shadow-2: 0 8px 30px rgba(7, 24, 41, .14);
  --shadow-pop: 0 12px 48px rgba(7, 24, 41, .22);

  /* Tipos */
  --font-ui: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Inter', -apple-system, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
/* Garante que o atributo hidden vença classes de display (ex.: .alert{display:flex})
   já que estilos de autor têm precedência sobre a folha de estilo do agente. */
[hidden] { display: none !important; }
body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--t1);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { max-width: 100%; display: block; }
a { color: var(--teal-700); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }
::selection { background: var(--teal-100); color: var(--ink-900); }

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink-900);
  line-height: 1.18;
}

.money, .num {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

/* Textura assinatura: papel quadriculado sutil */
.grid-paper {
  background-image:
    linear-gradient(rgba(18, 49, 77, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 49, 77, .05) 1px, transparent 1px);
  background-size: 28px 28px;
}
.grid-paper--dark {
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: background .13s, border-color .13s, color .13s, transform .08s, box-shadow .13s;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn svg { flex-shrink: 0; }

.btn-primary { background: var(--ink-800); color: #fff; }
.btn-primary:hover { background: var(--ink-700); }

.btn-accent { background: var(--teal-600); color: #fff; }
.btn-accent:hover { background: var(--teal-700); }

.btn-ghost { background: var(--card); color: var(--t2); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--t4); color: var(--t1); }

.btn-soft { background: var(--teal-50); color: var(--teal-700); border-color: var(--teal-100); }
.btn-soft:hover { background: var(--teal-100); }

.btn-danger { background: #fff; color: var(--err-tx); border-color: var(--err-bd); }
.btn-danger:hover { background: var(--err-bg); }

.btn-wpp { background: var(--wpp); color: #fff; }
.btn-wpp:hover { background: #1AA34C; }

.btn-lg { padding: 13px 24px; font-size: .975rem; border-radius: 12px; }
.btn-sm { padding: 6px 11px; font-size: .8rem; border-radius: var(--radius-xs); }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--radius-xs); }

/* ---------- Chips de status ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .74rem;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.chip--plain::before { display: none; }

.chip-rascunho   { background: var(--mut-bg);  color: var(--mut-tx);  border-color: var(--mut-bd); }
.chip-aguardando { background: var(--warn-bg); color: var(--warn-tx); border-color: var(--warn-bd); }
.chip-aprovado   { background: var(--ok-bg);   color: var(--ok-tx);   border-color: var(--ok-bd); }
.chip-recusado   { background: var(--err-bg);  color: var(--err-tx);  border-color: var(--err-bd); }
.chip-expirado   { background: var(--mut-bg);  color: var(--mut-tx);  border-color: var(--mut-bd); }
.chip-cancelado  { background: var(--pink-bg); color: var(--pink-tx); border-color: var(--pink-bd); }
.chip-info       { background: var(--info-bg); color: var(--info-tx); border-color: var(--info-bd); }
.chip-teal       { background: var(--teal-50); color: var(--teal-700); border-color: var(--teal-100); }

/* ---------- Formulários ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--t2);
}
.field > label .req { color: var(--err-tx); }
.field .hint { font-size: .75rem; color: var(--t3); }

.input, .select, .textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--t1);
  font-size: .9rem;
  transition: border-color .13s, box-shadow .13s;
  appearance: none;
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px var(--teal-100);
}
.input::placeholder, .textarea::placeholder { color: var(--t4); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--paper); color: var(--t4); cursor: not-allowed; }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236E8399' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Toggle switch */
.toggle { display: inline-flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .tgl {
  width: 42px; height: 24px;
  border-radius: 99px;
  background: var(--line-2);
  position: relative;
  flex-shrink: 0;
  transition: background .15s;
  margin-top: 1px;
}
.toggle .tgl::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(7, 24, 41, .25);
  transition: left .15s;
}
.toggle input:checked + .tgl { background: var(--teal-600); }
.toggle input:checked + .tgl::after { left: 21px; }
.toggle-copy { display: flex; flex-direction: column; gap: 2px; }
.toggle-copy strong { font-size: .875rem; font-weight: 600; color: var(--t1); }
.toggle-copy span { font-size: .78rem; color: var(--t3); }

/* ---------- Cartão base ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 {
  font-size: .95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
}
.card-head h3 svg { color: var(--teal-600); }
.card-head .card-sub { font-size: .78rem; color: var(--t3); font-family: var(--font-ui); font-weight: 500; }
.card-body { padding: 20px; }
.card-foot {
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #FAFCFD;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ---------- Toast ---------- */
.toast-zone {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 24px;
  z-index: 9500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
body.has-bottom-nav .toast-zone { bottom: 92px; }
.toast {
  background: var(--ink-900);
  color: #fff;
  font-size: .85rem;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  display: flex;
  align-items: center;
  gap: 9px;
  animation: toastIn .22s ease;
}
.toast svg { color: var(--teal-400); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Utilidades ---------- */
.t-right { text-align: right; }
.t-center { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.hide-desktop { display: none !important; }
@media (max-width: 899px) {
  .hide-mobile { display: none !important; }
  .hide-desktop { display: revert !important; }
}
