:root {
  color-scheme: light;
  --ink: #171a1f;
  --muted: #626a73;
  --paper: #fbfaf5;
  --panel: #f0eadf;
  --line: #d7d0c3;
  --green: #0b6b57;
  --green-2: #11493f;
  --coral: #ff6848;
  --cyan: #a6e7e2;
  --yellow: #f5c84b;
  --shadow: 0 28px 70px rgba(42, 38, 30, .15);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(90deg, rgba(23, 26, 31, .045) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(rgba(23, 26, 31, .035) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--paper);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
a.google-button {
  min-height: 42px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 0 16px;
  background: var(--paper);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

button:hover,
a.google-button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--ink);
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.primary {
  background: var(--green);
  color: white;
}

.ghost {
  box-shadow: none;
  border-color: var(--line);
}

.big {
  min-height: 52px;
  padding: 0 22px;
  font-weight: 700;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--ink);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  text-decoration: none;
}

.wordmark-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--coral);
  color: var(--ink);
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}

.nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: .95rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 24px 0 28px;
  align-items: stretch;
}

.console,
.reports-panel,
.admin-panel {
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: rgba(251, 250, 245, .92);
  box-shadow: var(--shadow);
}

.publisher {
  padding: 2px 0 0;
}

.publisher-head {
  display: grid;
  grid-template-columns: minmax(240px, .85fr) minmax(260px, 1fr) minmax(240px, auto);
  gap: 24px;
  align-items: start;
  margin-bottom: 20px;
}

.section-kicker {
  width: fit-content;
  margin-bottom: 14px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--cyan);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: .98;
  letter-spacing: 0;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.8rem);
  font-weight: 700;
}

.lede {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.publish-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  box-shadow: 0 0 0 3px var(--cyan);
}

textarea:disabled {
  background: #ece7dc;
  color: var(--muted);
  cursor: not-allowed;
}

textarea {
  min-height: 260px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: .92rem;
  line-height: 1.55;
}

.content-field {
  display: grid;
  gap: 8px;
}

.editor-panel {
  border: 1px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.editor-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.editor-tab {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 0 16px;
  box-shadow: none;
  background: transparent;
  font-weight: 800;
}

.editor-tab:hover {
  transform: none;
  box-shadow: none;
}

.editor-tab.active {
  background: white;
  color: var(--green);
}

.editor-panel textarea {
  border: 0;
  border-radius: 0;
  min-height: 300px;
}

.editor-panel textarea:focus {
  box-shadow: inset 0 0 0 3px var(--cyan);
}

.local-preview {
  display: block;
  width: 100%;
  min-height: 300px;
  border: 0;
  background: white;
}

.content-meta {
  margin-top: -6px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.4;
}

.content-meta .over-limit {
  color: #b42318;
  font-weight: 900;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 14px;
}

.upload-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px dashed var(--ink);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: .9rem;
}

.dragging-file .upload-strip {
  background: var(--cyan);
  border-style: solid;
  box-shadow: 0 0 0 4px rgba(166, 231, 226, .35);
}

.upload-strip input {
  max-width: 300px;
  background: white;
}

.settings {
  margin: 0;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(180px, .7fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.settings legend {
  padding: 0 8px;
  font-weight: 800;
}

.settings small {
  color: var(--coral);
  font-weight: 900;
}

.settings .check small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.35;
}

.check {
  grid-template-columns: 20px 1fr;
  align-content: center;
  align-items: center;
}

.check input {
  width: 18px;
  height: 18px;
}

.turnstile-slot {
  min-height: 0;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.publish-topline {
  justify-content: flex-end;
  align-items: flex-start;
}

.publish-topline #publishButton {
  flex: 0 0 auto;
  min-width: 190px;
}

.publish-topline output {
  flex: 1 1 320px;
  max-width: 620px;
}

output {
  color: var(--muted);
  line-height: 1.45;
}

.publish-result {
  width: min(100%, 620px);
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
}

.publish-result.success {
  color: var(--ink);
  border-color: var(--green);
  box-shadow: 4px 4px 0 var(--green);
}

.publish-result.error {
  color: #8a1f11;
  border-color: #d92d20;
  background: #fff4f1;
  font-weight: 800;
}

.publish-result strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green-2);
  font-size: 1rem;
}

.publish-result p {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}

.publish-result span {
  color: var(--muted);
  font-size: .86rem;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.compact {
  min-height: 34px;
  padding: 0 12px;
  font-size: .84rem;
}

.console {
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  background: #171a1f;
  color: #fbfaf5;
}

.console-header {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 12px;
  border-right: 1px solid rgba(251, 250, 245, .22);
  padding-right: 14px;
}

.console-header span {
  color: rgba(251, 250, 245, .7);
}

.console-header strong {
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--yellow);
  color: var(--ink);
}

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

.limits-grid div {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(251, 250, 245, .18);
  border-radius: 8px;
  padding: 12px;
  background: rgba(251, 250, 245, .06);
}

.limits-grid span {
  color: rgba(251, 250, 245, .58);
  font-size: .82rem;
}

