:root {
  --background: #080e15;
  --paper: #0e1b28;
  --ink: #e3f2f7;
  --muted: #96adbd;
  --line: #22394a;
  --line-soft: #1c3040;
  --primary: #c4edfa;
  --primary-dark: #e2f7ff;
  --mint: #c4edfa;
  --mint-wash: #102735;
  --dark: #09131d;
  --danger: #ffb8b6;
  --shadow: none;
  --signal: #64d5f7;
  --warning: #e2c07f;
  --graphite: #0c1722;
  --well: #080f17;
  --grid: #7fcbe611;
}

body { color-scheme: dark; }
:focus-visible { outline-color: var(--signal); }
.brand { color: var(--ink); }
.brand small { color: #8fa9b9; }
.brand-mark { display: block; width: 38px; height: 38px; flex: none; }
.boot img { filter: hue-rotate(75deg) saturate(.7); }
.overline > span, .private-status > span, .visual-index > span {
  background: var(--signal);
  box-shadow: 0 0 9px #64d5f755;
}
.btn { border-radius: 4px; }
.btn:hover { background: #142635; border-color: #476578; }
.btn:disabled { color: #8ea6b7; background: #101c26; }
.btn.primary { color: #09202b; background: var(--primary); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.primary:disabled { color: #a4b8c4; background: #263744; border-color: #3a4b57; opacity: 1; }

.workspace { grid-template-columns: 205px minmax(0, 1fr); }
.workspace .sidebar {
  padding: 24px 14px 18px;
  background: #0a131c;
  border-color: var(--line-soft);
}
.workspace .sidebar .brand { margin: 3px 11px 38px; }
.workspace .sidebar .brand small {
  color: #8eacbc;
  letter-spacing: .12em;
}
.workspace .nav-heading {
  margin: 0 12px 8px;
  color: #91aab9;
  font: 650 10px/1.3 var(--mono);
  letter-spacing: .15em;
}
.workspace .nav > a, .workspace .logout {
  gap: 9px;
  border-radius: 4px;
  color: #a6bac8;
  font-size: 13px;
}
.workspace .nav > a .icon, .workspace .logout .icon { color: #8bb1c4; }
.workspace .nav > a:hover, .workspace .logout:hover { background: #111f2b; color: var(--ink); }
.workspace .nav > a[aria-current] {
  background: #122a3a;
  border-color: #29536a;
  color: #e2f5fc;
  box-shadow: inset 2px 0 var(--signal);
}
.workspace .nav > a[aria-current] .icon { color: var(--signal); }
.workspace .sidebar-foot { border-color: var(--line-soft); }
.workspace .private-status { color: #a3bac9; font-size: 11px; }
.workspace .private-status > span { width: 6px; height: 6px; }

.workspace .topbar {
  min-height: 62px;
  padding: 10px clamp(20px, 3.4vw, 46px);
  border-color: var(--line-soft);
  background: #0b141e;
  color: #a8bdca;
  font-size: 13px;
}
.workspace .hdd-channel, .workspace .top-private, .workspace .top-auth {
  display: flex;
  align-items: center;
  gap: 9px;
}
.workspace .hdd-channel { min-width: 0; flex-wrap: wrap; }
.workspace .hdd-channel strong { color: #e1f2f7; }
.workspace .hdd-channel .icon { width: 16px; height: 16px; color: var(--signal); }
.workspace .top-private { gap: 11px; color: #afc4d0; font-size: 12px; }
.workspace .top-auth { gap: 6px; white-space: nowrap; }
.workspace .top-divider { padding: 0 3px; color: #7395a9; }
.workspace .top-private .icon { color: #8eafc0; }
.workspace .top-private .fairy-boot-replay {
  color: #c2dce7;
  background: #101e29;
  border-color: #2c4556;
  border-radius: 4px;
}
.workspace .top-private .fairy-boot-replay:hover {
  color: #e5f9ff;
  background: #173044;
  border-color: #48758c;
}
.workspace .page { max-width: 1350px; padding: 25px clamp(20px, 3.4vw, 46px) 0; }

.fairy-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(226px, .75fr) minmax(0, 1.25fr);
  border: 1px solid #2d4b5f;
  background: var(--graphite);
  scroll-margin-top: 14px;
}
.fairy-panel::before, .fairy-panel::after {
  position: absolute;
  z-index: 2;
  width: 14px;
  height: 14px;
  content: "";
  pointer-events: none;
}
.fairy-panel::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid #b1e9f9;
  border-left: 1px solid #b1e9f9;
}
.fairy-panel::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 1px solid #b1e9f9;
  border-right: 1px solid #b1e9f9;
}
.fairy-visual, .login-art {
  position: relative;
  min-width: 0;
  display: grid;
  overflow: hidden;
}
.fairy-visual {
  grid-template-rows: auto minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
  padding: 16px;
  border-right: 1px solid #2d4b5f;
  background-color: #0b1a27;
  background-image: repeating-linear-gradient(0deg, #d5eff803 0 1px, transparent 1px 4px),
    linear-gradient(0deg, var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, 29px 29px, 29px 29px;
  background-position: center;
}
.fairy-visual::before {
  position: absolute;
  inset: 8px;
  border: 1px solid #78aec11f;
  content: "";
  pointer-events: none;
}
.fairy-ident, .fairy-signal, .fairy-eyebrow, .fairy-status-wrap, .fairy-speaker {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .1em;
}
.fairy-ident {
  position: relative;
  display: flex;
  align-items: center;
  justify-self: stretch;
  gap: 8px;
  color: #c0dce9;
}
.fairy-stripe {
  width: 20px;
  height: 7px;
  flex: none;
  background: repeating-linear-gradient(135deg, #8ed3e8 0 2px, transparent 2px 5px);
}
.fairy-iris { display: block; width: min(100%, 320px); height: auto; overflow: visible; }
.fairy-visual .fairy-core {
  position: relative;
  width: min(100%, 355px);
  max-height: 292px;
  object-fit: contain;
  pointer-events: none;
}
.iris-pupil { filter: drop-shadow(0 0 8px #78c8f7aa); animation: fairy-glow 5s ease-in-out infinite alternate; }
.iris-orbit { transform-origin: 170px 145px; animation: fairy-drift 11s ease-in-out infinite alternate; }
.fairy-signal {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
  color: #a8c2d0;
}
.fairy-signal svg { width: min(37%, 87px); color: #80d0e9; }
.fairy-console {
  display: grid;
  grid-template-rows: auto auto minmax(98px, 1fr) auto auto;
  min-width: 0;
  gap: 9px;
  padding: clamp(16px, 2.35vw, 25px);
}
.fairy-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  min-width: 0;
  gap: 9px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.fairy-eyebrow { margin: 0 0 6px; color: #a5c4d1; }
#fairy-heading {
  color: #edf9fc;
  font-size: clamp(35px, 4.65vw, 53px);
  line-height: .92;
  letter-spacing: -.062em;
  font-weight: 760;
}
#fairy-heading span { color: var(--signal); }
.fairy-status-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border: 1px solid #2d5062;
  border-radius: 3px;
  background: #122938;
  color: #c4e8f5;
  white-space: nowrap;
}
.fairy-led {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 8px #64d5f780;
}
.fairy-status-wrap:has([data-state="busy"]) { color: var(--warning); }
.fairy-status-wrap:has([data-state="busy"]) .fairy-led { background: var(--warning); box-shadow: 0 0 8px #e2c07f80; }
.fairy-log-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding-top: 1px;
  color: #b5c9d4;
  font-size: 12px;
}
.fairy-quiet {
  padding: 1px 3px;
  border: 0;
  background: transparent;
  color: #a7c5d4;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.fairy-quiet:hover { color: #e1f7ff; }
.fairy-transcript {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  min-height: 98px;
  max-height: 175px;
  overflow: auto;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--well);
  scrollbar-color: #426074 #0a151f;
}
.fairy-message {
  min-width: 0;
  padding: 7px 9px;
  border-left: 2px solid #4d8da8;
  background: #102331;
  overflow-wrap: anywhere;
}
.fairy-message.is-user { border-color: #8099a8; background: #162431; }
.fairy-speaker { display: block; margin-bottom: 2px; color: #a4d7e7; }
.fairy-message.is-user .fairy-speaker { color: #beced9; }
.fairy-message-text {
  color: #deedf3;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.fairy-message-text a { text-decoration-color: #80bcd4; text-underline-offset: 3px; }
.fairy-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.fairy-suggestions button {
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid #2e4b5e;
  border-radius: 3px;
  background: #122330;
  color: #bed7e3;
  font-size: 12px;
}
.fairy-suggestions button:hover { background: #173447; border-color: #54869e; color: #e7f8ff; }
.fairy-suggestions button:disabled { cursor: not-allowed; opacity: .55; }
.fairy-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  min-width: 0;
  min-height: 43px;
  border: 1px solid #3f6277;
  border-radius: 4px;
  background: #070f17;
}
.fairy-form:focus-within { border-color: #91d9ef; box-shadow: 0 0 0 1px #64d5f733; }
.fairy-prompt {
  display: flex;
  align-items: center;
  padding-inline: 10px 7px;
  color: #8fdff6;
  font: 700 13px/1 var(--mono);
}
.fairy-form input {
  min-width: 0;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: #e7f8ff;
  caret-color: var(--signal);
  font-size: 14px;
}
.fairy-form input:focus-visible { outline: none; }
.fairy-form input::placeholder { color: #9ab3c2; }
#fairy-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 3px;
  padding: 4px 12px;
  border: 1px solid #a9d8e6;
  border-radius: 3px;
  background: var(--primary);
  color: #09202b;
  font-size: 13px;
  font-weight: 730;
  white-space: nowrap;
}
#fairy-send:hover { background: var(--primary-dark); }
#fairy-send:disabled { cursor: not-allowed; color: #a4b8c4; background: #263744; border-color: #3a4b57; }
#fairy-send .icon { width: 14px; height: 14px; }

.stats {
  gap: 0;
  margin: 15px 0 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--graphite);
}
.stat {
  min-width: 0;
  padding: 14px 16px 13px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.stat + .stat { border-left: 1px solid var(--line); }
.stat-label { color: #b2c9d5; font-size: 12px; }
.stat-label .icon { color: #8fcbe1; }
.stat-value {
  margin-top: 8px;
  color: #e3f5fd;
  font-family: var(--mono);
  font-size: clamp(25px, 2.5vw, 35px);
  letter-spacing: -.065em;
}
.stat-detail { color: #91aabb; line-height: 1.4; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

/* Login geometry and final styling are defined in fairy-login.css. */
.login-layout { grid-template-columns: minmax(365px, .86fr) minmax(0, 1fr); }
.login-panel { background: #0b141e; }
.login-art {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  background-color: #0b1a27;
}
.login-art::before { position: absolute; inset: 26px; content: ""; border: 1px solid #81b4c442; pointer-events: none; }
.visual-index { z-index: 1; color: #c7e4ee; }
.login-route { width: min(90%, 540px); margin: 12px auto 3px; }
.login-art-copy { z-index: 1; justify-self: center; text-align: center; }

@keyframes fairy-glow {
  from { filter: drop-shadow(0 0 5px #74c5f58a); }
  to { filter: drop-shadow(0 0 12px #8bd6f2a5); }
}
@keyframes fairy-drift {
  from { transform: rotate(-7deg); }
  to { transform: rotate(19deg); }
}
@media (max-width: 820px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .workspace .sidebar { padding: 11px 14px 8px; }
  .workspace .sidebar .brand { margin: 0; }
  .workspace .sidebar .brand-mark { width: 31px; height: 31px; }
  .workspace .nav > a { font-size: 12px; gap: 5px; }
  .workspace .nav > a[aria-current] { box-shadow: inset 0 -2px var(--signal); }
  .workspace .topbar { min-height: 44px; padding: 7px 14px; }
  .workspace .page { padding: 13px 14px 0; }
}
@media (max-width: 540px) {
  .workspace .topbar, .workspace .top-private { gap: 7px; }
  .workspace .hdd-channel { font-size: 12px; gap: 5px; }
  .fairy-panel { grid-template-columns: minmax(0, 1fr); }
  .fairy-visual {
    grid-template-columns: minmax(0, 1fr) 126px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    padding: 0 10px;
    border-right: 0;
    border-bottom: 1px solid #2d4b5f;
  }
  .fairy-visual::before { inset: 5px; }
  .fairy-visual .fairy-core { width: 100%; }
  .fairy-ident {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    padding-left: 3px;
    font-size: 9px;
  }
  .fairy-signal { flex-direction: column; align-items: flex-end; gap: 3px; font-size: 9px; text-align: right; }
  .fairy-signal svg { width: min(100%, 58px); }
  .fairy-console { grid-template-rows: auto auto minmax(80px, 1fr) auto auto; gap: 7px; padding: 12px; }
  #fairy-heading { font-size: 38px; }
  .fairy-transcript { min-height: 80px; max-height: 142px; padding: 6px; }
  .fairy-message { padding: 6px 7px; }
  .fairy-suggestions { gap: 4px; }
  .fairy-suggestions button { min-height: 29px; padding-inline: 6px; font-size: 11px; }
  .fairy-form input { font-size: 16px; }
  #fairy-send { padding-inline: 8px; }
  .stats { margin: 11px 0 17px; }
  .stat { padding: 10px 8px; }
  .stat-label { font-size: 11px; }
  .stat-detail { font-size: 10px; }
}
@media (max-width: 480px) {
  .workspace .top-auth { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .iris-pupil, .iris-orbit { animation: none; }
}

.workspace .hdd-channel-code {
  color: var(--signal);
  font: 700 11px/1.3 var(--mono);
  letter-spacing: .13em;
}
.workspace .sidebar .brand-mark { filter: hue-rotate(-55deg) saturate(.8); }

/* H.D.D. node and distribution bays */
#workspace .data-panel,
#workspace #state-error,
#dialog,
#toast.toast {
  --bay-field: #080e15;
  --bay-surface: #0c1722;
  --bay-raised: #0e1b28;
  --bay-border: #22394a;
  --bay-hairline: #1a2e3d;
  --bay-ice: #e3f2f7;
  --bay-muted: #96adbd;
  --bay-cyan: #64d5f7;
  --bay-amber: #f1c68a;
  --bay-red: #ffb6ad;
}

#workspace .data-panel {
  --bay-padding: clamp(14px, 2vw, 24px);
  --bay-gap: clamp(10px, 1.4vw, 19px);
  --bay-columns: minmax(0, 1.02fr) minmax(0, 1.14fr) minmax(0, 1.16fr) minmax(174px, .88fr);
  --link-columns: minmax(0, 1.12fr) minmax(0, .95fr) minmax(0, .9fr) minmax(178px, .94fr);
  position: relative;
  min-width: 0;
  margin-bottom: 20px;
  scroll-margin-top: 16px;
  border: 1px solid var(--bay-border);
  border-radius: 5px;
  background: var(--bay-surface);
  color: var(--bay-ice);
  box-shadow: 0 9px 22px #03080e38;
}
#workspace .data-panel::before,
#workspace .data-panel::after {
  position: absolute;
  z-index: 1;
  width: 13px;
  height: 13px;
  content: "";
  pointer-events: none;
}
#workspace .data-panel::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid #b6e3ee;
  border-left: 1px solid #b6e3ee;
}
#workspace .data-panel::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 1px solid #648c9d;
  border-right: 1px solid #648c9d;
}
#workspace .data-panel .panel-header {
  min-width: 0;
  min-height: 94px;
  align-items: center;
  gap: 14px;
  padding: 17px var(--bay-padding) 16px;
  border-bottom: 1px solid var(--bay-border);
  border-radius: 5px 5px 0 0;
  background:
    repeating-linear-gradient(0deg, #89d9ee04 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at 91% 0%, #1b3448 0%, transparent 52%),
    #101f2c;
}
#workspace .data-panel .panel-header > div { min-width: 0; }
#workspace .data-panel .section-index {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 6px;
  color: #9cd5e4;
  font: 650 10px/1.25 var(--mono);
  letter-spacing: .11em;
}
#workspace .data-panel .section-index::before {
  flex: 0 0 9px;
  height: 1px;
  background: var(--bay-cyan);
  content: "";
}
#workspace .data-panel .panel-header h2 {
  color: var(--bay-ice);
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 720;
  letter-spacing: -.015em;
  line-height: 1.18;
  overflow-wrap: anywhere;
}
#workspace .data-panel .panel-header p {
  margin-top: 6px;
  color: var(--bay-muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
#workspace .data-panel .panel-list {
  container: fairy-data / inline-size;
  min-width: 0;
  border-radius: 0 0 5px 5px;
}
#workspace .data-panel :is(.data-head, .row) {
  display: grid;
  grid-template-columns: var(--bay-columns);
  align-items: center;
  gap: var(--bay-gap);
  padding-inline: var(--bay-padding);
}
#workspace .data-panel :is(.link-head, .link-row) {
  grid-template-columns: var(--link-columns);
}
#workspace .data-panel .data-head {
  min-height: 38px;
  padding-block: 7px;
  background: #09131d;
  border-bottom: 1px solid var(--bay-hairline);
  color: #a0b7c6;
  font: 600 11px/1.4 var(--mono);
  letter-spacing: .045em;
}
#workspace .data-panel .data-head > span:last-child { text-align: end; }
#workspace .data-panel .row {
  min-width: 0;
  min-height: 76px;
  padding-block: 13px;
  border-bottom: 1px solid var(--bay-hairline);
  background: linear-gradient(90deg, #15283955, transparent 28%);
  transition: background .15s ease;
}
#workspace .data-panel .row:is(:hover, :focus-within) { background: #132332; }
#workspace .data-panel .row:last-child {
  border-bottom: 0;
  border-radius: 0 0 5px 5px;
}
#workspace .data-panel .row > div,
#workspace .data-panel .data-cell {
  min-width: 0;
  color: var(--bay-ice);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
#workspace .data-panel .data-identity {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
}
#workspace .data-panel .data-identity > :not(.data-symbol) {
  min-width: 0;
  grid-column: 2;
}
#workspace .data-panel .data-symbol,
#workspace .data-panel .empty-icon {
  display: grid;
  place-items: center;
  border: 1px solid #315161;
  border-radius: 4px;
  background:
    linear-gradient(135deg, #4e9db633 0%, #17334222 63%, #10243200 100%),
    #0c1a26;
  color: #a8e3f1;
}
#workspace .data-panel .data-symbol {
  grid-row: 1 / span 2;
  grid-column: 1;
  width: 36px;
  height: 36px;
}
#workspace .data-panel .data-symbol .icon {
  width: 17px;
  height: 17px;
}
#workspace .data-panel .row-name {
  color: var(--bay-ice);
  font-size: 14px;
  font-weight: 720;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
#workspace .data-panel .row-meta {
  margin-top: 4px;
  color: var(--bay-muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
#workspace .data-panel .row-meta:first-child {
  margin-top: 0;
  margin-bottom: 3px;
}
#workspace .data-panel .mono,
#workspace .data-panel .link-row > .data-cell:nth-child(3) > :not(.row-meta) {
  color: #c9e8f0;
  font: 12px/1.5 var(--mono);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
#workspace .data-panel .tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid #304551;
  border-radius: 3px;
  background: #132531;
  color: #bad0da;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
#workspace .data-panel .tag::before {
  flex: 0 0 6px;
  height: 6px;
  border: 1px solid currentColor;
  border-radius: 50%;
  content: "";
}
#workspace .data-panel .tag.good {
  background: #102c38;
  border-color: #275367;
  color: #a9e8f3;
}
#workspace .data-panel .tag.good::before {
  background: #79dbeb;
  border-color: #79dbeb;
  box-shadow: 0 0 7px #64d5f76a;
}
#workspace .data-panel .tag.warn {
  background: #2b231a;
  border-color: #594329;
  color: var(--bay-amber);
}
#workspace .data-panel .tag.bad {
  background: #302023;
  border-color: #593637;
  color: var(--bay-red);
}
#workspace .data-panel :is(.tag.warn, .tag.bad)::before { background: currentColor; }
#workspace .data-panel .row-actions {
  grid-column: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
#workspace .data-panel .row-actions .btn {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 12px;
}
#workspace .data-panel .row-actions .icon {
  width: 14px;
  height: 14px;
}
#workspace .data-panel .row-actions :is([data-action="probe"], [data-action="copy-link"]):not(:disabled) {
  background: #132c3b;
  border-color: #3b6273;
  color: #bfeef7;
}
#workspace .data-panel .row-actions :is([data-action="probe"], [data-action="copy-link"]):not(:disabled):hover {
  background: #204456;
  border-color: #6eb1c5;
}
#workspace .data-panel .empty {
  align-items: center;
  gap: 15px;
  min-height: 121px;
  padding: 21px var(--bay-padding);
  border-radius: 0 0 5px 5px;
  background: linear-gradient(105deg, #15283975, transparent 66%);
}
#workspace .data-panel .empty > div:last-child { min-width: 0; }
#workspace .data-panel .empty-icon {
  position: relative;
  width: 46px;
  height: 46px;
}
#workspace .data-panel .empty-icon::before {
  position: absolute;
  inset: 4px;
  border: 1px solid #7eb2c022;
  border-radius: 2px;
  pointer-events: none;
  content: "";
}
#workspace .data-panel .empty-icon .icon {
  width: 20px;
  height: 20px;
}
#workspace .data-panel .empty-label {
  display: block;
  margin-bottom: 3px;
  color: #8ab9c9;
  font: 650 9px/1.4 var(--mono);
  letter-spacing: .12em;
  overflow-wrap: anywhere;
}
#workspace .data-panel .empty strong {
  color: var(--bay-ice);
  font-size: 15px;
  font-weight: 720;
  overflow-wrap: anywhere;
}
#workspace .data-panel :is(.empty p, .loading-copy) {
  color: var(--bay-muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
#workspace .data-panel .empty p { margin-top: 4px; }
#workspace .data-panel .loading-copy { padding: 23px var(--bay-padding); }

#workspace .data-panel .btn,
#workspace #state-error .btn,
#dialog .btn {
  min-width: 0;
  background: #112231;
  border: 1px solid #315063;
  border-radius: 4px;
  color: #d9edf4;
  font-weight: 650;
}
#workspace .data-panel .btn:hover,
#workspace #state-error .btn:hover,
#dialog .btn:hover {
  background: #1b374a;
  border-color: #588899;
  color: #effbff;
}
#workspace .data-panel .panel-header > .btn,
#dialog .btn.primary {
  background: #c4edfa;
  border-color: #a5dce9;
  color: #0b2431;
  box-shadow: inset 0 1px #effaff60;
}
#workspace .data-panel .panel-header > .btn:not(:disabled):hover,
#dialog .btn.primary:not(:disabled):hover {
  background: #e2f7ff;
  border-color: #e2f7ff;
  color: #09202b;
}
#workspace .data-panel .btn:disabled,
#dialog .btn:disabled {
  background: #14202a;
  border-color: #293c4b;
  color: #90a5b2;
  box-shadow: none;
  opacity: 1;
}
#workspace .data-panel .btn:focus-visible,
#workspace #state-error .btn:focus-visible,
#dialog :is(.btn, .icon-btn, summary, .check input):focus-visible {
  outline: 2px solid #9ae7f8;
  outline-offset: 2px;
}

