:root {
  color-scheme: light;
  --bg: #fbfaff;
  --surface: rgb(255 255 255 / 0.84);
  --text: #1e293b;
  --strong: #0f172a;
  --muted: #64748b;
  --border: rgb(226 232 240 / 0.9);
  --accent: #7c3aed;
  --accent-soft: #f5f3ff;
  --accent-line: #ddd6fe;
  --danger: #be123c;
  --danger-soft: #fff1f2;
  --danger-line: #fecdd3;
  --ok: #047857;
  --ok-soft: #ecfdf5;
  --ok-line: #a7f3d0;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --warn-line: #fde68a;
  --info: #0369a1;
  --info-soft: #f0f9ff;
  --info-line: #bae6fd;
  --pink: #be185d;
  --pink-soft: #fdf2f8;
  --pink-line: #fbcfe8;
  --brand: linear-gradient(90deg, #7c3aed, #a21caf, #be185d);
  --glow: linear-gradient(135deg, #8b5cf6, #ec4899, #f97316);
  --shadow: 0 20px 25px -5px rgb(139 92 246 / 0.08), 0 8px 10px -6px rgb(139 92 246 / 0.06);
  --gutter: 5%;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(rgb(124 58 237 / 0.07) 1px, transparent 1px) 0 0 / 22px 22px,
    radial-gradient(42rem 42rem at 105% -10%, rgb(168 85 247 / 0.2), transparent 62%),
    radial-gradient(42rem 42rem at -8% 108%, rgb(244 114 182 / 0.2), transparent 62%),
    radial-gradient(30rem 30rem at 58% 42%, rgb(34 211 238 / 0.11), transparent 62%),
    radial-gradient(24rem 24rem at 22% 12%, rgb(251 146 60 / 0.1), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 78rem;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 3.5rem) 4rem;
}

body:has(.topbar) main {
  position: relative;
  max-width: none;
  margin-top: -2rem;
  padding: 0 var(--gutter) 4rem;
}

.hero {
  position: relative;
  isolation: isolate;
  padding-bottom: 6rem;
  background: linear-gradient(180deg, #1e1b4b 0, #4c1d95 calc(60% - 3rem), #86198f calc(100% - 6rem), rgb(134 25 143 / 0.55) calc(100% - 4.5rem), rgb(134 25 143 / 0.25) calc(100% - 3rem), rgb(134 25 143 / 0.08) calc(100% - 1.5rem), rgb(134 25 143 / 0) 100%);
  color: #fff;
  overflow: hidden;
}

h1,
h2 {
  margin: 0;
  color: var(--strong);
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  font-size: 1.75rem;
  font-weight: 800;
}

h2 {
  margin-bottom: 1rem;
  font-size: 1.0625rem;
  font-weight: 700;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid #c026d3;
  outline-offset: 2px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem var(--gutter);
}

.topbar .brand {
  color: rgb(255 255 255 / 0.7);
}

.topbar .shine {
  background: none;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  line-height: 1.25;
}

.brand:hover {
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  font-size: 0.75rem;
  font-weight: 500;
}

.logo {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--glow);
  color: #fff;
  font-size: 1.125rem;
  font-weight: 800;
  border-radius: 1rem;
  box-shadow: 0 10px 15px -3px rgb(217 70 239 / 0.35);
}

.shine {
  background: var(--brand);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  font-size: 1rem;
  font-weight: 800;
}

.clock {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  padding: 0.375rem 0.75rem;
  background: rgb(255 255 255 / 0.1);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 999px;
}

.clock svg {
  flex: none;
  width: 1rem;
  height: 1rem;
  color: #6ee7b7;
}

.clock span {
  display: flex;
  overflow: hidden;
}

.clock b {
  animation: tick 0.35s var(--ease-out);
}

@keyframes tick {
  from {
    opacity: 0;
    transform: translateY(70%);
  }
}

button.logout {
  padding: 0.5rem 0.75rem;
  background: transparent;
  color: rgb(255 255 255 / 0.8);
  font-weight: 600;
  box-shadow: none;
  transition: background-color 0.15s ease-out, color 0.15s ease-out;
}

button.logout:hover {
  background: rgb(255 255 255 / 0.12);
  color: #fff;
  transform: none;
  box-shadow: none;
}

.logout svg {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card-head h2 {
  margin: 0;
}

.card,
fieldset {
  min-width: 0;
  margin: 0 0 1.5rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.card {
  overflow-x: auto;
}

.narrow {
  max-width: 25rem;
  margin: 0 auto;
  padding: 2rem;
}

.login-brand {
  justify-content: center;
  margin-top: 14dvh;
}

.login-brand + main {
  padding-top: 1.5rem;
}

.narrow h1 {
  margin-bottom: 1.25rem;
  font-size: 1.375rem;
}

.stack {
  display: grid;
  gap: 1rem;
}

form.stack {
  gap: 0;
}

.card form.stack {
  gap: 1rem;
}

.card:not(.narrow) form.stack {
  max-width: 32rem;
}

fieldset.stack {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem 1.25rem;
}

fieldset.stack .field {
  flex: 1 1 17rem;
}

fieldset.stack .field:has(textarea),
fieldset.stack .field:has(.breaks),
fieldset.stack .field:has(.check) {
  flex-basis: 100%;
}

fieldset.stack hr {
  flex-basis: 100%;
  margin: 0.25rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

legend {
  float: left;
  width: 100%;
  margin-bottom: 1rem;
  padding: 0;
  color: var(--strong);
  font-size: 1.0625rem;
  font-weight: 700;
}

legend + * {
  clear: both;
}

fieldset.stack legend {
  flex: 0 0 100%;
  margin-bottom: 0;
}

.inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

form.inline {
  align-items: flex-end;
}

.inline .field {
  flex: 0 1 14rem;
}

.field {
  display: grid;
  gap: 0.375rem;
  min-width: 0;
}

label,
.label {
  color: #334155;
  font-size: 0.8125rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.5625rem 0.75rem;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.05);
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}

textarea {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  resize: vertical;
}

.breaks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.75rem, 1fr));
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breaks label {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.125rem;
  padding: 0.5rem 0.25rem;
  background: #fff;
  color: var(--strong);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.05);
  cursor: pointer;
  transition: border-color 0.15s ease-out, background-color 0.15s ease-out, box-shadow 0.15s ease-out, transform 0.1s ease-out;
}

.breaks label::after {
  content: "Chạy";
  color: var(--ok);
  font-size: 0.6875rem;
  font-weight: 600;
}

.breaks label:hover {
  border-color: var(--accent-line);
}

.breaks label:active {
  transform: scale(0.97);
}

.breaks label:has(:checked) {
  background: var(--danger-soft);
  color: var(--muted);
  border-color: var(--danger-line);
  box-shadow: none;
}

.breaks label:has(:checked) span {
  text-decoration: line-through;
}

.breaks label:has(:checked)::after {
  content: "Nghỉ";
  color: var(--danger);
}

.breaks label:has(:focus-visible) {
  border-color: #e879f9;
  box-shadow: 0 0 0 3px rgb(232 121 249 / 0.3);
}

.breaks input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--accent-line);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: #e879f9;
  outline: 0;
  box-shadow: 0 0 0 3px rgb(232 121 249 / 0.3);
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
  background: var(--danger-soft);
}

