/* Shared tokens and layout, copied from the viewer pages so the app reads as
   the same site. */
:root {
  --ink: #1a1a1a;
  --paper: #fafaf7;
  --ochre: #a8762a;
  --ochre-soft: rgba(168, 118, 42, 0.12);
  --teal: #2a7a8a;
  --teal-soft: rgba(42, 122, 138, 0.18);
  --muted: #888;
  --rule: #e5e5e0;
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}
header { border-bottom: 1px solid var(--rule); padding-bottom: 1rem; margin-bottom: 1.5rem; }
h1 { font-weight: 400; font-size: 1.5rem; margin: 0 0 0.25rem; }
header p { margin: 0; color: var(--muted); font-size: 0.9rem; }
header a { color: var(--ochre); text-decoration: none; border-bottom: 1px solid var(--ochre); }
nav { margin-top: 0.75rem; font-size: 0.85rem; display: flex; gap: 1.25rem; flex-wrap: wrap; }
nav a { color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent; padding-bottom: 1px; }
nav a:hover { color: var(--ochre); }
nav a.active { color: var(--ink); border-bottom-color: var(--ink); }

h2 { font-size: 1rem; font-weight: 500; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 0.85rem; font-weight: 500; margin: 1rem 0 0.5rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

.intro { background: white; border: 1px solid var(--rule); padding: 1rem 1.25rem; border-radius: 4px; font-size: 0.9rem; margin-bottom: 1.5rem; }
.intro p { margin: 0; }
.intro p + p { margin-top: 0.5rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; align-items: center; }
.btn {
  border: 1px solid var(--rule);
  background: white;
  color: var(--ink);
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}
.btn:hover { border-color: var(--ochre); }
.btn.primary { background: var(--ochre); color: white; border-color: var(--ochre); }
.btn.primary:hover { background: #8a6020; border-color: #8a6020; }
.btn.subtle { color: var(--muted); }

input[type="text"], input[type="date"], input[type="time"], input[type="datetime-local"], select {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: white;
  color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--ochre); outline-offset: -1px; border-color: var(--ochre); }
label { font-size: 0.8rem; color: var(--muted); display: block; margin-bottom: 0.25rem; }
/* Reserves a label's box so a self-labelling control still sits on the grid's
   baseline. The zero-width space gives the empty div its line height. */
.label-spacer { font-size: 0.8rem; line-height: 1.5; margin-bottom: 0.25rem; }
.label-spacer::after { content: "\200b"; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; background: white; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
th, td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--rule); }
th { background: #f5f5f0; font-weight: 500; font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
td.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; }
tr:hover td { background: #f9f9f5; }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--rule); margin: 1.25rem 0 1rem; }
.tabs a {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--ochre); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--ochre); }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.75rem 0; }
.chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  background: white;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
  color: var(--ink);
}
.chip .muted { color: var(--muted); }

.card { background: white; border: 1px solid var(--rule); border-radius: 4px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.row-list { display: flex; flex-direction: column; gap: 0; }
.row-item { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; align-items: baseline; padding: 0.6rem 0; border-bottom: 1px solid var(--rule); font-size: 0.9rem; }
.row-item:last-child { border-bottom: none; }
.row-when { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; color: var(--muted); min-width: 12rem; }
.row-what { flex: 1 1 14rem; }
.row-note { font-size: 0.8rem; color: var(--muted); width: 100%; }
.dot-open { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); margin-right: 0.4rem; }
.tag-open { color: var(--teal); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }

.banner { background: var(--ochre-soft); border: 1px solid var(--ochre); border-radius: 4px; padding: 0.75rem 1rem; font-size: 0.85rem; margin-bottom: 1rem; }
.notice { font-size: 0.85rem; color: var(--muted); margin: 0.5rem 0; }
.empty { color: var(--muted); font-style: italic; padding: 2rem; text-align: center; background: white; border: 1px dashed var(--rule); border-radius: 4px; }
footer { margin-top: 2rem; font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 1rem; }
footer a { color: var(--ochre); text-decoration: none; }
.error { color: #a02020; padding: 1rem; background: #fff5f5; border: 1px solid #a02020; border-radius: 4px; margin: 1rem 0; }
details { font-size: 0.85rem; margin-top: 0.75rem; color: var(--muted); }
summary { cursor: pointer; }
code { background: white; padding: 0.05rem 0.35rem; border: 1px solid var(--rule); border-radius: 2px; font-size: 0.85em; }

.pass { color: var(--teal); }
.fail { color: #a02020; font-weight: 600; }

.panel {
  position: fixed; top: 0; right: 0; height: 100%;
  width: min(420px, 92vw);
  background: white; border-left: 1px solid var(--rule);
  transform: translateX(100%); transition: transform 0.22s ease;
  overflow-y: auto; padding: 1.25rem; z-index: 20;
}
.panel.open { transform: translateX(0); }
.backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.15);
  opacity: 0; pointer-events: none; transition: opacity 0.22s ease; z-index: 10;
}
.backdrop.show { opacity: 1; pointer-events: auto; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 0.75rem; }
.suggest { position: relative; }
.suggest-list {
  position: absolute; left: 0; right: 0; top: 100%;
  background: white; border: 1px solid var(--rule); border-radius: 0 0 3px 3px;
  max-height: 16rem; overflow-y: auto; z-index: 30;
  font-size: 0.85rem;
}
.suggest-list div { padding: 0.4rem 0.6rem; cursor: pointer; }
.suggest-list div:hover, .suggest-list div.hi { background: var(--ochre-soft); }
