:root {
  color-scheme: dark;
  --bg: #050707;
  --rail: #080b0c;
  --panel: #0d1112;
  --panel-2: #111718;
  --panel-3: #151c1d;
  --line: #273234;
  --line-soft: #182123;
  --text: #f4f1e8;
  --muted: #a7aaa3;
  --dim: #70776f;
  --accent: #e4b338;
  --accent-soft: #5b430e;
  --ok: #61d348;
  --warning: #ffc44d;
  --critical: #ff6b62;
  --shadow: 0 18px 44px rgb(0 0 0 / 28%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

h1,
h2,
h3,
p {
  margin: 0;
}

code,
pre,
textarea {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.app-shell,
.console-shell {
  min-height: 100vh;
}

.console-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  background:
    linear-gradient(90deg, rgb(228 179 56 / 7%), transparent 24rem),
    radial-gradient(circle at top right, rgb(97 211 72 / 5%), transparent 34rem),
    var(--bg);
}

.side-rail {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  padding: 18px 8px;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #070a0b, var(--rail));
}

.rail-brand,
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rail-brand {
  padding: 0 14px 20px;
  color: var(--accent);
  font-size: 1.26rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.brand-cube {
  position: relative;
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  flex: 0 0 auto;
}

.brand-cube span {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--accent);
  background: rgb(228 179 56 / 18%);
  transform: rotate(30deg) skewY(-18deg);
}

.brand-cube span:nth-child(1) {
  top: 2px;
  left: 8px;
}

.brand-cube span:nth-child(2) {
  top: 13px;
  left: 2px;
  opacity: .9;
}

.brand-cube span:nth-child(3) {
  top: 13px;
  right: 2px;
  opacity: .72;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rail-nav button,
.app-row,
.quick-actions button,
.soft-button,
.icon-button,
.text-action,
.terminal-form button,
.login-form button,
.stack-form button,
.ghost-button {
  border: 1px solid transparent;
  color: var(--text);
  background: transparent;
}

.rail-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 6px;
  color: #d8dbd3;
  text-align: left;
}

.rail-nav button:hover,
.rail-nav button.active {
  border-color: rgb(228 179 56 / 35%);
  background: linear-gradient(90deg, rgb(228 179 56 / 28%), rgb(228 179 56 / 6%));
  color: var(--accent);
}

.rail-status {
  margin: 16px 6px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b1011;
}

.rail-status strong,
.rail-status span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rail-status strong {
  margin-bottom: 10px;
  font-size: .86rem;
}

.rail-status span {
  color: var(--ok);
  font-size: .8rem;
}

.main-stage {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: rgb(5 7 7 / 88%);
  backdrop-filter: blur(14px);
}

.title-area h1,
.login-panel h1 {
  font-size: 1.34rem;
  line-height: 1.12;
  font-weight: 760;
}

.title-area p,
.login-panel p {
  margin-top: 4px;
  color: var(--accent);
  font-size: .72rem;
  font-weight: 760;
  letter-spacing: .08em;
}

.top-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  white-space: nowrap;
}

.content-wrap {
  padding: 10px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 270px minmax(480px, 1fr) minmax(360px, .78fr);
  gap: 8px;
  align-items: stretch;
  height: calc(100vh - 96px);
  min-height: 690px;
  max-height: 820px;
}

.left-stack,
.right-stack {
  display: grid;
  gap: 8px;
  align-content: start;
}

.right-stack {
  grid-template-rows: minmax(260px, 1fr) minmax(250px, .9fr);
  min-height: 0;
}

.bottom-grid,
.account-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tool-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(180deg, rgb(21 28 29 / 94%), rgb(10 14 15 / 98%));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.panel-title h2 {
  font-size: 1rem;
  line-height: 1.2;
}

.tool-actions,
.panel-title span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .82rem;
}

.icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--warning);
  box-shadow: 0 0 0 3px rgb(255 196 77 / 10%);
  flex: 0 0 auto;
}

