@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Source+Sans+3:wght@300;400;600&display=swap');

:root {
  --ink:    #1a1a2e;
  --paper:  #f5f0e8;
  --cream:  #ede8dc;
  --rust:   #8b3a2a;
  --gold:   #c9a84c;
  --sage:   #6b8c6b;
  --muted:  #7a7060;
  --border: #ccc5b0;
  --shadow: rgba(26,26,46,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Source Sans 3', sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--rust); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Header ---- */
header {
  background: var(--ink);
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.8rem 2rem;
}
.logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  color: var(--gold) !important;
  text-decoration: none !important;
  white-space: nowrap;
}
.header-nav { display: flex; gap: 1.2rem; flex: 1; }
.header-nav a {
  color: #ccc5b0;
  font-size: 0.9rem;
  text-decoration: none;
}
.header-nav a:hover { color: var(--gold); }
.header-nav a.howto-link {
  margin-left: auto;
  background: var(--rust);
  color: white !important;
  padding: 0.25rem 0.8rem;
  border-radius: 4px;
  font-size: 0.85rem;
}
.book-count {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ---- Layout ---- */
.layout { display: flex; min-height: calc(100vh - 58px); }

/* ---- Sidebar ---- */
aside {
  width: 210px;
  flex-shrink: 0;
  background: var(--cream);
  border-right: 1px solid var(--border);
  padding: 1rem 0.8rem;
  font-size: 0.84rem;
  overflow-y: auto;
}
aside h3 {
  font-family: 'Playfair Display', serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 1rem 0 0.3rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}
aside h3:first-child { margin-top: 0; }
aside a {
  display: block;
  padding: 0.22rem 0.4rem;
  color: var(--ink);
  border-radius: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
aside a small { display: block; font-size: 0.75rem; color: var(--muted); }
aside a:hover, aside a.active {
  background: var(--rust);
  color: white;
  text-decoration: none;
}
aside a.active small { color: rgba(255,255,255,0.7); }
aside a.all-link { font-weight: 600; }

/* ---- Main ---- */
main { flex: 1; padding: 1.5rem 2rem; overflow-x: auto; }

/* ---- Toolbar ---- */
.toolbar {
  display: flex;
  gap: 0.7rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar input[type=text] {
  flex: 1;
  min-width: 180px;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  font-family: inherit;
  font-size: 0.9rem;
}
.toolbar input:focus { outline: none; border-color: var(--rust); box-shadow: 0 0 0 2px rgba(139,58,42,0.12); }
.btn, button[type=submit] {
  padding: 0.45rem 1rem;
  background: var(--rust);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
}
.btn:hover, button[type=submit]:hover { background: #6e2d1e; text-decoration: none; }
.btn.secondary { background: var(--muted); }
.btn.add { background: var(--sage); }

/* ---- Results info ---- */
.results-info { font-size: 0.84rem; color: var(--muted); margin-bottom: 0.8rem; }
.results-info strong { color: var(--ink); }
.search-scope-notice { font-size: 0.84rem; color: var(--muted); margin: 0.3rem 0 0.8rem; }
.search-scope-notice strong { color: var(--ink); }
.search-scope-notice a { color: var(--rust); }

/* ---- Table ---- */
table { width: 100%; border-collapse: collapse; background: white; box-shadow: 0 1px 4px var(--shadow); border-radius: 6px; overflow: hidden; font-size: 0.88rem; }
thead { background: var(--ink); color: var(--gold); }
thead th { padding: 0.6rem 0.8rem; text-align: left; font-family: 'Playfair Display', serif; font-weight: 400; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
tbody tr { border-bottom: 1px solid var(--cream); transition: background 0.12s; }
tbody tr:hover { background: #faf7f2; }
tbody tr:last-child { border-bottom: none; }
td { padding: 0.5rem 0.8rem; vertical-align: top; }
td.title { font-weight: 600; max-width: 260px; }
td.author { color: var(--muted); font-style: italic; }
td.loc { font-size: 0.82rem; color: var(--muted); }
td.shelf { font-size: 0.82rem; color: var(--muted); text-align: center; }
td.note-cell { font-size: 0.78rem; color: var(--muted); font-style: italic; max-width: 160px; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 600;
  background: var(--cream);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.medical    { background: #e8f4e8; color: #2d6a2d; border-color: #b5d9b5; }
.badge.sailing    { background: #e8f0f8; color: #2a4a7a; border-color: #b5cce8; }
.badge.fiction    { background: #f8f0e8; color: #7a4a2a; border-color: #e8d0b5; }
.badge.cookery    { background: #fff3e0; color: #8b5e00; border-color: #f0d080; }
.badge.tefl       { background: #f0e8f8; color: #5a2a7a; border-color: #d0b5e8; }
.badge.music      { background: #fce8f0; color: #7a1a4a; border-color: #e8b5cc; }
.badge.humour     { background: #fffbe0; color: #6b5a00; border-color: #e0d070; }
.badge.poetry     { background: #e8f8f0; color: #1a6a4a; border-color: #b5e8cc; }
.badge.games      { background: #f0f0ff; color: #3a3a8a; border-color: #c0c0f0; }

/* ---- Inline edit ---- */
.edit-row td { background: #fffdf7; padding: 0.4rem 0.8rem; }
.edit-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.edit-form label { display: flex; flex-direction: column; font-size: 0.78rem; color: var(--muted); gap: 0.15rem; }
.edit-form select, .edit-form input[type=text] {
  padding: 0.28rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.85rem;
  background: white;
}
.edit-form button { padding: 0.28rem 0.7rem; background: var(--sage); color: white; border: none; border-radius: 3px; cursor: pointer; font-size: 0.85rem; align-self: flex-end; }
.cancel-btn { background: var(--muted) !important; }
.edit-toggle { background: none; border: none; cursor: pointer; color: var(--border); font-size: 0.9rem; padding: 0; }
.edit-toggle:hover { color: var(--rust); }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 0.3rem; margin-top: 1rem; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 0.3rem 0.6rem; border: 1px solid var(--border); border-radius: 4px; font-size: 0.83rem; color: var(--ink); background: white; text-decoration: none; }
.pagination a:hover { background: var(--cream); }
.pagination span.current { background: var(--rust); color: white; border-color: var(--rust); font-weight: 600; }
.pagination span.ellipsis { border: none; background: none; color: var(--muted); }

/* ---- Bookcases grid ---- */
.page-heading { font-family: 'Playfair Display', serif; font-size: 1.4rem; margin-bottom: 1.2rem; color: var(--ink); }
.bc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.2rem; }
.bc-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px var(--shadow);
  display: flex;
  flex-direction: column;
}
.bc-photo { height: 160px; background: var(--cream); overflow: hidden; }
.bc-photo img { width: 100%; height: 100%; object-fit: cover; }
.bc-no-photo { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--border); }
.bc-no-photo span { font-size: 2.5rem; }
.bc-no-photo p { font-size: 0.8rem; margin-top: 0.4rem; }
.bc-info { padding: 0.9rem; flex: 1; display: flex; flex-direction: column; gap: 0.3rem; }
.bc-info h3 { font-family: 'Playfair Display', serif; font-size: 1rem; }
.bc-info h3 a { color: var(--ink); }
.bc-info h3 a:hover { color: var(--rust); }
.bc-location { font-size: 0.82rem; color: var(--muted); }
.bc-count { font-size: 0.82rem; color: var(--sage); font-weight: 600; }
.bc-notes { font-size: 0.8rem; color: var(--muted); font-style: italic; }
.upload-label { font-size: 0.82rem; color: var(--rust); cursor: pointer; margin-top: auto; padding-top: 0.5rem; }
.upload-label input { display: none; }
.bc-add-card { border-style: dashed; background: #faf8f4; padding: 1.2rem; justify-content: flex-start; }
.bc-add-card h3 { font-family: 'Playfair Display', serif; font-size: 1rem; color: var(--muted); margin-bottom: 0.8rem; }
.add-bc-form { display: flex; flex-direction: column; gap: 0.5rem; }
.add-bc-form input, .add-bc-form textarea {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.88rem;
  background: white;
}
.add-bc-form button { align-self: flex-start; }

/* ---- How-to page ---- */
.howto-page { max-width: 780px; margin: 0 auto; padding: 2rem; }
.howto-title { font-family: 'Playfair Display', serif; font-size: 2rem; margin-bottom: 0.5rem; }
.howto-intro { font-size: 1.05rem; color: var(--muted); margin-bottom: 2rem; border-bottom: 1px solid var(--border); padding-bottom: 1.2rem; }
.howto-steps { display: flex; flex-direction: column; gap: 1.8rem; }
.step { display: flex; gap: 1.2rem; }
.step-num {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--rust);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  margin-top: 0.2rem;
}
.step-body h2 { font-family: 'Playfair Display', serif; font-size: 1.15rem; margin-bottom: 0.5rem; }
.step-body h3 { font-size: 0.92rem; margin: 0.8rem 0 0.3rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.step-body p { margin-bottom: 0.5rem; }
.step-body ul, .step-body ol { padding-left: 1.4rem; margin-bottom: 0.5rem; }
.step-body li { margin-bottom: 0.25rem; }
.step-body code { background: var(--cream); padding: 0.1rem 0.4rem; border-radius: 3px; font-family: monospace; font-size: 0.88rem; }
.tip { background: #f0f7e8; border-left: 3px solid var(--sage); padding: 0.6rem 0.9rem; border-radius: 0 4px 4px 0; font-size: 0.88rem; margin-top: 0.6rem; color: #3a5a3a; }
.prompt-box { position: relative; background: var(--ink); border-radius: 6px; padding: 1rem 1rem 1rem 1.2rem; margin: 0.8rem 0; }
.prompt-box pre { color: #d4cfbf; font-size: 0.82rem; white-space: pre-wrap; line-height: 1.6; font-family: 'Courier New', monospace; }
.copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: var(--rust);
  color: white;
  border: none;
  border-radius: 3px;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
}
.code-block { background: var(--ink); color: #d4cfbf; padding: 0.8rem 1rem; border-radius: 6px; font-family: monospace; font-size: 0.82rem; white-space: pre-wrap; margin: 0.5rem 0; }
.howto-tips { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.howto-tips h2 { font-family: 'Playfair Display', serif; font-size: 1.2rem; margin-bottom: 0.8rem; }
.howto-tips ul { padding-left: 1.4rem; }
.howto-tips li { margin-bottom: 0.4rem; }

/* ---- Footer ---- */
footer { background: var(--cream); border-top: 1px solid var(--border); text-align: center; padding: 0.8rem; font-size: 0.8rem; color: var(--muted); margin-top: 2rem; }
footer a { color: var(--muted); }

/* ── Auth ─────────────────────────────────────────────────── */
.header-right { display:flex; align-items:center; gap:1rem; }
.auth-link { font-size:0.8rem; color:var(--muted); text-decoration:none; }
.auth-link:hover { color:var(--rust); }
.edit-login { opacity:0.35; font-size:1rem; text-decoration:none; cursor:pointer; }
.edit-login:hover { opacity:0.7; }

.login-wrap { display:flex; justify-content:center; align-items:center; min-height:60vh; }
.login-box { background:var(--card); border:1px solid var(--border); border-radius:8px;
             padding:2rem 2.5rem; max-width:380px; width:100%; text-align:center; }
.login-box h2 { margin:0 0 0.5rem; color:var(--ink); }
.login-box p { font-size:0.88rem; color:var(--muted); margin:0 0 1.2rem; }
.login-box input[type=password] { width:100%; padding:0.5rem 0.75rem; border:1px solid var(--border);
  border-radius:4px; font-size:1rem; margin-bottom:0.75rem; box-sizing:border-box; }
.login-box button { background:var(--rust); color:#fff; border:none; padding:0.5rem 1.5rem;
  border-radius:4px; font-size:1rem; cursor:pointer; }
.login-box button:hover { background:var(--rust-dark, #7a2e1e); }
.login-error { color:var(--rust); font-size:0.88rem; margin-bottom:0.75rem; }
.login-box a { color:var(--rust); font-size:0.85rem; }

/* ── How To tabs ──────────────────────────────────────────── */
.install-tabs { display:flex; gap:0.75rem; margin:1.5rem 0 0; flex-wrap:wrap; }
.install-tab { background:var(--card); border:2px solid var(--border); border-radius:8px;
  padding:0.75rem 1.25rem; cursor:pointer; font-size:0.95rem; color:var(--muted);
  text-align:left; transition:border-color 0.15s, color 0.15s; }
.install-tab:hover { border-color:var(--rust); color:var(--ink); }
.install-tab.active { border-color:var(--rust); color:var(--ink); background:var(--bg); }
.tab-sub { display:block; font-size:0.78rem; color:var(--muted); font-weight:normal; margin-top:0.15rem; }
.install-tab.active .tab-sub { color:var(--muted); }
.install-panel { margin-top:0; }
.howto-section-title { margin:2.5rem 0 0.25rem; font-size:1.3rem; color:var(--ink);
  border-top:2px solid var(--border); padding-top:2rem; }

/* ── Sortable column headers ──────────────────────────────── */
.sort-link { color: var(--gold); text-decoration: none; white-space: nowrap; }
.sort-link:hover { color: white; text-decoration: none; }
.sort-ind { font-size: 0.65rem; opacity: 0.8; }
.sort-ind.muted { opacity: 0.3; }

/* ── Responsive — tablet (≤900px) ────────────────────────── */
@media (max-width: 900px) {
  .header-inner { padding: 0.7rem 1rem; gap: 1rem; }
  main { padding: 1rem 1rem; }
  aside { width: 170px; }
  td.title { max-width: 180px; }
  .col-subcat, .col-notes { display: none; }
}

/* ── Responsive — mobile (≤600px) ────────────────────────── */
@media (max-width: 600px) {
  .header-inner { flex-wrap: wrap; gap: 0.5rem; padding: 0.6rem 0.8rem; }
  .logo { font-size: 1.1rem; }
  .header-nav { gap: 0.7rem; }
  .header-nav a { font-size: 0.8rem; }
  .header-nav a.howto-link { padding: 0.2rem 0.5rem; }
  .header-right { margin-left: auto; }
  .book-count { display: none; }

  /* Sidebar collapses to a horizontal scroll strip */
  .layout { flex-direction: column; }
  aside {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
    overflow-x: auto;
    overflow-y: visible;
  }
  aside h3 { display: none; }
  aside a {
    white-space: nowrap;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.78rem;
    background: white;
  }
  aside a small { display: none; }
  aside a.all-link { font-weight: 600; }

  main { padding: 0.8rem; }

  /* Table — hide less useful columns, keep title/author/category */
  .col-subcat, .col-notes, .col-shelf, .col-bc { display: none; }
  td.title { max-width: 55vw; font-size: 0.85rem; }
  td.author { font-size: 0.8rem; }
  .badge { font-size: 0.68rem; }

  /* Toolbar */
  .toolbar { gap: 0.4rem; }
  .toolbar input[type=text] { font-size: 0.85rem; min-width: 120px; }

  /* Bookcases grid — single column */
  .bc-grid { grid-template-columns: 1fr; }

  /* How-to page */
  .howto-page { padding: 1rem; }
  .howto-title { font-size: 1.5rem; }
  .install-tabs { flex-direction: column; }
}

/* ── Sidebar sub-categories ───────────────────────────────── */
.cat-row { display: flex; align-items: center; }
.cat-link { flex: 1; }
.subcat-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.6rem;
  padding: 0.2rem 0.3rem;
  line-height: 1;
  transition: transform 0.15s, color 0.15s;
  flex-shrink: 0;
}
.subcat-toggle:hover { color: var(--rust); }
.subcat-toggle.open { transform: rotate(90deg); color: var(--gold); }
.subcat-list { padding-left: 0.6rem; margin-bottom: 0.2rem; }
.subcat-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.18rem 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-radius: 3px;
  text-decoration: none;
}
.subcat-link:hover, .subcat-link.active {
  background: var(--rust);
  color: white;
  text-decoration: none;
}
.subcat-link small { font-size: 0.7rem; opacity: 0.7; }
.subcat-link.active small { opacity: 0.8; color: rgba(255,255,255,0.8); }

/* ── About page ───────────────────────────────────────────── */
.about-page { max-width: 860px; margin: 0 auto; padding: 2rem; }
.about-hero { text-align: center; padding: 3rem 1rem 2.5rem; border-bottom: 1px solid var(--border); margin-bottom: 3rem; }
.about-hero h1 { font-family: 'Playfair Display', serif; font-size: 2.8rem; color: var(--ink); margin-bottom: 0.5rem; }
.about-tagline { font-size: 1.2rem; color: var(--muted); margin-bottom: 1.5rem; }
.about-hero-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.about-features { display: flex; flex-direction: column; gap: 0; }
.about-feature {
  display: flex;
  gap: 2rem;
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.about-feature-alt { flex-direction: row-reverse; }
.about-feat-icon { font-size: 3rem; flex-shrink: 0; width: 60px; text-align: center; margin-top: 0.3rem; }
.about-feat-body h2 { font-family: 'Playfair Display', serif; font-size: 1.4rem; margin-bottom: 0.6rem; color: var(--ink); }
.about-feat-body p { color: var(--muted); margin-bottom: 0.6rem; line-height: 1.7; }
.about-feat-body p:last-child { margin-bottom: 0; }
.about-feat-body code { background: var(--cream); padding: 0.1rem 0.4rem; border-radius: 3px; font-family: monospace; font-size: 0.88rem; color: var(--ink); }
.about-feat-body a { color: var(--rust); }

.about-categories { padding: 2.5rem 0; border-bottom: 1px solid var(--border); }
.about-categories h2 { font-family: 'Playfair Display', serif; font-size: 1.3rem; margin-bottom: 0.5rem; }
.about-categories p { color: var(--muted); margin-bottom: 1rem; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cat-chip {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.25rem 0.8rem;
  font-size: 0.85rem;
  color: var(--ink);
  text-decoration: none;
}
.cat-chip:hover { background: var(--rust); color: white; border-color: var(--rust); text-decoration: none; }

.about-credits { padding: 2rem 0; text-align: center; font-size: 0.88rem; color: var(--muted); }
.about-credits a { color: var(--rust); }

@media (max-width: 600px) {
  .about-hero h1 { font-size: 2rem; }
  .about-tagline { font-size: 1rem; }
  .about-feature, .about-feature-alt { flex-direction: column; gap: 1rem; }
  .about-feat-icon { width: auto; }
}

/* ── Status badges ────────────────────────────────────────── */
.status-badge { display:inline-block; font-size:0.68rem; padding:0.1rem 0.4rem; border-radius:10px; margin-left:0.4rem; font-weight:600; vertical-align:middle; }
.status-badge.lent   { background:#fff0e0; color:#8b4a00; border:1px solid #e8c080; }
.status-badge.stored { background:#e8eef8; color:#2a3a6a; border:1px solid #b0c0e0; }
.row-lent td.title   { color: var(--muted); }
.row-stored td.title { color: var(--muted); font-style:italic; }
.lent-alert { color:var(--rust); font-weight:600; }

/* ── Toolbar row (search + add button) ───────────────────── */
.toolbar-row { display:flex; align-items:flex-start; gap:0.7rem; margin-bottom:0.5rem; flex-wrap:wrap; }
.toolbar-row .toolbar { margin-bottom:0; flex:1; }

/* ── Flash message ───────────────────────────────────────── */
.flash-success { background:#eaf7ea; border:1px solid #b0d8b0; color:#2a5a2a; border-radius:4px; padding:0.5rem 1rem; margin-bottom:0.8rem; font-size:0.88rem; }

/* ── Expanded edit form grid ─────────────────────────────── */
.edit-form-grid { display:flex; flex-wrap:wrap; gap:0.5rem; align-items:flex-end; margin-bottom:0.5rem; }
.edit-form-grid label { display:flex; flex-direction:column; font-size:0.78rem; color:var(--muted); gap:0.15rem; }
.edit-form-grid select, .edit-form-grid input[type=text], .edit-form-grid input[type=number] {
  padding:0.28rem 0.5rem; border:1px solid var(--border); border-radius:3px;
  font-family:inherit; font-size:0.85rem; background:white;
}
.edit-form-actions { display:flex; gap:0.4rem; align-items:center; }
.delete-btn { background:#c0392b !important; margin-left:auto; }
.delete-btn:hover { background:#922b21 !important; }

/* ── Add book form ───────────────────────────────────────── */
.add-book-wrap { max-width:700px; }
.add-book-form { background:white; border:1px solid var(--border); border-radius:8px; padding:1.5rem; box-shadow:0 1px 4px var(--shadow); }
.form-row { display:flex; gap:1rem; flex-wrap:wrap; margin-bottom:1rem; }
.form-label { display:flex; flex-direction:column; gap:0.3rem; font-size:0.88rem; color:var(--muted); flex:1; min-width:180px; }
.form-label.required::after { content:' *'; color:var(--rust); }
.form-label input, .form-label select, .form-label textarea {
  padding:0.45rem 0.7rem; border:1px solid var(--border); border-radius:4px;
  font-family:inherit; font-size:0.92rem; background:white; color:var(--ink);
}
.form-label input:focus, .form-label select:focus { outline:none; border-color:var(--rust); box-shadow:0 0 0 2px rgba(139,58,42,0.1); }
.form-label small { font-size:0.76rem; color:var(--muted); }
.form-actions { display:flex; gap:0.7rem; align-items:center; margin-top:0.5rem; }
.form-error { background:#fdecea; border:1px solid #f0b0aa; color:#8b1a10; border-radius:4px; padding:0.5rem 1rem; margin-bottom:1rem; font-size:0.88rem; }

@media (max-width:600px) {
  .form-row { flex-direction:column; gap:0.7rem; }
  .toolbar-row { flex-direction:column; }
  .edit-form-grid { flex-direction:column; }
}
