/* Omni reference app. Dark, phone-first, after the old phone web app. */
:root {
  --bg: #000;
  --panel: #1c1c1c;
  --panel-edge: #333;
  --cell: #262626;
  --text: #f2f2f2;
  --note: #c9c9c9;
  --dim: #8f8f8f;
  --dimmer: #6a6a6a;
  --line: #5a5a5a;
  --parents: #17a81a;
  --notes: #f5a31a;
  --children: #e02020;
  --cross: #2f8fe0;
  --web: #9a9a9a;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

#bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 6px 12px;
  background: #101010; border-bottom: 1px solid var(--panel-edge);
}
#bar a { display: inline-flex; padding: 6px; border-radius: 50%; border: 2px solid var(--notes); }
#bar svg { width: 20px; height: 20px; fill: none; stroke: var(--text); stroke-width: 2.4; stroke-linecap: round; }
#status { color: var(--dim); font-size: 14px; }

#page { max-width: 900px; margin: 0 auto; padding-bottom: 80px; }

.title {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; background: var(--panel);
  border-bottom: 3px solid var(--line); margin-bottom: 12px;
}
.title h1 { flex: 1; margin: 0; font-size: 26px; font-weight: 500; line-height: 1.2; overflow-wrap: anywhere; }
.title .type { color: var(--dim); font-size: 14px; max-width: 35%; text-align: right; overflow-wrap: anywhere; padding-top: 6px; }
.title input { flex: 1; font-size: 24px; }
.flag { color: var(--danger); font-size: 14px; padding: 0 16px 8px; }

section { background: var(--panel); margin-bottom: 12px; padding: 12px 16px 16px; }

.head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pill {
  display: inline-flex; align-items: center;
  border: 2px solid var(--line); border-radius: 999px;
  padding: 2px 14px 2px 2px; gap: 8px;
  color: var(--dim); font-weight: 700; font-size: 14px; letter-spacing: .02em; text-transform: uppercase;
}
.pill .ring {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--ring, var(--line)); background: #000; margin: -4px 0 -4px -4px;
}
.head .count { color: var(--dimmer); font-size: 14px; }
.head .spacer { flex: 1; }

