/* Plume — admin theme
   WordPress-style shell: dark pine sidebar, light work area,
   highlighter-yellow active marker. */

:root {
  --paper:   #F6F5F0;
  --card:    #FFFFFF;
  --ink:     #1C2420;
  --muted:   #6B7268;
  --pine:    #14422F;
  --pine-2:  #0E2F22;
  --accent:  #176245;
  --mark:    #FFE34D;
  --hairline:#E3E1D8;
  --danger:  #A8402F;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.55;
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------ shell ------------------------------ */
.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--pine-2);
  color: #D9E3DC;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 0.75rem;
}

.brand { margin: 0 0.5rem 1.1rem; font-family: var(--serif); font-size: 1.15rem; }
.brand a { color: #fff; text-decoration: none; }
.brand a:hover { color: var(--mark); }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  color: #C9D6CD;
  text-decoration: none;
  font: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}
.nav-item:hover { background: var(--pine); color: #fff; }
.nav-item.active {
  background: var(--pine);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--mark);
}

.bubble {
  display: inline-block;
  min-width: 1.25rem;
  text-align: center;
  background: var(--mark);
  color: var(--ink);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.05rem 0.35rem;
  margin-left: 0.3rem;
}

.sidebar-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.12); }
.sidebar-foot form { margin: 0; }

.content { flex: 1; padding: 1.75rem 2rem 3rem; min-width: 0; }

/* --------------------------- page chrome --------------------------- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.page-head h1 { margin: 0; font-family: var(--serif); font-size: 1.5rem; }

.panel {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.1rem;
}
.panel h2 { margin: 0 0 0.75rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.panel.narrow { max-width: 34rem; }

.muted { color: var(--muted); }
.empty { color: var(--muted); }

.notice { padding: 0.65rem 1rem; border-radius: 6px; margin: 0 0 1rem; }
.notice-ok  { background: #E4F2E8; border: 1px solid #BCDCC6; }
.notice-err { background: #F8E7E3; border: 1px solid #E8C3BA; }

/* ----------------------------- buttons ----------------------------- */
.btn {
  display: inline-block;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--pine); border-color: var(--pine); color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-small { padding: 0.25rem 0.6rem; font-size: 0.82rem; }
.btn-block { display: block; width: 100%; text-align: center; }

/* ------------------------------ stats ------------------------------ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}
.stat {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: var(--ink);
  display: block;
}
a.stat:hover { border-color: var(--accent); }
.stat-n { display: block; font-family: var(--serif); font-size: 1.7rem; line-height: 1.2; }
.stat-l { display: block; color: var(--muted); font-size: 0.85rem; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }

/* ------------------------------ tables ----------------------------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--hairline);
}
.table td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table a { text-decoration: none; }
.table a:hover { text-decoration: underline; }
.row-view { font-size: 0.8rem; margin-left: 0.4rem; }

.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
}
.pill-published, .pill-approved { background: #E4F2E8; color: #14532D; }
.pill-draft, .pill-pending     { background: #FBF3D2; color: #6B5310; }
.pill-spam                     { background: #F8E7E3; color: #8C3323; }

/* --------------------------- list tooling -------------------------- */
.list-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}
.subtabs { display: flex; gap: 0.25rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.list-tools .subtabs { margin-bottom: 0; }
.subtabs a {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid transparent;
}
.subtabs a:hover { color: var(--ink); }
.subtabs a.on { background: var(--card); border-color: var(--hairline); color: var(--ink); font-weight: 600; }

.inline-search { display: flex; gap: 0.4rem; }
.inline-search input[type="search"] {
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  font: inherit;
  background: var(--card);
}

/* ------------------------------ forms ------------------------------ */
label { display: block; margin-bottom: 0.85rem; color: var(--muted); font-size: 0.88rem; }
label input, label select, label textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}
.check-label, .checkall-label { display: flex; align-items: center; gap: 0.45rem; }
.check-label input, .checkall-label input { width: auto; margin: 0; }
.inline-form { display: flex; gap: 0.35rem; align-items: center; margin: 0; }
.inline-form select { width: auto; padding: 0.3rem 0.5rem; font: inherit; border: 1px solid var(--hairline); border-radius: 6px; background: var(--card); }
.confirm-form { display: inline; margin: 0; }
.form-hint { color: var(--muted); font-size: 0.85rem; }

