:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #111827;
  --muted: #667085;
  --line: #d8e0ea;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --ok: #067647;
  --ok-bg: #e8f7ef;
  --info: #2f5fb8;
  --info-bg: #ecf2ff;
  --warn: #9a5b00;
  --warn-bg: #fff5df;
  --danger: #b42318;
  --danger-bg: #ffefed;
  --shadow: 0 18px 50px rgba(16, 24, 40, .08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

a { color: inherit; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px;
  background: #101828;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 21px;
  font-weight: 900;
}

.brand strong {
  display: block;
  font-size: 15px;
  line-height: 1.1;
}

.brand small {
  color: #98a2b3;
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a,
.logout-form button {
  min-height: 40px;
  display: flex;
  align-items: center;
  border: 0;
  border-radius: 7px;
  padding: 0 12px;
  color: #d0d5dd;
  background: transparent;
  text-decoration: none;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.side-nav a.is-active {
  color: #fff;
  background: rgba(255,255,255,.1);
}

.side-nav a small {
  margin-left: 6px;
  font-weight: 450;
  font-size: 11px;
  opacity: .6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-form {
  margin-top: auto;
}

.logout-form button {
  width: 100%;
  border: 1px solid rgba(255,255,255,.14);
}

.main {
  min-width: 0;
  padding: 28px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: 0;
}

.hero p:last-child {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.primary-link,
.item-link,
.login-form button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 14px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 760;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.primary-link:hover,
.login-form button:hover {
  background: var(--brand-strong);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.metric-card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.metric-card.ok strong { color: var(--ok); }
.metric-card.info strong { color: var(--info); }
.metric-card.warn strong { color: var(--warn); }

.workbench {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 230px 230px;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 52px;
}

.password-field button {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 34px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.password-field button:hover,
.password-field button.is-visible {
  background: #eef4ff;
  color: var(--brand);
}

.eye-icon {
  width: 19px;
  height: 12px;
  position: relative;
  display: block;
  border: 1.8px solid currentColor;
  border-radius: 50% / 58%;
}

.eye-icon::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: currentColor;
}

input:focus,
select:focus {
  outline: 3px solid rgba(37, 99, 235, .14);
  border-color: var(--brand);
}

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 0;
}

.board-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.board-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.board-head strong {
  color: var(--muted);
  font-size: 14px;
}

.items-list {
  display: grid;
  gap: 0;
  padding: 10px 18px 18px;
}

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.item:last-child {
  border-bottom: 0;
}

.item-main h4 {
  margin: 10px 0 6px;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0;
}

.item-main > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pill {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: #475467;
  font-size: 12px;
  font-weight: 760;
}

.pill.status-publicado { background: var(--ok-bg); color: var(--ok); }
.pill.status-validacao { background: var(--info-bg); color: var(--info); }
.pill.status-implementacao { background: var(--warn-bg); color: var(--warn); }
.pill.status-conferencia { background: #eef4f8; color: #36556f; }
.pill.status-ajuste { background: var(--danger-bg); color: var(--danger); }

.item-detail {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-box {
  padding: 11px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.detail-box strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.detail-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.test-context {
  margin-top: 10px;
  padding: 11px;
  border: 1px dashed #b8c6d8;
  border-radius: 7px;
  background: #fbfdff;
}

.test-context strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.test-context p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.proofs {
  margin-top: 10px;
}

.proofs summary {
  width: max-content;
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--brand);
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

.proof-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.proof-context {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.proof-card {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: inherit;
  text-decoration: none;
}

.proof-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: block;
  object-fit: cover;
  background: #eef2f6;
}

.proof-card span,
.proof-card small {
  display: block;
  padding: 8px 10px 0;
  font-size: 12px;
  font-weight: 760;
}

.proof-card small {
  padding: 3px 10px 10px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.35;
}

.item-actions {
  display: flex;
  align-items: flex-start;
}

.item-link {
  width: 100%;
  background: #fff;
  color: var(--brand);
  border-color: var(--line);
}

.item-link:hover {
  border-color: var(--brand);
  background: #f8fbff;
}

.item-link.is-disabled {
  justify-content: center;
  background: #f2f4f7;
  color: #98a2b3;
  border-color: var(--line);
  cursor: not-allowed;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #101828;
}

.login-shell {
  width: min(440px, calc(100% - 28px));
}

.login-panel {
  padding: 32px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 24px;
}

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

.login-copy {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.45;
}

.login-form button {
  width: 100%;
  margin-top: 14px;
}

.login-error {
  display: none;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.login-error.is-visible { display: block; }

@media (max-width: 940px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
  }

  .side-nav {
    display: none;
  }

  .logout-form {
    margin: 0 0 0 auto;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .main {
    padding: 14px;
  }

  .hero,
  .board-head {
    flex-direction: column;
    align-items: stretch;
  }

  .hero h1 {
    font-size: 26px;
  }

  .metric-grid,
  .item-detail {
    grid-template-columns: 1fr;
  }

  .item {
    grid-template-columns: 1fr;
  }
}
