:root {
  --bg: #0b1118;
  --bg2: #111c28;
  --card: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.2);
  --line-soft: rgba(255, 255, 255, 0.1);
  --text: #e9f0f8;
  --muted: #9cb2c8;
  --accent: #3dc8c5;
  --accent2: #ff9d5a;
  --ok: #61d394;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Noto Sans SC", "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 15% -5%, #173449 0%, transparent 60%),
    radial-gradient(1000px 600px at 90% 0%, #3d2a1d 0%, transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg2));
  min-height: 100vh;
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(61, 200, 197, 0.05), transparent 35%),
    linear-gradient(330deg, rgba(255, 157, 90, 0.07), transparent 40%);
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 18px 56px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #081218;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.2rem, 2.6vw, 1.8rem);
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pill {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
}

.ghost-btn {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease;
}

.ghost-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.workspace {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  padding: 14px;
  backdrop-filter: blur(6px);
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
}

.sidebar {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.tree-nav {
  font-size: 14px;
}

.tree-root {
  margin: 0 0 8px;
  font-weight: 700;
  color: #d7e8fb;
}

.tree-company {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  margin-bottom: 10px;
  overflow: hidden;
}

.tree-company > summary {
  cursor: pointer;
  padding: 9px 11px;
  list-style: none;
  font-weight: 600;
}

.tree-company > summary::-webkit-details-marker {
  display: none;
}

.tree-company > summary::before {
  content: "▸";
  margin-right: 8px;
  color: var(--accent);
}

.tree-company[open] > summary::before {
  content: "▾";
}

.tree-list {
  margin: 0;
  padding: 0 10px 8px 18px;
  list-style: none;
}

.tree-list li {
  margin-top: 6px;
  position: relative;
}

.tree-list li::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 11px;
  width: 8px;
  border-top: 1px solid var(--line-soft);
}

.tree-link {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.22);
  color: #dbe9f8;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  transition: border-color .2s ease, background .2s ease;
}

.tree-link:hover {
  border-color: var(--accent);
}

.tree-link.active {
  border-color: var(--accent2);
  background: rgba(255, 157, 90, 0.15);
  color: #fff3e8;
}

.tree-group {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.015);
}

.tree-group > summary {
  cursor: pointer;
  list-style: none;
  padding: 7px 10px;
  font-size: 13px;
  color: #cfe2f7;
}

.tree-group > summary::-webkit-details-marker {
  display: none;
}

.tree-group > summary::before {
  content: "▸";
  margin-right: 6px;
  color: var(--accent);
}

.tree-group[open] > summary::before {
  content: "▾";
}

.tree-group-list {
  margin: 0;
  padding: 0 8px 8px 14px;
  list-style: none;
}

.tree-group-list li {
  margin-top: 6px;
}

.tree-group-list li:first-child {
  margin-top: 4px;
}

.tree-group-list .tree-link {
  width: 100%;
}

.tree-empty {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.detail {
  min-height: 560px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.detail-title {
  margin: 0;
  font-size: 1.15rem;
}

.detail-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.intro {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.22);
}

.stat .k {
  color: var(--muted);
  font-size: 12px;
}

.stat .v {
  margin-top: 5px;
  font-weight: 700;
}

.block {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  padding: 12px;
  margin-bottom: 12px;
}

.block h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.trend-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.trend-list li {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.trend-list strong {
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
}

.card {
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.24);
  border-radius: 10px;
  padding: 10px;
}

.card h4 {
  margin: 0;
  font-size: 14px;
}

.card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.rowline {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.org-tree {
  margin: 0;
  padding-left: 16px;
  list-style: none;
}

.org-tree li {
  margin: 6px 0;
  position: relative;
}

.org-tree li::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 11px;
  width: 8px;
  border-top: 1px solid var(--line-soft);
}

.node {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
  font-size: 13px;
}

.node.root {
  border-color: var(--accent2);
  background: rgba(255, 157, 90, 0.14);
}

.node.major {
  border-color: var(--accent);
}

.tag {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  color: #d8e8f7;
  background: rgba(255, 255, 255, 0.04);
}

.tagline {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.radial-wrap {
  display: grid;
  gap: 12px;
}

.radial-stage {
  position: relative;
  width: min(100%, 520px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 50%;
  border: 1px dashed var(--line-soft);
  background:
    radial-gradient(circle at center, rgba(61, 200, 197, 0.08) 0 18%, transparent 19% 100%);
}

.radial-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 118px;
  min-height: 78px;
  border-radius: 14px;
  border: 1px solid var(--accent2);
  background: rgba(255, 157, 90, 0.15);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 8px;
  font-size: 12px;
}

.radial-node {
  position: absolute;
  left: calc(50% + var(--x) * 1%);
  top: calc(50% + var(--y) * 1%);
  transform: translate(-50%, -50%);
  width: 120px;
  min-height: 66px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.32);
  color: var(--text);
  padding: 7px;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}

.radial-node strong {
  display: block;
  font-size: 12px;
}

.radial-node small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.radial-node.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(61, 200, 197, 0.35) inset;
}

