/* Shared design language across the user's Hono-SSR-JSX projects (see
   do-books/public/style.css, the source of these tokens and component
   patterns): navy/blue on off-white, white cards with a soft shadow,
   uppercase gray-500 microcopy, pill badges for state. */
:root {
  --navy:        #10233f;
  --navy-light:  #1c3a63;
  --ink:         #0a0a0a;
  --blue:        #2f6fed;
  --blue-light:  #eaf1ff;
  --green:       #1f9d55;
  --green-light: #e8f8ee;
  --red:         #d64545;
  --red-light:   #fdecec;
  --red-border:  #f5c2c2;
  --gray-50:     #f7f8fa;
  --gray-100:    #eef0f3;
  --gray-300:    #d3d8e0;
  --gray-500:    #6b7280;
  --gray-700:    #3a4150;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 35, 63, 0.08), 0 8px 24px rgba(16, 35, 63, 0.06);

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--gray-50);
  color: var(--navy);
  font: 400 14px/1.5 var(--sans);
}

h1, h2, h3 { margin: 0; font-weight: 700; }
form { margin: 0; }

.eyebrow {
  font: 700 11px/1 var(--sans);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gray-500);
}
h2.eyebrow {
  font: 700 20px/1.3 var(--sans);
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
}

button, input, select {
  font: inherit; color: inherit;
  border: 1px solid var(--gray-300);
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  height: 38px;
}
textarea {
  font: inherit; color: inherit;
  border: 1px solid var(--gray-300);
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
  resize: vertical;
}
button {
  cursor: pointer; font-weight: 600;
  background: var(--blue); color: #fff; border-color: var(--blue);
  padding: 8px 16px;
  transition: background .15s, opacity .15s;
}
button:hover { background: #2559c9; }
button.ghost { background: #fff; color: var(--navy); border-color: var(--gray-300); }
button.ghost:hover { background: var(--gray-50); }
button.ghost.danger { color: var(--red); border-color: var(--red-border); }
button.ghost.danger:hover { background: var(--red-light); }
button:disabled { opacity: .5; cursor: not-allowed; }
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue);
}
a { color: var(--blue); }

/* ── app chrome ────────────────────────────────────────────────────────── */
header.app-header {
  position: sticky; top: 0; z-index: 20;
  background: #fff;
  border-bottom: 1px solid var(--gray-100);
  padding: 8px 20px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.app-header .logo {
  font: 700 16px/1 var(--sans); letter-spacing: -.02em; color: var(--navy);
  text-decoration: none;
}
.app-header .logo span { color: var(--gray-500); font-weight: 500; }
.app-nav { display: flex; gap: 2px; flex-wrap: wrap; }
.app-nav a {
  font: 600 13px/1 var(--sans); color: var(--gray-700); text-decoration: none;
  padding: 6px 10px; border-radius: 8px;
}
.app-nav a:hover { background: var(--gray-50); }
.app-nav a.active { background: var(--blue-light); color: var(--blue); }
.app-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.menu { position: relative; }
.menu-trigger { display: inline-flex; align-items: center; gap: 4px; }
.menu-caret { font-size: 9px; }
.menu-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 180px; padding: 6px; z-index: 30;
}
.menu-dropdown[hidden] { display: none; }
.menu-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 8px;
  text-decoration: none; color: var(--navy); font: 600 13px/1.3 var(--sans);
  background: none; border: 0; height: auto;
}
.menu-item:hover { background: var(--blue-light); color: var(--blue); }

.app-wrap { max-width: 720px; margin: 0 auto; padding: 24px 20px 48px; display: grid; gap: 20px; }

.flash {
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 4px;
  font-size: 13px; font-weight: 600;
}
.flash.ok { background: var(--green-light); color: var(--green); }
.flash.err { background: var(--red-light); color: var(--red); }
.flash.info { background: var(--blue-light); color: var(--blue); }

.back-link { font-size: 13px; color: var(--gray-500); text-decoration: none; }
.back-link:hover { color: var(--blue); }

.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--gray-100);
}
.card > .body { padding: 20px; }
.stack { display: grid; gap: 20px; }

