:root {
  --green-950: #0a2e20;
  --green-900: #0d3c2a;
  --green-800: #125238;
  --green-700: #166a45;
  --green-600: #1b8a59;
  --green-500: #2aa971;
  --green-400: #5bc692;
  --green-200: #bfe3cd;
  --green-100: #dcf0e4;
  --green-50: #f1f8f3;
  --ink: #17231d;
  --muted: #5e7065;
  --soft: #7d8d84;
  --line: #e0e9e2;
  --line-strong: #cbdacf;
  --card: #ffffff;
  --bg: #f3f7f4;
  --amber-700: #a66008;
  --amber-500: #d98416;
  --amber-100: #fbebc9;
  --red-700: #b33a2b;
  --red-500: #d65b45;
  --red-100: #f9ded7;
  --blue-700: #2563a5;
  --blue-100: #dcecf8;
  --shadow-sm: 0 1px 2px rgba(18, 48, 34, 0.05);
  --shadow-md: 0 8px 22px rgba(18, 48, 34, 0.07);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

button {
  color: inherit;
}

.app {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 22px;
  height: 72px;
  padding: 0 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 236px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 8px;
  background: var(--green-800);
  color: #dff4e7;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), 0 5px 12px rgba(18, 82, 56, 0.2);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-copy {
  display: grid;
  line-height: 1.2;
}

.brand-copy strong {
  color: var(--green-900);
  font-size: 20px;
  letter-spacing: 0.06em;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.role-switch {
  display: inline-flex;
  flex: 0 1 auto;
  gap: 2px;
  padding: 4px;
  background: var(--green-50);
  border: 1px solid var(--green-100);
  border-radius: 8px;
}

.role-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.role-btn svg {
  width: 16px;
  height: 16px;
}

.role-btn:hover {
  color: var(--green-800);
}

.role-btn.active {
  background: var(--green-800);
  color: #fff;
  box-shadow: 0 4px 12px rgba(18, 82, 56, 0.22);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--green-800);
  border-color: var(--green-200);
  background: var(--green-50);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.has-dot::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--red-500);
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  margin-left: 6px;
  padding: 4px 12px 4px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--green-100);
  color: var(--green-800);
  font-size: 13px;
  font-weight: 700;
}

.account-copy {
  display: grid;
  line-height: 1.25;
}

.account-copy strong {
  font-size: 13px;
}

.account-copy small {
  color: var(--muted);
  font-size: 11px;
}

.workspace {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: calc(100vh - 72px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 12px;
  background: var(--green-950);
  color: #d5e9dc;
}

.side-label {
  padding: 0 12px 7px;
  color: rgba(218, 240, 226, 0.62);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #cfe6d8;
  text-align: left;
  cursor: pointer;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  opacity: 0.88;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.nav-item.active {
  background: var(--green-600);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 5px 12px rgba(11, 53, 38, 0.3);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 11px;
  bottom: 11px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--green-400);
}

.nav-count {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 11px;
  text-align: center;
}

.nav-item.active .nav-count {
  background: rgba(255, 255, 255, 0.22);
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 12px 10px 4px;
  color: rgba(222, 241, 230, 0.68);
  font-size: 12px;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green-400);
  box-shadow: 0 0 0 4px rgba(91, 198, 146, 0.14);
}

.main {
  min-width: 0;
  padding: 26px 30px 44px;
  overflow-x: hidden;
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  animation: pageIn 0.22s ease both;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-600);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.page-head h1 {
  margin-bottom: 4px;
  color: var(--green-950);
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: 0;
}

.page-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.btn:hover {
  border-color: var(--green-400);
  color: var(--green-800);
}

.btn-primary {
  border-color: var(--green-700);
  background: var(--green-700);
  color: #fff;
  box-shadow: 0 5px 14px rgba(18, 82, 56, 0.18);
}

.btn-primary:hover {
  border-color: var(--green-600);
  background: var(--green-600);
  color: #fff;
}

.btn-soft {
  border-color: var(--green-200);
  background: var(--green-50);
  color: var(--green-800);
}

.btn-soft:hover {
  border-color: var(--green-400);
  background: var(--green-100);
  color: var(--green-900);
}

.btn-danger-soft {
  border-color: #f0cfc7;
  background: #fdf2ef;
  color: var(--red-700);
}

.btn-danger-soft:hover {
  border-color: var(--red-500);
}

