:root {
  color-scheme: light;
  --ink: #1d2522;
  --muted: #66736e;
  --line: #dce5df;
  --paper: #fbfcf8;
  --surface: #ffffff;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warm: #f5b44d;
  --blue: #376996;
  --danger: #a64040;
  --shadow: 0 18px 50px rgba(29, 37, 34, 0.08);
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.site-header,
.site-footer {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 0;
}

.brand,
.top-nav,
.intro-actions,
.card-actions,
.device-actions,
.pill-row,
.filter-group {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 8px;
  background: #fff;
  object-fit: cover;
}

.top-nav {
  gap: 18px;
  color: var(--muted);
  font-size: 15px;
}

.top-nav a {
  text-decoration: none;
}

main {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 42px;
  align-items: end;
  min-height: 430px;
  padding: 54px 0 42px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 820px;
  margin-bottom: 20px;
  font-size: clamp(40px, 7vw, 82px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 30px;
  letter-spacing: 0;
}

h3 {
  font-size: 21px;
  line-height: 1.2;
}

.intro p:not(.eyebrow),
.page-title p,
.lead {
  max-width: 680px;
  color: var(--muted);
  font-size: 19px;
}

.intro-actions,
.card-actions,
.device-actions {
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

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

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

.button.ghost {
  background: var(--surface);
}

.button.danger {
  border-color: rgba(166, 64, 64, 0.35);
  background: #fff5f5;
  color: var(--danger);
}

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

.intro-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intro-panel strong {
  font-size: 44px;
  line-height: 1;
}

.intro-panel span {
  margin-bottom: 14px;
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 52px 0 18px;
}

.section-head a,
.text-link {
  color: var(--accent-strong);
  font-weight: 800;
}

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

.device-card,
.article-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(29, 37, 34, 0.05);
}

.device-card {
  display: flex;
  flex-direction: column;
}

.feed-card {
  border-color: rgba(55, 105, 150, 0.28);
}

.card-image {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  text-decoration: none;
  background: #dfe8e2;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-image span {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 800;
}

.card-body,
.article-card {
  padding: 18px;
}

.device-card .card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.card-body h3 a,
.article-card h3 a {
  text-decoration: none;
}

.card-body p,
.article-card p,
.content-band p {
  color: var(--muted);
}

.not-found {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 42px;
  align-items: center;
  min-height: 560px;
  padding: 58px 0 42px;
}

.not-found-copy h1 {
  max-width: 760px;
}

.not-found-panel {
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(245, 180, 77, 0.14)),
    var(--surface);
  box-shadow: var(--shadow);
}

.not-found-panel strong {
  color: var(--accent-strong);
  font-size: clamp(72px, 11vw, 116px);
  line-height: 0.9;
}

.not-found-panel > span {
  color: var(--ink);
  font-size: 20px;
  font-weight: 850;
}

.not-found-panel ul {
  display: grid;
  gap: 10px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.not-found-panel li {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.not-found-panel li b {
  color: var(--accent-strong);
}

.not-found-panel li span {
  color: var(--muted);
  font-size: 14px;
}

.pill-row {
  flex-wrap: wrap;
  gap: 7px;
  margin: 16px 0;
}

.device-card .pill-row {
  margin-top: auto;
}

.pill,
.chip {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f4f7f2;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.page-title {
  padding: 52px 0 26px;
}

.page-title.narrow {
  max-width: 760px;
}

.filters {
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.search input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  font: inherit;
}

.filter-group {
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  cursor: pointer;
}

.chip.is-active {
  border-color: var(--accent);
  background: #dff3ed;
  color: var(--accent-strong);
}

.chip.subtle {
  background: #fff;
}

.empty-state {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.scroll-top-button {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 100vh;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid rgba(15, 118, 110, 0.2);
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-strong);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-100%);
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease;
  writing-mode: horizontal-tb;
}

.scroll-top-button:hover {
  background: rgba(15, 118, 110, 0.14);
}

.scroll-top-button.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.device-page {
  display: grid;
  grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
  gap: 42px;
  align-items: start;
  padding: 46px 0 70px;
}

.device-media {
  overflow: hidden;
  border-radius: 8px;
  background: #dfe8e2;
}

.device-media img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.device-info h1 {
  font-size: clamp(36px, 6vw, 64px);
}

.verdict,
.content-band {
  margin: 28px 0;
  padding: 22px;
  border-left: 5px solid var(--warm);
  background: #fff8ea;
}

.verdict h2,
.content-band h2 {
  font-size: 22px;
}

.feed-note {
  border-left-color: var(--blue);
  background: #eef6fb;
}

.feed-facts ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.feed-disclaimer {
  max-width: 720px;
  padding: 12px 14px;
  border: 1px solid rgba(55, 105, 150, 0.22);
  border-radius: 8px;
  background: #eef6fb;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

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

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 70px;
  padding: 28px 0 38px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 860px) {
  .site-header,
  .site-footer,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    flex-wrap: wrap;
  }

  .intro,
  .device-page,
  .not-found {
    grid-template-columns: 1fr;
  }

  .not-found {
    min-height: auto;
    padding-top: 36px;
  }

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

  .scroll-top-button {
    top: auto;
    left: 16px;
    bottom: 28px;
    width: auto;
    height: auto;
    min-height: 46px;
    padding: 0 16px;
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: var(--accent);
    box-shadow: var(--shadow);
    color: #fff;
    transform: translateY(10px);
  }

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

  .scroll-top-button.is-visible {
    transform: translateY(0);
  }
}

@media (max-width: 560px) {
  main,
  .site-header,
  .site-footer {
    width: min(100% - 22px, 1160px);
  }

  h1 {
    font-size: 40px;
  }

  .intro {
    min-height: auto;
    padding-top: 28px;
  }

  .not-found-panel li {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .catalog-grid,
  .article-grid {
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }

  .scroll-top-button {
    left: 12px;
    bottom: 18px;
  }
}

.admin-page {
  background: #f6f8f5;
}

.admin-shell {
  width: min(1340px, calc(100% - 32px));
  margin: 0 auto;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
}

.admin-actions,
.admin-list-actions,
.admin-toggles label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 0 20px;
}

.admin-title h1 {
  margin-bottom: 0;
  font-size: 46px;
}

.admin-title > p {
  max-width: 420px;
  color: var(--muted);
  font-weight: 750;
  text-align: right;
}

.admin-title > p.is-error {
  color: var(--danger);
}

.admin-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-workspace {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding-bottom: 48px;
}

.admin-list-panel,
.admin-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(29, 37, 34, 0.05);
}

.admin-list-panel {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.admin-list-actions .button {
  flex: 1;
}

.admin-category-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.admin-panel-head,
.admin-category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.admin-panel-head span,
.admin-category-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-category-list {
  display: grid;
  gap: 6px;
  max-height: 230px;
  overflow: auto;
}

.admin-category-row {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-align: left;
}

.admin-category-row:hover,
.admin-category-row.is-active {
  border-color: var(--accent);
  background: #eef7f2;
}

.admin-category-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-category-editor {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.admin-category-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.admin-category-editor label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.admin-status-filter {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.admin-status-filter select,
.admin-category-editor input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
}

.admin-device-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 245px);
  overflow: auto;
  padding-right: 4px;
}

.admin-article-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 245px);
  overflow: auto;
  padding-right: 4px;
}

