:root {
  --paper: #f4f1e9;
  --surface: #fffdf8;
  --surface-2: #ebe7dd;
  --ink: #171714;
  --muted: #747268;
  --line: #d8d3c8;
  --accent: #ff694b;
  --accent-dark: #d9492f;
  --acid: #d9ff64;
  --blue: #4767ff;
  --green: #278a62;
  --yellow: #f2bd45;
  --purple: #9a75dc;
  --shadow: 0 18px 50px rgba(30, 27, 19, .08);
  --radius: 18px;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
button:not(:disabled), a { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
::selection { color: #111; background: var(--acid); }

.sr-only {
  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;
}

.skip-link {
  position: fixed;
  z-index: 999;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: #111;
  background: var(--acid);
  border-radius: 9px;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  width: 250px;
  display: flex;
  flex-direction: column;
  padding: 24px 18px 18px;
  color: #f7f3e9;
  background: #171714;
  border-right: 1px solid rgba(255, 255, 255, .08);
}
.brand { display: flex; align-items: center; gap: 12px; margin: 0 5px 34px; }
.brand-mark {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  color: #171714;
  background: var(--acid);
  border-radius: 11px;
  transform: rotate(-4deg);
  box-shadow: 5px 5px 0 var(--accent);
}
.brand-mark i { font: 900 22px/1 var(--serif); transform: rotate(4deg); }
.brand > span:last-child { display: grid; gap: 2px; }
.brand b { letter-spacing: .13em; font-size: 14px; }
.brand small { color: #9c9a92; font-size: 11px; }

.main-nav { display: grid; gap: 3px; }
.main-nav p {
  margin: 21px 12px 7px;
  color: #737169;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.main-nav a, .main-nav button {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  color: #b9b6ae;
  background: transparent;
  border: 0;
  border-radius: 10px;
  text-align: left;
  transition: color .2s, background .2s, transform .2s;
}
.main-nav a:hover, .main-nav button:hover { color: #fff; background: #282722; transform: translateX(2px); }
.main-nav a.active { color: #171714; background: var(--acid); }
.main-nav span { font-size: 19px; text-align: center; }
.main-nav b { font-size: 13px; font-weight: 650; }
.main-nav em {
  min-width: 23px;
  padding: 3px 6px;
  color: #171714;
  background: #f5f1e7;
  border-radius: 999px;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  text-align: center;
}
.main-nav a.active em { background: #171714; color: var(--acid); }

.sidebar-note {
  margin-top: auto;
  padding: 16px;
  background: #26251f;
  border: 1px solid #38362f;
  border-radius: 14px;
}
.sidebar-note > span { color: var(--acid); font-size: 9px; font-weight: 900; letter-spacing: .15em; }
.sidebar-note p { margin: 8px 0 13px; color: #b6b3aa; font-size: 12px; line-height: 1.5; }
.sidebar-note button { width: 100%; display: flex; justify-content: space-between; padding: 0; color: #fff; background: none; border: 0; font-size: 12px; font-weight: 700; }
.sidebar-note button b { color: var(--accent); }
.profile-card { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; margin-top: 16px; padding: 10px 5px 0; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; color: #171714; background: #f0c8d5; border-radius: 50%; font-size: 10px; font-weight: 900; }
.profile-card div { display: grid; gap: 2px; }
.profile-card b { font-size: 11px; }
.profile-card small { color: #858279; font-size: 9px; }
.profile-card button { color: #88857d; background: none; border: 0; }

.main-shell { width: calc(100% - 250px); min-width: 0; margin-left: 250px; }
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 70px;
  display: grid;
  grid-template-columns: 1fr minmax(250px, 430px) 1fr;
  align-items: center;
  gap: 22px;
  padding: 0 30px;
  background: color-mix(in srgb, var(--paper) 91%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.breadcrumb { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; }
.breadcrumb span { color: var(--muted); }
.breadcrumb i { color: #aaa69d; font-style: normal; }
.breadcrumb b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-search {
  min-width: 0;
  height: 40px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 0 rgba(24, 22, 16, .04);
  text-align: left;
}
.command-search:hover { border-color: #aaa69b; }
.command-search > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
kbd { padding: 3px 6px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; font: 600 9px/1.2 var(--sans); }
.top-actions { display: flex; justify-content: flex-end; align-items: center; gap: 9px; }
.icon-button {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.icon-button:hover { border-color: var(--ink); }
.menu-button { display: none; }
.primary-button, .secondary-button, .ghost-button, .danger-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  transition: transform .18s, box-shadow .18s, background .18s;
}
.primary-button { color: #fff; background: var(--ink); border: 1px solid var(--ink); box-shadow: 4px 4px 0 var(--accent); }
.primary-button:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--accent); }
.primary-button.accent { color: #171714; background: var(--acid); border-color: #171714; box-shadow: 4px 4px 0 #171714; }
.secondary-button { background: var(--surface); border: 1px solid var(--line); }
.secondary-button:hover { border-color: var(--ink); }
.ghost-button { padding-inline: 11px; background: transparent; border: 1px solid transparent; }
.ghost-button:hover { background: var(--surface-2); }
.danger-button { color: #fff; background: #b84132; border: 1px solid #b84132; }
.compact { min-height: 39px; padding-inline: 14px; box-shadow: none; }
.compact:hover { transform: none; box-shadow: none; background: var(--accent); }

#workspace { min-height: calc(100vh - 70px); outline: 0; }
.view-page { padding: 34px 30px 60px; }
.page-shell { width: 100%; max-width: 1420px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.title-block { max-width: 720px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--accent-dark); font-size: 10px; font-weight: 900; letter-spacing: .17em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 19px; height: 2px; background: currentColor; }
.title-block h1 { margin: 0; font: 700 clamp(35px, 4vw, 57px)/.98 var(--serif); letter-spacing: -.045em; }
.title-block p { margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }

.hero-band {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.45fr .75fr;
  gap: 28px;
  margin-bottom: 22px;
  padding: 31px 34px;
  color: #f9f7ef;
  background: #171714;
  border: 1px solid #171714;
  border-radius: 22px;
}
.hero-band::after {
  content: "D";
  position: absolute;
  right: -5px;
  bottom: -80px;
  color: rgba(217, 255, 100, .08);
  font: 800 260px/1 var(--serif);
  transform: rotate(-8deg);
}
.hero-copy { position: relative; z-index: 1; }
.hero-copy > span { color: var(--acid); font-size: 9px; font-weight: 900; letter-spacing: .16em; }
.hero-copy h2 { max-width: 680px; margin: 12px 0 10px; font: 700 clamp(27px, 3.1vw, 45px)/1.05 var(--serif); letter-spacing: -.035em; }
.hero-copy p { max-width: 610px; margin: 0; color: #aaa79e; font-size: 12px; line-height: 1.65; }
.hero-action { position: relative; z-index: 1; align-self: center; justify-self: end; text-align: right; }
.hero-action small { display: block; margin-bottom: 11px; color: #8c8982; font-size: 10px; }
.hero-action .primary-button { color: #171714; background: var(--acid); border-color: var(--acid); box-shadow: 5px 5px 0 var(--accent); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 22px; }
.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stat-card::after { content: ""; position: absolute; right: -21px; bottom: -25px; width: 74px; height: 74px; background: color-mix(in srgb, var(--metric) 15%, transparent); border-radius: 50%; }
.stat-card small { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 700; }
.stat-card small i { width: 7px; height: 7px; background: var(--metric); border-radius: 50%; }
.stat-card strong { display: block; margin: 17px 0 8px; font: 700 30px/1 var(--serif); }
.stat-card span { color: var(--muted); font-size: 9px; }
.stat-card .positive { color: var(--green); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(270px, .7fr); gap: 18px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 15px rgba(24, 21, 15, .025); }
.panel-head { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font: 700 19px/1.2 var(--serif); }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.panel-head a, .panel-head button { color: var(--accent-dark); background: none; border: 0; font-size: 10px; font-weight: 800; }

.post-list { display: grid; }
.post-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) 105px 110px 74px auto;
  align-items: center;
  gap: 14px;
  min-height: 83px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  transition: background .18s;
}
.post-row:last-child { border-bottom: 0; }
.post-row:hover { background: color-mix(in srgb, var(--surface-2) 46%, transparent); }
.post-title-cell { min-width: 0; display: flex; align-items: center; gap: 13px; }
.post-index {
  width: 39px;
  height: 44px;
  flex: 0 0 39px;
  display: grid;
  place-items: center;
  color: #171714;
  background: var(--cover, #e8dfbc);
  border-radius: 8px;
  font: 800 15px/1 var(--serif);
  transform: rotate(-2deg);
}
.post-title-cell > div { min-width: 0; }
.post-title-cell b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.post-title-cell small { display: block; overflow: hidden; margin-top: 5px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; width: max-content; padding: 5px 8px; border-radius: 999px; font-size: 9px; font-weight: 800; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.status-pill.published { color: #1e6d4d; background: #e0f3e9; }
.status-pill.published::before { background: #2d9369; }
.status-pill.draft { color: #795c19; background: #f7eccb; }
.status-pill.draft::before { background: #e0a92f; }
.post-date, .post-words { color: var(--muted); font-size: 10px; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.row-actions button {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}
.row-actions button:hover { color: var(--ink); background: var(--surface); border-color: var(--line); }
.row-actions button.delete:hover { color: #b53e31; border-color: #e7b7b1; }

.side-stack { display: grid; gap: 18px; }
.writing-goal { padding: 21px; }
.writing-goal h3, .category-panel h3 { margin: 0; font: 700 18px/1.2 var(--serif); }
.writing-goal > p { margin: 6px 0 18px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.goal-ring { position: relative; width: 132px; height: 132px; display: grid; place-items: center; margin: 4px auto 18px; border-radius: 50%; background: conic-gradient(var(--accent) var(--progress), var(--surface-2) 0); }
.goal-ring::before { content: ""; position: absolute; inset: 10px; background: var(--surface); border-radius: 50%; }
.goal-ring div { position: relative; display: grid; gap: 2px; text-align: center; }
.goal-ring strong { font: 700 24px/1 var(--serif); }
.goal-ring small { color: var(--muted); font-size: 8px; }
.goal-meta { display: flex; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--line); }
.goal-meta span { display: grid; gap: 3px; color: var(--muted); font-size: 9px; }
.goal-meta b { color: var(--ink); font-size: 12px; }
.category-panel { padding: 20px; }
.category-panel h3 { margin-bottom: 16px; }
.category-list { display: grid; gap: 11px; }
.category-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; font-size: 10px; }
.category-row i { width: 8px; height: 8px; background: var(--category); border-radius: 50%; }
.category-row span { color: var(--muted); }
.category-row b { font-size: 10px; }

.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.filters { display: flex; flex: 1; flex-wrap: wrap; gap: 9px; }
.filter-search { position: relative; min-width: min(100%, 290px); flex: 1; max-width: 380px; }
.filter-search span { position: absolute; left: 12px; top: 50%; color: var(--muted); transform: translateY(-50%); }
.filter-search input, .filter-select {
  width: 100%;
  height: 42px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
}
.filter-search input { padding: 0 12px 0 36px; }
.filter-select { width: auto; min-width: 135px; padding: 0 34px 0 12px; }
.filter-search input:focus, .filter-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(71, 103, 255, .12); }
.results-count { color: var(--muted); font-size: 10px; white-space: nowrap; }
.posts-panel .post-row { grid-template-columns: minmax(230px, 1.7fr) 110px 110px 86px auto; }
.empty-state { padding: 58px 24px; text-align: center; }
.empty-state i { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 18px; color: #171714; background: var(--acid); border: 1px solid #171714; border-radius: 18px; font: normal 27px/1 var(--serif); box-shadow: 5px 5px 0 var(--ink); }
.empty-state h3 { margin: 0; font: 700 22px/1.2 var(--serif); }
.empty-state p { margin: 8px auto 18px; max-width: 370px; color: var(--muted); font-size: 11px; line-height: 1.6; }

.editor-page { padding-bottom: 30px; }
.editor-top {
  position: sticky;
  z-index: 12;
  top: 70px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 30px;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.editor-top-left, .editor-top-actions { display: flex; align-items: center; gap: 9px; }
.editor-back { width: 36px; height: 36px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.editor-state { display: grid; gap: 3px; }
.editor-state b { font: 700 14px/1.1 var(--serif); }
.editor-state small { color: var(--muted); font-size: 9px; }
.editor-layout { max-width: 1320px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .75fr); gap: 20px; margin: 0 auto; padding: 24px 30px; }
.editor-card, .preview-card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 19px; }
.editor-card { overflow: hidden; }
.editor-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 9px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.field input, .field select, .field textarea {
  width: 100%;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
}
.field input, .field select { height: 42px; padding: 0 12px; }
.field textarea { min-height: 100px; padding: 11px 12px; resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(71, 103, 255, .11); }
.title-field { padding: 26px 26px 16px; }
.title-field label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.title-field input { width: 100%; padding: 0; color: var(--ink); background: transparent; border: 0; outline: 0; font: 700 clamp(27px, 3.2vw, 43px)/1.08 var(--serif); letter-spacing: -.035em; }
.title-field input::placeholder { color: #b6b1a6; }
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 9px 18px; background: var(--paper); border-block: 1px solid var(--line); }
.editor-toolbar button { min-width: 32px; height: 31px; display: grid; place-items: center; padding: 0 8px; background: transparent; border: 1px solid transparent; border-radius: 7px; font-size: 11px; font-weight: 800; }
.editor-toolbar button:hover { background: var(--surface); border-color: var(--line); }
.editor-toolbar i { width: 1px; height: 20px; margin: 0 3px; background: var(--line); }
.content-field { position: relative; }
.content-field textarea { width: 100%; min-height: 500px; display: block; padding: 25px 26px 65px; color: var(--ink); background: transparent; border: 0; outline: 0; resize: vertical; font: 400 16px/1.8 var(--serif); }
.editor-counts { position: absolute; right: 18px; bottom: 13px; display: flex; gap: 13px; color: var(--muted); font-size: 9px; }
.editor-help { padding: 12px 20px; color: var(--muted); background: var(--paper); border-top: 1px solid var(--line); font-size: 9px; line-height: 1.5; }
.editor-help b { color: var(--ink); }

.preview-card { position: sticky; top: 158px; align-self: start; overflow: hidden; max-height: calc(100vh - 184px); }
.preview-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.preview-head span { font-size: 9px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.preview-head small { color: var(--muted); font-size: 8px; }
.preview-scroll { overflow: auto; max-height: calc(100vh - 233px); }
.article-preview { min-height: 530px; padding: 39px 36px 54px; }
.article-preview .preview-category, .reader-article .preview-category { color: var(--accent-dark); font-size: 9px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.article-preview h1, .reader-article h1 { margin: 13px 0 14px; font: 700 clamp(29px, 3.2vw, 46px)/1.05 var(--serif); letter-spacing: -.045em; overflow-wrap: anywhere; }
.article-preview .byline, .reader-article .byline { display: flex; align-items: center; gap: 10px; margin-bottom: 31px; color: var(--muted); font-size: 9px; }
.article-preview .byline .avatar, .reader-article .byline .avatar { width: 29px; height: 29px; font-size: 8px; }
.preview-body { color: color-mix(in srgb, var(--ink) 86%, transparent); font: 400 15px/1.78 var(--serif); overflow-wrap: anywhere; }
.preview-body p { margin: 0 0 1.25em; }
.preview-body h2 { margin: 1.5em 0 .55em; font: 700 25px/1.15 var(--serif); }
.preview-body h3 { margin: 1.4em 0 .5em; font: 700 19px/1.2 var(--serif); }
.preview-body ul { padding-left: 1.3em; }
.preview-body blockquote { margin: 1.4em 0; padding: 4px 0 4px 18px; color: var(--muted); border-left: 3px solid var(--accent); font-style: italic; }
.preview-placeholder { color: #aaa69a; font-style: italic; }

.reader-page { padding: 38px 30px 70px; }
.reader-shell { max-width: 860px; margin: 0 auto; }
.reader-toolbar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.reader-toolbar > div { display: flex; gap: 8px; }
.reader-article { padding: clamp(28px, 6vw, 72px); background: var(--surface); border: 1px solid var(--line); border-radius: 23px; box-shadow: var(--shadow); }
.reader-article h1 { max-width: 690px; font-size: clamp(39px, 6vw, 72px); }
.reader-article .preview-body { font-size: 18px; line-height: 1.85; }

.search-palette, .modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: start center;
  padding: 12vh 20px 24px;
  background: rgba(18, 17, 14, .57);
  backdrop-filter: blur(8px);
}
.search-palette[hidden], .modal[hidden] { display: none; }
.search-box { width: min(650px, 100%); overflow: hidden; background: var(--surface); border: 1px solid color-mix(in srgb, var(--line) 70%, #fff); border-radius: 18px; box-shadow: 0 30px 90px rgba(0, 0, 0, .25); }
.search-input-row { height: 62px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 0 17px; border-bottom: 1px solid var(--line); }
.search-input-row > span { font-size: 20px; }
.search-input-row input { width: 100%; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 14px; }
.search-results { max-height: 410px; overflow: auto; padding: 8px; }
.search-result { width: 100%; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px; padding: 10px; background: transparent; border: 0; border-radius: 10px; text-align: left; }
.search-result:hover, .search-result.selected { background: var(--surface-2); }
.search-result .post-index { width: 34px; height: 38px; font-size: 12px; }
.search-result div { min-width: 0; }
.search-result b { display: block; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.search-result small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.search-result > span { color: var(--muted); font-size: 10px; }
.search-empty { padding: 48px 20px; color: var(--muted); font-size: 11px; text-align: center; }
.search-box footer { display: flex; gap: 17px; padding: 11px 17px; color: var(--muted); background: var(--paper); border-top: 1px solid var(--line); font-size: 8px; }

.modal { place-items: center; padding-top: 24px; }
.modal-card { width: min(540px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 19px; box-shadow: 0 30px 90px rgba(0, 0, 0, .27); }
.modal-card.wide { width: min(700px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 21px 22px 17px; border-bottom: 1px solid var(--line); }
.modal-head span { color: var(--accent-dark); font-size: 9px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.modal-head h2 { margin: 5px 0 0; font: 700 25px/1.1 var(--serif); }
.close-button { width: 33px; height: 33px; display: grid; place-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; font-size: 18px; }
.modal-body { padding: 21px 22px; }
.modal-body > p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 22px 21px; }
.settings-list { display: grid; gap: 12px; }
.settings-item { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 13px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.settings-item > span { width: 40px; height: 40px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 17px; }
.settings-item div { display: grid; gap: 4px; }
.settings-item b { font-size: 11px; }
.settings-item small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.settings-item button { padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-size: 9px; font-weight: 800; }
.settings-item.danger button { color: #b53e31; }

.toast-region { position: fixed; z-index: 200; right: 22px; bottom: 22px; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 245px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 15px; color: #fff; background: #171714; border: 1px solid #3e3c34; border-radius: 11px; box-shadow: var(--shadow); font-size: 10px; pointer-events: auto; animation: toast-in .23s ease both; }
.toast button { padding: 0; color: var(--acid); background: none; border: 0; font-size: 9px; font-weight: 850; text-transform: uppercase; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

.sidebar-scrim { position: fixed; z-index: 29; inset: 0; background: rgba(17, 16, 13, .42); }
.sidebar-scrim[hidden] { display: none; }
.mobile-nav { display: none; }

body.dark {
  --paper: #1b1a17;
  --surface: #24231f;
  --surface-2: #302e28;
  --ink: #f3f0e8;
  --muted: #aaa69c;
  --line: #3d3a33;
  --accent-dark: #ff8065;
  --shadow: 0 18px 50px rgba(0, 0, 0, .25);
}
body.dark .sidebar { background: #10100e; }
body.dark .primary-button { color: #171714; background: var(--acid); border-color: var(--acid); box-shadow-color: var(--accent); }
body.dark .primary-button.accent { color: #171714; }
body.dark .compact { color: #171714; }
body.dark .status-pill.published { color: #98e5c1; background: #1d4636; }
body.dark .status-pill.draft { color: #f2d17e; background: #493d20; }
body.dark .post-index { color: #171714; }
body.dark .hero-band { background: #0f0f0d; border-color: #37352e; }
body.dark .editor-card, body.dark .preview-card, body.dark .reader-article { box-shadow: none; }
body.dark input[type="date"] { color-scheme: dark; }

@media (max-width: 1120px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: 1fr 1fr; }
  .post-row, .posts-panel .post-row { grid-template-columns: minmax(220px, 1.5fr) 100px 90px auto; }
  .post-words { display: none; }
  .editor-layout { grid-template-columns: 1fr; }
  .preview-card { position: static; max-height: none; }
  .preview-scroll { max-height: none; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-105%); transition: transform .25s ease; box-shadow: 24px 0 60px rgba(0, 0, 0, .23); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .main-shell { width: 100%; margin-left: 0; }
  .topbar { grid-template-columns: auto 1fr auto; gap: 12px; padding: 0 16px; }
  .menu-button { display: grid; }
  .breadcrumb { display: none; }
  .command-search { max-width: 480px; justify-self: stretch; }
  .top-actions .compact { display: none; }
  .view-page { padding: 27px 18px 88px; }
  .editor-top { top: 70px; padding-inline: 18px; }
  .editor-layout { padding: 18px 18px 95px; }
  .mobile-nav {
    position: fixed;
    z-index: 25;
    right: 0;
    bottom: 0;
    left: 0;
    height: 69px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    padding: 7px 8px max(7px, env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(18px);
  }
  .mobile-nav a, .mobile-nav button { height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); background: transparent; border: 0; border-radius: 10px; font-size: 8px; }
  .mobile-nav span { font-size: 17px; }
  .mobile-nav a.active { color: var(--accent-dark); }
  .mobile-nav .mobile-create { width: 48px; height: 48px; justify-self: center; color: #171714; background: var(--acid); border: 1px solid #171714; border-radius: 15px; box-shadow: 3px 3px 0 var(--ink); transform: translateY(-10px); }
  .mobile-nav .mobile-create span { font-size: 25px; }
  .toast-region { right: 12px; bottom: 82px; left: 12px; }
  .toast { min-width: 0; }
}

@media (max-width: 680px) {
  .topbar { height: 63px; }
  .command-search kbd, .top-actions { display: none; }
  .command-search { grid-template-columns: auto 1fr; }
  #workspace { min-height: calc(100vh - 63px); }
  .page-head { align-items: flex-start; flex-direction: column; }
  .head-actions { width: 100%; justify-content: flex-start; }
  .title-block h1 { font-size: 38px; }
  .hero-band { grid-template-columns: 1fr; padding: 25px 22px; }
  .hero-action { justify-self: start; text-align: left; }
  .hero-action small { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { min-height: 114px; padding: 15px; }
  .stat-card strong { margin-top: 14px; font-size: 25px; }
  .side-stack { grid-template-columns: 1fr; }
  .panel-head { align-items: flex-start; }
  .post-row, .posts-panel .post-row { grid-template-columns: minmax(0, 1fr) auto; gap: 9px; min-height: 85px; padding: 13px 14px; }
  .post-row > .status-pill { grid-column: 1; margin-left: 52px; }
  .post-date, .post-words { display: none; }
  .row-actions { grid-column: 2; grid-row: 1 / span 2; }
  .toolbar-row { align-items: flex-start; flex-direction: column; }
  .filters, .filter-search, .filter-select { width: 100%; max-width: none; }
  .filter-select { flex: 1; min-width: 0; }
  .results-count { align-self: flex-end; }
  .editor-top { top: 63px; padding: 9px 13px; }
  .editor-state { display: none; }
  .editor-top-actions .secondary-button { display: none; }
  .editor-layout { padding: 12px 12px 92px; }
  .editor-meta { grid-template-columns: 1fr; }
  .title-field { padding: 22px 19px 14px; }
  .title-field input { font-size: 30px; }
  .content-field textarea { min-height: 440px; padding: 21px 19px 60px; }
  .article-preview { padding: 30px 22px 43px; }
  .reader-page { padding: 22px 12px 90px; }
  .reader-toolbar { flex-wrap: wrap; }
  .reader-article { padding: 30px 21px; }
  .reader-article .preview-body { font-size: 16px; }
  .search-palette { padding: 7vh 11px 16px; }
  .modal { padding: 12px; }
  .settings-item { grid-template-columns: 38px 1fr; }
  .settings-item button { grid-column: 1 / -1; }
}

@media (max-width: 410px) {
  .stat-grid { grid-template-columns: 1fr; }
  .post-title-cell { gap: 9px; }
  .post-index { width: 34px; flex-basis: 34px; }
  .post-row > .status-pill { margin-left: 43px; }
  .editor-top-actions .ghost-button { display: none; }
}

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