:root {
  --bg: #0c1110;
  --panel: #121a18;
  --panel-2: #182421;
  --accent: #00b894;
  --accent-2: #ffb86b;
  --text: #e7f0ed;
  --muted: #8ca2a0;
  --border: #253431;
  --shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Space Grotesk", "Gill Sans", "Trebuchet MS", sans-serif;
  color: var(--text);
  background: radial-gradient(1200px circle at 10% -10%, rgba(0, 184, 148, 0.18), transparent 50%),
              radial-gradient(1000px circle at 120% 10%, rgba(255, 184, 107, 0.15), transparent 45%),
              var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(120deg, rgba(255,255,255,0.03) 1px, transparent 1px),
                    linear-gradient(60deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 72px 72px;
  pointer-events: none;
}

.app {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: 100vh;
}

.sidebar {
  position: relative;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow: auto;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.4px;
  margin-bottom: 16px;
}

.search input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}

.section-title {
  margin-top: 18px;
  margin-bottom: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
}

.project-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.module-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.module-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.module-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.module-item.active {
  color: var(--text);
  background: rgba(0, 184, 148, 0.16);
  border: 1px solid rgba(0, 184, 148, 0.28);
}

.module-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.module-label {
  font-size: 12px;
}

.module-meta {
  font-size: 11px;
  color: var(--accent-2);
}

.project-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.project-item:hover {
  background: rgba(255,255,255,0.04);
  transform: translateX(2px);
}

.project-item.active {
  background: rgba(0, 184, 148, 0.2);
  border: 1px solid rgba(0, 184, 148, 0.3);
}

.project-ref {
  font-weight: 600;
  font-size: 12px;
  color: var(--accent-2);
}

.project-name {
  font-size: 12px;
  color: var(--text);
}

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

.tree {
  margin-top: 10px;
}

.tree-node {
  margin-left: 6px;
}

.tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
}

.tree-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.tree-item.active {
  color: var(--text);
  background: rgba(255,255,255,0.08);
}

.main {
  padding: 20px 24px;
  overflow: hidden;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 12px 30px var(--shadow);
}

.summary-bar {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 12px 30px var(--shadow);
}

.summary-item {
  font-size: 13px;
  color: var(--text);
}

.summary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

button, select {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  color: #04110d;
  border: none;
  font-weight: 600;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.status-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 184, 148, 0.18);
  color: var(--accent);
  font-size: 12px;
}

.content {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  height: calc(100vh - 140px);
  overflow: auto;
}

.pathbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  color: var(--muted);
}

.file-table {
  width: 100%;
  border-collapse: collapse;
}

.file-table th, .file-table td {
  text-align: left;
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.file-row:hover {
  background: rgba(255,255,255,0.03);
}

.login-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 13, 0.75);
  backdrop-filter: blur(6px);
  z-index: 10;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 13, 0.8);
  backdrop-filter: blur(6px);
  z-index: 20;
}

.modal-card {
  width: min(920px, 92vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px var(--shadow);
  overflow: hidden;
}

.modal-card.wide {
  width: min(1100px, 95vw);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 16px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-body {
  padding: 16px 18px;
  overflow: auto;
}

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

.detail-item {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.label {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 10px;
  color: var(--muted);
}

.log-box {
  background: #0b0f0e;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-size: 11px;
  max-height: 240px;
  overflow: auto;
  color: var(--text);
  white-space: pre-wrap;
}

.login-card {
  width: 360px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px var(--shadow);
  animation: float-in 0.4s ease;
}

.login-card h1 {
  margin: 0 0 10px;
  font-size: 18px;
}

.login-card input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  margin-bottom: 12px;
}

@keyframes float-in {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    height: 40vh;
  }
  .content {
    height: calc(60vh - 80px);
  }
}
