.admin-body {
  min-height: 100vh;
  background:
    linear-gradient(rgba(80, 223, 242, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 223, 242, 0.035) 1px, transparent 1px),
    #07090c;
  background-size: 64px 64px;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 12, 0.9);
  backdrop-filter: blur(15px);
}

.admin-brand,
.admin-back {
  display: flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.admin-brand {
  min-width: 0;
  gap: 11px;
}

.admin-brand > span:first-child {
  width: 38px;
  height: 38px;
  display: grid;
  flex: 0 0 38px;
  place-items: center;
  color: #080b06;
  background: var(--acid);
}

.admin-brand svg {
  width: 21px;
  height: 21px;
}

.admin-brand > span:last-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.admin-brand strong,
.admin-brand small {
  overflow: hidden;
  font-family: var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-brand strong { font-size: 11px; }
.admin-brand small { color: var(--muted); font-size: 8px; }

.admin-back {
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 720;
}

.admin-back svg {
  width: 18px;
  height: 18px;
  transition: transform 180ms ease;
}

.admin-back:hover,
.admin-back:focus-visible { color: var(--acid); }
.admin-back:hover svg,
.admin-back:focus-visible svg { transform: translateX(-2px); }

.admin-main {
  position: relative;
  z-index: 2;
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: 54px 0 80px;
}

.admin-auth {
  width: min(620px, 100%);
  margin: 9vh auto 0;
  padding: 42px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.admin-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px;
  color: var(--cyan);
  font: 9px/1 var(--font-mono);
}

.admin-kicker span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 12px rgba(255, 113, 129, 0.7);
}

.admin-auth h1 {
  margin: 0;
  font-size: 48px;
  line-height: 1.15;
  letter-spacing: 0;
}

.admin-auth > p:not(.admin-kicker):not(.admin-auth-status) {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.admin-auth form {
  margin-top: 32px;
}

.admin-auth label,
.admin-field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 720;
}

.admin-token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.admin-token-row input,
.admin-field input,
.admin-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text);
  background: rgba(13, 18, 21, 0.92);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.admin-token-row input,
.admin-field input {
  min-height: 46px;
  padding: 0 13px;
}

.admin-field textarea {
  min-height: 110px;
  padding: 12px 13px;
  resize: vertical;
  line-height: 1.75;
}

#editorPostContent {
  min-height: 390px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.85;
}

.admin-token-row input:focus,
.admin-field input:focus,
.admin-field textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(80, 223, 242, 0.08);
}

.admin-token-row button,
.admin-save-button,
.admin-delete-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 780;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.admin-token-row button,
.admin-save-button {
  color: #090b08;
  background: var(--acid);
}

.admin-token-row button:hover,
.admin-token-row button:focus-visible,
.admin-save-button:hover,
.admin-save-button:focus-visible {
  background: #d9ff80;
  transform: translateY(-1px);
}

.admin-token-row button svg,
.admin-save-button svg,
.admin-delete-button svg,
.admin-logout svg {
  width: 17px;
  height: 17px;
}

.admin-auth-status {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--coral);
  font-size: 11px;
}

.admin-workspace {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  border: 1px solid var(--line);
  background: rgba(8, 11, 13, 0.82);
}

.admin-workspace-title {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-posts {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(11, 15, 18, 0.82);
}

.admin-posts > header,
.admin-editor > header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.admin-posts header p,
.admin-posts header h2,
.admin-editor header p,
.admin-editor header h2 {
  margin: 0;
}

.admin-posts header p,
.admin-editor header p {
  margin-bottom: 5px;
  color: var(--cyan);
  font: 8px/1 var(--font-mono);
}

.admin-posts header h2,
.admin-editor header h2 {
  font-size: 21px;
  line-height: 1.2;
}

.admin-icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  flex: 0 0 40px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.admin-icon-button svg { width: 19px; height: 19px; }

.admin-icon-button:hover,
.admin-icon-button:focus-visible {
  border-color: var(--acid);
  color: #090b08;
  background: var(--acid);
}

.admin-list-status {
  min-height: 36px;
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 9px/1.3 var(--font-mono);
}

.admin-post-list {
  min-height: 280px;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan) transparent;
}

