:root {
  --bg: #f5f7f6;
  --panel: #ffffff;
  --ink: #17211c;
  --muted: #637067;
  --line: #dbe2dd;
  --accent: #1f7a5a;
  --accent-dark: #165a42;
  --danger: #b3261e;
  --tag: #e7f4ee;
  --shadow: 0 14px 40px rgba(23, 33, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

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

a:hover {
  text-decoration: underline;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px;
  background: #10231c;
  color: #f3faf6;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #bfe8d5;
  color: #10231c;
  font-size: 13px;
  letter-spacing: 0;
}

.sidebar nav {
  display: grid;
  gap: 6px;
}

.sidebar a {
  color: #e4f1ea;
  padding: 10px 12px;
  border-radius: 8px;
}

.sidebar a:hover {
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 6px;
  color: #b8c9c0;
}

.main {
  margin-left: 232px;
  padding: 32px;
}

.main.narrow {
  max-width: 920px;
}

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

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

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

h2 {
  margin-bottom: 16px;
  font-size: 18px;
}

p {
  color: var(--muted);
}

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

.ua {
  max-width: 360px;
  word-break: break-word;
}

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

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

.metric {
  display: grid;
  gap: 8px;
  padding: 18px;
}

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

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

.panel {
  padding: 18px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.tab {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 700;
}

.tab:hover,
.tab.active {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.tab-panel {
  margin-top: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.tag {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--tag);
  color: var(--accent-dark);
  font-size: 12px;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button:hover,
button:hover {
  background: var(--accent-dark);
  color: #fff;
  text-decoration: none;
}

.button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.button.secondary:hover {
  background: #eef4f0;
}

button.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

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

.row-actions {
  display: flex;
  gap: 8px;
}

.editable-remark {
  display: inline-flex;
  min-width: 72px;
  max-width: 260px;
  min-height: 28px;
  align-items: center;
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--muted);
  cursor: text;
  word-break: break-word;
}

.editable-remark:hover {
  background: #eef4f0;
  color: var(--ink);
}

.editable-remark.saved {
  background: #e7f4ee;
  color: var(--accent-dark);
}

.remark-input {
  width: 260px;
  min-height: 32px;
}

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

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

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

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
}

input:focus,
select:focus,
button:focus,
.button:focus {
  outline: 3px solid rgba(31, 122, 90, 0.24);
  outline-offset: 2px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.check input {
  width: 18px;
  min-height: 18px;
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
}

.alert {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff0ee;
  color: var(--danger);
}

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

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

code,
.json-view {
  border: 1px solid #cfdbd4;
  border-radius: 8px;
  background: #f7faf8;
  color: #17211c;
}

code {
  padding: 10px;
}

.json-view {
  overflow: auto;
  padding: 16px;
  line-height: 1.55;
}

.detail-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 16px;
  margin: 0 0 16px;
}

.detail-grid dt {
  color: var(--muted);
  font-weight: 700;
}

.detail-grid dd {
  margin: 0;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(31, 122, 90, 0.18), transparent 42%),
    var(--bg);
}

.login-shell {
  width: min(100%, 420px);
}

.login-panel {
  padding: 28px;
}

.login-brand {
  margin-bottom: 22px;
}

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

@media (max-width: 760px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .main {
    margin-left: 0;
    padding: 18px;
  }

  .page-head,
  .row-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics,
  .grid-form,
  .filter-bar {
    grid-template-columns: 1fr;
  }
}
