:root {
  color-scheme: light;
  --ag-bg: #eef4fb;
  --ag-panel: #ffffff;
  --ag-panel-soft: #f8fbff;
  --ag-line: #d7e2f1;
  --ag-text: #0f172a;
  --ag-muted: #475569;
  --ag-blue: #2563eb;
  --ag-green: #16a34a;
  --ag-gold: #d97706;
  --ag-red: #dc2626;
  --ag-violet: #7c3aed;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ag-text);
  background:
    radial-gradient(circle at 8% 0, rgba(37, 99, 235, .10), transparent 30%),
    radial-gradient(circle at 95% 12%, rgba(124, 58, 237, .08), transparent 32%),
    linear-gradient(145deg, #f8fbff, var(--ag-bg) 52%, #eaf1fb);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }

.ag-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--ag-line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
}

.ag-topbar-inner,
.ag-shell {
  width: min(1420px, calc(100% - 32px));
  margin: 0 auto;
}

.ag-topbar-inner {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.ag-topbar-inner > div { display: grid; gap: 3px; }
.ag-topbar-inner strong { font-size: 18px; }
.ag-top-actions, .ag-detail-actions, .ag-form-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.ag-shell { padding: 28px 0 52px; }

.ag-hero,
.ag-context,
.ag-card,
.ag-detail,
.ag-kpis article,
.ag-integrity-note {
  border: 1px solid var(--ag-line);
  background: var(--ag-panel);
  box-shadow: 0 20px 55px rgba(15, 23, 42, .10);
}

.ag-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border-radius: 24px;
}

.ag-hero h1 { margin: 2px 0 9px; font-size: clamp(29px, 4vw, 46px); }
.ag-hero p, .ag-context p, .ag-detail p { color: var(--ag-muted); line-height: 1.55; }
.ag-eyebrow { margin: 0; color: #1d4ed8; font-size: 12px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }

.ag-button {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--ag-text);
  text-decoration: none;
  font-weight: 850;
  cursor: pointer;
}
.ag-button:disabled { cursor: not-allowed; opacity: .5; }
.ag-button-primary { background: var(--ag-blue); color: #032033; }
.ag-button-green { background: var(--ag-green); color: #032b22; }
.ag-button-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.ag-button-gold { background: var(--ag-gold); color: #332000; }
.ag-button-ghost { border-color: var(--ag-line); background: #ffffff; }
.ag-button-small { min-height: 35px; padding: 7px 10px; font-size: 12px; }

.ag-context {
  margin-top: 17px;
  padding: 19px;
  border-radius: 18px;
  display: grid;
  grid-template-columns: 1fr minmax(250px, 420px);
  align-items: end;
  gap: 16px;
}
.ag-context h2 { margin: 4px 0 0; }
.ag-context-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 9px; }

.ag-chip,
.ag-status {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
  font-size: 12px;
  font-weight: 850;
}
.ag-chip-draft { border-color: #ddd6fe; background: #f5f3ff; color: #5b21b6; }
.ag-status-rascunho { color: #5b21b6; background: #ede9fe; }
.ag-status-convocada { color: #92400e; background: #fef3c7; }
.ag-status-em_andamento { color: #166534; background: #dcfce7; }
.ag-status-encerrada { color: #1e40af; background: #dbeafe; }
.ag-status-cancelada { color: #991b1b; background: #fef2f2; }

.ag-message { margin-top: 16px; padding: 13px 15px; border-radius: 13px; border: 1px solid var(--ag-line); background: #eff6ff; color: #334155; }
.ag-message.is-error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.ag-message.is-success { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }

.ag-kpis { margin: 17px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ag-kpis article { padding: 17px; border-radius: 16px; display: grid; gap: 6px; }
.ag-kpis span { color: var(--ag-muted); font-size: 13px; }
.ag-kpis strong { font-size: 28px; }

.ag-workspace { display: grid; grid-template-columns: minmax(0, .93fr) minmax(0, 1.07fr); gap: 16px; align-items: start; }
.ag-card { border-radius: 20px; padding: 20px; }
.ag-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 13px; margin-bottom: 16px; }
.ag-card-heading h2, .ag-card-heading h3 { margin: 3px 0 0; }

.ag-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.ag-field { display: grid; gap: 7px; min-width: 0; }
.ag-field > span { color: #334155; font-size: 13px; font-weight: 800; }
.ag-field small { color: #64748b; line-height: 1.4; }
.ag-field-full { grid-column: 1 / -1; }
.ag-field input, .ag-field select, .ag-field textarea, .ag-search input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--ag-line);
  border-radius: 11px;
  outline: none;
  background: #ffffff;
  color: var(--ag-text);
}
.ag-field textarea { resize: vertical; }
.ag-field input:focus, .ag-field select:focus, .ag-field textarea:focus, .ag-search input:focus { border-color: var(--ag-blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.ag-search { min-width: 190px; }

.ag-list { display: grid; gap: 10px; }
.ag-list-item { border: 1px solid var(--ag-line); border-radius: 14px; padding: 14px; background: var(--ag-panel-soft); }
.ag-list-item.is-selected { border-color: rgba(37, 99, 235, .65); box-shadow: 0 0 0 2px rgba(37, 99, 235, .10); }
.ag-list-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ag-list-item h3, .ag-list-item h4 { margin: 5px 0 6px; }
.ag-list-item p { margin: 4px 0; color: var(--ag-muted); font-size: 13px; line-height: 1.45; }
.ag-list-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.ag-empty { margin: 0; padding: 22px; border: 1px dashed var(--ag-line); border-radius: 14px; color: var(--ag-muted); text-align: center; }

.ag-detail { margin-top: 18px; padding: 22px; border-radius: 22px; }
.ag-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.ag-detail-header h2 { margin: 4px 0 0; }
.ag-detail-header p { margin: 8px 0 0; }
.ag-detail-actions { justify-content: flex-end; }
.ag-quorum { margin: 18px 0; padding: 16px; border: 1px solid #bbf7d0; border-radius: 16px; background: #f0fdf4; display: grid; grid-template-columns: minmax(220px, 1fr) minmax(180px, 2fr) auto; align-items: center; gap: 18px; }
.ag-quorum h3, .ag-quorum p { margin: 4px 0 0; }
.ag-quorum-meter { height: 14px; overflow: hidden; border-radius: 999px; background: #e2e8f0; }
.ag-quorum-meter span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ag-blue), var(--ag-green)); transition: width .25s ease; }
.ag-quorum > strong { font-size: 24px; color: #166534; }
.ag-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; align-items: start; }
.ag-subcard { box-shadow: none; background: #f8fbff; }
.ag-compact-form { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--ag-line); }
.ag-field-order { grid-column: span 1; }
.ag-field-grow { grid-column: span 1; }
.ag-inline-note, .ag-integrity-note { color: var(--ag-muted); line-height: 1.5; }
.ag-integrity-note { margin-top: 18px; padding: 16px; border-radius: 15px; }
.ag-integrity-note code { color: #1e40af; }
.ag-participant-shell { max-width: 1100px; }
.ag-participant-hero { margin-bottom: 16px; }
.ag-participant-info strong { font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.ag-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ag-busy button, .ag-busy input, .ag-busy select, .ag-busy textarea { cursor: wait; }

@media (max-width: 1060px) {
  .ag-workspace, .ag-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .ag-topbar-inner, .ag-hero, .ag-detail-header { align-items: flex-start; flex-direction: column; }
  .ag-topbar-inner { padding: 13px 0; }
  .ag-context, .ag-form, .ag-compact-form { grid-template-columns: 1fr; }
  .ag-field-full, .ag-context-meta { grid-column: auto; }
  .ag-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ag-quorum { grid-template-columns: 1fr; }
  .ag-card-heading { flex-direction: column; }
  .ag-search { width: 100%; }
}
