:root {
  --bg: #050b12;
  --bg-soft: #0b1520;
  --sidebar: #121722;
  --sidebar-soft: #171d29;
  --panel: #07141f;
  --panel-soft: #0c1b29;
  --panel-strong: #0f2131;
  --line: rgba(132, 148, 168, 0.18);
  --line-strong: rgba(34, 211, 238, 0.22);
  --text: #eef6ff;
  --muted: #90a4ba;
  --accent: #00c2e0;
  --accent-strong: #00a8c2;
  --accent-soft: rgba(0, 194, 224, 0.14);
  --success: #18c37e;
  --warn: #ffb84d;
  --danger: #ff6b6b;
  --shadow: 0 18px 52px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(0, 194, 224, 0.08), transparent 25%),
    radial-gradient(circle at bottom left, rgba(24, 195, 126, 0.08), transparent 25%),
    linear-gradient(180deg, #09121b 0%, #03080d 100%);
}

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

button {
  border: 0;
  border-radius: 12px;
  padding: 0.82rem 1.05rem;
  cursor: pointer;
  color: #031019;
  background: var(--accent);
  transition: transform 0.18s ease, background 0.18s ease, opacity 0.18s ease, border-color 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--accent-strong);
}

button:disabled {
  opacity: 0.65;
  cursor: wait;
}

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

.ghost-button:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line-strong);
}

input,
select,
textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(8, 18, 29, 0.92);
  color: var(--text);
  padding: 0.82rem 0.95rem;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 194, 224, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 194, 224, 0.12);
}

textarea {
  resize: vertical;
  min-height: 130px;
}

label {
  display: grid;
  gap: 0.45rem;
}

label span,
.panel-header p,
.detail-list,
.body-copy {
  color: var(--muted);
}

.form-hint {
  margin: -0.3rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.page-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

body.logged-out .page-shell {
  grid-template-columns: 1fr;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(18, 23, 34, 0.98), rgba(11, 18, 28, 0.98)),
    var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.55rem 0.4rem;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: rgba(0, 194, 224, 0.1);
  border: 1px solid rgba(0, 194, 224, 0.18);
  font-weight: 700;
}

.brand-block h1,
.main-panel h2,
.main-panel h3,
.entity-card h4 {
  margin: 0;
}

.eyebrow,
.section-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.72rem;
  color: var(--accent);
}

.sidebar-search {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.95rem;
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-nav {
  display: grid;
  gap: 0.35rem;
}

.nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
}

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

.nav-item.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent);
  border-color: rgba(0, 194, 224, 0.14);
}

.nav-label {
  text-align: left;
}

.nav-badge {
  min-width: 24px;
  padding: 0.16rem 0.42rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.76rem;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
}

.footer-value {
  margin: 0.45rem 0 0.3rem;
  font-weight: 600;
}

.footer-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.main-panel {
  padding: 1.3rem;
}

.login-layout {
  min-height: calc(100vh - 2.6rem);
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 440px);
  gap: 1.4rem;
  align-items: center;
}

.login-copy {
  padding: 2rem;
}

.login-copy h2 {
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1.02;
  max-width: 10ch;
}

.login-copy p {
  max-width: 56ch;
  color: var(--muted);
}

.login-card {
  max-width: 440px;
  margin-inline: auto;
}

.panel,
.stat-card,
.entity-card {
  background: linear-gradient(180deg, rgba(11, 26, 39, 0.96), rgba(6, 15, 24, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: var(--shadow);
  border-radius: 18px;
}

.panel {
  padding: 1.2rem;
}

.dashboard {
  display: grid;
  gap: 1rem;
}

.hidden {
  display: none !important;
}

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 40;
  display: grid;
  gap: 0.75rem;
  width: min(360px, calc(100vw - 2rem));
}

.toast {
  padding: 0.95rem 1rem;
  border-radius: 14px;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  background: linear-gradient(180deg, rgba(11, 26, 39, 0.98), rgba(6, 15, 24, 0.98));
  animation: toast-in 0.22s ease;
}

.toast.success {
  border-color: rgba(24, 195, 126, 0.3);
}

.toast.error {
  border-color: rgba(255, 107, 107, 0.34);
}

.tour-overlay {
  position: fixed;
  inset: 0;
  pointer-events: auto;
  z-index: 30;
  background: rgba(1, 7, 12, 0.7);
  backdrop-filter: blur(3px);
}

.tour-spotlight {
  position: fixed;
  border-radius: 16px;
  border: 1px solid rgba(0, 194, 224, 0.55);
  box-shadow:
    0 0 0 9999px rgba(1, 7, 12, 0.56),
    0 0 0 8px rgba(0, 194, 224, 0.08);
  pointer-events: none;
  transition: all 0.18s ease;
}

.tour-bubble {
  position: fixed;
  width: min(320px, calc(100vw - 2rem));
  padding: 1rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(11, 26, 39, 0.98), rgba(6, 15, 24, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow);
}

.tour-bubble::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 24px;
  border-width: 10px 10px 10px 0;
  border-style: solid;
  border-color: transparent rgba(11, 26, 39, 0.98) transparent transparent;
}