/* Matching popovers and form feedback */
#dialog {
  width: min(584px, calc(100% - 28px));
  max-height: min(880px, calc(100dvh - 32px));
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #466679 #0a1420;
  color-scheme: dark;
  border: 1px solid #456779;
  border-radius: 6px;
  background: var(--bay-surface);
  color: var(--bay-ice);
  box-shadow: 0 26px 90px #01060cd9, 0 0 28px #4ca8c118;
}
#dialog::backdrop {
  background: #02060cbd;
  backdrop-filter: blur(3px);
}
#dialog .dialog-head {
  position: sticky;
  z-index: 2;
  top: 0;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 13px clamp(14px, 4vw, 22px);
  border-bottom: 1px solid var(--bay-border);
  background:
    linear-gradient(90deg, #84c4d4, #84c4d400 104px) top left / 100% 1px no-repeat,
    radial-gradient(ellipse at 100% 0, #18394a 0%, transparent 58%),
    #101f2c;
}
#dialog .dialog-head > :first-child { min-width: 0; }
#dialog .dialog-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 5px;
  color: #a6d8e5;
  font: 650 10px/1.25 var(--mono);
  letter-spacing: .12em;
  overflow-wrap: anywhere;
}
#dialog .dialog-kicker::before {
  flex: 0 0 6px;
  height: 6px;
  border: 1px solid #a7dce8;
  content: "";
}
#dialog #dialog-title {
  color: var(--bay-ice);
  font-size: clamp(18px, 4vw, 22px);
  line-height: 1.2;
  font-weight: 730;
  overflow-wrap: anywhere;
}
#dialog .dialog-head .icon-btn {
  flex: 0 0 35px;
  width: 35px;
  height: 35px;
  border: 1px solid #2e4a5d;
  border-radius: 4px;
  background: #0b1823;
  color: #bad7e2;
}
#dialog .dialog-head .icon-btn:hover {
  border-color: #5e8a9a;
  background: #1c3948;
  color: #f0faff;
}
#dialog #dialog-body { padding: 19px clamp(14px, 4vw, 22px) 22px; }
#dialog #dialog-body form {
  min-width: 0;
  gap: 14px;
}
#dialog :is(.field, .share-item > label, .node-picks > legend) {
  color: #daedf4;
  font-size: 13px;
  font-weight: 670;
  overflow-wrap: anywhere;
}
#dialog :is(.field > input, .field > select, .share-url) {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding-inline: 10px;
  border: 1px solid #355365;
  border-radius: 4px;
  background: var(--bay-field);
  color: var(--bay-ice);
  caret-color: var(--bay-cyan);
}
#dialog :is(.field > input, .field > select, .share-url):focus-visible {
  border-color: #8ed7eb;
  outline: 2px solid #64d5f74f;
  outline-offset: 1px;
}
#dialog .field > input::placeholder { color: #8da5b5; }
#dialog .field > input:disabled {
  background: #14212c;
  border-color: #263c4a;
  color: #8da5b5;
}
#dialog .field-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  gap: 10px;
}
#dialog .field-row.endpoint { grid-template-columns: minmax(0, 2.2fr) minmax(68px, .8fr); }
#dialog .quick-paste {
  min-width: 0;
  padding: 10px 12px;
  background: var(--bay-raised);
  border: 1px solid #2f4d5e;
  border-radius: 4px;
}
#dialog .quick-paste summary {
  color: #c3eaf5;
  font-weight: 680;
  overflow-wrap: anywhere;
}
#dialog .quick-paste-controls { min-width: 0; }
#dialog .quick-paste-controls .btn { min-height: 42px; }
#dialog .check {
  min-width: 0;
  color: #d8e9ef;
  overflow-wrap: anywhere;
}
#dialog .check input {
  flex: 0 0 16px;
  accent-color: #98e0f1;
}
#dialog .node-picks {
  min-width: 0;
  padding: 7px 9px 9px;
  border: 1px solid #2c4859;
  border-radius: 4px;
  background: #09141d;
  scrollbar-color: #466679 #09141d;
}
#dialog .node-picks > legend { padding-inline: 6px; }
#dialog .node-picks > .check {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) minmax(0, auto);
  align-items: center;
  min-height: 38px;
  gap: 8px;
  padding: 6px 7px;
  border-radius: 3px;
  font-size: 13px;
}
#dialog .node-picks > .check:focus-within,
#dialog .node-picks > .check:hover { background: #162837; }
#dialog .node-picks .row-meta {
  min-width: 0;
  max-width: 16ch;
  color: var(--bay-muted);
  text-align: end;
  overflow-wrap: anywhere;
}
#dialog .share-item,
#dialog .share-input { min-width: 0; }
#dialog .share-input .btn {
  flex-shrink: 0;
  min-height: 42px;
}
#dialog .share-url {
  font: 12px/1.45 var(--mono);
  background: #0a141d;
  color: #c7e9f4;
}
#dialog .dialog-divider {
  border-color: var(--bay-border);
  margin: 17px 0 13px;
}
#dialog .dialog-note {
  color: var(--bay-muted);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
