:root {
  color-scheme: light;
  --bg: #f5f6f4;
  --panel: #ffffff;
  --panel-soft: #f0f3ef;
  --text: #18211f;
  --muted: #66736e;
  --line: #d9dfda;
  --accent: #1d6f5f;
  --accent-strong: #145449;
  --warn: #a15c13;
  --danger: #b33b31;
  --blue: #315f91;
  --topic: #8a4fd6;
  --topic-soft: #f4eefc;
  --shadow: 0 12px 36px rgba(24, 33, 31, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

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

.sidebar {
  background: #18211f;
  color: #f4f7f4;
  padding: 20px 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #d7ee77;
  color: #16201d;
  font-weight: 800;
}

.brand-title {
  font-weight: 750;
}

.brand-subtitle {
  color: #aab8b1;
  font-size: 13px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  text-align: left;
  color: #dce5df;
  background: transparent;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
  color: #15201d;
  background: #d7ee77;
  font-weight: 700;
}

.main {
  min-width: 0;
  padding: 22px 28px 32px;
}

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

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.status-line {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

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

.api-input {
  width: 250px;
  max-width: 34vw;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
}

.token-input {
  width: 180px;
}

.button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  min-height: 38px;
  cursor: pointer;
  white-space: nowrap;
}

.button:hover {
  border-color: #aeb9b2;
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

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

.button.warn {
  border-color: #f1d2a1;
  color: var(--warn);
}

.button:disabled {
  opacity: 0.55;
  cursor: default;
}

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

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

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

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(240px, 1fr));
}

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

.panel {
  padding: 16px;
}

.card {
  padding: 14px;
}

/* Предложенная тема статьи выделена среди новостей. */
.card.topic-card {
  background: var(--topic-soft);
  border-color: var(--topic);
}

.stat {
  min-height: 100px;
}

.stat-value {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  margin-top: 8px;
  color: var(--muted);
}

.section-title {
  margin: 0 0 12px;
  font-size: 17px;
}

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

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

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

th {
  background: var(--panel-soft);
  color: #34413d;
  font-weight: 700;
  position: sticky;
  top: 0;
}

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

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--panel-soft);
  color: #34413d;
  font-size: 12px;
  font-weight: 700;
}

.badge.ready {
  background: #e8f4d4;
  color: #315016;
}

.badge.warn {
  background: #fff0d9;
  color: #78440d;
}

.badge.danger {
  background: #fae0dd;
  color: #8e2d25;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(250px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.column {
  min-width: 250px;
  background: #eef2ed;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.column-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 800;
}

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

.item-title {
  font-weight: 750;
  line-height: 1.28;
}

.item-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 7px;
}

.progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dde5df;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.split {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 14px;
}

.textarea,
.text-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
}

.textarea {
  min-height: 120px;
  resize: vertical;
}

.logbox {
  max-height: calc(100vh - 190px);
  overflow: auto;
  padding: 14px;
  background: #111816;
  color: #d8e5df;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.loading,
.empty {
  padding: 24px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #1f2b28;
  box-shadow: var(--shadow);
  z-index: 20;
}

.hidden {
  display: none;
}

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

a:hover {
  text-decoration: underline;
}

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

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

  .brand {
    padding-bottom: 10px;
  }

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

  .nav-item {
    text-align: center;
    padding-left: 6px;
    padding-right: 6px;
  }

  .main {
    padding: 16px;
  }

  .topbar,
  .topbar-actions,
  .split {
    display: grid;
    grid-template-columns: 1fr;
  }

  .api-input {
    width: 100%;
    max-width: none;
  }

  .token-input {
    width: 100%;
  }

  .grid.cols-3,
  .grid.cols-4 {
    grid-template-columns: 1fr;
  }
}
