:root {
  --bg: #f4f7f6;
  --panel: #ffffff;
  --text: #18231f;
  --muted: #65736d;
  --line: #dce5e1;
  --primary: #137a5f;
  --primary-dark: #0d5d49;
  --danger: #bc2f32;
  --warning: #9b6a10;
  --blue: #2e5aac;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--primary);
  cursor: pointer;
  padding: 0 16px;
}

button:hover {
  background: var(--primary-dark);
}

button.secondary {
  color: var(--primary);
  background: #e6f2ee;
}

button.ghost {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

input,
select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 10px;
  outline-color: var(--primary);
}

.hidden {
  display: none !important;
}

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

.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(23, 43, 35, 0.08);
}

.login-panel h1 {
  margin: 18px 0 24px;
  font-size: 24px;
}

.logo-slot {
  width: 116px;
  height: 54px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed #9fb0aa;
  border-radius: 6px;
  background: #fafdfc;
  font-size: 13px;
}

.logo-slot.small {
  width: 70px;
  height: 38px;
}

.stack {
  display: grid;
  gap: 14px;
}

.stack label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.brand-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.brand-row strong,
.brand-row span {
  display: block;
}

.brand-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  justify-content: flex-start;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.nav-item.active {
  color: #fff;
  background: var(--primary);
}

.content {
  min-width: 0;
  padding: 24px;
}

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

.topbar h2 {
  margin: 0;
  font-size: 24px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.message {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
}

.message.error {
  color: var(--danger);
  border-color: #efc5c6;
  background: #fff4f4;
}

.message.success {
  color: var(--primary-dark);
  border-color: #b8dbcf;
  background: #f0faf6;
}

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

.metric {
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.metric strong {
  font-size: 32px;
}

h3 {
  margin: 22px 0 12px;
}

.toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.inline-form,
.file-actions,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.inline-form input {
  width: 150px;
}

.file-actions {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.filters {
  margin: 0 0 14px;
}

.filters input {
  min-width: 230px;
}

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

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: #fff;
  background: #34433f;
  font-weight: 600;
}

td {
  color: #24312d;
}

tbody tr:nth-child(even) {
  background: #f8fbfa;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: #e8f3ff;
  color: var(--blue);
  font-size: 13px;
}

.status.disabled,
.status.verified {
  color: var(--warning);
  background: #fff7e8;
}

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

.danger:hover {
  background: #9d2528;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
  }

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
