:root {
  color-scheme: light;
  --bg: #f3f5f4;
  --panel: #ffffff;
  --panel-soft: #f8faf9;
  --text: #17211e;
  --muted: #69756f;
  --line: #dce3df;
  --line-strong: #bdc9c3;
  --primary: #126b57;
  --primary-dark: #0b5142;
  --primary-soft: #e5f3ee;
  --danger: #a43b3b;
  --danger-soft: #faeeee;
  --focus: #2176d2;
  --shadow: 0 1px 2px rgba(19, 35, 29, 0.04), 0 8px 28px rgba(19, 35, 29, 0.05);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 95% 0%, rgba(18, 107, 87, 0.07), transparent 25rem),
    var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

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

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(220, 227, 223, 0.9);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 780;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brandMark {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

nav,
.toolbar,
.rowActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

nav > a {
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

nav > a:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.logoutForm {
  margin: 0 0 0 4px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.button:hover:not(:disabled) {
  border-color: #8d9e96;
  background: #fafcfb;
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.58;
}

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

.button.primary:hover:not(:disabled) {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
}

.button.primary.subtle {
  border-color: #b8d9cf;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.button.primary.subtle:hover:not(:disabled) {
  background: #d7ebe4;
}

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

.button.danger:hover:not(:disabled) {
  border-color: #cf9898;
  background: var(--danger-soft);
}

.button.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.shell {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 52px 0 72px;
}

.sectionHeader {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.sectionMeta {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

input,
select {
  min-height: 40px;
  padding: 8px 11px;
}

select {
  min-width: 170px;
}

.searchField {
  width: min(300px, 30vw);
}

textarea {
  display: block;
  min-height: 540px;
  padding: 15px;
  border: 0;
  border-radius: 0 0 10px 10px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
.button:focus-visible,
.textButton:focus-visible,
a:focus-visible,
.dropZone:focus-within {
  outline: 3px solid rgba(33, 118, 210, 0.2);
  outline-offset: 2px;
  border-color: var(--focus);
}

[aria-invalid="true"] {
  border-color: var(--danger);
}

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

.row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(210px, auto) auto;
  align-items: center;
  gap: 24px;
  min-height: 86px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(19, 35, 29, 0.025);
}

.row:hover {
  border-color: #c5d0ca;
  box-shadow: var(--shadow);
}

.rowTitle,
.rowMeta {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.rowTitle strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rowMeta {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.muted {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
}

.emptyState {
  display: grid;
  justify-items: start;
  gap: 8px;
}

.emptyState strong {
  color: var(--text);
  font-size: 17px;
}

.emptyState .button {
  margin-top: 8px;
}

.loadingState {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.editor {
  display: grid;
  gap: 18px;
}

.editorBasics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.field,
.codePanel,
.previewPanel {
  display: grid;
  align-content: start;
}

.field {
  gap: 7px;
}

.field > label,
.panelHeader label {
  font-size: 13px;
  font-weight: 750;
}

.checkField {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.checkField input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.urlCard {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.urlCard span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.urlCard code {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropZone {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 25px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.dropZone strong {
  color: var(--text);
  font-size: 15px;
}

.dropZone.dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: scale(1.005);
}

.dropIcon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 18px;
  font-weight: 800;
}

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

.codePanel,
.previewPanel {
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  font-size: 13px;
  font-weight: 750;
}

.previewPanel iframe {
  width: 100%;
  height: 100%;
  min-height: 540px;
  border: 0;
  background: #fff;
}

.textButton {
  padding: 5px 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.textButton:hover {
  background: var(--primary-soft);
}

.fieldError,
.pageError {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.pageError {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #e7c5c5;
  border-radius: 8px;
  background: var(--danger-soft);
}

.codePanel .fieldError {
  padding: 0 14px 12px;
}

.overLimit {
  color: var(--danger);
  font-weight: 700;
}

.toast {
  position: fixed;
  z-index: 30;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 16px;
  border-radius: 9px;
  background: #13211c;
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  box-shadow: 0 12px 40px rgba(19, 33, 28, 0.24);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

.visuallyHidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.loginPage {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.loginShell {
  width: min(100%, 390px);
}

.loginBox {
  display: grid;
  gap: 17px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.loginBox h1 {
  font-size: 27px;
  letter-spacing: -0.035em;
}

.loginBox label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.loginMark {
  width: 40px;
  height: 40px;
}

.loginError {
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}

.loginHelpLink {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.guidePage {
  min-height: 100vh;
}

.guideShell {
  width: min(1040px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 48px;
}

.guideHero {
  max-width: 780px;
  margin-bottom: 42px;
}

.guideMark {
  width: 44px;
  height: 44px;
  margin-bottom: 24px;
  font-size: 21px;
}

.guideHero h1,
.guideDocument h1 {
  font-size: clamp(40px, 7vw, 68px);
}

.guideLead {
  max-width: 720px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 2.4vw, 23px);
  line-height: 1.45;
}

.guideActions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.guideGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.guideCard,
.guideNotice,
.guideDocument {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.guideCard {
  padding: 24px;
}

.guideCard h2 {
  margin: 0 0 14px;
  font-size: 21px;
  letter-spacing: -0.025em;
}

.guideCard p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.guideEndpoint {
  display: block;
  overflow: hidden;
  margin-bottom: 14px;
  padding: 10px 11px;
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--primary-dark);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guideNotice {
  margin-top: 12px;
  padding: 18px 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.guideNotice strong {
  color: var(--text);
}

.guideHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.guideHeader .guideActions {
  margin-top: 0;
}

.guideDocument {
  padding: clamp(24px, 5vw, 52px);
}

.guideContent {
  margin: 42px 0 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
}

.guideContent h1 {
  display: none;
}

.guideContent h2 {
  margin: 42px 0 12px;
  font-size: 25px;
  letter-spacing: -0.025em;
}

.guideContent h3 {
  margin: 30px 0 10px;
  font-size: 19px;
}

.guideContent p {
  margin: 0 0 16px;
}

.guideContent ul,
.guideContent ol {
  margin: 0 0 20px;
  padding-left: 24px;
}

.guideContent li {
  margin: 5px 0;
}

.guideContent code {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--panel-soft);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88em;
}

.guideContent pre {
  margin: 18px 0 24px;
  padding: 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
}

.guideContent pre code {
  padding: 0;
  background: transparent;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.guideFooter {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 24px 4px 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1050px) {
  .row {
    grid-template-columns: minmax(220px, 1fr) auto;
  }

  .rowMeta {
    text-align: right;
  }

  .rowActions {
    grid-column: 1 / -1;
  }

  .editorWorkspace {
    grid-template-columns: 1fr;
  }

  .guideGrid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
  }

  .brand {
    min-height: 38px;
  }

  nav {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  nav > a,
  .button.quiet {
    padding-right: 7px;
    padding-left: 7px;
  }

  .shell {
    width: min(100% - 24px, 1280px);
    padding: 34px 0 48px;
  }

  .sectionHeader {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .searchField,
  select {
    width: 100%;
  }

  .row,
  .editorBasics {
    grid-template-columns: 1fr;
  }

  .row {
    gap: 14px;
    padding: 16px;
  }

  .rowMeta {
    text-align: left;
  }

  .rowActions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .rowActions .button {
    width: 100%;
  }

  .dropZone {
    grid-column: auto;
  }

  textarea,
  .previewPanel iframe {
    min-height: 440px;
  }

  .guideShell {
    width: min(100% - 24px, 1040px);
    padding-top: 34px;
  }

  .guideHeader {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .topbar {
    position: static;
  }

  .brand > span:last-child {
    display: none;
  }

  nav {
    gap: 1px;
  }

  nav > a,
  .button.quiet {
    font-size: 13px;
  }

  h1 {
    font-size: 34px;
  }

  .rowActions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