/* ------------------------------ editor ----------------------------- */
.editor-form { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 1.25rem; align-items: start; }
.editor-main { min-width: 0; }

.title-input {
  width: 100%;
  font-family: var(--serif);
  font-size: 1.5rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--card);
  margin-bottom: 0.7rem;
}

.editor-toolbar {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  padding: 0.4rem;
}
.editor-toolbar button {
  border: 1px solid transparent;
  background: none;
  border-radius: 5px;
  padding: 0.3rem 0.6rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--ink);
}
.editor-toolbar button:hover { background: var(--paper); border-color: var(--hairline); }
.toolbar-spacer { flex: 1; }
#preview-toggle.on { background: var(--mark); border-color: var(--mark); }

.content-input {
  width: 100%;
  min-height: 26rem;
  padding: 1rem;
  border: 1px solid var(--hairline);
  border-radius: 0 0 8px 8px;
  background: var(--card);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
}

.preview-pane {
  border: 1px solid var(--hairline);
  border-radius: 0 0 8px 8px;
  background: var(--card);
  padding: 1rem 1.25rem;
  min-height: 26rem;
}
/* Reuse the public post-body look inside the preview */
.post-body h2, .post-body h3 { font-family: var(--serif); }
.post-body img { max-width: 100%; height: auto; }
.post-body pre { background: #20281f; color: #E8EEE4; padding: 1rem; border-radius: 8px; overflow-x: auto; font-family: var(--mono); font-size: 0.85rem; }
.post-body code { font-family: var(--mono); background: #EFEBDD; padding: 0.1em 0.3em; border-radius: 4px; }
.post-body pre code { background: none; padding: 0; }
.post-body blockquote { border-left: 3px solid var(--mark); margin: 1rem 0; padding: 0.25rem 1rem; font-style: italic; }

.editor-side .panel { margin-bottom: 1rem; }

/* ---------------------------- comments ----------------------------- */
.bulk-bar { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.checkall-label { margin: 0 0.5rem 0 0; }
.comment-row { display: flex; gap: 0.8rem; }
.comment-check { margin: 0.15rem 0 0; }
.mini-meta { margin: 0 0 0.25rem; font-size: 0.88rem; }
.mini-body { margin: 0; }
.mini-comment { padding: 0.5rem 0; border-bottom: 1px dashed var(--hairline); }
.mini-comment:last-of-type { border-bottom: 0; }

/* ------------------------------ media ------------------------------ */
.upload-form { display: flex; align-items: end; gap: 1rem; flex-wrap: wrap; }
.upload-label { flex: 1; min-width: 240px; margin: 0; }
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.media-item { margin: 0; text-align: center; }
.media-item img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--paper);
}
.media-item figcaption { font-size: 0.75rem; word-break: break-all; margin: 0.4rem 0; }
.media-item .btn { margin: 0.15rem 0; }
.copy-md.copied { background: var(--mark); border-color: var(--mark); }

/* --------------------------- auth screens -------------------------- */
.hp-field { position: absolute; left: -9999px; top: -9999px; height: 1px; overflow: hidden; }

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--pine-2);
  padding: 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 24rem;
  background: var(--card);
  border-radius: 12px;
  padding: 2rem 2rem 1.5rem;
  border-top: 5px solid var(--mark);
}
.auth-card h1 { margin: 0 0 0.25rem; font-family: var(--serif); font-size: 1.4rem; }
.auth-sub { margin: 0 0 1.25rem; color: var(--muted); }
.auth-back { margin-top: 1rem; font-size: 0.88rem; }

/* ---------------------------- responsive --------------------------- */
@media (max-width: 900px) {
  .editor-form { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .admin-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: column; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin-top: 0.75rem; display: flex; gap: 0.5rem; align-items: center; border-top: 0; padding-top: 0; }
  .content { padding: 1.25rem 1rem 3rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
