:root {
  --bg: #f5f6f2;
  --surface: #ffffff;
  --ink: #20251f;
  --muted: #657066;
  --line: #dfe5dd;
  --brand: #1f7a4d;
  --brand-dark: #145a39;
  --accent: #c98328;
  --danger: #b73535;
  --shadow: 0 10px 28px rgba(32, 37, 31, .08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: 82px;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  background: rgba(245, 246, 242, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; line-height: 1.1; }
h2 { margin-bottom: 0; font-size: 19px; }
h3 { margin-bottom: 14px; font-size: 18px; }
main { width: min(1040px, 100%); margin: 0 auto; padding: 14px; }
.view { display: none; }
.view.active { display: block; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.summary-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 10px;
  box-shadow: var(--shadow);
}
.summary-grid span { display: block; font-size: 26px; font-weight: 800; }
.summary-grid small { color: var(--muted); font-weight: 700; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 10px; }
.list { display: grid; gap: 10px; }
.item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  box-shadow: var(--shadow);
}
.item h3 { margin: 0 0 5px; font-size: 16px; }
.item p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.35; }
.item .meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: #eef4ee; color: #245339; font-size: 12px; font-weight: 700; }
.timeline .item { border-left: 4px solid var(--brand); }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
.primary { background: var(--brand); color: white; border-radius: 8px; padding: 11px 14px; font-weight: 800; }
.primary:hover { background: var(--brand-dark); }
.small { padding: 8px 11px; }
.icon-btn { width: 42px; height: 42px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-size: 22px; }
.field { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 800; }
.field input, .field select, .field textarea, .search input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 11px;
  font-weight: 500;
}
.field textarea { resize: vertical; }
.compact { margin-bottom: 12px; }
.search { display: block; margin: 10px 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; }
.chips button { flex: 0 0 auto; border-radius: 999px; padding: 8px 12px; background: white; border: 1px solid var(--line); color: var(--muted); font-weight: 800; }
.chips button.active { background: #e6f2ea; color: var(--brand-dark); border-color: #a9d4ba; }
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 6px 8px max(6px, env(safe-area-inset-bottom));
}
.bottom-nav button { display: grid; place-items: center; gap: 2px; min-height: 58px; background: transparent; border-radius: 8px; color: var(--muted); font-size: 19px; }
.bottom-nav button span { font-size: 10px; font-weight: 800; }
.bottom-nav button.active { color: var(--brand); background: #eef6f0; }
menu { display: flex; justify-content: flex-end; gap: 10px; margin: 8px 0 0; padding: 0; }
menu button { border-radius: 8px; padding: 10px 14px; font-weight: 800; background: #edf0ed; color: var(--ink); }
.table-wrap { overflow: auto; background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: #f8faf7; color: var(--muted); }
.empty { color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; padding: 18px; text-align: center; background: rgba(255,255,255,.55); }
@media (min-width: 760px) {
  body { padding-bottom: 0; }
  main { padding: 22px; }
  .topbar { padding-inline: 24px; }
  .bottom-nav { left: 50%; right: auto; bottom: 18px; width: min(620px, calc(100% - 36px)); transform: translateX(-50%); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
  .list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline { grid-template-columns: 1fr; }
}
.hidden { display: none !important; }
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background: linear-gradient(180deg, #eef4ee 0%, #f7f8f4 100%);
}
.auth-panel {
  width: min(430px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}
.auth-panel h1 { margin-bottom: 16px; }
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f5f1;
}
.tabs button {
  min-height: 40px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}
.tabs button.active { background: white; color: var(--brand-dark); box-shadow: 0 2px 8px rgba(32,37,31,.08); }
.auth-form { display: grid; gap: 12px; }
.form-error { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-weight: 800; font-size: 13px; }
.app-shell { min-height: 100vh; }
.top-actions { display: flex; gap: 8px; }
.current-book-band {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}
.selected-item { border-color: #9bc7ad; box-shadow: 0 0 0 2px rgba(31,122,77,.12), var(--shadow); }
.badge.accent { background: #fbefd9; color: #7a4c12; }
.bottom-nav { grid-template-columns: repeat(6, 1fr); }
.inline-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}
.access-item {
  display: grid;
  gap: 12px;
}
.access-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.access-controls select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 8px 10px;
}
.danger {
  background: #f6e8e8;
  color: var(--danger);
  border-radius: 8px;
  font-weight: 800;
}
@media (min-width: 760px) {
  .inline-form { grid-template-columns: 1.4fr .8fr auto; align-items: end; }
  .access-item { grid-template-columns: minmax(0, 1fr) minmax(260px, .45fr); align-items: center; }
}

.document-item {
  display: grid;
  gap: 12px;
}
.document-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.file-field input {
  padding-top: 8px;
}
@media (min-width: 760px) {
  .document-form { grid-template-columns: .8fr .8fr .7fr 1.4fr auto; }
  .document-item { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
}

.page-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.form-actions button, .section-head > button {
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
  background: #edf0ed;
  color: var(--ink);
}
.form-actions .primary {
  background: var(--brand);
  color: white;
}
.form-view {
  padding-bottom: 16px;
}
@media (min-width: 760px) {
  .page-form {
    max-width: 680px;
    margin: 0 auto;
  }
}