.btn-sm {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.icon-btn-sm {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 6px;
}

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

.stat-card {
  position: relative;
  min-width: 0;
  padding: 15px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 7px;
  background: var(--green-50);
  color: var(--green-700);
}

.stat-icon svg {
  width: 17px;
  height: 17px;
}

.stat-icon.amber {
  background: #fdf3e0;
  color: var(--amber-700);
}

.stat-icon.red {
  background: var(--red-100);
  color: var(--red-700);
}

.stat-icon.blue {
  background: var(--blue-100);
  color: var(--blue-700);
}

.stat-value {
  color: var(--ink);
  font-size: 26px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: 0;
}

.stat-note {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.stat-note svg {
  width: 14px;
  height: 14px;
  color: var(--green-600);
}

.stat-note.warn svg {
  color: var(--amber-700);
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 17px 0;
}

.panel-title {
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.panel-desc {
  margin: 0;
  color: var(--soft);
  font-size: 12px;
}

.panel-body {
  padding: 13px 17px 17px;
}

.panel.span-2 {
  grid-column: span 2;
}

.panel.span-full {
  grid-column: 1 / -1;
}

.list {
  display: grid;
  gap: 1px;
  margin-top: 4px;
}

.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 10px 2px;
  border-bottom: 1px dashed var(--line);
}

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

.item-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.item-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 7px;
  background: var(--green-50);
  color: var(--green-700);
}

.item-icon svg {
  width: 16px;
  height: 16px;
}

.item-title {
  overflow: hidden;
  color: var(--ink);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta {
  margin-top: 2px;
  color: var(--soft);
  font-size: 12px;
}

.item-aside {
  display: grid;
  justify-items: end;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.tag::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 999px;
  background: currentColor;
}

.tag-ok {
  background: var(--green-100);
  color: var(--green-800);
}

.tag-warn {
  background: var(--amber-100);
  color: var(--amber-700);
}

.tag-danger {
  background: var(--red-100);
  color: var(--red-700);
}

.tag-info {
  background: var(--blue-100);
  color: var(--blue-700);
}

.tag-neutral {
  background: #edf2ef;
  color: var(--muted);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfdfb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: #fbfefc;
}

.data-table .cell-strong {
  font-weight: 700;
}

.data-table .cell-muted {
  color: var(--muted);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green-700);
  font-weight: 600;
  cursor: pointer;
}

.link-btn svg {
  width: 14px;
  height: 14px;
}

.link-btn.danger {
  color: var(--red-700);
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.chip-group {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: #eef4f0;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.chip {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.chip.active {
  background: #fff;
  color: var(--green-800);
  box-shadow: 0 2px 7px rgba(25, 60, 43, 0.08);
}

.search-box {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 220px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--soft);
}

.search-box svg {
  width: 16px;
  height: 16px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.search-box input::placeholder {
  color: #9aa9a0;
}

.progress {
  position: relative;
  width: 120px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6efe9;
}

.progress span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: var(--green-500);
}

.progress.warn span {
  background: var(--amber-500);
}

.progress.danger span {
  background: var(--red-500);
}

.metric-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.mini-chart {
  height: 178px;
}

.chart-svg {
  display: block;
  width: 100%;
  height: 178px;
}

.chart-svg text {
  fill: var(--muted);
  font-size: 11px;
}

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

.progress-card {
  min-width: 0;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.progress-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.progress-card-head strong {
  font-size: 14px;
}

.progress-card .value {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.progress-card .value b {
  color: var(--green-900);
  font-size: 22px;
}

.field-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.field-tile {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tile-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 15px 10px;
}

.tile-code {
  min-width: 0;
}

.tile-code strong {
  display: block;
  overflow: hidden;
  color: var(--green-900);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-code small {
  color: var(--muted);
}

.tile-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  padding: 4px 15px 8px;
}

.meta-cell {
  padding: 8px 0;
}

.meta-cell span {
  display: block;
  color: var(--soft);
  font-size: 12px;
}

.meta-cell b {
  color: var(--ink);
  font-size: 14px;
}

.tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 15px;
  border-top: 1px solid var(--line);
  background: #fbfdfb;
}

.timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin-top: 8px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  min-height: 58px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 26px;
  bottom: -2px;
  width: 1px;
  background: var(--green-200);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 25px;
  height: 25px;
  margin-top: 4px;
  border-radius: 7px;
  background: var(--green-100);
  color: var(--green-700);
}

.timeline-dot svg {
  width: 14px;
  height: 14px;
  margin: 5px;
}

.timeline-content strong {
  display: block;
  font-size: 13px;
}

.timeline-content p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.code-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.code-pattern {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
}

.qr-svg {
  width: 54px;
  height: 54px;
}

.code-copy strong {
  display: block;
  color: var(--green-900);
  font-size: 16px;
}

.code-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.alert-stack {
  display: grid;
  gap: 10px;
}

.alert-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.alert-row.warn {
  border-color: #f0ddb6;
  background: #fffaf0;
}

.alert-row.danger {
  border-color: #f2c9c0;
  background: #fff6f3;
}

.alert-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  color: #fff;
  background: var(--green-600);
}

.alert-row.warn .alert-icon {
  background: var(--amber-500);
}

.alert-row.danger .alert-icon {
  background: var(--red-500);
}

.alert-icon svg {
  width: 17px;
  height: 17px;
}