#dialog .local-note {
  padding: 9px 10px;
  border: 1px solid #5e492d;
  border-left: 2px solid var(--bay-amber);
  border-radius: 4px;
  background: #251f18;
  color: var(--bay-amber);
  overflow-wrap: anywhere;
}
#dialog .dialog-actions {
  gap: 8px;
  margin-top: 7px;
}
#dialog .dialog-actions > .btn {
  min-height: 41px;
  white-space: normal;
}
#dialog .dialog-actions > [data-action="delete-node"] {
  margin-inline-end: auto;
}
#dialog .dialog-actions :is([data-action="delete-node"], [data-action="revoke-link"]):not(:disabled) {
  border-color: #624348;
  color: #ffc1b8;
}
#dialog .dialog-actions :is([data-action="delete-node"], [data-action="revoke-link"]):not(:disabled):hover {
  background: #3b2429;
  border-color: #a96e6e;
}
#dialog .btn.danger:not(:disabled) {
  border-color: #e0988d;
  background: #d9948c;
  color: #271212;
}
#dialog .btn.danger:not(:disabled):hover {
  border-color: #ffc9c1;
  background: #f6b8b0;
}
#workspace #state-error,
#dialog .form-error,
#toast.toast.error {
  border: 1px solid #624348;
  border-left: 2px solid #e39d94;
  background: #271a1f;
  color: var(--bay-red);
}
#workspace #state-error {
  gap: 10px;
  padding: 10px 12px;
  border-radius: 4px;
}
#workspace #state-error > span {
  min-width: 0;
  overflow-wrap: anywhere;
}
#workspace #state-error .btn { flex-shrink: 0; }
#dialog .form-error {
  padding: 9px 11px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}