button, .button {
  font: inherit; color: var(--text); background: #2e2e2e;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer;
}
button.round { border-radius: 50%; width: 36px; height: 36px; padding: 0; font-size: 20px; line-height: 1; }
button.small { padding: 2px 8px; font-size: 14px; }
button.quiet { background: none; border-color: transparent; color: var(--dim); }
button.primary { background: #3a3120; border-color: var(--notes); }
button:disabled { opacity: .4; cursor: default; }

input, textarea {
  font: inherit; color: var(--text); background: #0d0d0d;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { min-height: 9em; resize: vertical; line-height: 1.45; }

ul.items { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
ul.items li { display: flex; align-items: baseline; gap: 6px; font-size: 20px; min-width: 0; max-width: 100%; }
ul.items li::before { content: "•"; color: var(--dimmer); }
ul.items .kind { color: var(--dimmer); font-size: 13px; }
a.item { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
a.item.gone { color: var(--dim); text-decoration: line-through; }
.empty { color: var(--dimmer); font-size: 15px; }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs button[aria-pressed="true"] { border-color: var(--notes); color: var(--text); }
.tabs button { color: var(--dim); }

.note { border-top: 1px solid var(--panel-edge); padding: 10px 0; }
.note:first-of-type { border-top: 0; }
.note .body { color: var(--note); font-family: Georgia, "Times New Roman", serif; font-size: 19px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.tools { display: flex; gap: 6px; justify-content: flex-end; }
.note .tools { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }
.note .more { color: var(--dimmer); font-size: 14px; }

.placeholder { border: 1px dashed var(--line); border-radius: 8px; padding: 18px; color: var(--dim); text-align: center; font-size: 15px; overflow-wrap: anywhere; }

.details { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 15px; }
.details dt { color: var(--dim); }
.details dd { margin: 0; overflow-wrap: anywhere; color: var(--note); }

.weblink { overflow-wrap: anywhere; color: #8ab4f8; }
iframe.webpage { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-top: 10px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin: 0 -8px; }
.cell { background: var(--cell); padding: 10px; min-height: 90px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.cell a.item { font-size: 18px; padding-right: 26px; }
.cell .notes { color: var(--dim); font-size: 15px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; }
.cell .urls { color: var(--dimmer); font-size: 14px; overflow-wrap: anywhere; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cell .unlink { position: absolute; top: 2px; right: 2px; }

.picker { margin-top: 10px; display: grid; gap: 8px; }
.picker ul { list-style: none; margin: 0; padding: 0; max-height: 40vh; overflow: auto; }
.picker li button { width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--panel-edge); border-radius: 0; padding: 8px 4px; }

.history { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.history li { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--panel-edge); }
.history .when { color: var(--dimmer); min-width: 9.5em; }
.history .what { flex: 1; color: var(--note); }

.search { padding: 16px; display: grid; gap: 12px; }
.search ul { list-style: none; margin: 0; padding: 0; }
.search li { border-top: 1px solid var(--panel-edge); padding: 10px 0; display: flex; gap: 8px; align-items: baseline; }
.search .kind { color: var(--dimmer); font-size: 13px; }

#toast {
  position: fixed; left: 12px; right: 12px; bottom: 14px; z-index: 10;
  max-width: 600px; margin: 0 auto;
  background: #2a2a2a; border: 1px solid var(--notes); border-radius: 10px;
  padding: 10px 12px; display: flex; gap: 12px; align-items: center;
}
#toast[hidden] { display: none; }
#toast.error { border-color: var(--danger); }
#toast span { flex: 1; }

img.icon { width: 1.05em; height: 1.05em; object-fit: contain; vertical-align: -0.15em; margin-right: 0.35em; }
.picture { display: block; max-width: 100%; max-height: 80vh; margin: 0 auto 8px; }
video.picture { width: 100%; background: #000; }
img.picture.paper { background: #fff; box-shadow: 0 0 0 1px var(--line); max-height: 70vh; }
.caption { margin-right: auto; color: var(--dim); font-size: 14px; overflow-wrap: anywhere; }
.thumb-box { position: relative; margin: 0 -10px; }
.thumb-box:empty { display: none; }
img.thumb { display: block; width: 100%; max-height: 240px; object-fit: cover; }
/* A play mark on videos. */
.thumb-box.video::after {
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-35%, -50%);
  border-style: solid; border-width: 14px 0 14px 24px; border-color: transparent transparent transparent rgba(255, 255, 255, .92);
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, .8)); pointer-events: none;
}
.tools.attach { justify-content: flex-start; flex-wrap: wrap; }

/* Dragging a note. touch-action stops the page scrolling under the finger. */
.handle { touch-action: none; cursor: grab; margin-right: auto; color: var(--dim); letter-spacing: 1px; }
.note.dragging { opacity: .45; }
.note.drop-before { box-shadow: 0 -3px 0 var(--notes); }
.note.drop-after { box-shadow: 0 3px 0 var(--notes); }

/* Line-drawn icons take the colour of the text around them. */
svg.glyph { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button.round { display: inline-flex; align-items: center; justify-content: center; }
button.round svg.glyph { width: 20px; height: 20px; }
button.round.on { border-color: var(--text); }

/* The orderings: large icons with a small label beneath. The current one
   is bright white, the others mid-grey. */
.orderings { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 -6px 12px; }
button.ordering {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 68px; padding: 8px 2px 6px; background: none; border: 1px solid transparent; border-radius: 10px;
  color: #7d7d7d;
}
button.ordering svg.glyph { width: 30px; height: 30px; }
button.ordering .label { font-size: 11px; line-height: 1.15; text-align: center; white-space: nowrap; }
button.ordering.current { color: #fff; border-color: var(--line); background: #2b2b2b; }
button.ordering.current .label { font-weight: 600; }
.option { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 14px; margin: -4px 0 12px; }
.option input { width: auto; }

/* The foot of a list that has more to show: discreet, centred. */
.more-foot { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; color: var(--dimmer); font-size: 14px; }
.more-foot:empty { display: none; }
.more-foot button { color: var(--dim); border-color: var(--panel-edge); }

.settings { display: flex; align-items: center; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--panel-edge); color: var(--dim); font-size: 15px; }
.settings input { width: 6em; }

/* Dragging entries of a list to arrange them. */
.grip { touch-action: none; cursor: grab; color: var(--dim); letter-spacing: 1px; padding: 0 6px; }
.cell .grip { position: absolute; right: 4px; bottom: 4px; background: rgba(0, 0, 0, .55); }
.cell.dragging, ul.items li.dragging { opacity: .45; }
.cell.drop-before { box-shadow: -4px 0 0 var(--notes); }
.cell.drop-after { box-shadow: 4px 0 0 var(--notes); }
ul.items li.drop-before { box-shadow: -3px 0 0 var(--notes); }
ul.items li.drop-after { box-shadow: 3px 0 0 var(--notes); }
p.option { margin: -4px 0 12px; }

/* The primary parent, the item's type: first in the list, in a rounded box. */
ul.items li.primary { border: 1.5px solid var(--line); border-radius: 9px; padding: 1px 10px 2px 4px; }
ul.items li.primary::before { content: none; }

/* Signing in, and the list of passkeys and signed-in browsers. */
.signin { max-width: 26em; margin: 8vh auto 0; }
.signin h1 { font-size: 22px; margin: 0 0 18px; }
.orderings.ways { margin-bottom: 18px; }
button.ordering.way { width: 104px; }
button.ordering.way svg.glyph { width: 36px; height: 36px; }
button.ordering.way .label { font-size: 13px; }
.way-detail p { margin: 10px 0; }
.approve { text-align: center; }
/* A QR code must stay dark on light, with its pale border, to be read. */
img.qr { width: 240px; height: 240px; background: #fff; border-radius: 10px; }
.number { font-size: 34px; font-weight: 600; letter-spacing: 3px; text-align: center; margin: 6px 0 14px; font-variant-numeric: tabular-nums; }
.address { font-size: 13px; color: var(--dim); word-break: break-all; user-select: all; }
.code-row { display: flex; gap: 8px; }
input.code { font-size: 22px; letter-spacing: 2px; text-transform: uppercase; }
.warning { color: var(--note); border-left: 3px solid var(--notes); padding-left: 10px; }
.signin .tools { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.settings .spacer { flex: 1; }
.devices .head { margin-top: 22px; }
ul.who-list { list-style: none; margin: 0 0 12px; padding: 0; }
ul.who-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--panel-edge); }
ul.who-list .who { font-weight: 600; }
ul.who-list .kind { color: var(--dim); font-size: 14px; }
ul.who-list .spacer { flex: 1; }
