:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --line: #dce3ec;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warn: #b45309;
  --danger: #b91c1c;
}

* {
  box-sizing: border-box;
}

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

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #e6f4f1, #f8fafc 55%, #eef2ff);
}

.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

.login-card h1 {
  color: var(--text);
}

.login-hint {
  color: var(--muted);
  margin-bottom: 2px;
}

.demo-users {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.demo-users button,
.ghost-btn {
  background: #e2e8f0;
  color: #334155;
}

.demo-users button:hover,
.ghost-btn:hover {
  background: #cbd5e1;
}

button, input, select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 9px 14px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 32px;
  background: #113b3a;
  color: #fff;
}

.eyebrow {
  margin: 0 0 4px;
  color: #9de1d7;
  font-size: 13px;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  padding: 7px 10px;
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

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

.stats-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.stats-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stats-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.workspace {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab {
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: #dff6f1;
  color: var(--accent-strong);
}

.panel {
  display: none;
  padding: 22px;
}

.panel.active {
  display: block;
}

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

.panel-heading p {
  color: var(--muted);
  margin-bottom: 0;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input, select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: #fff;
  color: var(--text);
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  font: 13px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  resize: vertical;
}

.item-search {
  border-color: #9ccfc8;
  background: #f0fdfa;
}

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

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

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

th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  background: #e2e8f0;
  color: #334155;
}

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

.badge.ok {
  background: #dcfce7;
  color: #166534;
}

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

.form-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.catalog-form {
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto;
}

.activity-list {
  display: grid;
  gap: 10px;
}

.activity {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.activity.pending {
  border-color: #facc15;
  background: #fffbeb;
}

.activity.rejected {
  border-color: #fecaca;
  background: #fef2f2;
}

.activity-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.danger-btn {
  background: var(--danger);
}

.danger-btn:hover {
  background: #991b1b;
}

.section-subtitle {
  margin-top: 24px;
}

.settings-table {
  margin-bottom: 14px;
}

.settings-table table {
  min-width: 980px;
}

.settings-table th,
.settings-table td {
  text-align: center;
}

.settings-table th:first-child,
.settings-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: #fff;
}

.settings-flow-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-bottom: 16px;
}

.wide-field {
  grid-column: 1 / -1;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-line input {
  min-height: auto;
}

.activity p {
  margin-bottom: 4px;
}

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

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #0f172a;
  opacity: 0;
  transform: translateY(12px);
  transition: 160ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .app-header, .panel-heading {
    flex-direction: column;
  }

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