#toast.toast {
  z-index: 30;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  max-width: min(410px, calc(100% - 32px));
  border: 1px solid #44687a;
  border-left: 2px solid var(--bay-cyan);
  border-radius: 4px;
  background: #11232f;
  color: var(--bay-ice);
  box-shadow: 0 12px 32px #0008;
}

@container fairy-data (max-width: 735px) {
  #workspace .data-panel .data-head { display: none; }
  #workspace .data-panel :is(.row.node-row, .row.link-row, .row) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 9px 14px;
    padding-block: 13px;
  }
  #workspace .data-panel .data-cell[data-label]::before {
    display: block;
    margin-bottom: 5px;
    color: #9ab8c8;
    font: 600 10px/1.35 var(--mono);
    letter-spacing: .025em;
    content: attr(data-label);
  }
  #workspace .data-panel .data-identity[data-label]::before {
    grid-row: 1;
    grid-column: 1 / -1;
  }
  #workspace .data-panel .data-identity[data-label] > .data-symbol { grid-row: 2 / span 2; }
  #workspace .data-panel .row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}
@container fairy-data (max-width: 447px) {
  #workspace .data-panel :is(.row.node-row, .row.link-row, .row) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding-block: 14px;
  }
  #workspace .data-panel .data-identity {
    grid-column: 1 / -1;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--bay-hairline);
  }
  #workspace .data-panel .data-identity[data-label]::before { display: none; }
  #workspace .data-panel .data-identity[data-label] > .data-symbol { grid-row: 1 / span 2; }
  #workspace .data-panel .row-actions .btn { min-height: 40px; }
}
@media (max-width: 540px) {
  #workspace .data-panel { --bay-padding: 13px; }
  #workspace .data-panel .panel-header {
    min-height: 84px;
    align-items: flex-start;
    gap: 9px;
    padding-block: 13px;
  }
  #workspace .data-panel .panel-header > .btn {
    flex-shrink: 0;
    min-height: 39px;
    padding-inline: 8px;
    font-size: 12px;
  }
  #workspace .data-panel .panel-header p { font-size: 12px; }
  #workspace .data-panel .empty {
    min-height: 104px;
    gap: 11px;
    padding-block: 16px;
  }
  #workspace .data-panel .empty-icon { width: 40px; height: 40px; }
  #workspace .data-panel .empty p { font-size: 12px; }
  #dialog :is(.field > input, .field > select, .share-url) { font-size: 16px; }
}
@media (max-width: 380px) {
  #dialog .quick-paste-controls { grid-template-columns: minmax(0, 1fr); }
  #dialog .quick-paste-controls .btn { justify-self: start; }
  #dialog .node-picks .row-meta { max-width: 10ch; }
  #dialog .dialog-actions > .btn { padding-inline: 10px; }
  #dialog .dialog-actions > [data-action="delete-node"] { margin-inline-end: 0; }
}