.admin-post-item {
  position: relative;
  width: 100%;
  min-height: 82px;
  display: grid;
  gap: 7px;
  padding: 16px 58px 16px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 180ms ease;
}

.admin-post-item:hover,
.admin-post-item:focus-visible {
  background: rgba(80, 223, 242, 0.055);
}

.admin-post-item strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-post-item span {
  color: var(--muted);
  font: 8px/1.2 var(--font-mono);
}

.admin-post-item i {
  position: absolute;
  top: 50%;
  right: 14px;
  color: var(--acid);
  font: normal 8px/1 var(--font-mono);
  transform: translateY(-50%);
}

.admin-logout {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: auto;
  padding: 0 12px;
  border: 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.admin-logout:hover,
.admin-logout:focus-visible { color: var(--coral); }

.admin-editor {
  min-width: 0;
}

.admin-save-status {
  max-width: 260px;
  color: var(--acid);
  font: 9px/1.4 var(--font-mono);
  text-align: right;
}

.admin-editor form {
  padding: 24px;
}

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

.admin-field {
  min-width: 0;
}

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

.admin-field small {
  color: var(--muted);
  font-weight: 500;
}

.admin-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.admin-editor-actions > div {
  display: flex;
  gap: 9px;
}

.admin-delete-button {
  border-color: rgba(255, 113, 129, 0.34);
  color: var(--coral);
  background: transparent;
}

.admin-delete-button:hover,
.admin-delete-button:focus-visible {
  color: #100608;
  background: var(--coral);
}

.admin-publish-toggle {
  position: relative;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding-left: 52px;
  cursor: pointer;
}

.admin-publish-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.admin-publish-toggle i {
  position: absolute;
  left: 0;
  width: 42px;
  height: 23px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  transition: border-color 180ms ease, background 180ms ease;
}

.admin-publish-toggle i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  content: "";
  background: var(--muted);
  transition: transform 180ms ease, background 180ms ease;
}

.admin-publish-toggle input:checked + i {
  border-color: rgba(200, 255, 72, 0.55);
  background: rgba(200, 255, 72, 0.12);
}

.admin-publish-toggle input:checked + i::after {
  background: var(--acid);
  transform: translateX(19px);
}

.admin-publish-toggle input:focus-visible + i {
  outline: 2px solid var(--acid);
  outline-offset: 4px;
}

.admin-publish-toggle > span {
  display: grid;
  gap: 3px;
}

.admin-publish-toggle strong { font-size: 12px; }
.admin-publish-toggle small { color: var(--muted); font-size: 9px; }

button:disabled {
  cursor: wait;
  opacity: 0.56;
}

@media (max-width: 960px) {
  .admin-main {
    width: min(100% - 32px, 760px);
    padding-top: 28px;
  }

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

  .admin-posts {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-post-list {
    max-height: 280px;
  }

  .admin-logout {
    margin-top: 0;
  }
}

@media (max-width: 620px) {
  .admin-header {
    min-height: 64px;
    padding: 10px 16px;
  }

  .admin-brand small,
  .admin-back {
    font-size: 0;
  }

  .admin-back svg {
    width: 22px;
    height: 22px;
  }

  .admin-main {
    width: calc(100% - 24px);
  }

  .admin-auth {
    margin-top: 4vh;
    padding: 32px 0;
  }

  .admin-auth h1 { font-size: 36px; }

  .admin-token-row,
  .admin-field-grid {
    grid-template-columns: 1fr;
  }

  .admin-token-row button { min-height: 44px; }
  .admin-field-wide { grid-column: 1; }
  .admin-editor > header { align-items: flex-start; }
  .admin-save-status { max-width: 120px; }
  .admin-editor form { padding: 18px 14px; }

  .admin-editor-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-editor-actions > div {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .admin-save-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
