:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --line: #d8dee9;
  --text: #17202e;
  --muted: #667085;
  --primary: #11845b;
  --primary-dark: #0b6847;
  --accent: #1f6feb;
  --danger: #c2410c;
  --success: #0f766e;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
}

.brand {
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
}

.env-label {
  background: #e8f5ef;
  border-radius: 999px;
  color: var(--primary-dark);
  display: inline-block;
  font-size: 12px;
  margin-left: 10px;
  padding: 2px 9px;
}

.admin-menu,
.button-row,
.actions,
.search-row,
.filter-row,
.inline-update {
  align-items: center;
  display: flex;
  gap: 10px;
}

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

.nav-tabs a {
  border-bottom: 3px solid transparent;
  color: var(--muted);
  display: block;
  font-weight: 600;
  padding: 14px 12px 12px;
  white-space: nowrap;
}

.nav-tabs a.active {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.container {
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px;
}

.page-title {
  margin-bottom: 18px;
}

h1,
h2 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 18px;
}

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

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

.metric {
  padding: 18px;
}

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

.metric strong {
  display: block;
  font-size: 30px;
  line-height: 1.2;
  margin-top: 6px;
}

.panel {
  padding: 18px;
}

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

.split-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(280px, 0.36fr) minmax(0, 1fr);
}

.form-panel,
.stack {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 5px;
}

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

input,
textarea,
select {
  background: #fff;
  border: 1px solid #c8d0dc;
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 40px;
  padding: 8px 10px;
  width: 100%;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(31, 111, 235, 0.14);
}

button,
.button {
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  text-decoration: none;
  white-space: nowrap;
}

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

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

.secondary {
  background: #eef4ff;
  border-color: #c9dafd;
  color: #184fa3;
}

.small {
  min-height: 32px;
  padding: 5px 10px;
}

.full {
  width: 100%;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  background: #f8fafc;
  color: #475467;
  font-size: 13px;
  white-space: nowrap;
}

.actions {
  flex-wrap: wrap;
}

.actions form {
  display: inline;
}

.link-button,
.link-danger {
  background: transparent;
  border: 0;
  color: var(--accent);
  font: inherit;
  min-height: 0;
  padding: 0;
}

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

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

.empty {
  color: var(--muted);
  padding: 28px 10px;
  text-align: center;
}

.flash {
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 10px 12px;
}

.flash.success {
  background: #e7f7f3;
  color: var(--success);
}

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

.badge {
  background: #eef2f7;
  border-radius: 999px;
  color: #475467;
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
}

.badge.success {
  background: #e7f7f3;
  color: var(--success);
}

.check-line,
.inline-check {
  align-items: center;
  display: flex;
  gap: 7px;
}

.check-line input,
.inline-check input {
  min-height: auto;
  width: auto;
}

.tiny-input {
  max-width: 70px;
  min-height: 32px;
}

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

.seal-preview-wrap {
  align-items: center;
  background: #fff8f6;
  border: 1px dashed #e2a39a;
  border-radius: 8px;
  display: flex;
  min-height: 112px;
  padding: 16px;
}

.seal-preview {
  align-items: center;
  border: 3px solid #b91c1c;
  color: #b91c1c;
  display: flex;
  font-size: 12px;
  font-weight: 800;
  justify-content: center;
  line-height: 1.15;
  overflow-wrap: anywhere;
  padding: 7px;
  text-align: center;
}

.filter-row {
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.search-row {
  margin-bottom: 14px;
}

.search-row input {
  max-width: 360px;
}

.info-box {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.login-body {
  align-items: center;
  background: linear-gradient(180deg, #edf8f3 0%, #f6f8fb 100%);
  display: flex;
  min-height: 100vh;
  padding: 20px;
}

.login-panel {
  margin: 0 auto;
  max-width: 420px;
  padding: 26px;
  width: 100%;
}

.login-title {
  margin-bottom: 20px;
}

.login-title h1 {
  font-size: 28px;
}

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

@media (max-width: 900px) {
  .metric-grid,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .container,
  .topbar,
  .nav-tabs {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 12px;
    padding-top: 12px;
  }

  .filter-row,
  .search-row {
    align-items: stretch;
    flex-direction: column;
  }

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