@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/ibm-plex-sans-400-600.woff2') format('woff2');
  font-weight: 400 600;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/ibm-plex-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  --navy: #1c1d3b;
  --navy-light: #28294b;
  --brand: #4a4d9a;
  --brand-hover: #353776;
  --muted: #565970;
  --border: #dedfe9;
  --paper: #fff;
  --background: #f4f5f9;
  --lavender: #ededfa;
  --warning: #79501b;
  --warning-bg: #fff2da;
  --danger: #a03236;
  --danger-bg: #ffeded;
  --success: #266150;
  --success-bg: #e7f4ee;
  --mono: 'IBM Plex Mono', monospace;
  --sidebar-width: 218px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--background);
  color: var(--navy);
  font: 400 15px/1.55 'IBM Plex Sans', Arial, sans-serif;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-hover); }
a:hover { color: var(--navy); }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.16; font-weight: 600; }
h1 { font-size: clamp(1.9rem, 3.8vw, 3rem); letter-spacing: -.045em; }
h2 { font-size: 1.3rem; letter-spacing: -.025em; }
h3 { font-size: 1.05rem; }
strong { font-weight: 600; }
small, .small { font-size: .84rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .85em; }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.on-dark :focus-visible { outline-color: #b9baf0; }
.skip-link {
  position: fixed;
  z-index: 5;
  transform: translateY(-150%);
  padding: 10px 16px;
  color: var(--navy);
  background: var(--paper);
}
.skip-link:focus { transform: translateY(0); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: auto;
  color: #f5f4ff;
  background: var(--navy);
  padding: 28px 17px 18px;
}
.sidebar-brand {
  display: inline-flex;
  align-self: flex-start;
  margin: 0 0 30px 10px;
}
.sidebar-brand img { width: 104px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar a, .sidebar button { color: inherit; }
.sidebar-nav a, .sidebar-logout button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  background: transparent;
  text-decoration: none;
  font-weight: 500;
  text-align: left;
}
.sidebar-nav a:hover, .sidebar-logout button:hover { background: var(--navy-light); }
.sidebar-nav a[aria-current='page'] {
  background: #353661;
  border-color: #4e5090;
  color: #fff;
}
.sidebar-bottom { margin-top: auto; padding-top: 25px; }
.sidebar-logout { border-top: 1px solid #444568; padding-top: 9px; }
.sidebar-logout button { cursor: pointer; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; }

.main-shell { display: flex; min-width: 0; flex-direction: column; }
.topbar {
  min-height: 67px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px clamp(19px, 3vw, 42px);
  background: var(--paper);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: .92rem; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 9px; line-height: 1.2; }
.topbar-user span { min-width: 0; }
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--lavender);
  color: var(--brand-hover);
}
.workspace {
  width: 100%;
  max-width: 1550px;
  margin: 0 auto;
  padding: clamp(25px, 4vw, 46px) clamp(19px, 3vw, 42px) 52px;
}
.workspace > * + * { margin-top: 22px; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 25px;
  margin-bottom: 26px;
}
.page-head p { margin-top: 7px; color: var(--muted); max-width: 64ch; }
.page-head h1 { overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 43px;
  padding: 8px 15px;
  border: 1px solid var(--brand);
  border-radius: 7px;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
  text-decoration: none;
  font-size: .93rem;
  font-weight: 600;
  line-height: 1.23;
  text-align: center;
}
.button:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.button.secondary { border-color: var(--border); color: var(--navy); background: var(--paper); }
.button.secondary:hover { border-color: #a5a7cc; background: var(--lavender); }
.button.danger { border-color: #eab8bc; background: var(--danger-bg); color: var(--danger); }
.button.danger:hover { border-color: var(--danger); }
.button.compact { min-height: 37px; padding: 6px 11px; font-size: .84rem; }
.button:disabled { cursor: not-allowed; opacity: .55; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

.hero-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--navy);
  color: #fff;
  border-radius: 13px;
  padding: clamp(23px, 5vw, 48px);
}
.hero-panel::after, .login-brand::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(ellipse at 91% 12%, #50528e75, transparent 58%),
    linear-gradient(90deg, #888ac72c 1px, transparent 1px),
    linear-gradient(#888ac72c 1px, transparent 1px);
  background-size: auto, 39px 39px, 39px 39px;
  mask-image: linear-gradient(90deg, transparent 15%, #000 79%);
}
.hero-panel .page-head { margin: 0; }
.hero-panel p { color: #dfdff4; }
.hero-panel .button.secondary { border-color: #f6f6ff; }
.hero-panel .back-link { color: #e1e2fb; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 7px 12px;
}
.section-head p { margin-top: 4px; color: var(--muted); }
.panel {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 11px;
  min-width: 0;
}
.panel-body { padding: clamp(15px, 2.5vw, 26px); }
.panel-body > * + * { margin-top: 16px; }
.panel-head { padding: 18px clamp(15px, 2.5vw, 26px); border-bottom: 1px solid var(--border); }
.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 246px), 1fr)); gap: 12px; }
.module-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 20px;
  gap: 9px;
  min-height: 148px;
  color: var(--navy);
  text-decoration: none;
}
a.module-link:hover { background: #fafaff; border-color: #acadd0; }
.module-pending { background: #f8f8fc; }
.module-icon {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border-radius: 8px;
  color: var(--brand-hover);
  background: var(--lavender);
}
.module-link p { color: var(--muted); }
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(127px, 1fr)); gap: 10px; }
.metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 13px 14px 12px;
  min-height: 98px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-top: 3px solid #9b9dc6;
  border-radius: 8px;
  color: var(--navy);
  text-decoration: none;
}
.metric[data-tone='danger'] { border-top-color: #b34c50; }
.metric[data-tone='warning'] { border-top-color: #b67d38; }
.metric[data-tone='success'] { border-top-color: #468174; }
.metric:hover, .metric[aria-current='true'] { background: #f6f6ff; border-color: var(--brand); }
.metric-number { font-size: 1.8rem; line-height: 1.08; font-weight: 600; letter-spacing: -.04em; }
.metric-label { display: block; margin-top: 3px; font-size: .86rem; font-weight: 600; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 6px;
  background: var(--lavender);
  color: var(--brand-hover);
  padding: 3px 7px;
  font-size: .77rem;
  line-height: 1.25;
  font-weight: 600;
}
.badge[data-tone='success'] { color: var(--success); background: var(--success-bg); }
.badge[data-tone='warning'] { color: var(--warning); background: var(--warning-bg); }
.badge[data-tone='danger'] { color: var(--danger); background: var(--danger-bg); }
.badge[data-tone='neutral'] { color: var(--muted); background: #eff0f4; }
.badge-row { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid > .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; }
.field label, .field > span:first-child { font-weight: 600; font-size: .88rem; }
.field :is(input:not([type='checkbox']), select, textarea) {
  width: 100%;
  min-height: 43px;
  border: 1px solid #c7c9da;
  border-radius: 7px;
  background: #fff;
  padding: 8px 10px;
}
.field textarea { min-height: 90px; resize: vertical; }
.field :is(input, textarea)::placeholder { color: #636779; opacity: 1; }
.field :is(input, textarea)[aria-invalid='true'] { border-color: var(--danger); }
.field .hint { color: var(--muted); font-size: .79rem; }
.chosen-value {
  display: flex;
  align-items: center;
  min-height: 43px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f6f6fa;
}
.inline-field { display: flex; align-items: center; gap: 7px; }
.inline-field input { accent-color: var(--brand); width: 17px; height: 17px; }
.filter-main { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; }
.filter-main .field { flex: 1 1 300px; }
.filter-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 10px; }
.filter-labels { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.notice {
  padding: 11px 14px;
  border: 1px solid #c8c9e6;
  border-radius: 8px;
  color: var(--brand-hover);
  background: var(--lavender);
}
.notice[data-tone='danger'] { border-color: #ecc1c1; color: var(--danger); background: var(--danger-bg); }
.notice[data-tone='success'] { border-color: #b8dccc; color: var(--success); background: var(--success-bg); }
.notice ul { margin: 4px 0 0; padding-left: 20px; }
.notice li + li { margin-top: 2px; }

.table-scroll { overflow-x: auto; }
.data-table { border-collapse: collapse; width: 100%; font-size: .88rem; }
.data-table caption { text-align: left; }
.data-table :is(th, td) { padding: 11px 13px; vertical-align: top; text-align: left; }
.data-table th { background: #f6f6fa; color: var(--muted); font-size: .81rem; font-weight: 600; white-space: nowrap; }
.data-table tbody tr + tr { border-top: 1px solid var(--border); }
.data-table tbody tr:hover { background: #fafaff; }
.data-table td:first-child { padding-left: 18px; }
.data-table th:first-child { padding-left: 18px; }
.data-table a { text-decoration-thickness: 1px; text-underline-offset: 2px; }
.process-table { min-width: 775px; }
.table-main { display: block; font-weight: 600; overflow-wrap: anywhere; }
.table-meta { display: block; margin-top: 3px; }
.data-table td > .badge { margin-top: 3px; }
.empty-state { padding: 32px 20px; text-align: center; color: var(--muted); }
.empty-state h3 { color: var(--navy); margin-bottom: 5px; }
.empty-state .actions { justify-content: center; margin-top: 14px; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(250px, 1fr); gap: 17px; align-items: start; }
.stack > * + * { margin-top: 16px; }
.key-value { display: grid; grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)); gap: 12px 18px; margin: 0; }
.key-value dt { color: var(--muted); font-size: .82rem; }
.key-value dd { margin: 1px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.section-tabs { display: flex; flex-wrap: wrap; align-items: stretch; gap: 4px; }
.section-tabs a {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper);
  color: var(--brand-hover);
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
}
.section-tabs a:hover, .section-tabs a[aria-current='page'] { border-color: #a6a8cd; background: var(--lavender); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 17px 17px;
  border-left: 1px solid #cccde2;
}
.timeline li:last-child { border-color: transparent; padding-bottom: 0; }
.timeline li::before {
  position: absolute;
  content: '';
  top: 5px;
  left: -4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}
.timeline .key-value { color: var(--muted); margin-top: 6px; font-size: .85rem; }
.timeline .key-value dd { color: var(--navy); font-weight: 400; }
details.disclosure > summary { min-height: 33px; }
details.disclosure > summary { color: var(--brand-hover); font-weight: 600; cursor: pointer; }
details.disclosure[open] > summary { margin-bottom: 12px; }
.process-actions { border-top: 1px solid var(--border); }
.process-actions > details { padding: 7px 12px; border: 1px solid var(--border); border-radius: 7px; }
.process-actions > details + details { margin-top: 8px; }
.process-actions > details > summary { min-height: 25px; }
.process-actions > .actions { margin-block: 12px; }
.related-list { margin: 7px 0 0; padding-left: 19px; }
.related-list li + li { margin-top: 5px; }
.task-actions { min-width: 190px; }
.data-table th[scope='row'] { color: var(--navy); background: transparent; white-space: normal; }
.narrow-panel { width: min(100%, 540px); }
.account-row { padding: 15px clamp(15px, 2.5vw, 26px); }
.account-row + .account-row { border-top: 1px solid var(--border); }
.account-row .account-name { display: inline-block; min-width: min(60%, 290px); overflow-wrap: anywhere; }
.account-row summary > span + span { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }

.login-shell { display: grid; grid-template-columns: minmax(320px, .93fr) minmax(414px, 1.07fr); min-height: 100dvh; }
.login-brand {
  position: relative;
  isolation: isolate;
  display: grid;
  align-content: space-between;
  min-height: 425px;
  padding: clamp(32px, 7vw, 94px);
  color: #fdfdff;
  background: var(--navy);
}
.login-brand img { width: 148px; }
.login-brand h1 { max-width: 15ch; font-size: clamp(2.1rem, 5vw, 4.5rem); }
.login-brand p { max-width: 31ch; color: #e0e1f4; margin-top: 13px; }
.login-main { display: grid; place-items: center; padding: 26px; }
.login-card { width: min(100%, 420px); padding: clamp(21px, 4vw, 38px); }
.login-card h2 { font-size: 1.8rem; }
.login-card .login-form { display: grid; gap: 13px; margin-top: 18px; }
.login-card .notice { margin-top: 12px; }
.login-card .button { margin-top: 4px; }

@media (max-width: 1040px) {
  :root { --sidebar-width: 185px; }
  .sidebar { padding-inline: 12px; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 790px) {
  .shell { display: block; }
  .sidebar {
    position: static;
    padding: 13px 17px 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'marca sair' 'nav nav';
    align-items: center;
    gap: 7px 10px;
    height: auto;
  }
  .sidebar-brand { grid-area: marca; margin: 0; }
  .sidebar-brand img { width: 88px; }
  .sidebar-nav { grid-area: nav; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .sidebar-nav a { width: auto; min-height: 36px; padding: 5px 8px; font-size: .85rem; }
  .sidebar-nav .icon { width: 15px; height: 15px; }
  .sidebar-bottom { grid-area: sair; margin: 0; padding: 0; }
  .sidebar-logout { border: 0; padding: 0; }
  .sidebar-logout button { width: auto; min-height: 38px; font-size: .85rem; }
  .login-shell { display: block; }
  .login-brand { display: flex; justify-content: space-between; align-items: flex-start; gap: 23px; min-height: 0; }
  .login-brand img { width: 105px; }
  .login-brand h1 { font-size: clamp(1.65rem, 5.8vw, 3rem); }
  .login-brand p { display: none; }
}

@media (max-width: 500px) {
  .sidebar-nav a { gap: 5px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar { min-height: 54px; }
  .login-brand { padding: 21px; }
  .page-head { align-items: flex-start; flex-direction: column; }
}

@media print {
  body { background: #fff; color: #111; font-size: 11pt; }
  .shell { display: block; }
  .sidebar, .topbar, .back-link, .section-tabs, .hero-panel .actions, .process-actions, .task-actions { display: none !important; }
  .workspace { max-width: none; padding: 0; }
  .hero-panel { padding: 0 0 12pt; color: #111; background: #fff; border-bottom: 1pt solid #ccc; }
  .hero-panel::after { display: none; }
  .hero-panel p { color: #333; }
  .table-scroll { overflow: visible; }
  .detail-grid { display: block; }
  .detail-grid > * + * { margin-top: 10pt; }
  tr, .timeline li { break-inside: avoid; }
}