/* H.D.D. instrument feedback and arrival. */
@media (prefers-reduced-motion: no-preference) {
  /* Retain the dock timing after the shared element leaves the screen. */
  #workspace.hdd-workspace-arrive { --hdd-arrival-delay: 0ms; }
  #workspace.hdd-workspace-arrive.is-docking { --hdd-arrival-delay: 520ms; }
  #workspace.hdd-workspace-arrive .topbar,
  #workspace.hdd-workspace-arrive .sidebar {
    animation: hdd-instrument-arrival 210ms var(--hdd-arrival-delay) ease-out backwards;
  }

  #workspace.hdd-workspace-arrive .fairy-console {
    animation: hdd-instrument-arrival 310ms calc(var(--hdd-arrival-delay) + 35ms) cubic-bezier(.17, .69, .28, 1) backwards;
  }

  #workspace.hdd-workspace-arrive .stats {
    animation: hdd-instrument-arrival 245ms calc(var(--hdd-arrival-delay) + 95ms) cubic-bezier(.17, .69, .28, 1) backwards;
  }

  #workspace.hdd-workspace-arrive .data-panel {
    animation: hdd-instrument-arrival 245ms calc(var(--hdd-arrival-delay) + 130ms) cubic-bezier(.17, .69, .28, 1) backwards;
  }

  /* The bay and core remain stationary so the handoff uses their true bounds. */
  #workspace .fairy-visual::after {
    position: absolute;
    inset: 0;
    content: "";
    opacity: 0;
    pointer-events: none;
    background: linear-gradient(180deg, transparent 45%, #80d4ec16 49.5%, #a5eaff5c 50%, #80d4ec0d 50.5%, transparent 55%);
  }

  #workspace.hdd-workspace-arrive .fairy-visual::after {
    animation: hdd-bay-acquire 355ms var(--hdd-arrival-delay) cubic-bezier(.2, .54, .37, 1) backwards;
  }

  #workspace .fairy-signal svg {
    animation: hdd-signal-idle 8s ease-in-out infinite;
  }

  #workspace .fairy-status-wrap:has([data-state="busy"]) .fairy-led {
    animation: hdd-signal-busy 760ms ease-in-out infinite alternate;
  }

  #workspace .nav > a {
    position: relative;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
  }

  #workspace .nav > a[aria-current]::after {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 3px;
    height: 3px;
    content: "";
    border-radius: 1px;
    background: var(--signal);
    box-shadow: 0 0 6px #64d5f771;
    animation: hdd-channel-selected 320ms ease-out both;
  }

  #workspace :is(.btn, .logout, .fairy-suggestions button, #fairy-send, .fairy-boot-replay),
  #dialog :is(.btn, .icon-btn) {
    transition: background 145ms ease, border-color 145ms ease, color 145ms ease, transform 125ms ease;
  }

  #workspace :is(.btn, .logout, .fairy-suggestions button, #fairy-send, .fairy-boot-replay):active:not(:disabled),
  #dialog :is(.btn, .icon-btn):active:not(:disabled) {
    transform: translateY(1px);
  }

  #workspace .data-panel .row {
    transition: background-color 165ms ease, box-shadow 165ms ease;
  }

  #workspace .data-panel .row:has([data-action="edit-node"]:disabled) {
    background-color: #102a37;
    box-shadow: inset 2px 0 #4c9aab;
  }

  #workspace .data-panel .tag.is-probing::before {
    background: var(--signal);
    animation: hdd-signal-busy 640ms ease-in-out infinite alternate;
  }

  #workspace .data-panel:target .section-index {
    animation: hdd-panel-select 550ms ease-out backwards;
  }

  #workspace .fairy-message {
    animation: hdd-log-arrival 185ms ease-out backwards;
  }

  #dialog[open] { animation: hdd-dialog-arrival 225ms cubic-bezier(.18, .7, .26, 1) backwards; }
  #dialog[open]::backdrop { animation: hdd-dialog-backdrop 200ms ease-out backwards; }

  #dialog[open] #dialog-body > :first-child {
    animation: hdd-log-arrival 180ms ease-out backwards;
  }

  #toast.toast:not([hidden]) {
    animation: hdd-toast-arrival 205ms cubic-bezier(.15, .68, .26, 1) backwards;
  }

  @keyframes hdd-instrument-arrival {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @keyframes hdd-bay-acquire {
    from { opacity: 0; transform: translateY(-52%); }
    32% { opacity: .84; }
    74% { opacity: .35; }
    to { opacity: 0; transform: translateY(52%); }
  }

  @keyframes hdd-signal-idle {
    0%, 100% { opacity: .88; }
    42% { opacity: .99; }
    56% { opacity: .79; }
  }

  @keyframes hdd-signal-busy {
    from { opacity: .52; }
    to { opacity: 1; }
  }

  @keyframes hdd-channel-selected {
    0% { opacity: .1; transform: scale(.56); }
    46% { opacity: 1; transform: scale(1.25); }
    100% { opacity: .85; transform: scale(1); }
  }

  @keyframes hdd-log-arrival {
    from { opacity: .55; }
    to { opacity: 1; }
  }

  @keyframes hdd-panel-select {
    0% { opacity: .55; }
    36% { color: #e0f8ff; text-shadow: 0 0 7px #64d5f78f; }
    100% { opacity: 1; }
  }

  @keyframes hdd-dialog-arrival {
    from { opacity: .22; transform: translateY(7px) scale(.991); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  @keyframes hdd-dialog-backdrop {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @keyframes hdd-toast-arrival {
    from { opacity: .33; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