input[type="file"] {
  padding: 0.375rem;
}

.check {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.05);
  cursor: pointer;
  transition: border-color 0.15s ease-out, background-color 0.15s ease-out, box-shadow 0.15s ease-out, transform 0.1s ease-out;
}

.check:hover {
  border-color: var(--accent-line);
}

.check:active {
  transform: scale(0.99);
}

.check:has(:checked) {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.check:has(:focus-visible) {
  border-color: #e879f9;
  box-shadow: 0 0 0 3px rgb(232 121 249 / 0.3);
}

.check input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.check-icon {
  position: relative;
  flex: none;
  width: 2rem;
  height: 2rem;
  background: #f1f5f9;
  color: var(--muted);
  border-radius: 0.625rem;
  transition: background-color 0.15s ease-out, color 0.15s ease-out;
}

.check :checked + .check-icon {
  background: var(--accent);
  color: #fff;
}

.check-icon svg {
  position: absolute;
  inset: 0.4375rem;
  transition: opacity 0.15s ease-out, transform 0.2s var(--ease-out);
}

.check-on,
.check :checked + .check-icon .check-off {
  opacity: 0;
  transform: scale(0.5);
}

.check :checked + .check-icon .check-on {
  opacity: 1;
  transform: none;
}

.check-text {
  display: grid;
  gap: 0.125rem;
  font-size: 0.875rem;
}

.check-text .hint {
  font-weight: 400;
}

.hint,
.empty {
  color: var(--muted);
  font-size: 0.8125rem;
}

output:empty {
  display: none;
}

.error {
  color: var(--danger);
  font-size: 0.8125rem;
  font-weight: 600;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5625rem 1rem;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  white-space: nowrap;
  border: 0;
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px -3px rgb(217 70 239 / 0.3);
  cursor: pointer;
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

button:hover,
.button:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 16px 22px -6px rgb(217 70 239 / 0.4);
}

button:active,
.button:active {
  transform: scale(0.97);
}

.button svg {
  width: 1rem;
  height: 1rem;
}

button.quiet,
.button.quiet {
  padding: 0.375rem 0.75rem;
  background: #fff;
  color: #334155;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.05);
}

button.quiet:hover,
.button.quiet:hover {
  color: var(--accent);
  border-color: var(--accent-line);
  box-shadow: 0 4px 6px -1px rgb(124 58 237 / 0.12);
}

button.danger {
  background: linear-gradient(90deg, #e11d48, #be185d);
  box-shadow: 0 10px 15px -3px rgb(225 29 72 / 0.3);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

td .actions {
  flex-wrap: nowrap;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.actions a[href$="/delete"] {
  color: var(--danger);
}

.notice {
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 600;
  border: 1px solid var(--ok-line);
  border-radius: 1rem;
}

.notice.invalid {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-line);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th,
td {
  padding: 0.75rem 1rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody th {
  width: 10rem;
}

tbody tr {
  transition: background-color 0.15s ease-out;
}

tbody tr:hover {
  background: rgb(245 243 255 / 0.7);
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

.num {
  width: 3.5rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.time {
  color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.terminal {
  margin: 0;
  overflow: hidden;
  background: #0f1424;
  border: 1px solid #1e293b;
  border-radius: 1rem;
  box-shadow: var(--shadow);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.625rem 1rem;
  background: #1a2136;
  border-bottom: 1px solid #283048;
}

.terminal-bar h3 {
  margin: 0;
  overflow: hidden;
  color: #94a3b8;
  font: 500 0.8125rem/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-dots {
  display: flex;
  flex: none;
  gap: 0.4375rem;
}

.terminal-dots i {
  width: 0.75rem;
  height: 0.75rem;
  background: #ff5f57;
  border-radius: 50%;
}

.terminal-dots i:nth-child(2) {
  background: #febc2e;
}

.terminal-dots i:nth-child(3) {
  background: #28c840;
}

.terminal-body {
  display: flex;
  flex-direction: column-reverse;
  max-height: min(34rem, 55dvh);
  padding: 1rem 1.125rem;
  overflow: auto;
  color: #e2e8f0;
  font: 0.8125rem/1.7 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  scrollbar-color: #334155 transparent;
}

.terminal-body:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: -2px;
}

.terminal-body p {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  margin: 0;
  overflow-wrap: anywhere;
}

.terminal-body time,
.terminal-body .dim {
  color: #7c8aa3;
}

.terminal-body .ok {
  color: #4ade80;
}

.terminal-body .warn {
  color: #fbbf24;
}

.terminal-body .danger {
  color: #f87171;
}

.terminal-cursor {
  width: 0.5rem;
  height: 1rem;
  margin-top: 0.1875rem;
  background: #e2e8f0;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.who {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--strong);
  white-space: nowrap;
}

.who > div {
  display: grid;
  justify-items: start;
  gap: 0.25rem;
}

.who a {
  color: inherit;
  font-weight: 600;
}

.cell {
  white-space: nowrap;
}

.cell a + a {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
}

.avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  background: linear-gradient(135deg, #8b5cf6, #d946ef);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: 0.75rem;
  box-shadow: 0 4px 6px -1px rgb(124 58 237 / 0.25);
}

img.avatar {
  object-fit: cover;
}

tr:nth-child(4n + 2) .avatar {
  background: linear-gradient(135deg, #ec4899, #fb923c);
}

tr:nth-child(4n + 3) .avatar {
  background: linear-gradient(135deg, #0ea5e9, #22d3ee);
}

tr:nth-child(4n + 4) .avatar {
  background: linear-gradient(135deg, #10b981, #84cc16);
}

.status,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.625rem;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
}

.status::before {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  background: currentColor;
  border-radius: 50%;
}

.status.live::before {
  animation: pulse 1s ease-in-out infinite alternate;
}

.status .time {
  color: inherit;
  font-size: inherit;
  font-weight: 500;
}

.next {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.375rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.tag {
  font-variant-numeric: tabular-nums;
}

.tag.site,
.tag.soon {
  background: var(--info-soft);
  color: var(--info);
  border-color: var(--info-line);
}

.tag.groups {
  background: var(--pink-soft);
  color: var(--pink);
  border-color: var(--pink-line);
}

.tag.messages,
.tag.ca {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-line);
}

.tag.schedule {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: var(--warn-line);
}

.tag.empty {
  background: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  border-style: dashed;
}

a:hover > .tag {
  border-color: currentColor;
}

a.status:hover {
  text-decoration: none;
  border-color: currentColor;
}

.status.ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: var(--ok-line);
}

.status.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-line);
}

button.status,
button.status:hover {
  box-shadow: none;
}

button.status:hover {
  border-color: currentColor;
}

tr.flagged {
  background: rgb(255 241 242 / 0.6);
}

tr.flagged td:first-child {
  box-shadow: inset 3px 0 var(--danger);
}

.blank {
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding: 2.5rem 1rem;
  text-align: center;
}

.host {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.875rem 1.5rem;
  margin: 0.75rem var(--gutter) 0;
}

.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -3rem;
  right: -3rem;
  width: 9rem;
  height: 9rem;
  background: radial-gradient(closest-side, rgb(244 114 182 / 0.6), transparent);
  animation: drift 9s ease-in-out infinite alternate;
}

.meter {
  display: grid;
  flex: 1 1 11rem;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
}

.tile {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  background: rgb(255 255 255 / 0.12);
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 0.75rem;
  transition: background-color 0.3s ease;
}

.meter:has(.warn) .tile {
  background: rgb(251 191 36 / 0.28);
}

.meter:has(.danger) .tile {
  background: rgb(244 63 94 / 0.4);
}

.tile svg {
  width: 1.25rem;
  height: 1.25rem;
}

.chip .core {
  transform-box: fill-box;
  transform-origin: center;
  animation: pulse 1.2s ease-in-out infinite alternate;
}

.chip .pins {
  animation: glimmer 1.2s ease-in-out infinite alternate;
}

.meter:has(.warn) .chip * {
  animation-duration: 0.7s;
}

.meter:has(.danger) .chip * {
  animation-duration: 0.35s;
}

.ram .cell {
  animation: blink 1.6s ease-in-out infinite;
}

.ram .cell:nth-child(2) {
  animation-delay: 0.2s;
}

.ram .cell:nth-child(3) {
  animation-delay: 0.4s;
}

.ram .cell:nth-child(4) {
  animation-delay: 0.6s;
}

.hdd .led {
  animation: flicker 1.3s steps(1) infinite;
}

.hdd .led + .led {
  animation-delay: -0.5s;
}

.figure {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0.25rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
}

.figure strong {
  font-size: 0.9375rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.figure small {
  grid-column: 1 / -1;
  color: rgb(255 255 255 / 0.65);
  font-size: 0.6875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.bar {
  grid-column: 1 / -1;
  height: 0.375rem;
  background: rgb(255 255 255 / 0.16);
  border-radius: 999px;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #a78bfa, #f472b6, #fdba74);
  border-radius: inherit;
  transition: transform 0.6s var(--ease-out);
}

.figure.warn strong {
  color: #fde68a;
}

.figure.warn i {
  background: linear-gradient(90deg, #fbbf24, #fb923c);
}

.figure.danger strong {
  color: #fecdd3;
}

.figure.danger i {
  background: linear-gradient(90deg, #fb7185, #e11d48);
}

.counts {
  display: grid;
  flex: 1 1 15rem;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.375rem;
  margin: 0;
  text-align: center;
}

.counts div {
  padding: 0.5rem 0.125rem;
  background: rgb(255 255 255 / 0.1);
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 0.75rem;
}

.counts dt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: rgb(255 255 255 / 0.7);
  font-size: 0.625rem;
  font-weight: 600;
  white-space: nowrap;
}

.counts svg {
  flex: none;
  width: 0.875rem;
  height: 0.875rem;
}

.counts .on svg {
  color: #6ee7b7;
}

.counts dd {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.counts .on dd {
  color: #6ee7b7;
}

.counts .off dd {
  color: rgb(255 255 255 / 0.6);
}

html:has(dialog[open]) {
  overflow: hidden;
}

dialog {
  flex-direction: column;
  width: min(30rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 1.75rem;
  box-shadow: 0 40px 80px -20px rgb(76 29 149 / 0.45);
  overflow: hidden;
  opacity: 0;
  transform: translateY(0.75rem) scale(0.96);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out), overlay 0.2s allow-discrete, display 0.2s allow-discrete;
}

dialog:has(.field + .field) {
  width: min(44rem, calc(100vw - 2rem));
}

dialog:has(.field:nth-of-type(6)) {
  width: min(64rem, calc(100vw - 2rem));
}

#ca-history,
#ca-log {
  width: min(64rem, calc(100vw - 2rem));
}

#ca-history .dialog-body {
  overflow-x: auto;
}

#back-to-history {
  justify-self: start;
}

#run {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

dialog[open] {
  display: flex;
  opacity: 1;
  transform: none;
}

dialog::backdrop {
  background: rgb(30 27 75 / 0.5);
  opacity: 0;
  transition: opacity 0.2s ease-out, overlay 0.2s allow-discrete, display 0.2s allow-discrete;
}

dialog[open]::backdrop {
  opacity: 1;
}

@starting-style {
  dialog[open] {
    opacity: 0;
    transform: translateY(0.75rem) scale(0.96);
  }

  dialog[open]::backdrop {
    opacity: 0;
  }
}

.dialog-head {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 4.5rem 1.25rem 1.5rem;
  background: linear-gradient(135deg, var(--accent-soft), #fdf2f8 60%, #fff7ed);
  border-bottom: 1px solid var(--border);
}

.dialog-head > div {
  flex: 1 1 12rem;
}

.dialog-head.danger {
  background: var(--danger-soft);
}

.dialog-head.danger .dialog-icon {
  background: linear-gradient(135deg, #fb7185, #e11d48);
  box-shadow: 0 10px 15px -3px rgb(225 29 72 / 0.3);
}

.dialog-head h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
}

.dialog-head p {
  margin-top: 0.125rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.dialog-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  background: var(--glow);
  color: #fff;
  border-radius: 1rem;
  box-shadow: 0 10px 15px -3px rgb(217 70 239 / 0.35);
}

.dialog-icon svg {
  width: 1.375rem;
  height: 1.375rem;
}

dialog[open] .dialog-icon svg {
  animation: spin-in 0.5s var(--ease-out) backwards;
}

.dialog-body {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  min-height: 0;
  gap: 1.25rem;
  padding: 1.5rem;
  overflow-y: auto;
}

.dialog-form {
  display: grid;
  gap: 1.25rem;
}

.dialog-body .notice {
  margin: 0;
}

.changes {
  display: grid;
  gap: 1rem;
  margin: 0;
}

.changes dt {
  font-size: 0.8125rem;
  font-weight: 700;
}

.changes dd {
  display: grid;
  gap: 0.25rem;
  margin: 0.375rem 0 0;
  font-size: 0.875rem;
}

.changes del,
.changes ins {
  max-height: 6rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0.5rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-y: auto;
}

.changes del {
  background: var(--danger-soft);
  color: var(--danger);
}

.changes ins {
  background: var(--ok-soft);
  color: var(--ok);
  text-decoration: none;
}

dialog fieldset {
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

dialog fieldset + fieldset {
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

dialog[open] fieldset {
  animation: rise 0.3s var(--ease-out) backwards;
}

dialog[open] fieldset:nth-of-type(2) {
  animation-delay: 50ms;
}

dialog[open] fieldset:nth-of-type(3) {
  animation-delay: 100ms;
}

dialog legend {
  color: var(--accent);
  font-size: 0.6875rem;
  text-transform: uppercase;
}

dialog legend small {
  color: var(--muted);
  font-size: inherit;
  font-weight: 500;
  text-transform: none;
}

#new-tenant .field:has([type="url"]),
#new-tenant .field:has([type="tel"]) {
  flex-basis: 100%;
}

.dialog-foot {
  flex: none;
  flex-direction: row-reverse;
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-top: 1px solid var(--border);
}

dialog button.quiet {
  padding: 0.5625rem 1rem;
  font-size: 0.875rem;
}

dialog button.close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--muted);
}

.close svg {
  width: 1rem;
  height: 1rem;
}

@keyframes drift {
  to {
    transform: translate(-5rem, 6rem) scale(1.3);
  }
}

@keyframes pulse {
  from {
    opacity: 0.35;
    transform: scale(0.7);
  }

  to {
    opacity: 1;
    transform: scale(1.15);
  }
}

@keyframes glimmer {
  from {
    opacity: 0.45;
  }
}

@keyframes blink {
  0%,
  60%,
  100% {
    opacity: 0.25;
  }

  30% {
    opacity: 1;
  }
}

@keyframes flicker {
  0%,
  35%,
  55% {
    opacity: 1;
  }

  20%,
  50%,
  80% {
    opacity: 0.2;
  }
}

@keyframes spin-in {
  from {
    opacity: 0;
    transform: rotate(-90deg) scale(0.6);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
}

@media (max-width: 60rem) {
  :root {
    --gutter: 1rem;
  }

  .brand small {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.peek-field {
  position: relative;
}

.peek-field input,
.peek-field textarea {
  padding-right: 2.75rem;
}

.peek {
  position: absolute;
  inset: 0 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.75rem;
  color: var(--muted);
  border-radius: 0.75rem;
}

.peek[href] {
  color: var(--accent);
}

.peek svg {
  width: 1rem;
  height: 1rem;
}

.peek[href] .peek-off,
.peek:not([href]) .peek-on {
  display: none;
}

#edit-tenant:has(#script) {
  width: 75vw;
  height: 75dvh;
}

fieldset.stack > .script {
  flex: 1 1 32rem;
  min-width: 0;
  min-height: 4rem;
  margin: 0;
}

.script {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-content: start;
  gap: 0.375rem;
  padding: 0;
  list-style: none;
  counter-reset: node;
}

.palette {
  position: sticky;
  top: 0;
  display: grid;
  flex: 0 0 16rem;
  gap: 0.5rem;
  max-height: calc(100dvh - 13rem);
  padding: 0.75rem;
  overflow-y: auto;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 0.75rem;
}

.palette .hint {
  margin: 0;
}

.palette fieldset {
  padding-top: 0.75rem;
  border-top: 1px solid var(--accent-line);
}

#node-add {
  display: grid;
  gap: 0.375rem;
}

#node-add > div {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  cursor: grab;
}

#node-add button {
  flex: 1;
  justify-content: flex-start;
  padding: 0.3125rem 0.625rem;
  font-size: 0.8125rem;
}

.node {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.5rem;
  padding: 0.375rem 0.5rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--accent-line);
  border-radius: 0.75rem;
  grid-column: 1 / -1;
  counter-increment: node;
}

.node.fixed {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.node.repeats {
  border-right: 4px solid var(--accent);
}

.node[hidden] {
  display: none;
}

.node-note {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

@media (min-width: 48rem) {
  .node[data-span="2"] {
    grid-column: span 2;
  }

  .node[data-span="3"] {
    grid-column: span 3;
  }

  .node[data-span="2"] .node-kind,
  .node[data-span="3"] .node-kind {
    flex-basis: auto;
  }
}

.node[data-kind="wait"] {
  background: var(--warn-soft);
  border-left-color: var(--warn-line);
}

.node.dragging {
  opacity: 0.4;
}

.grip {
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1;
  cursor: grab;
  user-select: none;
}

.grip:active {
  cursor: grabbing;
}

.node-kind {
  flex: 0 0 10rem;
  white-space: nowrap;
  color: var(--strong);
  font-size: 0.8125rem;
}

.node-kind::before {
  content: counter(node) ". ";
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.node input,
.node select,
.node textarea {
  padding-block: 0.3125rem;
  padding-left: 0.5rem;
  font-size: 0.8125rem;
}

.node > input {
  width: 5.5rem;
}

#script .field {
  flex: 0 1 8rem;
}

#script .node-text {
  flex: 1 1 14rem;
}

#script .node-to {
  flex: 0 0 auto;
}

.node .field > label,
.node .field > .label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.node-moves {
  display: flex;
  gap: 0.125rem;
  margin-left: auto;
}

#script .node-moves button {
  min-width: 1.75rem;
  padding: 0.125rem 0.375rem;
  font-size: 0.8125rem;
}

.node > .error {
  flex-basis: 100%;
  margin: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  font-size: 0.8125rem;
}

.chips::before {
  content: "→";
  color: var(--muted);
}

.chips label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}

.chips input {
  width: auto;
  margin: 0;
  padding: 0;
  box-shadow: none;
}

.grip.fixed {
  color: var(--accent);
  font-size: 0.75rem;
  cursor: default;
}

.node:has(.fixed) {
  padding-block: 0.5rem;
}