label { display: block; margin-bottom: 12px; }
[hidden] { display: none !important; }
label .eyebrow { display: block; margin-bottom: 6px; }
label input, label select { width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  font: 700 11px/1 var(--sans); letter-spacing: .04em; text-transform: uppercase;
  color: var(--gray-500); text-align: left;
  padding: 0 8px 8px; border-bottom: 1px solid var(--gray-300);
}
td { padding: 8px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; color: var(--navy-light); }
tbody tr:last-child td { border-bottom: 0; }

/* A list row that links through to a detail page — the <a> only covers its
   own cell's text, so app.js makes the whole row clickable too (falling back
   to the row href for any click that doesn't land on a real interactive
   element), while these per-cell anchors keep normal link behavior. */
tr.drillable { cursor: pointer; }
tr.drillable:hover td { background: var(--blue-light); }
a.row-link { display: block; color: inherit; text-decoration: none; }

.tag {
  display: inline-block;
  font: 700 10px/1 var(--sans); letter-spacing: .03em; text-transform: uppercase;
  background: var(--blue-light); color: var(--blue);
  border-radius: 999px; padding: 4px 8px;
}
.tag.ok { background: var(--green-light); color: var(--green); }
.tag.err { background: var(--red-light); color: var(--red); }
.tag.muted { background: var(--gray-100); color: var(--gray-500); }

/* ── entity detail header — a record's identity block, reused wherever a
   card's whole point is one named thing (an account, a contact). */
.entity-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.entity-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.entity-name { font: 700 20px/1.3 var(--sans); color: var(--ink); margin: 0; }
.entity-header-side { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.contact-subtitle { font: 500 14px/1.4 var(--sans); color: var(--gray-500); margin: 4px 0 0; }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--gray-100); flex-shrink: 0; }
.contact-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--gray-100); }
.section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 32px; }
.field-row { display: flex; gap: 12px; padding: 3px 0; align-items: baseline; }
.field-row .k { flex: 0 0 110px; font: 700 11px/1 var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--gray-500); }
.field-row .v { color: var(--navy); }

.empty { color: var(--gray-500); font-size: 13px; padding: 6px 0; }
.spread { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread .push, .head .push { margin-left: auto; }

/* A plain <a> or <form method="post"> wrapping a single <button> purely for
   its href/action still has a real box, which throws off alignment next to
   a bare <button> in the same flex row — display:contents drops it. */
.btn-link { display: contents; }

.code-block {
  background: var(--gray-50); border: 1px solid var(--gray-100); border-radius: 8px;
  padding: 12px 14px; font: 500 14px/1.4 var(--mono); word-break: break-all;
}

/* ── landing page ──────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 32px 0 8px; }
.hero h1 { font: 700 32px/1.2 var(--sans); color: var(--ink); margin: 0 0 12px; letter-spacing: -.01em; }
.hero .subhead { font-size: 16px; color: var(--gray-700); max-width: 460px; margin: 0 auto 24px; line-height: 1.5; }
.hero .cta { display: flex; gap: 10px; justify-content: center; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 8px; }
.feature-grid h3 { font-size: 14px; margin: 0 0 6px; }
.feature-grid p { margin: 0; font-size: 13px; color: var(--gray-500); }
@media (max-width: 640px) {
  .feature-grid { grid-template-columns: 1fr; }
}

/* Repeatable field group (a contact's emails/phones/addresses — arbitrarily
   many, unlike every other single-value form field) — see contactForm.js for
   the add/remove behavior each row wires up to. */
.repeat-group { margin-bottom: 16px; }
.repeat-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.repeat-row input { margin: 0; }
.repeat-label { flex: 0 0 100px; }
.repeat-row input:not(.repeat-label) { flex: 1 1 auto; }
.repeat-remove {
  flex: 0 0 auto; width: 38px; padding: 0; font-weight: 400;
  color: var(--gray-500); background: #fff; border-color: var(--gray-300);
}
.repeat-remove:hover { color: var(--red); background: var(--red-light); border-color: var(--red-border); }