.status-ok {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgb(97 211 72 / 12%);
}

.status-critical {
  background: var(--critical);
  box-shadow: 0 0 0 3px rgb(255 107 98 / 12%);
}

.soft-button,
.icon-button,
.text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border-color: var(--line);
  border-radius: 6px;
  background: #101617;
  color: var(--text);
}

.icon-button {
  width: 34px;
  padding: 0;
}

.text-action {
  min-height: 28px;
  padding: 0 8px;
  color: var(--accent);
  font-size: .78rem;
}

select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #070a0b;
  color: var(--text);
}

select,
input {
  min-height: 34px;
  padding: 0 10px;
}

.app-stack {
  display: grid;
}

.app-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
}

.app-row:hover {
  background: rgb(228 179 56 / 8%);
}

.app-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent);
  background: #080c0d;
}

.app-row strong,
.app-row small,
.app-row em {
  display: block;
}

.app-row strong {
  font-size: .88rem;
}

.app-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: .76rem;
}

.app-row em {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  color: var(--ok);
  font-size: .75rem;
  font-style: normal;
}

.quick-actions {
  padding-bottom: 8px;
}

.quick-actions button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 18px);
  min-height: 38px;
  margin: 7px 9px 0;
  padding: 0 10px;
  border-color: var(--line);
  border-radius: 5px;
  background: #101617;
  text-align: left;
}

.path-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 35px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: .78rem;
}

.path-bar code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.path-bar span {
  color: var(--accent);
  white-space: nowrap;
}

.file-grid {
  display: grid;
  grid-template-columns: minmax(260px, 42%) minmax(0, 1fr);
  min-height: 560px;
}

.compact-tool .file-grid {
  min-height: 0;
}

.dashboard-grid > .file-tool,
.dashboard-grid .right-stack,
.dashboard-grid .left-stack {
  height: 100%;
  min-height: 0;
}

.compact-tool.file-tool {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.compact-tool.terminal-tool,
.compact-tool.browser-tool {
  min-height: 0;
}

.full-tool .file-grid {
  min-height: calc(100vh - 180px);
}

.file-list {
  border-right: 1px solid var(--line);
  overflow: auto;
}

.file-heading,
.file-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 64px 54px;
  gap: 8px;
  align-items: center;
}

.compact-tool .file-heading,
.compact-tool .file-row {
  grid-template-columns: 24px minmax(0, 1fr) 58px;
}

.compact-tool .file-heading span:last-child,
.compact-tool .file-row time {
  display: none;
}

.file-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 31px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line-soft);
  background: #0b1011;
  color: var(--muted);
  font-size: .72rem;
}

.file-heading span:first-child {
  grid-column: 1 / 3;
}

.file-row {
  width: 100%;
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-bottom: 1px solid rgb(39 50 52 / 45%);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.file-row:hover,
.file-row.selected {
  background: rgb(228 179 56 / 11%);
}

.file-row span {
  color: var(--accent);
}

.file-row strong,
.file-row small,
.file-row time {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .78rem;
}

.file-row small,
.file-row time {
  color: var(--muted);
}

.editor-pane {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  background: #070a0b;
}

.editor-tabs,
.editor-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 31px;
  padding: 0 9px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: .76rem;
}

.editor-tabs span {
  color: var(--text);
}

.editor-tabs em {
  color: var(--accent);
  font-style: normal;
}

.editor-status {
  border-top: 1px solid var(--line-soft);
  border-bottom: 0;
}

textarea {
  width: 100%;
  min-height: 100%;
  padding: 12px;
  border: 0;
  border-radius: 0;
  resize: none;
  outline: none;
  background: #070a0b;
  color: #dfe7db;
  font-size: .82rem;
  line-height: 1.55;
}

.editor-empty,
.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 200px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.editor-empty strong {
  margin-top: 12px;
  color: var(--text);
}

