/* HelpFerry admin chrome — Direction B "Editorial".
   Paper, ink, hairlines, sharp corners, serif display, sans UI chrome. */

:root {
  --paper: #faf7f1;
  --paper-white: #ffffff;
  --ink: #1c2430;
  --ink-soft: #3d4756;
  --faint: #7a7264;
  --rule: #d8d0c0;
  --accent: #b4552d;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

* { margin: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }

/* ---- nav ---- */
.hf-nav {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 18px 40px;
  border-bottom: 2.5px solid var(--ink);
  background: var(--paper);
}
.hf-logo {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.hf-logo span { color: var(--accent); }
.hf-nav__links { display: flex; gap: 22px; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.hf-nav__right { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 13px; color: var(--faint); }
.hf-nav__plan { text-transform: uppercase; letter-spacing: 0.14em; font-size: 11px; border: 1px solid var(--rule); padding: 2px 8px; }
.hf-linkbtn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.hf-subnav {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 40px;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
  color: var(--ink-soft);
}
.hf-subnav a { padding: 4px 0; border-bottom: 2px solid transparent; }
.hf-subnav a.is-active { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }
.hf-subnav__cta { margin-left: auto; font-weight: 700; }

/* ---- shell ---- */
.hf-main { max-width: 1168px; margin: 0 auto; padding: 36px 40px 72px; }
.hf-body--editor .hf-main { max-width: 1320px; }
.hf-footer {
  display: flex;
  justify-content: space-between;
  max-width: 1168px;
  margin: 0 auto;
  padding: 18px 40px 40px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
/* The version is a version, not a label: no uppercase transform on it. */
.hf-footer__version { text-transform: none; letter-spacing: 0; }

/* ---- type ---- */
.hf-pagehead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 26px;
}
.hf-pagehead__actions { display: flex; gap: 10px; flex-shrink: 0; }
.hf-h1 { font-family: var(--serif); font-size: 34px; line-height: 1.14; font-weight: 700; letter-spacing: -0.01em; }
.hf-h1--auth { font-size: 40px; }
.hf-h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.hf-kicker {
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
}
.hf-sub { font-size: 15px; color: var(--ink-soft); margin-top: 8px; max-width: 72ch; }
.hf-note { font-size: 12.5px; color: var(--faint); line-height: 1.5; }
.hf-hint { font-style: normal; color: var(--faint); font-weight: 400; }
.hf-figure { font-family: var(--serif); font-size: 34px; font-weight: 600; line-height: 1; }
.hf-figure--alert { color: var(--accent); }
.hf-figure--small { font-size: 18px; }
/* Search-gap panels: white sheet, 2px ink border, hairline rows (design spec). */
.hf-panel {
  background: var(--paper-white);
  border: 2px solid var(--ink);
  padding: 18px 20px 20px;
}
.hf-panel .hf-table td { border-bottom: 1px solid var(--rule); }
.hf-panel .hf-table tr:last-child td { border-bottom: 0; }
.hf-panel .hf-figure { text-align: right; }
.hf-figure--zero { color: var(--accent); }
/* A figure inside a table row is a number, not a display headline. */
.hf-table .hf-figure { font-size: 15px; font-weight: 700; }

/* ---- buttons ---- */
.hf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 9px 16px;
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
}
.hf-btn:hover { background: rgba(28, 36, 48, 0.06); text-decoration: none; }
.hf-btn--solid { background: var(--ink); color: var(--paper); }
.hf-btn--solid:hover { background: #2b3646; }
.hf-btn--small { padding: 5px 10px; font-size: 12px; border-width: 1px; }
.hf-btn--danger { border-color: var(--accent); color: var(--accent); }
.hf-btn--danger:hover { background: rgba(180, 85, 45, 0.08); }
.hf-btn--disabled { border-color: var(--rule); color: var(--faint); cursor: not-allowed; }
/* A form that has been submitted once (src/admin/forms.ts): the button says so
   and stops taking clicks until the response arrives. */
.hf-btn.is-busy, .hf-btn[disabled] { border-color: var(--rule); color: var(--faint); cursor: progress; }
.hf-btn--solid.is-busy, .hf-btn--solid[disabled] { background: var(--ink-soft); border-color: var(--ink-soft); color: var(--paper); }
.hf-link { text-decoration: underline; text-underline-offset: 3px; }

/* ---- flash ---- */
.hf-flash {
  border: 0;
  border-left: 3px solid var(--ink);
  background: rgba(255, 255, 255, 0.6);
  padding: 7px 0 7px 12px;
  font-size: 13.5px;
  margin-bottom: 22px;
}
.hf-flash--error { border-left-color: var(--accent); color: #7d3419; }

/* ---- sections / stats ---- */
.hf-section { margin-top: 34px; }
.hf-section--danger { border-top: 1px solid var(--rule); padding-top: 24px; }
.hf-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.hf-stat { padding: 18px 20px; border-left: 1px solid var(--rule); }
.hf-stat:first-child { border-left: 0; padding-left: 0; }

/* ---- tables ---- */
.hf-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.hf-table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--ink);
}
.hf-table td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.hf-table--tight td { padding: 7px 12px 7px 0; }
.hf-cell--actions { text-align: right; white-space: nowrap; }
.hf-cell--actions form { display: inline-block; margin-left: 6px; vertical-align: middle; }
.hf-row--detail td { border-bottom: 1px solid var(--rule); background: rgba(255, 255, 255, 0.6); padding-top: 0; }
.hf-errors { margin: 6px 0 0 16px; font-size: 12.5px; color: var(--accent); }

/* ---- badges ---- */
.hf-badge {
  display: inline-block;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 2px 7px;
  border: 1px solid var(--ink-soft);
  color: var(--ink-soft);
  white-space: nowrap;
}
.hf-badge--ok { border-color: #2f6b46; color: #2f6b46; }
.hf-badge--warn { border-color: #8a6b12; color: #8a6b12; }
.hf-badge--err { border-color: var(--accent); color: var(--accent); }
.hf-badge--muted { border-color: var(--rule); color: var(--faint); }

/* ---- forms ---- */
.hf-form { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.hf-form--panel { border: 1px solid var(--rule); background: var(--paper-white); padding: 24px; max-width: 760px; }
.hf-form--inline { flex-direction: row; align-items: flex-end; flex-wrap: wrap; gap: 12px; max-width: none; }
.hf-form--row { flex-direction: row; gap: 6px; align-items: center; }
.hf-form--row input, .hf-form--row select { padding: 5px 7px; font-size: 12.5px; }
.hf-form__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hf-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.hf-field input, .hf-field select, .hf-field textarea {
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
  color: var(--ink);
  background: var(--paper-white);
  border: 1px solid var(--ink-soft);
  border-radius: 0;
  padding: 8px 10px;
  width: 100%;
}
.hf-field textarea { resize: vertical; }
.hf-field input:focus, .hf-field select:focus, .hf-field textarea:focus,
.hf-slug-input:focus, .hf-title-input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.hf-field input:disabled { background: #f1ece2; color: var(--faint); }
.hf-field--check { justify-content: flex-end; }
.hf-check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-soft); text-transform: none; letter-spacing: 0; font-weight: 400; }
.hf-check input { width: auto; }
.hf-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hf-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.hf-input--narrow { width: 64px !important; }
.hf-logo-preview { max-height: 32px; vertical-align: middle; }
.hf-rule { border-top: 1px solid var(--rule); margin: 6px 0; }

/* ---- filters ---- */
.hf-filters { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin: 20px 0 18px; }
.hf-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.hf-filters input, .hf-filters select { font-family: var(--sans); font-size: 13px; padding: 6px 8px; border: 1px solid var(--ink-soft); background: var(--paper-white); border-radius: 0; }

/* ---- auth ---- */
.hf-auth-body { display: flex; justify-content: center; padding: 72px 24px; }
.hf-auth { width: 100%; max-width: 420px; }
.hf-logo--auth { display: inline-block; margin-bottom: 30px; }
.hf-auth .hf-form { margin-top: 22px; }
.hf-auth__footer { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: 13px; }

/* ---- editor ---- */
.hf-editor__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.hf-editor__bar-left, .hf-editor__bar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hf-editor__grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 36px; }
.hf-editor__side { display: flex; flex-direction: column; gap: 22px; }
.hf-side-block { border-top: 2px solid var(--ink); padding-top: 12px; }
.hf-side-block--danger { border-top: 1px solid var(--accent); }
.hf-side-block .hf-field { margin-bottom: 10px; }
.hf-title-input {
  width: 100%;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -0.01em;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  padding: 4px 0 10px;
  margin-bottom: 10px;
}
.hf-slug-row { display: flex; align-items: center; gap: 6px; margin-bottom: 22px; flex-wrap: wrap; }
.hf-slug-input { font-family: ui-monospace, Menlo, monospace; font-size: 13px; padding: 5px 8px; border: 1px solid var(--ink-soft); background: var(--paper-white); border-radius: 0; min-width: 240px; }
.hf-blocks { display: flex; flex-direction: column; gap: 2px; min-height: 200px; }
.hf-block { position: relative; border-left: 2px solid transparent; padding: 6px 0 6px 12px; }
.hf-block:hover, .hf-block.is-active { border-left-color: var(--rule); }
.hf-block__tools { position: absolute; right: -4px; top: 2px; display: none; gap: 4px; background: var(--paper); padding: 2px 4px; border: 1px solid var(--rule); }
.hf-block:hover .hf-block__tools, .hf-block.is-active .hf-block__tools { display: flex; }
.hf-block__tool {
  border: 0;
  background: transparent;
  font-size: 11px;
  color: var(--faint);
  cursor: pointer;
  padding: 2px 5px;
  font-family: var(--sans);
}
.hf-block__tool:hover { color: var(--ink); background: rgba(28, 36, 48, 0.07); }
.hf-block__type { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin-bottom: 2px; }
.hf-block__edit { outline: none; }
.hf-block__edit:focus { background: rgba(255, 255, 255, 0.75); }
.hf-block--paragraph .hf-block__edit { font-size: 16px; line-height: 1.65; color: var(--ink-soft); }
.hf-block--heading2 .hf-block__edit { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.25; }
.hf-block--heading3 .hf-block__edit { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.hf-block--quote .hf-block__edit { border-left: 2px solid var(--accent); padding-left: 14px; font-family: var(--serif); font-size: 18px; color: var(--ink-soft); }
.hf-block--callout .hf-block__edit { border: 1px solid var(--ink); background: var(--paper-white); padding: 12px 14px; }
.hf-block--code .hf-block__edit { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: #f1ece2; padding: 12px; white-space: pre-wrap; }
.hf-block--list textarea { width: 100%; min-height: 76px; font-family: var(--sans); font-size: 15px; padding: 8px; border: 1px dashed var(--rule); background: var(--paper-white); border-radius: 0; }
.hf-block__image { display: flex; flex-direction: column; gap: 6px; }
.hf-block__image img { max-width: 100%; border: 1px solid var(--rule); }
.hf-block__image input[type="file"] { font-size: 12px; }
.hf-block--divider hr { border: 0; border-top: 1px solid var(--ink); margin: 14px 0; }
.hf-block-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--rule); }
.hf-block-toolbar .hf-kicker { margin: 0 6px 0 0; }
.hf-revlist { list-style: none; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.hf-revlist a { text-decoration: underline; text-underline-offset: 3px; }

/* ---- diff ---- */
.hf-diff { border: 1px solid var(--rule); background: var(--paper-white); font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.hf-diff__head { display: flex; justify-content: space-between; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--ink); font-family: var(--sans); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.hf-diff__line { display: flex; gap: 10px; padding: 1px 14px; white-space: pre-wrap; word-break: break-word; }
.hf-diff__sign { color: var(--faint); user-select: none; }
.hf-diff__line--add { background: rgba(47, 107, 70, 0.1); }
.hf-diff__line--del { background: rgba(180, 85, 45, 0.12); }
.hf-diff__line--same { color: var(--ink-soft); }

/* ---- misc ---- */
.hf-empty { border: 1px dashed var(--rule); padding: 40px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hf-mono { font-family: ui-monospace, Menlo, monospace; }

@media (max-width: 900px) {
  .hf-main { padding: 24px 18px 56px; }
  .hf-nav { padding: 14px 18px; gap: 14px; flex-wrap: wrap; }
  .hf-subnav { padding: 8px 18px; overflow-x: auto; }
  .hf-stats { grid-template-columns: repeat(2, 1fr); }
  .hf-stat { border-left: 0; }
  .hf-editor__grid { grid-template-columns: 1fr; }
  .hf-grid-2, .hf-grid-3 { grid-template-columns: 1fr; }
  .hf-h1, .hf-title-input { font-size: 27px; }
  .hf-pagehead { flex-direction: column; align-items: flex-start; }
}