.alert-main {
  min-width: 0;
}

.alert-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.alert-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-main p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.alert-aside {
  display: grid;
  justify-items: end;
  gap: 7px;
  white-space: nowrap;
}

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.switch input {
  width: 0;
  height: 0;
  opacity: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #ccd8d0;
  cursor: pointer;
  transition: background 0.15s ease;
}

.slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  transition: transform 0.15s ease;
}

.switch input:checked + .slider {
  background: var(--green-600);
}

.switch input:checked + .slider::before {
  transform: translateX(16px);
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.rule-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px dashed var(--line);
}

.rule-field:last-child {
  border-bottom: 0;
}

.rule-copy strong {
  display: block;
  font-size: 13px;
}

.rule-copy span {
  color: var(--muted);
  font-size: 12px;
}

.rule-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.input-sm {
  width: 78px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  background: #fff;
  color: var(--ink);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 5px;
  min-height: 120px;
  color: var(--soft);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 15px;
  border-radius: 7px;
  background: var(--green-950);
  color: #eaf6ef;
  box-shadow: 0 12px 34px rgba(8, 34, 23, 0.3);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast svg {
  width: 16px;
  height: 16px;
  color: var(--green-400);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(8, 30, 21, 0.46);
  animation: fadeIn 0.16s ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(8, 34, 23, 0.24);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 20px 13px;
}

.modal-head h3 {
  margin: 0 0 3px;
  color: var(--green-950);
  font-size: 18px;
}

.modal-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.modal-body {
  padding: 4px 20px 20px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 13px 20px 18px;
  border-top: 1px solid var(--line);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-field.span-2 {
  grid-column: span 2;
}

.form-field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: 0;
  background: #fff;
  color: var(--ink);
}

.form-field textarea {
  min-height: 90px;
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(42, 169, 113, 0.12);
}

.upload-zone {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 88px;
  border: 1px dashed var(--green-400);
  border-radius: 7px;
  background: var(--green-50);
  color: var(--green-700);
  cursor: pointer;
}

.upload-zone svg {
  width: 20px;
  height: 20px;
}

.upload-zone span {
  font-size: 12px;
}

.compact-table td,
.compact-table th {
  padding: 9px 12px;
}

.block-list {
  display: grid;
  gap: 8px;
}

.block-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.block-step {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--green-50);
  color: var(--green-700);
  font-size: 16px;
  font-weight: 800;
}

.block-row.done .block-step {
  background: var(--green-700);
  color: #fff;
}

.block-row.warn .block-step {
  background: var(--amber-100);
  color: var(--amber-700);
}

.block-title strong {
  display: block;
}

.block-title span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1180px) {
  .brand {
    min-width: 190px;
  }

  .brand-copy small {
    display: none;
  }

  .role-btn {
    padding: 0 11px;
  }

  .workspace {
    grid-template-columns: 204px minmax(0, 1fr);
  }

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

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

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

@media (max-width: 860px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    height: auto;
    padding: 10px 14px;
  }

  .brand {
    min-width: 0;
  }

  .brand-copy small {
    display: block;
  }

  .role-switch {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .role-btn {
    flex: 1 0 auto;
    justify-content: center;
  }

  .top-actions {
    margin-left: auto;
  }

  .account-copy {
    display: none;
  }

  .workspace {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    overflow-x: auto;
    padding: 8px;
    background: var(--green-950);
  }

  .side-label,
  .sidebar-foot {
    display: none;
  }

  .side-nav {
    display: flex;
    gap: 4px;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    padding: 0 13px;
  }

  .nav-item.active::before {
    display: none;
  }

  .main {
    padding: 18px 14px 30px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 16px;
  }

  .page-head h1 {
    font-size: 23px;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }

  .panel-grid,
  .rules-grid {
    grid-template-columns: 1fr;
  }

  .panel.span-2,
  .panel.span-full {
    grid-column: auto;
  }

  .field-tiles {
    grid-template-columns: 1fr;
  }

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

  .code-card {
    grid-template-columns: 1fr;
  }

  .alert-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .alert-aside {
    grid-column: 2;
    justify-items: start;
    flex-direction: row;
  }

  .block-row {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .block-row .table-actions {
    grid-column: 2;
  }
}

@media (max-width: 560px) {
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-value {
    font-size: 21px;
  }

  .stat-label {
    font-size: 12px;
  }

  .account-chip {
    padding: 3px;
    border: 0;
  }

  .avatar {
    width: 36px;
    height: 36px;
  }

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

  .form-field.span-2 {
    grid-column: auto;
  }

  .item-aside {
    display: none;
  }

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

  .timeline-item {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .timeline-item::before {
    left: 10px;
  }

  .timeline-dot {
    width: 21px;
    height: 21px;
  }

  .timeline-dot svg {
    width: 11px;
    height: 11px;
    margin: 5px;
  }
}
