:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #151820;
  --panel-2: #1b1f2a;
  --panel-3: #202532;
  --line: #2a303d;
  --line-soft: #222734;
  --text: #f3f4f6;
  --muted: #9ba3b2;
  --muted-2: #737c8e;
  --accent: #8bd3c7;
  --accent-2: #d6f36a;
  --danger: #ff7b7b;
  --warning: #f2c66d;
  --success: #73e2a7;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
  --radius: 8px;
  --sidebar: 264px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

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

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(139, 211, 199, 0.08), transparent 34%),
    var(--bg);
}

.login-card {
  width: min(100%, 420px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #07110f;
  background: var(--accent);
  font-weight: 700;
  margin-bottom: 18px;
}

.login-card h1,
.page-title h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 600;
}

.login-card p,
.page-title p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  color: var(--text);
  background: #10131a;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  outline: none;
}

.textarea {
  min-height: 110px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 211, 199, 0.12);
}

.btn {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  color: var(--text);
  background: var(--panel-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--line);
  background: #252b39;
}

.btn-primary {
  background: var(--accent);
  color: #07110f;
  font-weight: 600;
}

.btn-primary:hover {
  background: #a2e1d8;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
}

.btn-danger {
  color: #1b0a0a;
  background: var(--danger);
  font-weight: 600;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #10131a;
  border-right: 1px solid var(--line-soft);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}

.sidebar-brand strong {
  font-size: 15px;
}

.sidebar-brand span {
  color: var(--muted-2);
  font-size: 12px;
}

.nav-group {
  display: grid;
  gap: 4px;
}

.nav-label {
  color: var(--muted-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 10px 6px;
}

.nav-link {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: var(--panel-2);
}

.nav-icon {
  width: 18px;
  color: var(--muted-2);
}

.main-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 62px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(15, 17, 21, 0.88);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
}

.mobile-nav-btn {
  display: none;
}

.search-box {
  width: min(360px, 42vw);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #07110f;
  background: var(--accent-2);
  font-weight: 700;
}

.content {
  padding: 26px;
  width: min(100%, 1440px);
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.page-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

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

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel {
  padding: 18px;
}

.metric-card {
  padding: 16px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 600;
}

.metric-note {
  color: var(--muted-2);
  margin-top: 6px;
  font-size: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h2 {
  font-size: 16px;
  margin: 0;
  font-weight: 600;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

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

.table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  background: #11151d;
}

.table tr:last-child td {
  border-bottom: 0;
}

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

.small {
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 12px;
}

.badge.live,
.badge.enabled,
.badge.published {
  background: rgba(115, 226, 167, 0.12);
  color: var(--success);
}

.badge.draft {
  background: rgba(242, 198, 109, 0.12);
  color: var(--warning);
}

.badge.disabled,
.badge.private {
  background: rgba(255, 123, 123, 0.12);
  color: var(--danger);
}

.tool-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-icon {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--panel-3);
  border: 1px solid var(--line);
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #11151d;
  cursor: pointer;
}

.switch::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.16s ease, background 0.16s ease;
}

.switch.on {
  border-color: rgba(139, 211, 199, 0.42);
  background: rgba(139, 211, 199, 0.14);
}

.switch.on::after {
  transform: translateX(18px);
  background: var(--accent);
}

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

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

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.chart-bars {
  height: 210px;
  display: flex;
  align-items: end;
  gap: 10px;
  padding-top: 20px;
}

.chart-bar {
  flex: 1;
  min-width: 16px;
  background: linear-gradient(180deg, var(--accent), rgba(139, 211, 199, 0.24));
  border-radius: 4px 4px 0 0;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
}

.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
}

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  z-index: 30;
}

.toast {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  color: var(--text);
  min-width: 240px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.56);
  padding: 24px;
}

.modal {
  width: min(100%, 520px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.hide {
  display: none !important;
}

@media (max-width: 1080px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .sidebar {
    position: fixed;
    z-index: 12;
    width: var(--sidebar);
    transform: translateX(-100%);
    transition: transform 0.18s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-nav-btn {
    display: inline-flex;
  }

  .topbar {
    padding: 0 14px;
  }

  .search-box {
    display: none;
  }

  .content {
    padding: 18px;
  }

  .page-head,
  .form-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}