.admin-device-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.admin-article-row {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.admin-device-row:hover,
.admin-device-row.is-active,
.admin-article-row:hover,
.admin-article-row.is-active {
  border-color: var(--accent);
  background: #eef7f2;
}

.admin-device-row img {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: #dfe8e2;
  object-fit: cover;
}

.admin-device-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.admin-status {
  min-width: 52px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

.admin-status.is-ready {
  border-color: #8dc5a5;
  background: #e7f5ed;
  color: #247647;
}

.admin-status.is-draft {
  border-color: #d8c49a;
  background: #fff6df;
  color: #8a5c00;
}

.admin-status.is-moderation {
  min-width: 104px;
  border-color: #aeb8d8;
  background: #eef2ff;
  color: #38518c;
}

.admin-device-row strong,
.admin-device-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-device-row small {
  margin-top: 4px;
  color: var(--muted);
}

.admin-article-row strong,
.admin-article-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-article-row small {
  color: var(--muted);
}

.admin-editor {
  display: grid;
  gap: 20px;
  padding: 18px;
}

.admin-preview {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.admin-preview img {
  width: 210px;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: #dfe8e2;
  object-fit: cover;
}

.admin-article-preview-mark {
  display: grid;
  width: 210px;
  aspect-ratio: 4 / 3;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef7f2;
  color: var(--accent-strong);
  font-size: 18px;
  font-weight: 850;
}

.admin-preview h2 {
  font-size: 28px;
}

.admin-preview p:last-child {
  max-width: 760px;
  color: var(--muted);
}

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

.admin-form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.admin-form-grid label.wide {
  grid-column: 1 / -1;
}

.admin-form-grid input,
.admin-form-grid select,
.admin-form-grid textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
}

.admin-form-grid textarea {
  resize: vertical;
}

.admin-slug-control,
.admin-market-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.admin-slug-control .button,
.admin-market-control .button {
  min-height: 44px;
  white-space: nowrap;
}

.admin-form-grid small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.admin-toggles {
  padding-top: 2px;
  color: var(--muted);
  font-weight: 750;
}

.admin-toggles input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.admin-picker {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.admin-device-picker {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.admin-picker-row {
  display: grid;
  grid-template-columns: 18px 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-picker-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.admin-picker-row img {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: #dfe8e2;
  object-fit: cover;
}

.admin-picker-row strong,
.admin-picker-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-picker-row small {
  margin-top: 4px;
  color: var(--muted);
}

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

  .admin-list-panel {
    position: static;
  }

  .admin-device-list {
    max-height: 340px;
  }

  .admin-article-list,
  .admin-device-picker {
    max-height: 340px;
  }
}

@media (max-width: 680px) {
  .admin-header,
  .admin-title,
  .admin-preview {
    align-items: flex-start;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .admin-title > p {
    text-align: left;
  }

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

  .admin-slug-control {
    grid-template-columns: 1fr;
  }

  .admin-preview img {
    width: 100%;
  }

  .admin-article-preview-mark {
    width: 100%;
  }
}
