:root {
  --bg: #171512;
  --bg-elevated: #241f19;
  --bg-panel: #2d251e;
  --line: #4d4033;
  --text: #f2ede3;
  --muted: #c6b59e;
  --accent: #d46f41;
  --accent-2: #8eb06b;
  --danger: #d14c3f;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(212, 111, 65, 0.16), transparent 30%),
    radial-gradient(circle at bottom left, rgba(142, 176, 107, 0.14), transparent 25%),
    var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: "Cascadia Code", "Consolas", monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.35rem;
  border-radius: 0.35rem;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #3b3026, #2c241d);
  color: var(--text);
  padding: 0.7rem 1rem;
  border-radius: 0.8rem;
  cursor: pointer;
}

button.secondary {
  background: transparent;
}

button:hover {
  border-color: var(--accent);
}

input[type="search"],
input[type="password"],
input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0.8rem 0.9rem;
  border-radius: 0.8rem;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 1.5rem;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(15, 13, 11, 0.82);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.brand span {
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.sidebar-section,
.search-form,
.system-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.search-form label,
.section-title {
  display: block;
  margin-bottom: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
}

.search-form button {
  width: 100%;
  margin-top: 0.75rem;
}

.tree-node {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 0.6rem;
  margin-top: 0.6rem;
}

.tree-node:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.tree-node summary {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.tree-node ul {
  list-style: none;
  margin: 0.8rem 0 0 1.25rem;
  padding: 0;
}

.tree-node li {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin: 0.4rem 0;
}

.count {
  font-size: 0.78rem;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
}

.badge-accent {
  border-color: rgba(212, 111, 65, 0.35);
  background: rgba(212, 111, 65, 0.14);
}

.badge-match {
  border-color: rgba(24, 168, 119, 0.35);
  background: rgba(24, 168, 119, 0.14);
}

.badge-muted {
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.target-row,
.list-row,
.item-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.target-row + .target-row,
.list-row + .list-row,
.item-row + .item-row {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.target-label,
.item-link {
  font-weight: 700;
}

.row-main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.row-copy {
  min-width: 0;
}

.row-visual {
  flex: 0 0 auto;
}

.row-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.2));
  padding: 0.3rem;
}

.row-icon.placeholder {
  display: block;
}

.target-meta,
.item-meta,
.mini-label,
.muted {
  color: var(--muted);
}

.button-link {
  background: none;
  border: 0;
  padding: 0;
}

.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.9rem;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #3b3026, #2c241d);
  color: var(--text);
  padding: 0.7rem 1rem;
  border-radius: 0.8rem;
}

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

.danger,
.button-link.danger,
.text-danger {
  color: #ff9386;
}

.content {
  padding: 2rem;
}

.hero,
.panel,
.item-hero,
.login-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025));
  border-radius: 1.4rem;
  padding: 1.4rem;
  box-shadow: var(--shadow);
}

.hero {
  margin-bottom: 1.2rem;
}

.hero-copy {
  max-width: 52rem;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-2);
  font-size: 0.78rem;
}

h1,
h2 {
  margin-top: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.2rem 0;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 1.2rem;
  padding: 1rem;
}

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

.stat-value {
  margin-top: 0.5rem;
  font-size: 1.8rem;
  font-weight: 800;
}

.monitoring-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.monitoring-stats .stat-card {
  min-height: 136px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
}

.mini-grid strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.25rem;
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.monitoring-panels {
  align-items: stretch;
}

.monitoring-panels > .panel {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.monitoring-panels .target-list {
  flex: 1 1 auto;
}

.monitoring-panels .target-row {
  min-height: 68px;
}

.properties-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 1rem;
}

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

.property-value {
  font-weight: 600;
}

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

.data-table th,
.data-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  text-align: left;
}

.item-hero-main {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1.5rem;
  align-items: center;
}

.item-icon-wrap {
  width: 120px;
  height: 120px;
  border-radius: 1rem;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.2));
  display: grid;
  place-items: center;
}

.item-icon {
  width: 96px;
  height: 96px;
  object-fit: contain;
}

.item-title {
  margin-bottom: 0.5rem;
}

.hero-tags,
.toolbar,
.item-actions,
.panel-header {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar {
  margin: 1rem 0 0.65rem;
}

.monitor-config-card {
  margin-top: 1rem;
}

.artifact-filter-form {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.filter-block {
  display: grid;
  gap: 0.75rem;
}

.filter-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.choice-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.04);
}

.choice-chip input {
  width: auto;
  margin: 0;
}

.filter-inline {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(180px, 280px) 1fr;
  gap: 0.75rem;
  align-items: center;
}

.page-header {
  margin-bottom: 1rem;
}

.panel + .panel,
.split-grid + .split-grid {
  margin-top: 1rem;
}

.spoiler-card {
  margin: 1rem 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025));
  border-radius: 1.4rem;
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow);
}

.spoiler-card summary {
  cursor: pointer;
  font-weight: 700;
}

.spoiler-content {
  margin-top: 1rem;
}

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

.quality-group + .quality-group {
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.quality-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.quality-heading h3 {
  margin: 0;
}

.rarity-name {
  font-weight: 700;
}

.flash-stack {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.flash {
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.flash-success {
  background: rgba(24, 168, 119, 0.14);
}

.flash-error {
  background: rgba(209, 76, 63, 0.14);
}

.flash-warning {
  background: rgba(229, 183, 59, 0.14);
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-layout {
  width: min(100%, 480px);
  padding: 2rem;
}

.login-card h1 {
  margin-bottom: 0.5rem;
}

.login-form {
  margin-top: 1.2rem;
}

.login-form label {
  display: block;
  margin-bottom: 0.5rem;
}

.login-form button {
  width: 100%;
  margin-top: 0.9rem;
}

.range-switcher button.active {
  border-color: var(--accent);
  color: #fff;
}

.chart-shell {
  position: relative;
  width: 100%;
  height: 340px;
  min-height: 340px;
}

.price-chart {
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-height: 0;
}

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

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

  .split-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .content,
  .sidebar,
  .login-layout {
    padding: 1rem;
  }

  .item-hero-main {
    grid-template-columns: 1fr;
  }

  .properties-grid {
    grid-template-columns: 1fr;
  }

  .filter-inline {
    grid-template-columns: 1fr;
  }

  .item-row,
  .target-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-shell {
    height: 260px;
    min-height: 260px;
  }
}
