:root {
  --bg: #f3f5f0;
  --panel: #ffffff;
  --panel-soft: #fbfcfa;
  --text: #1f2933;
  --muted: #667085;
  --border: #d8ded2;
  --green: #598b4c;
  --green-dark: #3f6f35;
  --green-soft: #eef5ea;
  --amber-bg: #fff8eb;
  --amber-border: #e8c370;
  --shadow: 0 10px 28px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--green) #eef4ec;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.site-header {
  background: #416f38;
  color: white;
}

.header-inner {
  width: min(100% - 48px, 1360px);
  margin: 0 auto;
  padding: 34px 0 32px;
  display: flex;
  justify-content: space-between;
  gap: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #dcebd6;
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 980px;
  font-size: 1.85rem;
  font-weight: 650;
  line-height: 1.18;
}

.lead {
  margin: 10px 0 0;
  max-width: 980px;
  color: #eef5ea;
}

.logout-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid #b8d7ad;
  border-radius: 8px;
  background: #e8f5e3;
  color: #24451f;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

main {
  width: min(100% - 48px, 1360px);
  margin: 32px auto 56px;
}

.panel,
.notice {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 26px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

.notice {
  border-left: 5px solid var(--amber-border);
  background: var(--amber-bg);
  color: #4f3b12;
}

.notice strong {
  display: block;
  margin-bottom: 6px;
}

.notice p {
  margin: 0;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title h2 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

.section-title p {
  margin: 0;
  color: var(--muted);
}

.counter {
  align-self: flex-start;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 0.86rem;
  font-weight: 750;
  white-space: nowrap;
}

.roles-grid,
.documents-grid {
  display: grid;
  gap: 16px;
}

.roles-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.documents-grid {
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
}

.role-card,
.doc-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 18px;
  min-width: 0;
}

.role-card {
  cursor: pointer;
  text-align: left;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.role-card:hover,
.role-card.active {
  border-color: var(--green);
  background: #f9fbf7;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.06);
}

.role-card .role-name,
.doc-card .doc-title {
  display: block;
  margin-bottom: 6px;
  font-weight: 750;
  line-height: 1.32;
}

.role-card .role-desc,
.doc-card .doc-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 2fr) minmax(220px, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 0.9rem;
  font-weight: 700;
}

select,
input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.doc-code {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.tag {
  display: inline-block;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 0.74rem;
  font-weight: 700;
}

.doc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.doc-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #eef8e9;
  color: #24451f;
  font-size: 0.88rem;
  font-weight: 750;
  text-decoration: none;
  border: 1px solid #b8d7ad;
}

.badge-required {
  display: inline-block;
  margin-left: 6px;
  color: #7a4b00;
  font-size: 0.78rem;
  font-weight: 800;
}

.empty-state {
  grid-column: 1 / -1;
  color: var(--muted);
  font-style: italic;
  padding: 16px;
}

footer {
  width: min(100% - 48px, 1360px);
  margin: 0 auto 26px;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 820px) {
  .header-inner {
    width: min(100% - 32px, 1360px);
    flex-direction: column;
  }

  main,
  footer {
    width: min(100% - 32px, 1360px);
  }

  .filters,
  .section-title {
    grid-template-columns: 1fr;
    display: grid;
  }
}


.guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 16px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--green-dark);
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.muted-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.diagrams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
}

.diagram-card {
  overflow: hidden;
}

.diagram-preview {
  display: block;
  margin: 14px 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f6f7f4;
  overflow: hidden;
}

.diagram-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.training-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
}

.training-card {
  border-left: 4px solid var(--green);
}

.training-items {
  margin: 14px 0 0;
  padding-left: 22px;
}

.training-items li {
  margin-bottom: 8px;
  color: var(--muted);
}

.training-items a {
  color: var(--green-dark);
  font-weight: 750;
  text-decoration: none;
}

.training-items a:hover {
  text-decoration: underline;
}

.role-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.secondary-action {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid #b8d7ad;
  border-radius: 8px;
  background: #eef8e9;
  color: #24451f;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.secondary-action:hover {
  border-color: var(--green);
  background: #d9edcf;
}

.active-role-label {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}
