:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #f0f3f6;
  --line: #d8dde4;
  --text: #1f2328;
  --muted: #667085;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #a33b3b;
  --danger-bg: #fff1f1;
  --success: #276749;
  --success-bg: #eef8f2;
  --hidden-bg: #f7f1e7;
  --shadow: 0 8px 22px rgba(31, 35, 40, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--dsq-font-main, Arial, sans-serif);
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
textarea {
  font: inherit;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 64px;
}

.brand {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
}

.brand:hover {
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.site-nav a:hover,
.site-nav a.active {
  background: var(--surface-muted);
  color: var(--text);
  text-decoration: none;
}

.header-action {
  margin: 0;
}

.site-main {
  min-height: calc(100vh - 129px);
  padding: 36px 0 48px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 20px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 6px;
  font-size: 2rem;
  line-height: 1.2;
}

h2 {
  margin-bottom: 14px;
  font-size: 1.2rem;
}

h3 {
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.page-subtitle,
.muted,
.meta,
.empty {
  color: var(--muted);
}

.page-subtitle {
  margin-bottom: 0;
}

.layout-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.panel,
.post-card,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.panel.narrow {
  max-width: 760px;
}

.panel-head,
.post-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-head {
  margin-bottom: 14px;
}

.panel-head h2 {
  margin-bottom: 0;
}

.side-panel {
  position: sticky;
  top: 88px;
}

.post-list {
  display: grid;
  gap: 14px;
}

.post-card {
  padding: 18px;
}

.post-card.is-hidden {
  background: var(--hidden-bg);
}

.post-card p:last-child,
.side-panel p:last-child {
  margin-bottom: 0;
}

.post-body {
  white-space: pre-wrap;
}

.meta {
  margin-bottom: 14px;
  font-size: 0.9rem;
}

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

.actions {
  margin-top: 16px;
}

.actions form,
.table-wrap form {
  margin: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  padding: 0.55rem 0.9rem;
  color: #fff;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--accent-dark);
  color: #fff;
  text-decoration: none;
}

.button-secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.button-small {
  min-height: 34px;
  padding: 0.4rem 0.65rem;
  font-size: 0.9rem;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.status.published {
  background: var(--success-bg);
  color: var(--success);
}

.status.hidden {
  background: var(--hidden-bg);
  color: #8a5a12;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric {
  padding: 18px;
}

.metric-label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.metric-value {
  margin-top: 6px;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.15;
}

.auth-wrap {
  display: grid;
  min-height: 54vh;
  place-items: center;
}

.auth-panel {
  width: min(440px, 100%);
}

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

.form label {
  color: var(--text);
  font-weight: 700;
}

.form input,
.form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0.68rem 0.75rem;
  color: var(--text);
}

.form input:focus,
.form textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

.form textarea {
  resize: vertical;
}

.form .button {
  justify-self: start;
  margin-top: 8px;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0.75rem 0.9rem;
}

.flash.error {
  border-color: #e2b4b4;
  background: var(--danger-bg);
  color: var(--danger);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.78rem 0.65rem;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.align-right {
  text-align: right;
}

@media screen and (max-width: 860px) {
  .header-inner,
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    width: 100%;
  }

  .layout-two,
  .metrics {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
  }
}

@media screen and (max-width: 520px) {
  .shell {
    width: min(100% - 24px, 1120px);
  }

  .site-main {
    padding-top: 24px;
  }

  .panel,
  .post-card,
  .metric {
    padding: 16px;
  }

  .post-head,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions,
  .stack {
    display: grid;
  }

  .button,
  .form .button {
    width: 100%;
  }
}
