/* The new Falkor Admin. Plain CSS, no build step. See docs/ADMIN-UI.md. */
:root {
  --accent: #4338ca;
  --accent-dark: #2e27a0;
  --accent-soft: #e4e3fc;
  --text: #1b1d29;
  --muted: #4a4f66;
  --line: #dde0ec;
  --line-soft: #e8eaf3;
  --soft: #f1f2fb;
  --page: #ffffff;
  --ok-bg: #e5f4ea;
  --ok: #0d5c32;
  --warn-bg: #fff3df;
  --warn: #7a4200;
  --bar-height: 68px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 15px/1.5 Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
}
h1, h2, p { margin: 0; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.aui-main:focus { outline: none; }
.aui-icon {
  width: 22px; height: 22px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.aui-skip { position: absolute; left: 12px; top: -80px; z-index: 40; background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 10px; }
.aui-skip:focus { top: 12px; color: #fff; }

/* Top bar */
.aui-top { display: flex; align-items: center; gap: 12px; padding: 10px 24px; border-bottom: 1px solid var(--line); }
.aui-brand { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 19px; font-weight: 600; text-decoration: none; color: var(--text); white-space: nowrap; }
.aui-brand:hover { color: var(--text); }
.aui-site { font-size: 13px; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 4px 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aui-search { position: relative; flex: 1 1 200px; max-width: 580px; margin: 0 auto; display: flex; align-items: center; gap: 10px; background: var(--soft); border-radius: 999px; padding: 0 18px; height: 46px; color: var(--muted); }
.aui-search:focus-within { outline: 3px solid var(--accent); outline-offset: 1px; }
.aui-search input[type="search"] { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--text); outline: none; }
.aui-results { position: absolute; top: 52px; left: 0; right: 0; z-index: 30; margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 32px rgba(20, 22, 38, .16); max-height: 60vh; overflow-y: auto; }
.aui-results[hidden] { display: none; }
.aui-results a { display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: 44px; padding: 6px 14px; border-radius: 12px; text-decoration: none; color: var(--text); font-weight: 600; }
.aui-results a span { font-weight: 400; font-size: 13px; color: var(--muted); text-align: right; }
.aui-results a:hover, .aui-results a:focus { background: var(--soft); }
.aui-results .aui-none { padding: 10px 14px; color: var(--muted); }

.aui-pop { position: relative; }
.aui-pop summary { list-style: none; cursor: pointer; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 999px; color: var(--muted); }
.aui-pop summary::-webkit-details-marker { display: none; }
.aui-pop summary:hover { background: var(--soft); }
.aui-apps summary .aui-icon { stroke-width: 3.6; }
.aui-avatar { width: 38px; height: 38px; border-radius: 999px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.aui-pop-body { position: absolute; right: 0; top: 50px; z-index: 30; min-width: 230px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 32px rgba(20, 22, 38, .16); padding: 8px; display: flex; flex-direction: column; }
.aui-pop-body a { display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 12px; text-decoration: none; color: var(--text); }
.aui-pop-body a:hover { background: var(--soft); }
.aui-who { display: flex; flex-direction: column; padding: 8px 14px 12px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; overflow-wrap: anywhere; }
.aui-who span { font-size: 13px; color: var(--muted); }

/* Frame */
.aui-body { display: flex; align-items: flex-start; }
.aui-rail { width: 264px; flex-shrink: 0; padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; }
.aui-rail a { display: flex; align-items: center; gap: 14px; min-height: 46px; padding: 0 18px; border-radius: 999px; text-decoration: none; color: var(--text); font-weight: 500; }
.aui-rail a:hover { background: var(--soft); }
.aui-rail a[aria-current="page"] { background: var(--accent-soft); font-weight: 700; }
.aui-main { flex: 1; min-width: 0; padding: 32px 24px 64px; }
.aui-column { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.aui-head { text-align: center; }
.aui-head h1 { font-size: 30px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.aui-head p { margin-top: 6px; color: var(--muted); }

/* Cards and rows */
.aui-card { border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.aui-card-head { padding: 20px 24px 14px; }
.aui-card-head h2 { font-size: 19px; font-weight: 600; }
.aui-card-head p { color: var(--muted); }
.aui-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 16px; align-items: center; min-height: 60px; padding: 12px 24px; border-top: 1px solid var(--line-soft); color: var(--text); text-decoration: none; scroll-margin-top: 16px; }
a.aui-row:hover { background: #f8f8fe; color: var(--text); }
.aui-row:target { background: var(--accent-soft); }
.aui-row > strong { font-weight: 600; overflow-wrap: anywhere; }
.aui-value { display: flex; align-items: center; gap: 8px; color: var(--muted); overflow-wrap: anywhere; }
.aui-value > span { min-width: 0; }
.aui-chip, .aui-swatch, .aui-logo { flex-shrink: 0; }
/* A fixed width keeps the value column in line from card to card. */
.aui-action { color: var(--accent); font-weight: 600; min-width: 132px; text-align: right; }
.aui-todo { grid-template-columns: minmax(0, 1fr) auto; }
.aui-todo strong, .aui-todo .aui-muted { display: block; }
.aui-muted { color: var(--muted); }
.aui-chip { display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 700; background: var(--soft); color: var(--muted); }
.aui-chip.ok { background: var(--ok-bg); color: var(--ok); }
.aui-chip.warn { background: var(--warn-bg); color: var(--warn); }
.aui-swatch { width: 26px; height: 26px; border-radius: 999px; border: 1px solid rgba(0, 0, 0, .18); }
.aui-logo { height: 32px; max-width: 120px; object-fit: contain; background: var(--soft); border-radius: 6px; padding: 2px; }
.aui-checkup.needs .aui-card-head { background: var(--warn-bg); padding-bottom: 18px; }
.aui-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.aui-tile { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px; text-decoration: none; color: var(--text); }
.aui-tile .aui-icon { color: var(--accent); width: 28px; height: 28px; }
.aui-tile strong { font-size: 17px; font-weight: 600; }
a.aui-tile:hover { background: #f8f8fe; color: var(--text); }
.aui-empty { text-align: center; color: var(--muted); }

/* Edit screens */
.aui-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; text-decoration: none; font-weight: 600; }
.aui-flash { padding: 14px 18px; border-radius: 14px; background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.aui-alert { padding: 14px 18px; border-radius: 14px; background: #fdeeee; color: #8f1d1d; }
.aui-form { padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.aui-field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.aui-field > label, .aui-field > legend { font-weight: 600; padding: 0; }
.aui-field > legend { margin-bottom: 6px; }
.aui-field input:not([type="checkbox"]), .aui-field select, .aui-field textarea {
  width: 100%; min-height: 48px; border: 1px solid #767b91; border-radius: 12px; padding: 10px 14px;
  font: inherit; font-size: 16px; color: var(--text); background: #fff;
}
.aui-field textarea { resize: vertical; }
.aui-field [aria-invalid="true"] { border: 2px solid #b3261e; }
.aui-help { font-size: 13px; color: var(--muted); }
.aui-error { font-size: 13px; font-weight: 600; color: #8f1d1d; }
.aui-check { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; overflow-wrap: anywhere; }
.aui-check input { width: 22px; height: 22px; flex-shrink: 0; margin: 0; accent-color: var(--accent); cursor: pointer; }
.aui-switch { font-weight: 600; justify-content: space-between; flex-direction: row-reverse; }
.aui-switch input { appearance: none; -webkit-appearance: none; width: 52px; height: 30px; border-radius: 999px; background: #767b91; position: relative; }
.aui-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 999px; background: #fff; transition: left .15s; }
.aui-switch input:checked { background: var(--accent); }
.aui-switch input:checked::after { left: 25px; }
.aui-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border-top: 1px solid var(--line-soft); padding-top: 18px; }
.aui-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 24px; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.aui-btn:hover { background: var(--accent-dark); color: #fff; }
.aui-btn.quiet { background: transparent; border-color: var(--line); color: var(--accent); }
.aui-btn.quiet:hover { background: var(--soft); color: var(--accent-dark); }
.aui-reset { margin-left: auto; }

.aui-legend { font-weight: 600; }
.aui-qr { align-self: center; width: 100%; max-width: 240px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.aui-qr svg { display: block; width: 100%; height: auto; }
.aui-key { font: 600 16px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--soft); border-radius: 12px; padding: 12px 14px; overflow-wrap: anywhere; }
.aui-codes ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 0; padding: 0 24px 22px; list-style: none; }
.aui-codes.one ul { grid-template-columns: minmax(0, 1fr); }
.aui-codes code { overflow-wrap: anywhere; }
.aui-codes code { display: block; text-align: center; font: 600 16px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--soft); border-radius: 10px; padding: 10px; }
.aui-signin { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.aui-signin .aui-column { width: 100%; max-width: 440px; }

.aui-field input[type="file"] { min-height: 48px; padding: 10px; border: 1px dashed #767b91; }
.aui-picture { max-width: 100%; max-height: 120px; object-fit: contain; align-self: flex-start; background: var(--soft); border-radius: 12px; padding: 10px; }
.aui-list { margin: 0; padding: 0; list-style: none; }
.aui-list li { padding: 6px 0; border-top: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.aui-history article { border-top: 1px solid var(--line-soft); padding: 12px 0; }
.aui-history h3 { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.aui-history blockquote { margin: 8px 0 0; padding: 10px 14px; background: var(--soft); border-radius: 12px; }
.aui-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.aui-item { border-top: 1px solid var(--line-soft); padding-top: 14px; }
.aui-item legend { font-weight: 600; float: left; width: 100%; }
.aui-item legend + * { clear: both; }
.aui-item summary { cursor: pointer; color: var(--accent); font-size: 13px; min-height: 32px; display: flex; align-items: center; }
.aui-item-inputs { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 2fr); gap: 8px; }

/* Menu: a grid of every section, never a scrolling strip */
.aui-menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.aui-menu-grid a { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 6px 12px; border-radius: 16px; background: #f6f7fc; text-decoration: none; color: var(--text); font-weight: 600; line-height: 1.25; }
.aui-menu-grid a .aui-icon { color: var(--accent); }
.aui-menu-grid a[aria-current="page"] { background: var(--accent-soft); }
.aui-menu-apps { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.aui-menu-apps a { flex: 1 1 130px; display: flex; align-items: center; justify-content: center; min-height: 46px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-weight: 600; }

.aui-bar { display: none; }
.aui-sheet { border: 0; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); width: 100%; max-width: 560px; max-height: 100%; margin: auto auto 0; border-radius: 24px 24px 0 0; color: var(--text); background: #fff; }
.aui-sheet[open] { display: flex; flex-direction: column; gap: 12px; }
.aui-sheet::backdrop { background: rgba(20, 22, 38, .45); }
.aui-sheet-head { display: flex; align-items: center; justify-content: space-between; }
.aui-sheet-head h2 { font-size: 18px; }
.aui-close { width: 44px; height: 44px; border: 0; border-radius: 999px; background: var(--soft); color: var(--text); display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* Phones and small tablets: bottom bar instead of the side menu */
@media (max-width: 899px) {
  .aui-top { flex-wrap: wrap; padding: 8px 16px 12px; gap: 8px; }
  .aui-brand { flex: 1; font-size: 18px; }
  .aui-site, .aui-apps { display: none; }
  .aui-search { order: 3; flex-basis: 100%; max-width: none; }
  .aui-rail { display: none; }
  .aui-main { padding: 20px 16px calc(var(--bar-height) + 32px + env(safe-area-inset-bottom)); }
  .aui-head h1 { font-size: 24px; }
  .aui-card { border-radius: 18px; }
  .aui-card-head { padding: 16px 16px 12px; }
  .aui-row { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 16px; }
  .aui-row > strong { grid-column: 1; }
  .aui-value { grid-column: 1; }
  .aui-action { min-width: 52px; max-width: 96px; }
  .aui-row > .aui-action { grid-column: 2; grid-row: 1 / span 2; }
  .aui-todo > span:first-child { grid-column: 1; }
  .aui-todo > .aui-action { grid-row: 1; }
  .aui-form { padding: 16px; gap: 16px; }
  .aui-item-inputs { grid-template-columns: minmax(0, 1fr); }
  .aui-buttons .aui-btn { flex: 1 1 140px; }
  .aui-reset { margin-left: 0; flex-basis: 100%; }
  .aui-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .aui-tile { padding: 14px; border-radius: 18px; }
  .aui-tile strong { font-size: 15px; line-height: 1.25; }
  .aui-tile .aui-muted { font-size: 13px; line-height: 1.35; }
  .aui-bar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line); padding: 4px 4px env(safe-area-inset-bottom); }
  .aui-bar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: calc(var(--bar-height) - 8px); font-size: 12px; font-weight: 600; text-decoration: none; color: var(--muted); }
  .aui-pill { display: flex; justify-content: center; width: 52px; padding: 3px 0; border-radius: 999px; }
  .aui-bar a[aria-current="page"], .aui-bar a.is-current { color: var(--accent); }
  .aui-bar a[aria-current="page"] .aui-pill, .aui-bar a.is-current .aui-pill { background: var(--accent-soft); }
}
@media (max-width: 359px) {
  .aui-grid { grid-template-columns: minmax(0, 1fr); }
}
/* Short screens (phone held sideways): keep the whole menu on screen */
@media (max-height: 520px) {
  .aui-sheet .aui-menu-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .aui-sheet .aui-menu-grid a { min-height: 48px; font-size: 13px; }
}

/* ── Falkor Hub additions ─────────────────────────────────────────── */
.hub-column { max-width: 940px; }
.aui-chip.bad { background: #fdeeee; color: #8f1d1d; }
.hub-count { margin-left: auto; min-width: 24px; text-align: center; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; padding: 1px 7px; }
.hub-needs > .aui-card-head { background: var(--warn-bg); }
.hub-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.hub-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hub-actions .aui-btn, .hub-bar .aui-btn { min-height: 44px; }
.hub-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.hub-empty { margin: 0; padding: 16px 24px 20px; color: var(--muted); border-top: 1px solid var(--line-soft); }
.hub-center { text-align: center; display: flex; justify-content: center; }
.hub-legend { margin: 8px 0 -4px; font-size: 16px; }
.hub-sub { margin: 6px 0 -6px; font-size: 19px; text-align: center; }
.hub-inline { padding: 14px 24px 18px; border-top: 1px solid var(--line-soft); margin: 0; }
.hub-danger { color: #8f1d1d !important; border-color: #e5b4b4 !important; }
button.aui-btn.hub-danger:not(.quiet) { background: #8f1d1d; border-color: #8f1d1d !important; color: #fff !important; }
.hub-delete summary { cursor: pointer; padding: 16px 24px; color: #8f1d1d; font-weight: 600; min-height: 44px; }
.hub-delete .aui-form { border-top: 1px solid var(--line-soft); }
.aui-pop-body form { margin: 0; }
.aui-pop-body button { display: flex; width: 100%; align-items: center; min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: transparent; font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.aui-pop-body button:hover { background: var(--soft); }
.aui-signin .aui-head svg { margin-bottom: 10px; }

/* Rows that hold a small form */
.hub-pick { margin: 0; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) auto; }
.hub-pick select { width: 100%; min-height: 44px; border: 1px solid #767b91; border-radius: 12px; padding: 6px 10px; font: inherit; font-size: 16px; background: #fff; color: var(--text); }
.hub-task strong, .hub-task .aui-muted { display: block; overflow-wrap: anywhere; }
.hub-task strong a { color: inherit; }
.hub-task.is-done strong { text-decoration: line-through; color: var(--muted); }
.hub-person { border-top: 1px solid var(--line-soft); }
.hub-person summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 24px; cursor: pointer; min-height: 60px; }
.hub-person summary strong, .hub-person summary .aui-muted { display: block; overflow-wrap: anywhere; }
.hub-person .aui-form { background: #fafaff; border-top: 1px solid var(--line-soft); }

/* Tables: rows become cards on phones, so nothing scrolls sideways */
.hub-scroll { overflow-x: auto; }
.hub-table { width: 100%; border-collapse: collapse; }
.hub-table th, .hub-table td { text-align: left; padding: 12px 12px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.hub-table th:first-child, .hub-table td:first-child { padding-left: 24px; }
.hub-table thead th { font-size: 13px; color: var(--muted); font-weight: 700; }
.hub-table tbody th { font-weight: 600; }
.hub-table tbody th a { display: inline-flex; align-items: center; min-height: 36px; }

/* The visitor chart: one series in the accent color; text stays in text colors */
.hub-chart { margin: 0; padding: 4px 20px 16px; }
.hub-chart svg { display: block; width: 100%; height: auto; }
.hub-chart .grid { stroke: #ececf4; stroke-width: 1; }
.hub-chart .base { stroke: #b9bccd; stroke-width: 1; }
.hub-chart .tick { fill: var(--muted); font: 12px Figtree, system-ui, sans-serif; }
.hub-chart .hit { fill: transparent; }
.hub-chart .mark { fill: var(--accent); }
.hub-chart .day:hover .hit, .hub-chart .day:focus .hit { fill: rgba(67, 56, 202, .08); }
.hub-chart .day:hover .mark, .hub-chart .day:focus .mark { fill: var(--accent-dark); }
.hub-chart .day:focus { outline: none; }
.hub-chart .day:focus-visible .hit { stroke: var(--accent); stroke-width: 2; }
.hub-tip { min-height: 22px; margin: 4px 0; text-align: center; font-weight: 600; }
.hub-chart summary { cursor: pointer; color: var(--accent); min-height: 36px; display: flex; align-items: center; }
.hub-chart .hub-scroll { max-height: 320px; overflow-y: auto; }

@media (max-width: 899px) {
  .hub-count { display: none; }
  .hub-card-head { padding-bottom: 12px; }
  .hub-empty, .hub-inline { padding-left: 16px; padding-right: 16px; }
  .hub-pick { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .hub-pick > .aui-btn { justify-self: start; }
  .hub-person summary, .hub-delete summary { padding-left: 16px; padding-right: 16px; }
  .hub-chart { padding-left: 8px; padding-right: 8px; }
  .hub-chart .tick { font-size: 20px; }
  /* Column names stay for screen readers; each cell shows its own label. */
  .hub-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .hub-cards, .hub-cards tbody, .hub-cards tr, .hub-cards th, .hub-cards td { display: block; width: 100%; }
  .hub-cards tr { border-top: 1px solid var(--line-soft); padding: 8px 16px 12px; }
  .hub-cards th, .hub-cards td { border: 0; padding: 3px 0; }
  .hub-cards th:first-child, .hub-cards td:first-child { padding-left: 0; }
  .hub-cards td { display: flex; justify-content: space-between; gap: 12px; }
  .hub-cards td::before { content: attr(data-label); color: var(--muted); }
}
