:root {
  --red: #ed1c24;
  --red-dark: #c70e16;
  --ink: #161616;
  --ink-soft: #2b2b2b;
  --muted: #6f6f72;
  --line: #e5e5e7;
  --surface: #ffffff;
  --surface-soft: #f5f5f6;
  --surface-dark: #181819;
  --success: #14804a;
  --warning: #9c5c00;
  --danger: #b42318;
  --shadow: 0 16px 60px rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  color: var(--ink);
  background: var(--surface-soft);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
html {
  min-width: 320px;
  background: var(--surface-soft);
}
body {
  margin: 0;
  min-height: 100vh;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
}
.hidden {
  display: none !important;
}
.muted {
  color: var(--muted);
}
.eyebrow {
  margin: 0 0 5px;
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.stack-lg {
  display: grid;
  gap: 18px;
}
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
  background:
    radial-gradient(circle at 20% 20%, rgba(237, 28, 36, 0.12), transparent 30%),
    var(--surface-dark);
}
.auth-card {
  width: min(460px, 100%);
  background: var(--surface);
  border-radius: 26px;
  padding: 42px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.32);
}
.auth-card h1 {
  margin: 10px 0 8px;
  font-size: 38px;
  letter-spacing: -0.04em;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}
.brand strong,
.brand span {
  display: block;
  line-height: 1.05;
}
.brand strong {
  font-size: 20px;
}
.brand span {
  margin-top: 3px;
  color: #a1a1a5;
  font-size: 11px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.brand--auth {
  margin-bottom: 42px;
}
label {
  display: grid;
  gap: 7px;
  color: #39393d;
  font-size: 13px;
  font-weight: 700;
}
input,
textarea,
select {
  width: 100%;
  border: 1px solid #d9d9dc;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  padding: 11px 13px;
  outline: none;
  transition:
    border 0.15s,
    box-shadow 0.15s;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.11);
}
textarea {
  min-height: 120px;
  resize: vertical;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 0.15s,
    background 0.15s,
    border 0.15s;
}
.button:hover {
  transform: translateY(-1px);
}
.button--primary {
  background: var(--red);
  color: white;
}
.button--primary:hover {
  background: var(--red-dark);
}
.button--secondary {
  border-color: var(--line);
  background: white;
  color: var(--ink);
}
.button--danger {
  background: #fff1f0;
  color: var(--danger);
  border-color: #fecaca;
}
.button--full {
  width: 100%;
}
.button--small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}
.button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.cms-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 18px;
  background: var(--surface-dark);
  color: white;
  z-index: 20;
}
.sidebar .brand {
  padding: 0 10px 26px;
}
.sidebar-nav {
  display: grid;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #55555a transparent;
}
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #55555a;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav a {
  padding: 11px 12px;
  border-radius: 8px;
  color: #c5c5c9;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: #2a2a2c;
  color: white;
}
.sidebar-nav a.active::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 10px;
  border-radius: 99px;
  background: var(--red);
  vertical-align: 2px;
}
.sidebar-footer {
  margin-top: auto;
  padding: 18px 8px 4px;
  border-top: 1px solid #343437;
}
.user-summary {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-summary > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--red);
  font-size: 12px;
  font-weight: 900;
}
.user-summary strong,
.user-summary small {
  display: block;
}
.user-summary strong {
  font-size: 13px;
}
.user-summary small {
  margin-top: 2px;
  color: #99999e;
  text-transform: capitalize;
}
.text-button {
  border: 0;
  background: transparent;
  color: #b8b8bd;
  margin: 14px 0 0 43px;
  padding: 0;
  font-size: 12px;
}
.workspace {
  min-width: 0;
}
.topbar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 19px clamp(22px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.025em;
}
.topbar-actions {
  display: flex;
  gap: 9px;
}
.menu-button {
  display: none;
}
.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
}
.app-view {
  padding: 34px clamp(22px, 4vw, 56px) 70px;
  outline: none;
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.page-actions h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.035em;
}
.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}
.stat-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 32px;
  letter-spacing: -0.04em;
}
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}
.panel + .panel {
  margin-top: 20px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 16px;
}
.panel-body {
  padding: 20px;
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  background: #fafafa;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}
th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid #ececef;
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
td {
  font-size: 13px;
}
.table-title {
  display: block;
  font-weight: 800;
}
.table-subtitle {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}
.status {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 99px;
  background: #f1f1f3;
  color: #55555a;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.status--published {
  background: #e7f7ee;
  color: var(--success);
}
.status--in_review {
  background: #fff4dc;
  color: var(--warning);
}
.status--approved {
  background: #edf4ff;
  color: #2457a5;
}
.status--archived {
  background: #f2f2f2;
  color: #78787c;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.filters input {
  width: min(300px, 100%);
}
.empty {
  padding: 52px 20px;
  text-align: center;
}
.empty h3 {
  margin: 0 0 8px;
}
.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
  align-items: start;
}
.editor-main,
.editor-side {
  display: grid;
  gap: 18px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.form-grid .span-2 {
  grid-column: 1 / -1;
}
.help {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.block-list {
  display: grid;
  gap: 12px;
}
.content-block {
  position: relative;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfbfc;
}
.block-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}
.block-toolbar strong {
  font-size: 12px;
  text-transform: capitalize;
}
.block-actions {
  display: flex;
  gap: 5px;
}
.block-actions button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}
.block-add {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}
.block-add button {
  border: 1px dashed #c8c8cc;
  border-radius: 7px;
  background: white;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.checkbox-row input {
  width: auto;
}
.checkbox-grid {
  display: grid;
  gap: 8px;
  max-height: 230px;
  overflow: auto;
  padding: 4px;
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 13px;
}
.media-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: white;
}
.media-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: #f0f0f0;
}
.media-card div {
  padding: 10px;
}
.media-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.media-card small {
  color: var(--muted);
}
.upload-drop {
  padding: 28px;
  border: 1px dashed #bdbdc1;
  border-radius: 12px;
  background: #fafafa;
}
.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.dialog {
  width: min(560px, calc(100% - 30px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  box-shadow: var(--shadow);
}
.dialog::backdrop {
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(3px);
}
.dialog form {
  padding: 28px;
}
.dialog-close {
  position: absolute;
  right: 17px;
  top: 14px;
  border: 0;
  background: transparent;
  font-size: 24px;
}
.dialog h2 {
  margin: 0 0 20px;
}
.toast-region {
  position: fixed;
  right: 22px;
  top: 22px;
  z-index: 100;
  display: grid;
  gap: 10px;
}
.toast {
  min-width: 260px;
  max-width: 420px;
  padding: 13px 15px;
  border-radius: 9px;
  background: #1f1f20;
  color: white;
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: slide-in 0.2s ease-out;
}
.toast--error {
  background: #8f1711;
}
.code-inline {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #f3f3f4;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 11px;
}

.permission-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  padding: 15px 17px;
  border: 1px solid #f0c86c;
  border-radius: 10px;
  background: #fff8e7;
  color: #4d3a0d;
}
.permission-notice strong {
  flex: 0 0 auto;
}
.permission-notice span {
  line-height: 1.5;
}
.field-display {
  display: grid;
  gap: 9px;
}
.field-display__label {
  font-weight: 700;
}
.article-form--readonly input:disabled,
.article-form--readonly textarea:disabled,
.article-form--readonly select:disabled {
  color: #333438;
  -webkit-text-fill-color: #333438;
  opacity: 1;
  background: #f6f6f7;
  cursor: not-allowed;
}
.article-form--readonly .block-add,
.article-form--readonly .block-actions {
  display: none;
}

@keyframes slide-in {
  from {
    transform: translateY(-8px);
    opacity: 0;
  }
}
@media (max-width: 1050px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .editor-layout {
    grid-template-columns: 1fr;
  }
  .editor-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 780px) {
  .cms-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-102%);
    width: 250px;
    transition: transform 0.2s;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.25);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .menu-button {
    display: inline-grid;
    place-items: center;
  }
  .topbar {
    padding: 14px 18px;
  }
  .topbar-actions .button--secondary {
    display: none;
  }
  .app-view {
    padding: 24px 18px 60px;
  }
  .editor-side,
  .two-column {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  .auth-card {
    padding: 30px 22px;
  }
  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .span-2 {
    grid-column: auto;
  }
  .topbar-actions {
    display: none;
  }
  .page-actions {
    align-items: flex-start;
  }
}

.resource-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}
.resource-choice-grid .button {
  justify-content: flex-start;
}
.format-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1100px) {
  .format-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .resource-choice-grid,
  .format-stats {
    grid-template-columns: 1fr;
  }
}

.youtube-url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.youtube-url-field {
  min-width: 0;
}

.youtube-preview {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-subtle);
}

.youtube-preview--empty {
  display: block;
  padding: 18px;
}

.youtube-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 12px;
  background: #111;
}

.youtube-preview__content {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.youtube-preview__content strong {
  font-size: 1.05rem;
  line-height: 1.35;
}

@media (max-width: 720px) {
  .youtube-url-row,
  .youtube-preview {
    grid-template-columns: 1fr;
  }

  .youtube-url-row .button {
    width: 100%;
  }
}
