:root {
  --bg: #090a0d;
  --panel: #12141a;
  --panel-2: #191b22;
  --panel-3: #20232c;
  --line: #343746;
  --text: #f1e8d7;
  --muted: #a89f90;
  --gold: #d9a84f;
  --gold-2: #ffd37a;
  --red: #b84545;
  --green: #6fbf8a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 22% 8%, rgba(184, 69, 69, 0.18), transparent 26rem),
    radial-gradient(circle at 82% 18%, rgba(217, 168, 79, 0.12), transparent 24rem),
    linear-gradient(135deg, #07080a 0%, #101116 48%, #090a0d 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: rgba(9, 10, 13, 0.88);
  border-right: 1px solid rgba(217, 168, 79, 0.2);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 211, 122, 0.55);
  background: linear-gradient(145deg, #2a1c17, #14161d);
  color: var(--gold-2);
  font-family: Cinzel, serif;
  font-weight: 700;
}

.brand strong,
h1,
h2,
h3 {
  font-family: Cinzel, serif;
  letter-spacing: 0;
}

.brand small,
.guard-panel small,
.eyebrow,
.muted {
  color: var(--muted);
}

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

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 11px 12px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}

.nav a:hover,
.nav a.active {
  color: var(--text);
  background: rgba(217, 168, 79, 0.08);
  border-color: rgba(217, 168, 79, 0.28);
}

.nav a span:last-child {
  color: var(--gold);
}

.guard-panel {
  margin-top: auto;
  display: flex;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px rgba(111, 191, 138, 0.75);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 96px;
  padding: 20px 30px;
  display: flex;
  align-items: center;
  gap: 18px;
  background: rgba(12, 13, 17, 0.78);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: clamp(1.55rem, 3vw, 2.6rem);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 700;
}

.toolbar {
  margin-left: auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.icon-button,
.ghost-button,
.primary-button {
  min-height: 40px;
  border: 1px solid rgba(217, 168, 79, 0.32);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  padding: 0 14px;
}

.icon-button {
  width: 42px;
  display: none;
}

.primary-button {
  background: linear-gradient(180deg, #d9a84f, #9f6b27);
  color: #130e08;
  font-weight: 800;
}

.content {
  padding: 30px;
}

.hero {
  min-height: calc(100vh - 156px);
  display: grid;
  align-content: center;
  gap: 28px;
}

.hero-copy {
  max-width: 850px;
}

.hero-copy h2 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 5.4rem);
  line-height: 0.95;
}

.hero-copy p {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.module-grid,
.summary-grid,
.inventory-grid {
  display: grid;
  gap: 14px;
}

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

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 18px;
}

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

.module-card,
.metric,
.inventory-panel,
.table-wrap,
.donation-panel {
  background: linear-gradient(180deg, rgba(32, 35, 44, 0.96), rgba(18, 20, 26, 0.96));
  border: 1px solid rgba(217, 168, 79, 0.18);
  box-shadow: var(--shadow);
}

.module-card {
  min-height: 168px;
  padding: 18px;
  color: var(--text);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transform: translateY(0);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.module-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 211, 122, 0.09) 48%, transparent 70%);
  opacity: 0;
  transform: translateX(-24%);
  transition: opacity 180ms ease, transform 260ms ease;
  pointer-events: none;
}

.module-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 211, 122, 0.52);
  background: linear-gradient(180deg, rgba(39, 42, 52, 0.98), rgba(19, 20, 26, 0.98));
  box-shadow: 0 30px 82px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(255, 211, 122, 0.08);
}

.module-card:hover::before {
  opacity: 1;
  transform: translateX(24%);
}

.module-card strong {
  font-family: Cinzel, serif;
  font-size: 1.2rem;
}

.module-card small {
  color: var(--muted);
  line-height: 1.45;
}

.module-card .rune {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--gold-2);
  border: 1px solid rgba(217, 168, 79, 0.35);
  background: rgba(217, 168, 79, 0.08);
}

.module-card .rune img {
  max-width: 24px;
  max-height: 24px;
  object-fit: contain;
  image-rendering: auto;
}

.module-card[href*="donate"] .rune img {
  max-width: 28px;
  max-height: 28px;
}

.metric {
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.35rem;
  color: var(--gold-2);
}

.section-title {
  margin: 28px 0 12px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.section-title h2 {
  margin: 0;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
  white-space: normal;
  min-width: 230px;
}

thead th {
  position: sticky;
  top: 0;
  background: #191b22;
  color: var(--gold-2);
  font-size: 0.78rem;
  text-transform: uppercase;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}

.item-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.item-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(217, 168, 79, 0.3);
  background: #090a0d;
}

.item-icon img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: block;
}

.item-icon-empty {
  background:
    linear-gradient(135deg, transparent 45%, rgba(217, 168, 79, 0.26) 46%, rgba(217, 168, 79, 0.26) 54%, transparent 55%),
    #090a0d;
}

input[type="number"] {
  width: 118px;
  height: 36px;
  color: var(--text);
  background: #0c0d12;
  border: 1px solid rgba(217, 168, 79, 0.28);
  padding: 0 10px;
  text-align: right;
}

input[readonly] {
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.035);
  cursor: not-allowed;
}

.inventory-panel,
.donation-panel {
  padding: 16px;
}

.inventory-panel h3,
.donation-panel h3 {
  margin: 0 0 12px;
}

.inventory-row,
.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.field-row label,
.inventory-row label {
  color: var(--muted);
  line-height: 1.35;
}

.field-row-locked label::after {
  content: " fixo";
  color: rgba(217, 168, 79, 0.78);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.donation-layout {
  display: grid;
  grid-template-columns: minmax(280px, 430px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.profit {
  color: var(--green);
}

.loss {
  color: var(--red);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 12px 14px;
  background: #16181f;
  border: 1px solid rgba(217, 168, 79, 0.35);
  color: var(--text);
  box-shadow: var(--shadow);
}

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

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

  .sidebar {
    position: fixed;
    z-index: 5;
    width: min(86vw, 310px);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .icon-button {
    display: inline-grid;
    place-items: center;
  }

  .topbar,
  .content {
    padding-left: 18px;
    padding-right: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .toolbar {
    width: 100%;
    margin-left: 60px;
  }

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

@media (max-width: 560px) {
  .toolbar {
    margin-left: 0;
  }

  .ghost-button,
  .primary-button {
    flex: 1;
  }
}
