:root {
  --green: #1f9d55;
  --deep: #15331f;
  --muted: #6d7b71;
  --line: #e3eee6;
  --bg: #f6fbf7;
  --danger: #cb3e35;
  --warn: #b06b12;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: #193322;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

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

button,
a {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px;
}

.login-panel {
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(31, 84, 52, 0.1);
}

.brand,
.side-brand {
  color: var(--deep);
  font-size: 28px;
  font-weight: 900;
}

.login-sub,
.muted {
  color: var(--muted);
}

.login-sub {
  margin: 8px 0 24px;
}

label {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: var(--deep);
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #d5e6dc;
  border-radius: 6px;
  background: #fbfefc;
  color: var(--deep);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.primary,
.ghost,
.danger,
.mini,
.logout {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 900;
}

.primary {
  width: 100%;
  margin-top: 22px;
  background: var(--green);
  color: #fff;
}

.ghost {
  border: 1px solid #cfe5d5;
  background: #f3fbf5;
  color: #1e7140;
}

.danger {
  background: #ffecea;
  color: var(--danger);
}

.mini {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #cfe5d5;
  background: #f3fbf5;
  color: #1e7140;
  font-size: 13px;
}

.message {
  min-height: 22px;
  margin-top: 14px;
  color: var(--danger);
}

.admin-view {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 228px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: #fff;
  overflow-y: auto;
}

.side-brand {
  margin-bottom: 22px;
  font-size: 24px;
}

.side-menu {
  display: grid;
  gap: 8px;
}

.nav,
.logout {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #53665a;
  text-align: left;
}

.nav {
  padding: 12px 14px;
  font-weight: 800;
}

.nav.active {
  background: #e9f8ee;
  color: #1f8f4c;
}

.logout {
  margin-top: auto;
  background: #f5f8f6;
  color: var(--muted);
}

.content {
  min-width: 0;
  padding: 26px 30px 48px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--deep);
  font-size: 30px;
}

h2 {
  margin-bottom: 14px;
  color: var(--deep);
  font-size: 20px;
}

.page {
  display: none;
}

.active-page {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.dashboard-insights {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card,
.panel,
.table-wrap,
.form-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(31, 84, 52, 0.06);
}

.stat-card {
  padding: 18px;
}

.stat-value {
  color: var(--green);
  font-size: 30px;
  font-weight: 900;
}

.stat-label {
  margin-top: 4px;
  color: var(--muted);
}

.panel,
.form-card {
  padding: 18px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar input {
  width: 260px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf3ef;
  text-align: left;
  vertical-align: top;
}

th {
  color: #4e6758;
  font-size: 13px;
  white-space: nowrap;
}

td {
  color: #203d29;
}

.cell-clip {
  display: block;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #edf8f0;
  color: #1f8f4c;
  font-size: 13px;
  font-weight: 900;
}

.badge.warn {
  background: #fff4e4;
  color: var(--warn);
}

.badge.danger {
  background: #ffecea;
  color: var(--danger);
}

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

.form-grid .full {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.form-actions .primary {
  width: auto;
  margin-top: 0;
}

.roadmap {
  display: grid;
  gap: 12px;
}

.insight-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.insight-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  background: #edf8f0;
  color: #1f7141;
  font-weight: 900;
}

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pipeline-grid span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  border-radius: 6px;
  background: #f7fbf8;
  color: var(--deep);
  font-weight: 900;
  text-align: center;
}

.roadmap div {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  padding: 14px;
  border-radius: 6px;
  background: #f7fbf8;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.export-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
  border: 1px solid #cfe5d5;
  border-radius: 8px;
  background: #f3fbf5;
  color: #1e7140;
  font-weight: 900;
  text-decoration: none;
}

@media (max-width: 900px) {
  .admin-view {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .logout {
    position: static;
    width: 100%;
  }

  .stats-grid,
  .dashboard-insights,
  .export-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
