:root {
  --ink: #172033;
  --muted: #667085;
  --line: #dfe4ec;
  --canvas: #f4f6fa;
  --panel: #ffffff;
  --brand: #0b2545;
  --brand-2: #133d6b;
  --accent: #e7ad22;
  --success: #087443;
  --danger: #b42318;
  --warning: #9a6700;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: #175cd3; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

.platform-app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  background:
    radial-gradient(circle at 90% 0%, rgba(231, 173, 34, .12), transparent 28rem),
    var(--canvas);
}

.platform-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  color: #f5f8ff;
  background: linear-gradient(180deg, var(--brand), #071a31);
}

.platform-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px;
  color: inherit;
}
.platform-brand:hover { text-decoration: none; }
.platform-brand strong, .platform-brand small { display: block; }
.platform-brand strong { font-size: 1.08rem; }
.platform-brand small { margin-top: 2px; color: #b8c9dd; }

.platform-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  color: #10213a;
  background: linear-gradient(135deg, #ffd970, var(--accent));
  font-weight: 900;
  letter-spacing: -.04em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}

.platform-sidebar nav { display: grid; gap: 7px; }
.platform-nav-link {
  padding: 11px 12px;
  border-radius: 10px;
  color: #cbd8e8;
  font-weight: 700;
}
.platform-nav-link:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.platform-nav-link.active { color: #fff; background: var(--brand-2); box-shadow: inset 3px 0 var(--accent); }

.platform-sidebar-footer {
  margin-top: auto;
  padding: 16px 10px 4px;
  border-top: 1px solid rgba(255, 255, 255, .12);
}
.platform-sidebar-footer span, .platform-sidebar-footer strong { display: block; }
.platform-sidebar-footer span { color: #9fb2c8; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.platform-sidebar-footer strong { margin-top: 5px; color: #fff; }

.platform-main { min-width: 0; }
.platform-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 92px;
  padding: 18px clamp(20px, 4vw, 48px);
  border-bottom: 1px solid rgba(16, 24, 40, .08);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(12px);
}
.platform-topbar h1 { margin: 4px 0 0; font-size: clamp(1.45rem, 2.5vw, 2rem); }
.platform-user { display: flex; align-items: center; gap: 14px; color: var(--muted); }
.platform-user form { margin: 0; }
.platform-content { padding: 30px clamp(20px, 4vw, 48px) 56px; }
.eyebrow { color: #55718f; font-size: .72rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }

.platform-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.platform-metric {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 8px 30px rgba(31, 42, 68, .04);
}
.platform-metric span { display: block; color: var(--muted); font-weight: 700; }
.platform-metric strong { display: block; margin-top: 8px; font-size: 2rem; }

.platform-panel, .tenant-hero {
  margin-bottom: 20px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 12px 36px rgba(31, 42, 68, .05);
}
.narrow-panel { max-width: 780px; margin-inline: auto; }
.panel-head, .tenant-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.panel-head { margin-bottom: 20px; }
.panel-head h2, .tenant-hero h2 { margin: 4px 0 6px; }
.panel-head p, .tenant-hero p { margin: 0; color: var(--muted); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 800;
}
.button:hover { text-decoration: none; }
.button.primary { color: #fff; background: var(--brand-2); }
.button.primary:hover { background: #0b315a; }
.button.secondary { color: var(--brand); border-color: #cbd5e1; background: #fff; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 12px; border-bottom: 1px solid #edf0f5; text-align: left; vertical-align: top; }
th { color: #667085; background: #f8fafc; font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; }
td small { display: block; margin-top: 4px; color: var(--muted); }
.empty-cell { padding: 30px; color: var(--muted); text-align: center; }
code { padding: 3px 6px; border-radius: 5px; color: #344054; background: #f2f4f7; }

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #344054;
  background: #f2f4f7;
  font-size: .76rem;
  font-weight: 900;
}
.status-pill--ativo, .status-pill--disponivel, .status-pill--ok { color: #05603a; background: #dcfae6; }
.status-pill--implantacao, .status-pill--contratado, .status-pill--fundacao { color: #854a0e; background: #fef0c7; }
.status-pill--suspenso, .status-pill--desenvolvimento { color: #93370d; background: #ffead5; }
.status-pill--encerrado, .status-pill--cancelado { color: #912018; background: #fee4e2; }
.status-pill--planejado, .status-pill--nao_contratado { color: #475467; background: #eaecf0; }
.status-pill--nova { color: #175cd3; background: #eaf2ff; }
.status-pill--em_triagem { color: #854a0e; background: #fef0c7; }
.status-pill--aceita, .status-pill--concluida, .status-pill--pago { color: #05603a; background: #dcfae6; }
.status-pill--preparando, .status-pill--pendente { color: #175cd3; background: #eaf2ff; }
.status-pill--vencido { color: #912018; background: #fee4e2; }
.status-pill--revisao, .status-pill--review { color: #854a0e; background: #fef0c7; }
.status-pill--descartada { color: #475467; background: #eaecf0; }

.platform-form, .license-form, .charge-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
label { display: grid; gap: 7px; color: #344054; font-size: .88rem; font-weight: 800; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}
textarea { min-height: 78px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(23, 92, 211, .14); border-color: #175cd3; }
label small { color: var(--muted); font-weight: 500; }
.wide-field, .form-actions { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.form-actions span { margin-right: auto; color: var(--muted); font-size: .8rem; }
.inline-form { display: flex; align-items: end; gap: 14px; }
.inline-form label { min-width: 220px; }

.module-license-grid, .catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.module-license-card, .catalog-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfe;
}
.module-license-card h3, .catalog-card h2 { margin: 8px 0; }
.module-license-card > p, .catalog-card > p { color: var(--muted); }
.module-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.effective-badge { color: #05603a; font-size: .76rem; font-weight: 900; }
.license-form { margin-top: 18px; }
.charge-form {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.charge-form-head {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
}
.charge-form-head small { color: var(--muted); }
.catalog-card dl { display: flex; gap: 24px; margin: 20px 0 0; }
.catalog-card dl div { display: grid; gap: 3px; }
.catalog-card dt { color: var(--muted); font-size: .78rem; }
.catalog-card dd { margin: 0; font-size: 1.4rem; font-weight: 900; }

.suggestion-grid { display: grid; gap: 16px; }
.suggestion-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfe;
}
.suggestion-card h2 { margin: 8px 0; }
.suggestion-description { color: #344054; line-height: 1.55; }
.suggestion-meta { color: var(--muted); font-size: .82rem; }
.suggestion-triage-form {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.alert { padding: 12px 14px; border-radius: 9px; }
.alert.error { color: #912018; border: 1px solid #fecdca; background: #fef3f2; }
.alert.success { color: #05603a; border: 1px solid #abefc6; background: #ecfdf3; }

.platform-login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(231, 173, 34, .22), transparent 25rem),
    linear-gradient(145deg, #071a31, #0b2f55);
}
.platform-login-card {
  width: min(440px, 100%);
  padding: 34px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .3);
}
.platform-login-card h1 { margin: 14px 0 8px; }
.platform-login-card > p { color: var(--muted); }
.stack-form { display: grid; gap: 16px; margin-top: 22px; }

@media (max-width: 980px) {
  .platform-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .module-license-grid, .catalog-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .platform-app { grid-template-columns: 1fr; }
  .platform-sidebar { position: static; min-width: 0; width: 100%; height: auto; padding: 14px; }
  .platform-brand { min-width: 0; }
  .platform-brand > span:last-child { min-width: 0; overflow-wrap: anywhere; }
  .platform-sidebar nav { display: flex; overflow-x: auto; }
  .platform-nav-link { white-space: nowrap; }
  .platform-sidebar-footer { margin-top: 12px; }
  .platform-topbar, .panel-head, .tenant-hero { align-items: flex-start; flex-direction: column; }
  .platform-user { width: 100%; justify-content: space-between; }
  .platform-content { padding: 20px 14px 40px; }
  .platform-metrics, .platform-form, .license-form, .charge-form { grid-template-columns: 1fr; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .wide-field, .form-actions { grid-column: 1; }
}