.artifact-preview {
  align-self: end;
  min-height: 360px;
  border: 1px solid rgba(251, 250, 245, .22);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 20%, rgba(255, 104, 72, .25), transparent 28%),
    radial-gradient(circle at 84% 12%, rgba(166, 231, 226, .25), transparent 26%),
    #20242a;
}

.preview-toolbar {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(251, 250, 245, .18);
}

.preview-toolbar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--coral);
}

.preview-toolbar span:nth-child(2) {
  background: var(--yellow);
}

.preview-toolbar span:nth-child(3) {
  background: var(--cyan);
}

.preview-doc {
  width: min(78%, 360px);
  margin: 42px auto;
  padding: 24px;
  border-radius: 8px;
  background: #fbfaf5;
  color: var(--ink);
  transform: rotate(-2deg);
  box-shadow: 14px 14px 0 rgba(0, 0, 0, .28);
}

.preview-label {
  margin: 0 0 16px;
  color: var(--green);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: .78rem;
}

.preview-doc h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.15rem;
}

.preview-line {
  height: 10px;
  margin-top: 14px;
  background: #d8d1c3;
  border-radius: 999px;
}

.preview-line.wide {
  width: 86%;
}

.preview-chart {
  height: 120px;
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  align-items: end;
}

.preview-chart i {
  display: block;
  border-radius: 6px 6px 0 0;
  background: var(--green);
}

.preview-chart i:nth-child(1) { height: 48%; }
.preview-chart i:nth-child(2) { height: 78%; background: var(--coral); }
.preview-chart i:nth-child(3) { height: 62%; background: var(--yellow); }
.preview-chart i:nth-child(4) { height: 92%; background: var(--green); }

.reports-panel {
  margin: 24px 0 28px;
  padding: 24px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
}

.reports-panel h1 {
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  font-family: Georgia, "Times New Roman", serif;
}

.history-copy {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.admin-panel {
  margin: 24px 0 28px;
  padding: clamp(18px, 3vw, 30px);
}

.admin-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--ink);
}

.admin-heading h1 {
  font-size: clamp(2.5rem, 6vw, 5.2rem);
}

.admin-heading p {
  max-width: 620px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-back {
  flex: 0 0 auto;
  text-decoration: none;
}

.admin-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 24px 0 10px;
}

.admin-search button {
  min-height: 48px;
}

.admin-status {
  display: block;
  min-height: 1.5em;
  margin: 12px 0 18px;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin: 22px 0 4px;
}

.admin-metrics div {
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}

.admin-metrics span {
  display: block;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 1.55rem;
}

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

.admin-block {
  display: grid;
  gap: 12px;
}

.admin-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-block-head h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
}

.admin-filter-pill {
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--yellow);
  font-size: .78rem;
  font-weight: 800;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: white;
}

.admin-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  text-align: left;
}

.admin-users-table {
  min-width: 980px;
}

.admin-table th {
  padding: 12px 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: .76rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-table td {
  padding: 15px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: .93rem;
}

.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-table tbody tr:hover {
  background: #fff9e9;
}

.admin-table a {
  color: var(--green-2);
  font-weight: 800;
}

.admin-table small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: .8rem;
  overflow-wrap: anywhere;
}

.access-tag {
  display: inline-block;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 3px 8px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: .75rem;
  font-weight: 800;
}

.access-tag.sandbox { background: var(--cyan); }
.access-tag.trusted { background: var(--yellow); }
.access-tag.free { background: var(--cyan); }
.access-tag.pro { background: var(--yellow); }
.access-tag.anonymous { background: var(--panel); }

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.compact {
  min-height: 34px;
  padding: 0 10px;
  box-shadow: none;
  font-size: .82rem;
}

.danger {
  border-color: #8a1f12;
  background: #ffe0d8;
  color: #8a1f12;
}

.report-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
}

.report-item strong,
.report-item span {
  overflow-wrap: anywhere;
}

.report-item span {
  color: var(--muted);
  font-size: .9rem;
}

.auth-dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.auth-dialog::backdrop {
  background: rgba(23, 26, 31, .58);
}

.dialog-card {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  padding: 24px;
  box-shadow: 8px 8px 0 var(--ink);
  display: grid;
  gap: 14px;
  position: relative;
}

.dialog-card h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
}

.dialog-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  min-height: 34px;
  padding: 0;
  box-shadow: none;
}

.google-button {
  width: 100%;
  min-height: 48px;
}

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: .82rem;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

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

  .publisher-head {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .publish-topline {
    justify-content: flex-start;
  }

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

  .console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid rgba(251, 250, 245, .22);
    padding-right: 0;
    padding-bottom: 12px;
  }

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

  .reports-panel {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 680px) {
  .shell {
    padding: 12px;
  }

  .topbar {
    height: auto;
    padding-bottom: 12px;
    align-items: flex-start;
  }

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

  .nav a {
    display: none;
  }

  .field-row,
  .settings,
  .limits-grid,
  .admin-search {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(2rem, 11vw, 3rem);
  }

  .report-item {
    grid-template-columns: 1fr;
  }
}
