@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,600;12..96,700;12..96,800&family=Instrument+Sans:wght@400;500;600&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --navy: #173f7a;
  --navy-deep: #0e2a55;
  --teal: #1a9e9a;
  --teal-soft: #d8f0ee;
  --lime: #8cc63f;
  --lime-soft: #eef7e2;
  --paper: #f6f7f3;
  --card: #ffffff;
  --ink: #14223a;
  --muted: #5d6b80;
  --line: #dfe3e8;
  --warn: #d9822b;
  --warn-soft: #fcefdf;
  --danger: #c2413a;
  --danger-soft: #fbe6e4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(14, 42, 85, .06), 0 8px 24px -12px rgba(14, 42, 85, .18);
  --display: 'Bricolage Grotesque', Georgia, serif;
  --body: 'Instrument Sans', 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(23, 63, 122, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 63, 122, .045) 1px, transparent 1px);
  background-size: 28px 28px;
  min-height: 100vh;
  line-height: 1.5;
  font-size: 15px;
}
a { color: var(--navy); }
h1, h2, h3, h4 { font-family: var(--display); color: var(--navy-deep); line-height: 1.1; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- header ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 20px; }
.topbar img { height: 40px; display: block; }
.topbar .spacer { flex: 1; }
.topbar .tag { font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: var(--teal); letter-spacing: .14em; border-left: 1px solid var(--line); padding-left: 16px; }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 8px;
  padding: 10px 18px; font-weight: 600; cursor: pointer;
  background: var(--navy); color: #fff; text-decoration: none;
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--navy-deep); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.teal { background: var(--teal); }
.btn.teal:hover { background: #148581; }
.btn.ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.btn.ghost:hover { background: #fff; border-color: var(--navy); }
.btn.danger { background: transparent; color: var(--danger); border-color: #efc9c5; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.lg { padding: 14px 24px; font-size: 16px; }
.btn.icon { padding: 7px; }

label.field { display: block; }
label.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(26, 158, 154, .18); }
textarea.input { resize: vertical; min-height: 80px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 22px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: #eef1f5; color: var(--muted); white-space: nowrap; }
.badge.agendado { background: var(--teal-soft); color: #0f6f6c; }
.badge.realizado, .badge.aprovado, .badge.aceite, .badge.sem_gas { background: var(--lime-soft); color: #4b7a14; }
.badge.ausente, .badge.pendente { background: var(--warn-soft); color: #9a5612; }
.badge.cancelado, .badge.reprovado, .badge.recusado { background: var(--danger-soft); color: var(--danger); }
.badge.publico { background: var(--lime-soft); color: #4b7a14; }
.badge.interno { background: #eef1f5; color: var(--muted); }
.badge.gestor { background: #e6eefa; color: var(--navy); }

.alert { padding: 12px 14px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 14px; }
.alert.ok { background: var(--lime-soft); color: #3f6a10; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0;
  background: var(--navy-deep); color: #fff; padding: 12px 20px; border-radius: 8px; z-index: 100;
  transition: opacity .2s, transform .2s; box-shadow: var(--shadow); font-weight: 500;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

.spinner { width: 22px; height: 22px; border: 3px solid var(--teal-soft); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .5s cubic-bezier(.2, .7, .2, 1) both; }
.rise.d1 { animation-delay: .08s; } .rise.d2 { animation-delay: .16s; } .rise.d3 { animation-delay: .24s; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(14, 42, 85, .45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .4); animation: rise .25s ease both; }
.modal header { padding: 20px 22px 0; display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.modal .body { padding: 18px 22px; }
.modal footer { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- tables ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid #eef0f3; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #f7fafb; }
.tbl-wrap { overflow-x: auto; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg.i { width: 34px; height: 34px; color: var(--teal); margin-bottom: 8px; }

@media (max-width: 720px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .topbar .tag { display: none; }
  .topbar-inner { padding: 10px 16px; }
}

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
}

fieldset.billing { border: 1px solid var(--line, #dfe5ea); border-radius: 12px; padding: 14px 16px 16px; margin: 0; }
fieldset.billing legend { padding: 0 6px; font-weight: 600; font-size: .95rem; }
