:root {
  color-scheme: dark;
  --bg: #111312;
  --panel: #181b1a;
  --panel-2: #202321;
  --border: #303633;
  --text: #f3f1ea;
  --muted: #a9aea8;
  --subtle: #747b75;
  --accent: #47d18c;
  --accent-2: #f4c15d;
  --danger: #ff6b6b;
  --shadow: 0 18px 60px rgba(0, 0, 0, .32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

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

.sidebar {
  border-right: 1px solid var(--border);
  background: #0f1110;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #07110c;
  border-radius: 8px;
  font-weight: 800;
}

.brand-title {
  font-weight: 800;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  border: 0;
  text-align: left;
  color: var(--muted);
  background: transparent;
  padding: 11px 12px;
  border-radius: 8px;
  cursor: pointer;
}

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

.main {
  padding: 26px;
  min-width: 0;
}

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

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

h1 {
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 19px;
}

h3 {
  font-size: 15px;
}

#viewSubtitle {
  color: var(--muted);
  margin-top: 8px;
  max-width: 760px;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.button,
.icon-button {
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
  min-height: 38px;
}

.button {
  padding: 0 14px;
}

.button.primary {
  background: var(--accent);
  color: #07110c;
  border-color: transparent;
  font-weight: 800;
}

.button.secondary {
  background: transparent;
}

.button.danger {
  background: rgba(255, 107, 107, .12);
  border-color: rgba(255, 107, 107, .32);
  color: #ffb2b2;
}

.icon-button {
  width: 38px;
  display: grid;
  place-items: center;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 12px;
  white-space: nowrap;
}

.status-pill.ok {
  color: #baf7d4;
  border-color: rgba(71, 209, 140, .35);
}

.status-pill.warn {
  color: #ffe0a2;
  border-color: rgba(244, 193, 93, .4);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.stat .value {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 5px;
}

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

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

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

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

.preview-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b0c0b;
}

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

.panel {
  padding: 16px;
}

.panel-header,
.card-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.card {
  overflow: hidden;
}

.card-media {
  aspect-ratio: 16 / 10;
  background: #0b0c0b;
  border-bottom: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  padding: 14px;
}

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

.small {
  font-size: 13px;
}

.stack {
  display: grid;
  gap: 10px;
}

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

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

.table th {
  color: var(--subtle);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

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

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #101211;
  color: var(--text);
  padding: 11px 12px;
  resize: vertical;
}

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

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--panel-2);
}

.asset-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.asset-option {
  width: 116px;
  display: grid;
  justify-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-2);
  cursor: pointer;
  position: relative;
}

.asset-option input {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.asset-option:has(input:checked) {
  border-color: rgba(71, 209, 140, .7);
  box-shadow: inset 0 0 0 1px rgba(71, 209, 140, .35);
}

.asset-bubble {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0b0c0b;
}

.asset-bubble.graphic {
  border-radius: 8px;
}

.asset-bubble img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.asset-name {
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  min-height: 30px;
  display: grid;
  align-items: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .62);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(720px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 14px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.modal-header p {
  margin-top: 6px;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-actions.split {
  justify-content: space-between;
}

.avatar-edit-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: start;
}

.avatar-edit-preview {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b0c0b;
  overflow: hidden;
}

.avatar-edit-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

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

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

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

  .nav-item {
    text-align: center;
  }

  .stats-grid,
  .grid,
  .grid.two,
  .preview-grid,
  .form-grid,
  .avatar-edit-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }
}
