:root {
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  color: #20292c;
  background: #f3f5f3;
  font-synthesis: none;
  --muted: #536568;
  --line: #d8e2de;
  --paper: #fff;
  --accent: #126557;
  --accent-dark: #0e5147;
  --error: #a83134;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; }
button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .62rem .83rem;
  background: var(--paper);
  color: inherit;
  cursor: pointer;
  font-weight: 620;
  white-space: nowrap;
}
button:hover, .device-button:hover { background: #edf4f1; }
button:disabled { cursor: wait; opacity: .55; }
button.primary { background: var(--accent); color: white; border-color: var(--accent); }
button.primary:hover { background: var(--accent-dark); }
button.destructive { color: var(--error); }
button.quiet { background: transparent; }
button.text-button { padding: .3rem 0; border: 0; background: transparent; color: var(--accent); }
button.text-button:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid #b76032; outline-offset: 3px; }
.bar { background: #142824; color: #f3fbf8; }
.bar-inner {
  margin: 0 auto;
  max-width: 1280px;
  padding: .85rem clamp(1rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}
.wordmark { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; font-weight: 720; }
.mark {
  display: inline-block;
  width: 22px;
  height: 15px;
  position: relative;
  border: 2px solid #91d4bb;
  border-radius: 3px;
}
.mark::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 2px;
  bottom: -5px;
  left: 4px;
  background: #91d4bb;
  border-radius: 2px;
}
.account { display: flex; align-items: center; gap: .85rem; font-size: .86rem; }
.account button { border-color: #54776c; }
.account button:hover { background: #29413b; }
main { margin: 0 auto; max-width: 1280px; padding: clamp(1.2rem, 4vw, 3rem); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -.06em; line-height: 1.05; }
h2 { font-size: 1.55rem; letter-spacing: -.035em; overflow-wrap: anywhere; }
h3 { font-size: 1rem; }
.auth, .device-list, .detail {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.auth { max-width: 420px; margin: 5vh auto; padding: clamp(1.3rem, 4vw, 2rem); }
.auth h1 { margin-bottom: 1.3rem; }
.auth form { display: grid; gap: .85rem; }
.auth form button { justify-self: stretch; }
.auth .text-button { margin-top: .6rem; }
label { display: grid; gap: .42rem; font-size: .87rem; font-weight: 650; }
input, select {
  min-width: 0;
  width: 100%;
  padding: .65rem .7rem;
  border: 1px solid #bccdc5;
  border-radius: 8px;
  color: inherit;
  background: white;
}
.heading, .device-heading, .list-header, .dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.heading { margin-bottom: 1.25rem; }
.heading-actions { display: flex; gap: .45rem; flex-wrap: wrap; justify-content: end; }
.organization { color: var(--muted); font-size: .82rem; font-weight: 650; margin-bottom: .4rem; }
.layout { display: grid; grid-template-columns: minmax(235px, .72fr) minmax(0, 1.55fr); gap: 1rem; align-items: start; }
.list-header { padding: .78rem 1rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .86rem; }
ul { list-style: none; padding: 0; margin: 0; }
#devices li + li { border-top: 1px solid var(--line); }
.device-button {
  text-align: left;
  border: 0;
  border-radius: 0;
  width: 100%;
  padding: .94rem 1rem;
  display: flex;
  justify-content: space-between;
  gap: .55rem;
  align-items: start;
  white-space: normal;
}
.device-button[aria-current="true"] { background: #e5f2ec; box-shadow: inset 3px 0 var(--accent); }
.device-button > span:first-child { display: grid; gap: .28rem; overflow-wrap: anywhere; }
.device-button small { font-size: .73rem; color: var(--muted); font-weight: 500; }
.pill { font-size: .72rem; color: #505c60; background: #edf0f0; border-radius: 99px; padding: .28rem .55rem; font-weight: 700; white-space: nowrap; }
.pill[data-online="true"], .pill[data-status="succeeded"] { color: #155549; background: #def3e9; }
.pill[data-status="failed"], .pill[data-status="expired"] { color: var(--error); background: #fbe8e8; }
.empty, .notice { color: var(--muted); font-size: .88rem; }
.empty { padding: 1.05rem; }
.error { color: var(--error); font-size: .88rem; margin: .7rem 0; }
.error:empty, .notice:empty { display: none; }
.detail { padding: clamp(1rem, 3vw, 1.5rem); }
.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .8rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: .9rem 0;
  margin: 1rem 0 1.15rem;
}
.facts dt, .pair-details dt { color: var(--muted); font-size: .76rem; }
.facts dd, .pair-details dd { margin: .3rem 0 0; font-size: .88rem; overflow-wrap: anywhere; }
.facts .wide { grid-column: 1 / -1; }
.field-row { display: flex; gap: .45rem; align-items: stretch; margin-top: .4rem; }
.commands { display: flex; gap: .46rem; flex-wrap: wrap; margin: .85rem 0; }
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.install { margin-top: .9rem; }
.install .notice { margin-top: .35rem; }
#command-feedback { margin-top: .85rem; }
.history { margin-top: 1.3rem; border-top: 1px solid var(--line); padding-top: .95rem; }
.history li { display: grid; grid-template-columns: 1fr auto; gap: .35rem .6rem; padding: .65rem 0; align-items: start; }
.history li + li { border-top: 1px solid var(--line); }
.history li > div { display: grid; gap: .25rem; min-width: 0; overflow-wrap: anywhere; }
.history li .timestamp { color: var(--muted); font-size: .73rem; }
.history li .text-button { justify-self: start; }
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; width: min(93vw, 540px); color: inherit; }
dialog::backdrop { background: #17282099; }
dialog > p { margin-top: .85rem; line-height: 1.5; }
.pair-details { padding: 1rem; background: #edf6f1; border-radius: 8px; }
.pair-details > div + div { margin-top: .8rem; }
#pair-code { font-family: ui-monospace, monospace; font-size: 1.45rem; letter-spacing: .08em; }
#upload-release { display: grid; gap: .75rem; margin: 1rem 0 .8rem; }
#upload-release button { justify-self: start; }
#release-list li { padding: .55rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
#release-list li span { display: block; margin-top: .25rem; }
#image-dialog { width: min(92vw, 960px); }
#screenshot { width: 100%; max-height: 75vh; object-fit: contain; margin-top: .8rem; background: #152522; }

@media (max-width: 730px) {
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 470px) {
  .settings { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account > span { display: none; }
}
