:root {
  --green-950: #06241d;
  --green-900: #0a3329;
  --green-800: #0e4436;
  --green-700: #126148;
  --green-600: #167a55;
  --green-500: #1f9666;
  --gold-600: #b78522;
  --gold-100: #fff4d8;
  --red-600: #c24141;
  --red-100: #fee2e2;
  --blue-600: #2563a8;
  --blue-100: #e0efff;
  --ink: #17211d;
  --muted: #5b6b64;
  --line: #dfe6e2;
  --paper: #f5f8f6;
  --white: #ffffff;
  --shadow: 0 10px 24px rgba(16, 33, 26, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(31, 150, 102, 0.48);
  outline-offset: 2px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  background: var(--paper);
}

.brand-panel {
  min-height: 100vh;
  padding: 54px;
  color: #edf8f3;
  background: var(--green-950);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 36px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 22px;
}

.logo-box {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--green-950);
  background: #d7f4e5;
  font-weight: 900;
}

.brand-panel h1 {
  max-width: 720px;
  margin: 42px 0 16px;
  font-size: 38px;
  line-height: 1.18;
  font-weight: 800;
}

.brand-panel p {
  max-width: 720px;
  color: #bad8cd;
  font-size: 16px;
}

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

.proof-item {
  min-height: 94px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.proof-item strong {
  display: block;
  margin-bottom: 6px;
  color: #ffffff;
}

.proof-item span {
  color: #bfd8cf;
}

.login-panel {
  padding: 42px;
  display: flex;
  align-items: center;
  background: var(--white);
}

.login-card {
  width: 100%;
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.login-card p {
  margin: 0 0 28px;
  color: var(--muted);
}

.demo-accounts {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.account-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  text-align: left;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.account-button:hover {
  border-color: rgba(31, 150, 102, 0.55);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.role-pill,
.status-pill,
.mini-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  background: #f7faf8;
  color: var(--muted);
  white-space: nowrap;
}

.status-pill.ok {
  background: #e7f7ef;
  color: var(--green-700);
  border-color: #bde7d0;
}

.status-pill.warn {
  background: var(--gold-100);
  color: #805c17;
  border-color: #f0d58c;
}

.status-pill.error {
  background: var(--red-100);
  color: var(--red-600);
  border-color: #fecaca;
}

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

.sidebar {
  min-height: 100vh;
  padding: 22px 18px;
  color: #ecf8f3;
  background: var(--green-950);
  position: sticky;
  top: 0;
  align-self: start;
}

.side-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 4px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.side-head small {
  display: block;
  color: #9fc9ba;
}

.nav-list {
  display: grid;
  gap: 7px;
  margin-top: 22px;
}

.nav-button {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #cfe3db;
  background: transparent;
  text-align: left;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.nav-button:hover,
.nav-button.active {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.1);
}

.nav-button svg,
.icon-button svg,
.btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.main {
  min-width: 0;
  padding: 22px 26px 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.page-title h1,
.page-title h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.page-title p {
  margin: 4px 0 0;
  color: var(--muted);
}

.top-actions,
.row-actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn,
.icon-button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  background: var(--white);
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

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

.btn.primary:hover {
  background: var(--green-700);
}

.btn.secondary {
  border-color: var(--line);
  background: #fbfdfc;
}

.btn.secondary:hover {
  border-color: rgba(31, 150, 102, 0.45);
  box-shadow: var(--shadow);
}

.btn.danger {
  color: var(--red-600);
  background: #fff5f5;
  border-color: #fecaca;
}

.btn.warning {
  color: #805c17;
  background: var(--gold-100);
  border-color: #efd081;
}

.btn.small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.icon-button {
  width: 36px;
  padding: 0;
  border-color: var(--line);
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 16px;
}

.panel-body {
  padding: 18px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field label {
  font-weight: 700;
}

.hint {
  color: var(--muted);
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfdad4;
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
}

input,
select {
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  min-height: 116px;
  resize: vertical;
  padding: 10px 11px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  position: relative;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #fbfdfc;
  color: var(--muted);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.chip:has(input:checked),
.chip.active {
  border-color: #9cd7b7;
  color: var(--green-700);
  background: #e9f7ef;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  flex-wrap: wrap;
}

.segment {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 5px 10px;
  background: transparent;
  color: var(--muted);
}

.segment.active {
  color: #ffffff;
  background: var(--green-700);
}

.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: #fbfdfc;
  color: var(--muted);
}

.notice.warn {
  background: var(--gold-100);
  border-color: #efd081;
  color: #805c17;
}

.notice.error {
  background: var(--red-100);
  border-color: #fecaca;
  color: var(--red-600);
}

.notice.ok {
  background: #e7f7ef;
  border-color: #bde7d0;
  color: var(--green-700);
}

.reply-list {
  display: grid;
  gap: 12px;
}

.reply-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.reply-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px 8px;
}

.reply-head h3 {
  margin: 0;
  font-size: 15px;
}

.reply-text {
  margin: 0;
  padding: 0 14px 12px;
  white-space: pre-wrap;
  color: #26352f;
}

.reply-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 14px 14px;
}

.reply-rate {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.material-list,
.record-list,
.library-list {
  display: grid;
  gap: 10px;
}

.material-item,
.record-item,
.library-item,
.metric,
.audit-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 13px;
}

.material-item {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 12px;
}

.thumb {
  width: 62px;
  height: 62px;
  border: 1px solid #cfdad4;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(18, 97, 72, 0.15), rgba(183, 133, 34, 0.22)),
    repeating-linear-gradient(0deg, transparent, transparent 10px, rgba(255, 255, 255, 0.45) 10px, rgba(255, 255, 255, 0.45) 11px);
  position: relative;
  overflow: hidden;
}

img.thumb {
  display: block;
  object-fit: cover;
  padding: 0;
}

.thumb::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 12px;
  height: 8px;
  border-radius: 6px;
  background: var(--green-700);
}

.thumb.locked {
  background:
    linear-gradient(135deg, rgba(194, 65, 65, 0.12), rgba(183, 133, 34, 0.18)),
    repeating-linear-gradient(45deg, #f6f1e6, #f6f1e6 8px, #ece4d4 8px, #ece4d4 16px);
}

.item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  font-weight: 800;
}

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

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

.metric strong {
  display: block;
  font-size: 24px;
  line-height: 1.2;
}

.metric span {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

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

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  background: #f7faf8;
}

tr:last-child td {
  border-bottom: 0;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #cdd9d3;
  border-radius: 8px;
  background: #fbfdfc;
  padding: 24px;
}

.kbd-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}

.admin-accent .sidebar {
  background: #111827;
}

.admin-accent .nav-button.active,
.admin-accent .nav-button:hover {
  background: rgba(37, 99, 168, 0.28);
}

.admin-accent .btn.primary {
  background: var(--blue-600);
}

.admin-accent .segment.active {
  background: var(--blue-600);
}

.mobile-menu {
  display: none;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 12px 14px;
  color: #ffffff;
  background: var(--green-800);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.2);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

@media (max-width: 1080px) {
  .login-shell,
  .app-shell,
  .work-grid,
  .section-grid {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: auto;
    padding: 34px 26px;
  }

  .login-panel {
    padding: 30px 24px;
  }

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

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

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

  .topbar,
  .panel-header,
  .reply-head {
    align-items: stretch;
    flex-direction: column;
  }

  .proof-grid,
  .metric-grid,
  .two-col {
    grid-template-columns: 1fr;
  }

  .brand-panel h1 {
    font-size: 30px;
  }

  .login-card h2 {
    font-size: 24px;
  }

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

  .thumb {
    width: 54px;
    height: 54px;
  }
}