.editor-empty span {
  margin-top: 5px;
  font-size: .84rem;
}

.terminal-tool {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 310px;
}

.full-tool.terminal-tool {
  min-height: calc(100vh - 106px);
}

.terminal-screen {
  min-height: 0;
  padding: 10px;
  overflow: auto;
  background: #050707;
}

.terminal-entry {
  margin-bottom: 12px;
  color: #dfe7db;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: .78rem;
  line-height: 1.45;
}

.terminal-entry pre {
  margin: 4px 0;
  overflow: auto;
  white-space: pre-wrap;
}

.terminal-entry small {
  color: var(--dim);
}

.ok-text {
  color: var(--ok);
}

.warn-text,
.stderr {
  color: var(--critical);
}

.terminal-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border-top: 1px solid var(--line);
  background: #0b1011;
}

.terminal-form span {
  color: var(--accent);
}

.terminal-form input {
  width: 100%;
}

.terminal-form button,
.login-form button,
.stack-form button {
  min-height: 36px;
  padding: 0 14px;
  border-color: rgb(228 179 56 / 55%);
  border-radius: 5px;
  background: linear-gradient(180deg, #e7bd4b, #af7f12);
  color: #120e04;
  font-weight: 760;
}

.browser-tool {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 300px;
}

.full-tool.browser-tool {
  min-height: calc(100vh - 106px);
}

.browser-tool iframe {
  width: 100%;
  height: 100%;
  min-height: 260px;
  border: 0;
  background: #020303;
}

.full-tool.browser-tool iframe {
  min-height: calc(100vh - 152px);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.data-table th,
.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--text);
  font-weight: 680;
  background: #0b1011;
}

.data-table td:first-child {
  color: var(--text);
}

.data-table td span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.check-list {
  display: grid;
  padding: 8px 10px 10px;
}

.check-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  border-bottom: 1px solid var(--line-soft);
}

.check-list span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.check-list small {
  color: var(--muted);
}

.kv {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.kv div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 8px;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  text-align: right;
}

.stack-form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.stack-form label,
.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .84rem;
}

.stack-form p,
.form-note {
  color: var(--accent);
  font-size: .86rem;
}

.login-shell,
.boot-panel {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at top left, rgb(228 179 56 / 13%), transparent 30rem),
    var(--bg);
}

.login-panel,
.boot-panel {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
}

.login-panel {
  padding: 22px;
}

.boot-panel {
  min-height: auto;
  padding: 30px;
  text-align: center;
}

.boot-panel h1 {
  margin-top: 16px;
}

.boot-panel p {
  margin-top: 8px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.ghost-button {
  min-height: 36px;
  border-color: var(--line);
  border-radius: 5px;
  background: #101617;
  color: var(--text);
}

.login-brand .brand-cube {
  width: 40px;
  height: 40px;
}

@media (max-width: 1320px) {
  .dashboard-grid {
    grid-template-columns: 250px minmax(420px, 1fr);
    height: auto;
    max-height: none;
  }

  .right-stack {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
}

@media (max-width: 980px) {
  .console-shell {
    grid-template-columns: 1fr;
  }

  .side-rail {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .rail-nav {
    flex-direction: row;
    overflow-x: auto;
  }

  .rail-nav button {
    width: auto;
    min-width: 120px;
  }

  .rail-status {
    display: none;
  }

  .dashboard-grid,
  .right-stack,
  .bottom-grid,
  .account-grid,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .file-grid {
    grid-template-columns: 1fr;
  }

  .file-list {
    max-height: 300px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .content-wrap {
    padding: 6px;
  }

  .top-status {
    flex-wrap: wrap;
    white-space: normal;
  }

  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .tool-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  select {
    width: 100%;
  }

  .file-heading,
  .file-row {
    grid-template-columns: 24px minmax(0, 1fr) 56px;
  }

  .file-heading span:last-child,
  .file-row time {
    display: none;
  }
}