.tour-overlay .tour-progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin: 1rem 0 1.2rem;
}

.tour-dot {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.tour-dot.active {
  background: var(--accent);
}

.topbar,
.topbar-actions,
.panel-header.split,
.entity-actions,
.form-actions {
  display: flex;
  gap: 0.8rem;
}

.topbar,
.panel-header.split,
.entity-actions {
  justify-content: space-between;
  align-items: flex-start;
}

.topbar {
  align-items: center;
  padding: 0 0.2rem;
}

.stats-grid,
.overview-grid,
.card-grid {
  display: grid;
  gap: 1rem;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.stat-card,
.entity-card {
  padding: 1rem;
}

.stat-card {
  position: relative;
  min-height: 150px;
  display: grid;
  align-content: space-between;
  overflow: hidden;
  cursor: pointer;
}

.stat-value {
  margin: 0.45rem 0 0;
  font-size: 2.7rem;
  font-weight: 700;
}

.stat-preview {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.3rem;
}

.stat-preview-label {
  color: var(--muted);
  font-size: 0.84rem;
}

.stat-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.mini-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.52rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.78rem;
}

.stat-tooltip {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  padding: 0.8rem;
  border-radius: 14px;
  background: rgba(3, 12, 20, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-card:hover .stat-tooltip,
.stat-card:focus-within .stat-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 35;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 7, 12, 0.72);
  backdrop-filter: blur(5px);
}

.detail-card {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  margin: 1rem auto;
  padding: 1rem;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(11, 26, 39, 0.98), rgba(6, 15, 24, 0.99));
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: var(--shadow);
  overflow: auto;
}

.detail-modal-body {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
}

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

.detail-column {
  display: grid;
  gap: 0.8rem;
  align-content: start;
  padding: 0.9rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

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

.detail-item {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem;
  border-radius: 14px;
  background: rgba(4, 13, 22, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-item p,
.detail-item pre {
  margin: 0;
}

.detail-item pre {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow: auto;
}

.detail-meta {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.stack-form,
.grid-form {
  display: grid;
  gap: 1rem;
}

.grid-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wide {
  grid-column: 1 / -1;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 0.3rem 0.62rem;
  border-radius: 999px;
  background: rgba(0, 194, 224, 0.12);
  color: var(--accent);
  font-size: 0.78rem;
}

.pill.warn {
  color: var(--warn);
  background: rgba(255, 184, 77, 0.12);
}

.pill.danger {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.12);
}

.detail-list {
  display: grid;
  gap: 0.45rem;
  font-size: 0.94rem;
}

.detail-list code,
.snippet {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: #d7f7ff;
  border-radius: 10px;
  padding: 0.16rem 0.34rem;
}

.snippet-box {
  display: grid;
  gap: 0.35rem;
}

.snippet {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.86rem;
}

.company-log {
  display: grid;
  gap: 0.6rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.company-log-list {
  display: grid;
  gap: 0.5rem;
}

.log-item {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.log-copy {
  display: grid;
  gap: 0.2rem;
}

.log-copy strong {
  font-size: 0.92rem;
}

.log-copy span {
  font-size: 0.82rem;
  color: var(--muted);
}

.tab-view {
  display: grid;
  gap: 1rem;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  .login-layout {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .main-panel,
  .sidebar,
  .login-copy {
    padding: 1rem;
  }

  .grid-form,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .topbar-actions,
  .panel-header.split,
  .entity-actions,
  .form-actions {
    flex-direction: column;
  }

  .sidebar-nav {
    grid-template-columns: 1fr 1fr;
  }
}

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