/* reefhub web app for first-generation ORCAs – same tokens as the splash and the manuals. */
:root {
  --line: rgba(255,255,255,.10);
  --line-strong: rgba(255,255,255,.18);
  --text: rgba(255,255,255,.84);
  --panel: rgba(255,255,255,.035);
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
html { color-scheme: dark; }
html, body.app { height: auto; }
body.app { display: block; min-height: 100vh; }

.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; height: 56px; padding: 0 20px;
  background: rgba(18,19,22,.9); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.bar .home { line-height: 0; }
.bar .home img { width: 26px; height: auto; }
.bar .crumbs { font: 400 13px/1 var(--mono); color: var(--fg); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .crumbs .pr { color: var(--muted); }
.bar .spacer { flex: 1; }

.view { display: block; max-width: 760px; margin: 0 auto; padding: 40px 20px 72px; color: var(--text); }
.loading { color: var(--muted); font-family: var(--mono); font-size: 14px; }
.prompt { margin: 0 0 12px; font: 400 14px/1.4 var(--mono); color: var(--fg); }
.prompt .pr { color: var(--muted); }
h1 { margin: 0 0 12px; font-size: clamp(28px, 5vw, 38px); line-height: 1.1; font-weight: 700; letter-spacing: -.03em; color: var(--fg); }
h1 .cur { height: .8em; width: .4em; margin-left: .12em; vertical-align: -.04em; }
h2 { margin: 36px 0 12px; font-size: 13px; font-weight: 400; font-family: var(--mono); color: var(--pink); text-transform: lowercase; }
h2::before { content: "# "; color: var(--muted); }
h3 { margin: 0; font-size: 17px; font-weight: 600; color: var(--fg); }
p { margin: 0 0 14px; line-height: 1.65; }
.lead { font-size: 17px; color: var(--muted); max-width: 36em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
a { color: var(--fg); }

/* buttons: 44 px touch targets (HIG) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line-strong); background: transparent; color: var(--fg);
  font: 600 15px/1 Inter, system-ui, sans-serif; cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s; }
.btn:hover { background: rgba(255,255,255,.05); }
.btn:focus-visible, .link:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.btn.primary { background: var(--pink); border-color: var(--pink); color: #fff; }
.btn.primary:hover { background: #ff1a93; }
.btn.danger { color: #fca5a5; border-color: rgba(239,68,68,.45); }
.btn.danger:hover { background: rgba(239,68,68,.1); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.link { background: none; border: 0; padding: 8px 4px; color: var(--muted); font: 400 14px/1 Inter, system-ui, sans-serif; cursor: pointer; }
.link:hover { color: var(--fg); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.actions { margin-top: 20px; }
.view > .row, .card > .row { margin-top: 16px; }
.view > .card { margin-top: 24px; }
.row.end { justify-content: flex-end; }

/* cards & lists */
.card { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 18px; }
.card + .card { margin-top: 12px; }
.devices { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 12px; }
.device-link { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--panel); text-decoration: none; color: var(--fg); transition: border-color .15s; }
.device-link:hover, .device-link:focus-visible { border-color: rgba(230,0,126,.6); }
.device-link .meta { flex: 1; min-width: 0; }
.device-link .name { display: block; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-link .sub { display: block; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 4px; }
.device-link .chev { color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #5b5f66; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px rgba(34,197,94,.55); }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font: 600 11px/1.2 var(--mono); letter-spacing: .02em; border: 1px solid var(--line-strong); color: var(--muted); }
.badge.on { color: var(--ok); border-color: rgba(34,197,94,.5); }
.badge.run { color: var(--ok); border-color: rgba(34,197,94,.5); }
.badge.update { color: var(--pink); border-color: rgba(230,0,126,.5); }

/* forms */
.field { display: grid; gap: 6px; margin: 0 0 14px; }
.field label { font-size: 14px; color: var(--muted); }
input[type=text], input[type=number] { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: rgba(0,0,0,.25); color: var(--fg); font: 400 16px/1.2 Inter, system-ui, sans-serif; }
input[type=number] { font-family: var(--mono); }
input[aria-invalid=true] { border-color: var(--bad); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .grid3 { grid-template-columns: 1fr 1fr; } .grid3 .field:last-child { grid-column: span 2; } }
.unit { position: relative; }
.unit input { padding-right: 34px; }
.unit::after { content: attr(data-unit); position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }

/* iOS-style switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 999px; background: #3a3d43; position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(20px); }

/* channels */
.channel { padding: 0; }
.channel-head { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 14px 18px; cursor: pointer; list-style: none; border-radius: 16px; }
.channel-head::-webkit-details-marker { display: none; }
.channel-head::after { content: "+"; color: var(--pink); font-size: 20px; width: 14px; text-align: center; flex: none; }
.channel[open] > .channel-head::after { content: "–"; }
.channel-head:hover h3 { color: #fff; }
.channel-head:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.channel-head .num { font: 400 12px/1 var(--mono); color: var(--pink); }
.channel-head .title { flex: 1; min-width: 0; display: grid; gap: 4px; }
.channel-head .brief { font: 400 12px/1.2 var(--mono); color: var(--muted); }
.channel-head .brief:empty { display: none; }
.channel-body { padding: 4px 18px 18px; border-top: 1px solid var(--line); }
.channel-body > form { margin-top: 14px; }
details.more { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; }
details.more summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; justify-content: space-between; list-style: none; font-weight: 600; font-size: 15px; color: var(--fg); }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "+"; color: var(--pink); font-weight: 400; font-size: 20px; }
details.more[open] summary::after { content: "–"; }
.slots { width: 100%; border-collapse: collapse; margin: 6px 0 12px; }
.slots th { font: 400 12px/1.2 var(--mono); color: var(--muted); text-align: left; padding: 6px 6px; }
.slots td { padding: 4px 6px; vertical-align: middle; }
.slots td:first-child { width: 64px; }
.slots input[type=number] { min-height: 40px; padding: 8px; }
.slots .switch { min-height: 40px; }

/* info list */
dl.info { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; font-family: var(--mono); font-size: 13px; color: var(--fg); word-break: break-all; }

.notice { border: 1px solid var(--line-strong); border-left: 2px solid var(--pink); border-radius: 4px 10px 10px 4px; padding: 12px 16px; margin: 16px 0; }
.notice.error { border-left-color: var(--bad); }
.notice p:last-child { margin: 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(92vw, 460px); padding: 12px 18px; border-radius: 12px;
  background: #1f2126; border: 1px solid var(--line-strong); color: var(--fg); font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); z-index: 20; }
.toast.error { border-color: rgba(239,68,68,.6); }

.app footer { border-top: 1px solid var(--line); }
.hide { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
