:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --panel: #ffffff;
  --line: #deded8;
  --text: #20231f;
  --muted: #6d716b;
  --brand: #245d4d;
  --brand-strong: #174338;
  --danger: #9c2f2f;
  --warning: #8a5b12;
  --ok: #2f6f45;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

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

a:hover {
  text-decoration: underline;
}

.page {
  min-height: 100vh;
}

.auth-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  padding: 48px 16px;
}

.auth-card,
.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-card {
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar-inner,
.container {
  margin: 0 auto;
  max-width: 1220px;
  padding: 0 20px;
}

.topbar-inner {
  align-items: center;
  display: flex;
  gap: 18px;
  min-height: 64px;
}

.brand {
  color: var(--text);
  font-weight: 750;
  margin-right: auto;
}

.nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nav a,
.nav button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  padding: 8px 10px;
}

.nav a.active,
.nav a:hover,
.nav button:hover {
  background: #eef2ed;
  color: var(--text);
  text-decoration: none;
}

.container {
  padding-bottom: 56px;
  padding-top: 28px;
}

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

h1,
h2,
h3 {
  line-height: 1.15;
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 17px;
}

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

.grid {
  display: grid;
  gap: 16px;
}

.stats {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 22px;
}

.stat {
  padding: 16px;
}

.stat strong {
  display: block;
  font-size: 26px;
}

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

.toolbar {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

label {
  color: #3d423c;
  display: block;
  font-weight: 650;
  margin-bottom: 6px;
}

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

textarea {
  min-height: 96px;
  resize: vertical;
}

.field-row {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.checkbox-line input {
  width: auto;
}

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

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

.button:hover {
  background: var(--brand-strong);
  color: #fff;
  text-decoration: none;
}

.button.secondary {
  background: #fff;
  border-color: #bfc5bd;
  color: var(--text);
}

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

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

.alert {
  border-radius: 6px;
  margin-bottom: 16px;
  padding: 12px 14px;
}

.alert.ok {
  background: #e7f2ea;
  border: 1px solid #b6d7c0;
  color: var(--ok);
}

.alert.error {
  background: #f8e8e8;
  border: 1px solid #e5b8b8;
  color: var(--danger);
}

.media-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.form-pair {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.split-layout {
  grid-template-columns: minmax(260px, 420px) 1fr;
}

.card {
  overflow: hidden;
}

.preview {
  align-items: center;
  aspect-ratio: 16 / 10;
  background: #e8e9e4;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.preview img,
.preview video {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.preview .placeholder {
  color: var(--muted);
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.card-body {
  padding: 14px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.badge {
  background: #edf0eb;
  border-radius: 999px;
  color: #3f463f;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
}

.badge.ok {
  background: #e0efe4;
  color: var(--ok);
}

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

.mt-sm {
  margin-top: 8px;
}

.mt-md {
  margin-top: 14px;
}

.mt-lg {
  margin-top: 20px;
}

.sort-input {
  max-width: 82px;
}

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

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

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

th {
  color: #4b5049;
  font-size: 13px;
}

.pagination {
  margin-top: 18px;
}

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

@media (max-width: 720px) {
  .topbar-inner,
  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    margin-right: 0;
  }

  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .form-pair,
  .split-layout {
    grid-template-columns: 1fr;
  }
}
