/* The hub's additions to the AIEC base in app.css (ARCHITECTURE.md section 10). */

/* ---- consent: which agent ---- */
fieldset { margin: 12px 0; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
legend { padding: 0 6px; font-size: 0.9rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; margin: 6px 0; color: var(--text); font-size: 1rem; }
input[type="radio"], input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--aiec-gray); }

/* ---- web app ---- */
:root {
  --ok-bg: #e6f4ea; --ok-text: #1e6b34;
  --wait-bg: #fdf3c8; --wait-text: #6b5300;
  --info-bg: #e8eefc; --info-text: #1f3f8a;
  --off-bg: #ececee; --off-text: #5d5f64;
  --nav-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ok-bg: #1c3324; --ok-text: #9ad7ab;
    --wait-bg: #3a3215; --wait-text: #f3d85e;
    --info-bg: #1c2740; --info-text: #a9c0f5;
    --off-bg: #2c2e32; --off-text: #b5b5b5;
  }
}

body.app { display: block; padding: 0; min-height: 100vh; }

.top {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
}
.top .mark { display: block; height: 28px; width: auto; }
.top h1 { margin: 0; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.page {
  max-width: 760px; margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
}

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--border);
}
.tabs a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); text-decoration: none; font-size: 0.8rem; font-weight: 600;
  border-top: 3px solid transparent;
}
.tabs a[aria-current="page"] { color: var(--text); border-top-color: var(--aiec-yellow); }
.badge {
  min-width: 20px; padding: 0 6px; border-radius: 10px; text-align: center;
  background: var(--aiec-yellow); color: var(--on-accent); font-size: 0.75rem; line-height: 20px;
}
.badge[hidden] { display: none; }

@media (min-width: 900px) {
  body.app { display: flex; flex-direction: column; }
  .top { order: 0; position: static; }
  .tabs {
    order: 1; position: sticky; top: 0; bottom: auto; height: 44px; padding: 0;
    justify-content: center; border-top: 0; border-bottom: 1px solid var(--border);
  }
  .tabs a { flex: 0 0 auto; padding: 0 20px; font-size: 0.9rem; border-top: 0; border-bottom: 3px solid transparent; }
  .tabs a[aria-current="page"] { border-bottom-color: var(--aiec-yellow); }
  .page { order: 2; width: 100%; padding-bottom: 32px; }
}

a { color: inherit; text-decoration-color: var(--aiec-gray-2); text-underline-offset: 3px; }
a:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--aiec-yellow); outline-offset: 2px;
}

h2 { margin: 0 0 8px; font-size: 1.05rem; line-height: 1.3; }
h3 { margin: 0; font-size: 1rem; line-height: 1.35; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.panel {
  margin: 0 0 16px; padding: 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
}
.panel-head, .task-head, .row { display: flex; align-items: flex-start; gap: 8px; }
.panel-head h2, .task-head h3, .row-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.panel-foot { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.panel-foot details { margin-top: 12px; }
.empty { padding: 40px 16px; text-align: center; }
.more { margin: 16px 0; text-align: center; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--ok-bg); color: var(--ok-text); font-size: 0.9rem; }
.note { padding: 10px 12px; border-radius: 8px; background: var(--wait-bg); color: var(--wait-text); }
.note .muted { color: inherit; }

.chip {
  flex: none; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
  font-size: 0.75rem; font-weight: 600; line-height: 20px;
  background: var(--off-bg); color: var(--off-text);
}
.chip.pending, .chip.changes_requested { background: var(--wait-bg); color: var(--wait-text); }
.chip.approved, .chip.done { background: var(--ok-bg); color: var(--ok-text); }
.chip.in_progress, .chip.coordinator { background: var(--info-bg); color: var(--info-text); }
.chip.rejected, .chip.revoked, .chip.failed { background: var(--danger-bg); color: var(--danger-text); }

.tasks, .list, .messages, .log { list-style: none; margin: 0; padding: 0; }
.task { padding: 12px 0; border-top: 1px solid var(--border); }
.task p { margin: 6px 0 0; }
.tasks .from { padding: 12px 0 0; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--muted); }
.tasks .from + .task { border-top: 0; padding-top: 4px; }
.task-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.task-foot .decide { margin-left: auto; }
.result { padding: 8px 10px; border-radius: 8px; background: var(--bg); }

form.inline { display: flex; align-items: center; gap: 8px; margin: 0; }
form.spread { justify-content: space-between; margin: 10px 0; }
button.small { padding: 6px 12px; font-size: 0.9rem; }
.page button.primary { width: auto; margin-top: 0; }
form.panel > button, details form > button { margin-top: 14px; }
.buttons button.primary { flex: 2; }

select, textarea {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; max-width: 100%;
}
textarea { display: block; width: 100%; resize: vertical; }
select { min-height: 36px; }
form.panel select, details.panel select { display: block; width: 100%; }
summary { cursor: pointer; font-weight: 600; padding: 4px 0; }

.list > li { padding: 12px 0; border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; }
.list .row { text-decoration: none; }
.list a.row .row-title { text-decoration: underline; text-decoration-color: var(--aiec-gray-2); font-weight: 600; }
.list p { margin: 4px 0 0; }
.list.plain .row-title { font-weight: 600; }

.message { margin: 0 0 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.message.mine { border-left: 4px solid var(--aiec-yellow); }
.message p { margin: 0 0 4px; }

.log li { padding: 8px 0; border-top: 1px solid var(--border); font-size: 0.9rem; overflow-wrap: anywhere; }
.log li:first-child { border-top: 0; }

.filter { display: flex; gap: 8px; margin: 0 0 16px; }
.filter a { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; font-size: 0.9rem; }
.filter a[aria-current="true"] { background: var(--aiec-yellow); border-color: var(--aiec-yellow); color: var(--on-accent); font-weight: 600; }
