:root {
  color-scheme: dark;
  --bg: #080a0e;
  --panel: rgba(18, 21, 27, 0.84);
  --panel-solid: #11141a;
  --line: rgba(255, 255, 255, 0.085);
  --muted: #858b96;
  --text: #f5f6f7;
  --orange: #f28a63;
  --orange-deep: #c95334;
  --cyan: #72d5c9;
  --danger: #ff5b62;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button, input, textarea { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  pointer-events: none;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(150px);
  opacity: 0.11;
}
.ambient-one { top: -240px; right: 12%; background: var(--orange); }
.ambient-two { bottom: -300px; left: 10%; background: #369f96; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 92px 1fr; }

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(7, 9, 12, 0.92);
  backdrop-filter: blur(22px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 12px;
  z-index: 5;
}

.brand { display: flex; flex-direction: column; align-items: center; gap: 9px; text-align: center; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center;
  font: 700 20px/1 Georgia, serif;
  color: #111; background: var(--orange);
  box-shadow: 0 0 24px rgba(242, 138, 99, 0.23);
}
.brand strong { display: block; font-size: 10px; letter-spacing: .17em; }
.brand span { display: block; margin-top: 3px; font-size: 6px; color: var(--muted); letter-spacing: .15em; }

.rail-nav { margin-top: 64px; display: grid; gap: 12px; width: 100%; }
.rail-button {
  background: transparent; border: 1px solid transparent; border-radius: 13px;
  min-height: 62px; display: grid; place-items: center; align-content: center; gap: 4px;
  color: var(--muted); cursor: pointer; transition: .2s ease;
}
.rail-button span { font-size: 22px; }
.rail-button small { font-size: 8px; letter-spacing: .15em; }
.rail-button:hover, .rail-button.active { color: var(--text); background: #171a20; border-color: var(--line); }
.rail-button.active span { color: var(--orange); }

.rail-bottom { margin-top: auto; display: grid; justify-items: center; gap: 7px; color: var(--muted); }
.rail-bottom small { font-size: 7px; letter-spacing: .17em; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: #555; box-shadow: 0 0 0 4px rgba(255,255,255,.03); }
.connection-dot.online { background: var(--cyan); box-shadow: 0 0 16px rgba(114, 213, 201, .55); }

.workspace { min-width: 0; padding: 25px clamp(18px, 3vw, 48px) 36px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.eyebrow { color: var(--orange); font-size: 9px; letter-spacing: .22em; font-weight: 700; }
h1 { margin: 5px 0 0; font-size: clamp(25px, 3vw, 38px); letter-spacing: -.04em; font-weight: 560; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.button {
  min-height: 44px; border-radius: 12px; border: 1px solid var(--line); padding: 0 16px;
  font-size: 10px; font-weight: 750; letter-spacing: .09em; cursor: pointer; transition: .2s ease;
}
.button:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.18); }
.button.ghost { background: #15181e; }
.button.danger { background: rgba(255,91,98,.09); color: #ff7d82; border-color: rgba(255,91,98,.2); }
.button.loading .refresh-symbol { display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .08em; cursor: pointer; }
.toggle input { display: none; }
.toggle > span { width: 30px; height: 17px; border-radius: 20px; background: #242832; border: 1px solid var(--line); position: relative; transition: .2s; }
.toggle > span::after { content: ""; position: absolute; width: 11px; height: 11px; border-radius: 50%; left: 2px; top: 2px; background: #747b86; transition: .2s; }
.toggle input:checked + span { background: rgba(242,138,99,.25); border-color: rgba(242,138,99,.4); }
.toggle input:checked + span::after { transform: translateX(13px); background: var(--orange); }
.toggle.compact { font-size: 8px; }

.status-strip {
  margin-top: 24px; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(24,27,34,.96), rgba(12,14,19,.9));
  min-height: 82px; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 22px;
}
.status-main { display: flex; align-items: center; gap: 13px; }
.status-main strong, .status-main span { display: block; }
.status-main strong { font-size: 13px; margin-bottom: 4px; }
.status-main span:not(.pulse) { color: var(--muted); font-size: 11px; }
.pulse { width: 11px; height: 11px; border-radius: 50%; background: #777; position: relative; }
.pulse.online { background: var(--cyan); box-shadow: 0 0 16px rgba(114,213,201,.45); }
.pulse.online::after { content: ""; position: absolute; inset: -5px; border: 1px solid rgba(114,213,201,.3); border-radius: 50%; animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }
.status-metrics { display: flex; gap: clamp(22px, 5vw, 64px); }
.status-metrics div { display: grid; gap: 3px; text-align: right; }
.status-metrics span { font: 500 18px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.status-metrics small { color: var(--muted); font-size: 7px; letter-spacing: .15em; }

.content-grid { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: stretch; }
.node-panel, .activity-panel, .composer { border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(22px); border-radius: var(--radius); }
.node-panel { min-height: 390px; padding: 21px; }
.panel-heading, .activity-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-heading > div:first-child, .activity-heading > div { display: flex; align-items: flex-start; gap: 12px; }
.section-number { font: 500 9px/1 ui-monospace, monospace; color: var(--orange); padding-top: 5px; }
h2 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.panel-heading p { margin: 4px 0 0; font-size: 10px; color: var(--muted); }
.search-wrap { width: 190px; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line); background: #0e1116; }
.search-wrap span { color: var(--muted); font-size: 18px; }
.search-wrap input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 11px; }

.node-grid { margin-top: 19px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; max-height: 355px; overflow: auto; padding-right: 5px; }
.node-grid::-webkit-scrollbar, .timeline::-webkit-scrollbar { width: 5px; }
.node-grid::-webkit-scrollbar-thumb, .timeline::-webkit-scrollbar-thumb { background: #343945; border-radius: 10px; }
.node-card {
  position: relative; min-height: 104px; border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  background: linear-gradient(145deg, #171a20, #11141a); text-align: left; cursor: pointer; overflow: hidden; transition: .22s ease;
}
.node-card::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 2px; background: #474c56; border-radius: 3px; }
.node-card:hover { transform: translateY(-2px); border-color: rgba(242,138,99,.27); }
.node-card.selected { border-color: rgba(242,138,99,.55); box-shadow: inset 0 0 0 1px rgba(242,138,99,.08), 0 10px 32px rgba(0,0,0,.2); }
.node-card.selected::before, .node-card.available::before { background: var(--orange); }
.node-card.new::after { content: "NEW"; position: absolute; top: 10px; right: 10px; color: var(--orange); font-size: 7px; letter-spacing: .12em; }
.node-top { display: flex; align-items: center; justify-content: space-between; }
.node-orb { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: rgba(242,138,99,.08); color: var(--orange); }
.node-state { width: 6px; height: 6px; border-radius: 50%; background: #515660; }
.node-card.available .node-state { background: var(--cyan); box-shadow: 0 0 9px rgba(114,213,201,.5); }
.node-card h3 { margin: 13px 0 5px; font-size: 11px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-card p { margin: 0; color: var(--muted); font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.empty-state { min-height: 260px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.empty-state span { font-size: 36px; color: #3d424c; }
.empty-state strong { margin-top: 10px; color: var(--text); font-size: 13px; }
.empty-state p { font-size: 10px; }
.hidden { display: none !important; }

.activity-panel { padding: 21px 16px; min-width: 0; }
.activity-heading { padding: 0 4px; }
.icon-button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: #171a20; cursor: pointer; color: var(--muted); }
.timeline { margin-top: 18px; max-height: 348px; overflow: auto; padding: 0 3px 0 4px; }
.timeline-item { position: relative; display: grid; grid-template-columns: 10px 1fr; gap: 10px; padding-bottom: 18px; }
.timeline-item:not(:last-child)::after { content: ""; position: absolute; left: 4px; top: 11px; bottom: 2px; width: 1px; background: var(--line); }
.timeline-item > span { width: 8px; height: 8px; margin-top: 2px; border-radius: 50%; background: #6b717b; z-index: 1; }
.timeline-item.success > span { background: var(--cyan); }
.timeline-item.error > span { background: var(--danger); }
.timeline-item.warning > span { background: #e7b75f; }
.timeline-item strong, .timeline-item small { display: block; }
.timeline-item strong { font-size: 10px; font-weight: 600; line-height: 1.35; }
.timeline-item small { margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.45; }

.composer { margin-top: 18px; padding: 17px 19px; }
.target-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.target-badge { display: flex; align-items: center; gap: 10px; }
.target-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: rgba(242,138,99,.1); color: var(--orange); }
.target-badge small, .target-badge strong { display: block; }
.target-badge small { color: var(--muted); font-size: 7px; letter-spacing: .14em; }
.target-badge strong { margin-top: 3px; font-size: 11px; }
.input-surface { display: grid; grid-template-columns: 1fr auto; border: 1px solid var(--line); border-radius: 15px; background: #0d1015; overflow: hidden; }
.input-surface:focus-within { border-color: rgba(242,138,99,.38); box-shadow: 0 0 0 3px rgba(242,138,99,.05); }
.input-surface textarea { resize: none; min-height: 82px; padding: 16px; background: transparent; color: var(--text); border: 0; outline: 0; font-size: 12px; line-height: 1.55; }
.input-surface textarea::placeholder { color: #555c67; }
.input-actions { padding: 12px; display: flex; align-items: flex-end; gap: 8px; }
.round-button { width: 40px; height: 40px; border-radius: 12px; background: #1a1e25; border: 1px solid var(--line); cursor: pointer; color: var(--muted); font-size: 20px; }
.round-button.mic { color: var(--orange); font-size: 13px; }
.round-button.mic.listening { animation: mic 1s ease-in-out infinite alternate; background: rgba(242,138,99,.16); }
@keyframes mic { to { box-shadow: 0 0 20px rgba(242,138,99,.35); transform: scale(1.05); } }
.send-button { height: 40px; min-width: 165px; border: 0; border-radius: 12px; background: var(--orange); color: #17100d; font-size: 9px; font-weight: 850; letter-spacing: .09em; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 13px; }
.send-button:hover { background: #ff9d77; }
.send-button:disabled { opacity: .45; cursor: wait; }
.send-button b { font-size: 16px; }
.composer-hint { margin: 8px 2px 0; color: #646b76; font-size: 8px; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 7px; }
.attachment-list:not(:empty) { margin-bottom: 10px; }
.attachment-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #171a20; border-radius: 10px; padding: 7px 9px; font-size: 9px; }
.attachment-chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }

.toast-stack { position: fixed; right: 22px; bottom: 22px; display: grid; gap: 9px; z-index: 20; }
.toast { width: min(360px, calc(100vw - 44px)); border: 1px solid var(--line); border-left: 3px solid var(--orange); background: #171a20; border-radius: 12px; padding: 12px 14px; box-shadow: 0 18px 50px rgba(0,0,0,.35); animation: toast-in .22s ease-out; }
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--cyan); }
.toast strong { font-size: 10px; }
.toast p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1050px) {
  .content-grid { grid-template-columns: 1fr; }
  .activity-panel { min-height: 210px; }
  .timeline { max-height: 180px; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; height: 62px; inset: auto 10px 10px; width: auto; border: 1px solid var(--line); border-radius: 16px; padding: 6px 10px; flex-direction: row; z-index: 10; }
  .brand { display: none; }
  .rail-nav { margin: 0; display: flex; width: auto; }
  .rail-button { min-height: 46px; min-width: 72px; }
  .rail-button span { font-size: 17px; }
  .rail-bottom { margin: 0 0 0 auto; padding-left: 12px; }
  .workspace { padding: 18px 14px 95px; }
  .topbar, .status-strip { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .button { flex: 1; }
  .status-metrics { width: 100%; justify-content: space-between; }
  .panel-heading { align-items: stretch; flex-direction: column; }
  .search-wrap { width: 100%; }
  .node-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .input-surface { grid-template-columns: 1fr; }
  .input-actions { padding-top: 0; }
  .send-button { margin-left: auto; }
}

@media (max-width: 460px) {
  .node-grid { grid-template-columns: 1fr; }
  .topbar-actions .toggle { width: 100%; }
  .send-button { min-width: 140px; }
}

