/* Booklist Pages — dashboard stylesheet. Bearblog-esque: warm paper, serif,
 * minimal chrome, one narrow column. Mobile-first. */

:root {
  --paper: #faf7f0;
  --paper-2: #f3eee2;
  --ink: #2b2620;
  --ink-soft: #6b6257;
  --line: #e2d9c6;
  --accent: #8a5a2b;
  --accent-ink: #fffaf0;
  --danger: #a33b2e;
  --radius: 8px;
  --col: 640px;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.55;
  font-size: 17px;
}

/* ---------- nav ---------- */
.dash-nav {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  position: sticky; top: 0; z-index: 50;
  font-family: var(--sans); font-size: 14px;
  flex-wrap: wrap;
}
.dash-nav .brand { font-family: var(--serif); font-weight: bold; font-size: 18px; color: var(--ink); text-decoration: none; }
.dash-nav .brand span { color: var(--accent); font-weight: normal; font-style: italic; }
.dash-nav nav { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.dash-nav nav a { color: var(--ink-soft); text-decoration: none; }
.dash-nav nav a.active { color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--accent); }
.dash-nav nav a:hover { color: var(--ink); }
.dash-nav .nav-right { margin-left: auto; display: flex; gap: 0.6rem; align-items: center; }
.dash-nav .view-site { color: var(--accent); text-decoration: none; }
.dash-nav .signout { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 0.25rem 0.6rem; cursor: pointer; color: var(--ink-soft); font-size: 13px; }

/* ---------- layout ---------- */
.dash-main { max-width: var(--col); margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.dash-main h1 { font-size: 1.6rem; margin: 0.2rem 0 1rem; }
.dash-main h2 { font-size: 1.25rem; margin: 1.6rem 0 0.6rem; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }

/* ---------- cards / rows ---------- */
.card {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0.8rem 0;
}
.row-card {
  display: flex; gap: 0.9rem; align-items: flex-start; flex-wrap: wrap;
  background: #fffdf8; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.7rem 0.8rem; margin: 0.5rem 0; text-decoration: none; color: inherit;
}
a.row-card:hover { border-color: var(--accent); }
.row-card img.cover { width: 44px; height: 66px; object-fit: cover; border-radius: 3px; background: var(--paper-2); flex: none; }
.row-card .cover-ph { width: 44px; height: 66px; border-radius: 3px; background: var(--paper-2); flex: none; display: flex; align-items: center; justify-content: center; color: var(--ink-soft); font-size: 20px; }
.row-card .t { font-weight: bold; }
.row-card .a { color: var(--ink-soft); font-size: 0.9rem; overflow-wrap: anywhere; }
.row-card > div[style*="flex:1"] { min-width: 0; }
/* action buttons inside a row-card: wrap below the text on narrow screens */
.row-card .row-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; align-items: center; margin-left: auto; flex: none; max-width: 100%; }
.stars { color: var(--accent); letter-spacing: 1px; }

/* ---------- forms ---------- */
label { display: block; margin: 0.7rem 0 0.25rem; font-family: var(--sans); font-size: 13px; color: var(--ink-soft); }
input[type="text"], input[type="email"], input[type="url"], input[type="number"],
input[type="date"], select, textarea {
  width: 100%; padding: 0.55rem 0.65rem;
  border: 1px solid var(--line); border-radius: 6px;
  background: #fffdf8; color: var(--ink);
  font-family: var(--serif); font-size: 16px;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
button, .btn {
  font-family: var(--sans); font-size: 15px;
  background: var(--accent); color: var(--accent-ink);
  border: none; border-radius: 6px; padding: 0.55rem 1.1rem; cursor: pointer;
  text-decoration: none; display: inline-block;
}
button.secondary, .btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.danger, .btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
button:disabled { opacity: 0.5; cursor: default; }
.btn-row { display: flex; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }
.hint { font-size: 0.85rem; color: var(--ink-soft); font-family: var(--sans); }

/* ---------- toast ---------- */
.dash-toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1.1rem; border-radius: 20px;
  font-family: var(--sans); font-size: 14px;
  opacity: 0; transition: opacity 0.2s, transform 0.2s;
  pointer-events: none; z-index: 100; max-width: 90vw; text-align: center;
}
.dash-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- sign-in ---------- */
.signin-wrap { max-width: 420px; margin: 12vh auto 0; padding: 0 1rem; text-align: center; }
.signin-wrap h1 { font-size: 2rem; margin-bottom: 0.2rem; }
.signin-wrap h1 span { color: var(--accent); font-style: italic; font-weight: normal; }

/* ---------- stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.7rem; margin: 1rem 0; }
.stat { background: #fffdf8; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem; text-align: center; }
.stat .n { font-size: 1.7rem; font-weight: bold; }
.stat .l { font-size: 0.8rem; color: var(--ink-soft); font-family: var(--sans); }

/* ---------- page editor widget list ---------- */
.widget { border: 1px solid var(--line); border-radius: var(--radius); background: #fffdf8; margin: 0.7rem 0; }
.widget-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.8rem; background: var(--paper-2); border-radius: var(--radius) var(--radius) 0 0; font-family: var(--sans); font-size: 13px; }
.widget-head .grow { flex: 1; font-weight: 600; }
.widget-head button { padding: 0.2rem 0.5rem; font-size: 12px; }
.widget-body { padding: 0.8rem; }

/* ---------- misc ---------- */
.tag { display: inline-block; background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 0.05rem 0.6rem; font-size: 0.82rem; font-family: var(--sans); margin: 0.1rem 0.2rem 0.1rem 0; }
.tag button { background: none; border: none; color: var(--ink-soft); cursor: pointer; padding: 0 0 0 0.3rem; font-size: 0.9rem; }
table.plain { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.plain td, table.plain th { padding: 0.45rem 0.4rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.shelf-chip { display: inline-block; font-size: 0.78rem; font-family: var(--sans); background: var(--paper-2); border: 1px solid var(--line); border-radius: 4px; padding: 0.1rem 0.45rem; color: var(--ink-soft); }
pre.code { background: var(--paper-2); border: 1px solid var(--line); border-radius: 6px; padding: 0.7rem; overflow-x: auto; font-size: 0.85rem; }
.drag-handle { cursor: grab; color: var(--ink-soft); padding: 0 0.3rem; }
.empty { color: var(--ink-soft); font-style: italic; padding: 1.2rem 0; text-align: center; }
@media (max-width: 480px) {
  body { font-size: 16px; }
  .dash-nav { gap: 0.6rem; }
}