.auth-card {
  max-width: 420px;
  margin: 36px auto;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label {
  font-size: 12px;
  color: var(--muted);
}

.auth-form input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  padding: 9px 10px;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.warn {
  color: var(--accent2);
}

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

.linkish {
  color: var(--accent);
  text-decoration: none;
}

.linkish:hover {
  text-decoration: underline;
}

.ring-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.ring-card {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.24);
  display: grid;
  justify-items: center;
  gap: 8px;
}

.ring {
  --percent: 0;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background:
    conic-gradient(var(--ring-color) calc(var(--percent) * 1%), rgba(255, 255, 255, 0.12) 0);
  transition: background 0.3s ease;
}

.ring::after {
  content: "";
  position: absolute;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: #0f1823;
  border: 1px solid var(--line-soft);
}

.ring span {
  position: relative;
  z-index: 1;
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
  font-weight: 700;
}

.ring.green { --ring-color: #61d394; }
.ring.yellow { --ring-color: #ffcc66; }
.ring.red { --ring-color: #ff6b6b; }

.ring-label {
  font-size: 13px;
  color: #dbe7f5;
}

.ring-detail {
  font-size: 12px;
  color: var(--muted);
}

.plain-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  display: grid;
  gap: 6px;
}

.command-form {
  display: grid;
  gap: 10px;
}

.command-form-row {
  display: grid;
  gap: 6px;
}

.command-form label {
  font-size: 12px;
  color: var(--muted);
}

.command-form input,
.command-form textarea,
.command-form select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  padding: 9px 10px;
  font-family: "Noto Sans SC", "Space Grotesk", sans-serif;
}

.command-form select[multiple] {
  min-height: 140px;
}

.command-form-actions {
  display: flex;
  justify-content: flex-end;
}

.command-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.command-chip {
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 220px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 2px;
}

.command-chip strong {
  font-size: 13px;
}

.command-chip small {
  font-size: 11px;
  color: var(--muted);
}

.chip-red { border-color: #ff6b6b; }
.chip-yellow { border-color: #ffcc66; }
.chip-blue { border-color: #5fb7ff; }
.chip-green { border-color: #61d394; }
.chip-neutral { border-color: var(--line-soft); }

.mini-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  font-size: 11px;
}

.command-global-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.table-wrap {
  overflow: auto;
}

.node-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

.node-table th,
.node-table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 8px;
  text-align: left;
  font-size: 12px;
}

.node-table th {
  color: #dbe8f8;
}

.node-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.command-dept-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.command-dept-col {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.command-dept-col h4 {
  margin: 0 0 6px;
  font-size: 12px;
  color: #dbe8f8;
}

.command-dept-col select {
  width: 100%;
}

.command-picker-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.selected-dept-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 210px;
  overflow: auto;
}

.selected-dept-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 5px 7px;
  background: rgba(0, 0, 0, 0.22);
}

.selected-dept-list li.muted {
  justify-content: center;
  color: var(--muted);
}

.board-card-list {
  display: grid;
  gap: 10px;
}

.board-card {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
}

.board-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.board-card-head h4 {
  margin: 0;
  font-size: 14px;
}

.board-inner-block {
  margin-top: 10px;
}

.chain-tree {
  margin: 0;
  padding-left: 14px;
  list-style: none;
}

.chain-tree ul {
  margin: 6px 0 0;
  padding-left: 14px;
  list-style: none;
}

.chain-node {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.24);
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  font-size: 12px;
}

.json-view {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow: auto;
  font-size: 11px;
  color: #d9e8f7;
}

.quota-popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  z-index: 9999;
}

.quota-popup.hidden {
  display: none;
}

.quota-popup-card {
  width: min(92vw, 420px);
  border: 1px solid #ff6b6b;
  border-radius: 14px;
  background: #121f2c;
  color: var(--text);
  padding: 16px;
}

.quota-popup-card h3 {
  margin: 0 0 8px;
}

.quota-popup-card p {
  margin: 0;
  color: #ffd3d3;
  font-size: 13px;
}

.quota-popup-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .command-dept-picker {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    max-height: none;
  }
  .intro {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }
}

@media (max-width: 560px) {
  .shell {
    padding: 14px 10px 28px;
  }
  .panel {
    padding: 11px;
  }
  .intro {
    grid-template-columns: 1fr;
  }
}
