/* Shared styling for the itinerary's companion pages (sections, finances).
   Same Arial / navy / zebra vocabulary as index.html. */

:root {
  --navy: #1f3864;
  --line: #c9d3e0;
  --band: #eaf0f8;
  --rest: #fcefe3;
  --link: #0563c1;
  --err:  #b00020;
}

* { box-sizing: border-box; }
body {
  font-family: Arial, Helvetica, sans-serif;
  color: #1a1a1a;
  margin: 24px;
  font-size: 13px;
  max-width: 1100px;
}
h1 { color: var(--navy); font-size: 20px; margin: 0 0 4px; }
h2 { color: var(--navy); font-size: 16px; margin: 22px 0 6px; }
a { color: var(--link); }
.crumbs { margin: 0 0 10px; }
.sub { margin: 0 0 14px; color: #555; }
.err { color: var(--err); font-weight: bold; }
.muted { color: #777; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid var(--line); padding: 6px 8px; vertical-align: top; text-align: left; }
th { background: var(--navy); color: #fff; }
tbody tr:nth-child(even) { background: var(--band); }
td.num, th.num { text-align: right; white-space: nowrap; }

button, .btn {
  font: 12px Arial, Helvetica, sans-serif;
  padding: 5px 12px;
  border: 1px solid var(--navy);
  border-radius: 3px;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.ghost, .btn.ghost { background: #fff; color: var(--navy); }
button.danger, .btn.danger { background: #fff; color: var(--err); border-color: var(--err); }
button[disabled] { opacity: 0.5; cursor: default; }

input[type="text"], input[type="number"], input[type="date"], select, textarea {
  font: 13px Arial, Helvetica, sans-serif;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: #1a1a1a;
}
label { font-weight: bold; display: block; margin-bottom: 3px; }
.field { margin-bottom: 12px; }
/* Top-aligned, so the labels line up across the row. Bottom-aligning looked
   fine until a field grew a hint under its input and dragged its label out
   of line with the others. */
.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.row .field { margin-bottom: 0; }
.actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.actions .spacer { margin-left: auto; }

/* ------------------------------------------------------------ sections -- */

.seclist { list-style: none; padding: 0; margin: 0; }
.seclist li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.seclist .when { color: #888; font-size: 11px; }

.section-body { line-height: 1.6; font-size: 14px; }
.section-body img { max-width: 100%; height: auto; border-radius: 3px; }
.section-body pre {
  background: #f1f3f6; padding: 8px 10px; border-radius: 4px;
  overflow-x: auto; font-size: 12px;
}
.section-body code { background: #f1f3f6; padding: 0 3px; border-radius: 3px; }
.section-body pre code { background: none; padding: 0; }
.section-body blockquote {
  margin: 0 0 0.8em; padding-left: 12px;
  border-left: 3px solid var(--line); color: #444;
}
.section-body table { width: auto; }

/* Rich-text editor, lifted from the blog's post editor. */
.text-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; gap: 12px; }
.text-head label { margin: 0; }
.fmt-switch { font-weight: normal; font-size: 13px; color: #555; white-space: nowrap; }
.rich-toolbar {
  display: flex; align-items: center; gap: 1px;
  padding: 4px 6px;
  border: 1px solid #ddd; border-bottom: none; border-radius: 6px 6px 0 0;
  background: #f7f7f7; overflow-x: auto;
}
.rich-toolbar button {
  flex: 0 0 auto; width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: none; background: transparent; border-radius: 4px;
  color: #444; cursor: pointer;
}
.rich-toolbar button:hover { background: #e6e6e6; }
.rich-toolbar button:disabled { opacity: 0.35; cursor: default; }
.rich-toolbar button:disabled:hover { background: transparent; }
.rich-toolbar button svg { width: 20px; height: 20px; fill: currentColor; display: block; }
.rt-sep { flex: 0 0 auto; width: 1px; height: 22px; background: #d5d5d5; margin: 0 5px; }
@media (pointer: coarse), (max-width: 700px) {
  .rich-toolbar { gap: 2px; padding: 5px 6px; }
  .rich-toolbar button { width: 40px; height: 40px; }
  .rich-toolbar button svg { width: 24px; height: 24px; }
}
.rich-editor {
  min-height: 380px; padding: 12px;
  border: 1px solid #ddd; border-radius: 0 0 4px 4px;
  font-size: 14px; line-height: 1.6; background: #fff; overflow-y: auto;
}
.rich-editor:focus { outline: none; border-color: #3498db; }
.rich-editor:empty:before { content: attr(data-placeholder); color: #aaa; }
.rich-editor img { max-width: 100%; height: auto; }
.rich-editor p { margin: 0 0 0.8em; }
.rich-editor ul, .rich-editor ol { margin: 0 0 0.8em; padding-left: 1.6em; }
.rich-editor pre { background: #f1f3f6; padding: 8px 10px; border-radius: 4px; }
textarea#body {
  width: 100%; min-height: 380px;
  font: 13px/1.5 Menlo, Consolas, "DejaVu Sans Mono", monospace;
  padding: 10px; border: 1px solid #ddd; border-radius: 4px; resize: vertical;
}
.editor-status { font-size: 12px; color: #777; font-style: italic; }
.editor-status.err { color: var(--err); font-style: normal; }
.drop-hint { font-size: 11px; color: #888; margin-top: 4px; }

/* ------------------------------------------------------------ finances -- */

.people { display: flex; flex-wrap: wrap; gap: 6px; }
.people label {
  font-weight: normal; display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; cursor: pointer; user-select: none; margin: 0;
}
.people label:hover { border-color: var(--navy); }
.people input { margin: 0; }
.people label:has(input:checked) { background: var(--navy); color: #fff; border-color: var(--navy); }
.people .allnone { align-self: center; }

.pos { color: #1b7a2f; }
.neg { color: var(--err); }
.zero { color: #777; }
.balances td { font-size: 14px; }
.balances td.who { font-weight: bold; }
.settle { margin-top: 6px; color: #555; }
table.households { width: auto; min-width: 320px; }

/* The booze rule: a per-row "this was a dinner" box and one toggle for
   whether the rule applies at all. With it off the boxes are still there,
   just visibly not counting for anything. */
.listhead { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.listhead h2 { margin-right: 2px; }
.boozetoggle {
  font-weight: normal; font-size: 12px; color: #555;
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; user-select: none; margin: 0;
}
td.dinnercol, th.dinnercol { text-align: center; }
td.dinnercol input { cursor: pointer; }
table.nobooze td.dinnercol { opacity: 0.35; }
table.nobooze th.dinnercol { text-decoration: line-through; }

/* The row currently loaded into the form, and the per-row buttons. */
tr.beingedited > td { background: #fff6da; }
td.rowacts { white-space: nowrap; }
td.rowacts .btn { padding: 3px 8px; margin-right: 4px; }
form.expense.editing {
  background: #fffdf5; border: 1px solid var(--line);
  border-radius: 4px; padding: 12px; margin-bottom: 4px;
}
.expense-who { font-size: 11px; color: #666; }
.conv { font-size: 10px; color: #888; font-weight: normal; }

/* Sortable headers. The caret is always there in outline so the column
   width doesn't jump when the sort moves. */
table.sortable th[data-col] { cursor: pointer; user-select: none; white-space: nowrap; }
table.sortable th[data-col]:hover { background: #2a4a80; }
table.sortable th[data-col]:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
table.sortable th[data-col]::after { content: " \2195"; opacity: 0.35; }
table.sortable th[aria-sort="ascending"]::after { content: " \25B2"; opacity: 1; font-size: 9px; }
table.sortable th[aria-sort="descending"]::after { content: " \25BC"; opacity: 1; font-size: 9px; }
.field .hint { font-size: 11px; color: #777; font-weight: normal; margin-top: 3px; }

@media print {
  .crumbs, .actions, form.expense, .rich-toolbar, button, .btn { display: none !important; }
}
