:root {
  --wood-950: #160a05;
  --wood-900: #24120a;
  --wood-800: #381e11;
  --wood-700: #4f2c19;
  --wood-600: #6b3d24;
  --brass: #d4a024;
  --brass-bright: #ffd166;
  --parchment: #f8eed4;
  --parchment-2: #efe0bb;
  --parchment-3: #e0c996;
  --ink: #24140a;
  --ink-soft: #5c3d26;
  --crimson: #b93228;
  --crimson-dark: #881f17;
  --emerald: #1c8c53;
  --ocean: #1b4b72;
  --violet: #6c3eb8;
  --shadow: 0 8px 24px rgba(14, 6, 3, 0.36);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  background: var(--wood-950);
  color: var(--ink);
}

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

/* ===== ANIMATIONS ===== */
@keyframes tabFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes toastSlide {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pulseRing {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.55; }
}

/* ===== LOGIN SCREEN ===== */
.login-backdrop {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(16, 7, 3, 0.72), rgba(10, 4, 2, 0.88)),
    url("/assets/site/entrada-noite.ccd2117f.webp") center/cover no-repeat;
}

.login-parchment {
  position: relative;
  width: 100%;
  max-width: 450px;
  background: linear-gradient(180deg, #fff6e0, #ead4a6);
  border: 3px solid var(--wood-700);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), inset 0 0 0 2px var(--brass);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  animation: modalPop 0.25s ease;
}

.login-logo {
  max-width: 240px;
  width: 78%;
  height: auto;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.45));
  margin-bottom: 8px;
}

.seal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--wood-800);
  color: var(--brass-bright);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.6px;
  border: 1px solid var(--brass);
}
.seal-pill img { width: 16px; height: 16px; image-rendering: pixelated; }

.wood-title {
  margin: 10px 0 6px;
  font-family: "Luckiest Guy", Impact, Georgia, serif;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.6px;
  color: var(--wood-800);
}
.parchment-sub { margin: 0 0 18px; color: var(--ink-soft); font-size: 13px; }

.login-form { display: grid; gap: 12px; text-align: left; }
.login-form label { display: grid; gap: 4px; }
.login-form label span { font-size: 12px; font-weight: 800; color: var(--wood-700); text-transform: uppercase; }
.login-form input {
  padding: 11px 12px;
  border-radius: 9px;
  border: 2px solid var(--wood-600);
  background: #fffdf5;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}
.login-form input:focus { outline: none; border-color: var(--crimson); box-shadow: 0 0 0 3px rgba(185,50,40,0.2); }

.login-foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--wood-600);
  display: flex;
  justify-content: center;
  gap: 16px;
}
.wood-link { color: var(--crimson-dark); font-weight: 800; font-size: 13px; text-decoration: none; }
.wood-link:hover { text-decoration: underline; }

/* ===== APP LAYOUT ===== */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(212, 160, 36, 0.14), transparent 45%),
    linear-gradient(180deg, #2a170c 0%, #1d0f07 100%);
}

.sidebar-wood {
  width: 266px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--wood-900), var(--wood-950));
  border-right: 3px solid var(--wood-700);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
  z-index: 40;
  transition: transform 0.22s ease;
}

.sidebar-top {
  background: var(--wood-800);
  border: 2px solid var(--wood-600);
  box-shadow: inset 0 0 0 1px rgba(212, 160, 36, 0.3);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.sidebar-logo { max-width: 170px; width: 90%; height: auto; }
.brand-badge-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}
.brand-name { color: var(--brass-bright); font-weight: 900; font-size: 14px; }
.staff-user-sub { color: #d6c09a; font-size: 12px; margin-top: 4px; font-weight: 700; }

.nav-wood { display: flex; flex-direction: column; gap: 5px; flex: 1; overflow-y: auto; padding-right: 2px; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 246, 224, 0.04);
  color: #ebd9b7;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: all 0.16s ease;
}
.nav-btn img { width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; flex-shrink: 0; }
.nav-btn:hover { background: rgba(212, 160, 36, 0.14); border-color: rgba(212, 160, 36, 0.35); transform: translateX(2px); }
.nav-btn.active {
  background: linear-gradient(180deg, #ffd166, #d4a024);
  color: var(--wood-950);
  border-color: #fff2be;
  box-shadow: 0 3px 0 #7b550c;
}
.live-pill {
  margin-left: auto;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 99px;
  background: #1c8c53;
  color: #fff;
}

.sidebar-foot { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid var(--wood-700); }

.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.topbar-wood {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
  background: linear-gradient(180deg, var(--wood-800), var(--wood-900));
  border-bottom: 3px solid var(--wood-600);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.35);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-heading {
  margin: 0;
  font-family: "Luckiest Guy", Impact, Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  color: var(--brass-bright);
  letter-spacing: 0.5px;
  text-shadow: 0 2px 0 #160a05;
}
.page-sub { font-size: 12px; color: #d8c3a0; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 900;
  border: 2px solid;
}
.status-pill.online { background: #0f3e26; border-color: #2ecc71; color: #b7ffcf; }
.status-pill.maint { background: #541410; border-color: #ff6b57; color: #ffd4cc; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulseRing 1.6s infinite; }

.db-badge {
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--wood-950);
  border: 1px solid var(--wood-600);
  color: var(--brass);
  font-size: 11px;
  font-weight: 900;
}

.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: grid;
  gap: 16px;
  align-content: start;
}
.tab-anim { display: grid; gap: 16px; animation: tabFade 0.2s ease; }

/* ===== CARDS & PARCHMENT ===== */
.card {
  background: linear-gradient(180deg, var(--parchment), var(--parchment-2));
  border: 3px solid var(--wood-700);
  box-shadow: var(--shadow), inset 0 0 0 1.5px rgba(212, 160, 36, 0.55);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--ink);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px dashed rgba(92, 61, 38, 0.35);
}
.card-head h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 900;
  color: var(--wood-800);
}
.card-head h3 img { width: 22px; height: 22px; image-rendering: pixelated; }

.hero-maint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 3px solid var(--wood-700);
  background: linear-gradient(135deg, #3c2213, #231109);
  color: #fff6e0;
  box-shadow: var(--shadow), inset 0 0 0 1.5px var(--brass);
}
.hero-maint.is-maint { background: linear-gradient(135deg, #631610, #2b0907); border-color: #ff6b57; }
.hero-maint h3 { margin: 0 0 4px; color: var(--brass-bright); font-size: 18px; }
.hero-maint p { margin: 0; font-size: 13px; color: #f0dfc1; }

/* ===== GRIDS & KPI ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 12px;
}
.kpi-card {
  background: linear-gradient(180deg, #fff8e6, #eedab2);
  border: 2.5px solid var(--wood-700);
  box-shadow: 0 4px 0 var(--wood-800), inset 0 0 0 1px rgba(212, 160, 36, 0.6);
  border-radius: 12px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.15s ease;
}
.kpi-card:hover { transform: translateY(-2px); }
.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--wood-800);
  border: 2px solid var(--brass);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.kpi-icon img { width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; }
.kpi-label { font-size: 11px; font-weight: 900; text-transform: uppercase; color: var(--ink-soft); }
.kpi-val { font-size: 22px; font-weight: 900; color: var(--wood-900); line-height: 1.15; }
.kpi-sub { font-size: 11px; font-weight: 700; color: var(--ink-soft); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }

/* ===== BUTTONS & INPUTS ===== */
.btn-wood {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 9px;
  border: 2px solid var(--wood-900);
  background: linear-gradient(180deg, #fff2cf, #dcc08a);
  color: var(--wood-950);
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 3px 0 var(--wood-900);
  transition: transform 0.1s ease, filter 0.15s ease;
}
.btn-wood:hover { filter: brightness(1.06); }
.btn-wood:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--wood-900); }
.btn-wood img { width: 17px; height: 17px; object-fit: contain; image-rendering: pixelated; }
.btn-wood.block { width: 100%; }
.btn-wood.sm { padding: 6px 10px; font-size: 12px; }
.btn-wood.primary { background: linear-gradient(180deg, #ffd166, #d4a024); color: var(--wood-950); }
.btn-wood.success { background: linear-gradient(180deg, #2fb66e, #1a7c48); color: #fff; }
.btn-wood.danger { background: linear-gradient(180deg, #d8453a, #972219); color: #fff; }
.btn-wood.ocean { background: linear-gradient(180deg, #2d74ad, #184b75); color: #fff; }
.btn-wood.ghost { background: rgba(255,246,224,0.1); color: #f6e7c9; border-color: var(--wood-600); box-shadow: none; }
.btn-wood.ghost:hover { background: rgba(255,246,224,0.18); }
.btn-wood.icon-only { display: none; padding: 6px 10px; font-size: 18px; }

.inp {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 2px solid var(--wood-600);
  background: #fffdf5;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.inp:focus { outline: none; border-color: var(--crimson); }
textarea.inp { min-height: 76px; resize: vertical; }

.field { display: grid; gap: 4px; }
.field > span { font-size: 11px; font-weight: 900; text-transform: uppercase; color: var(--ink-soft); }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 160px; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 2px solid var(--wood-600); background: #fff9ec; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left;
  padding: 9px 10px;
  background: var(--wood-800);
  color: var(--brass-bright);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}
table.tbl td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(92, 61, 38, 0.22);
  vertical-align: middle;
}
table.tbl tr:hover td { background: rgba(212, 160, 36, 0.14); }

/* ===== BADGES & CHIPS ===== */
.role-chip, .badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 900;
  border: 1px solid rgba(0,0,0,0.2);
}
.role-chip.admin { background: #ffd166; color: #2b1304; }
.role-chip.moderator { background: #6cb8ff; color: #0b243b; }
.badge.green { background: #d4f7e2; color: #115e35; border-color: #2fb66e; }
.badge.red { background: #ffd9d6; color: #7e1912; border-color: #d8453a; }
.badge.gold { background: #fff0b8; color: #694805; border-color: #d4a024; }
.badge.blue { background: #dceeff; color: #11436e; border-color: #3a85c4; }
.badge.purple { background: #efe3ff; color: #471c87; border-color: #824cd1; }

.rar-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 900;
  border: 2px solid var(--wood-600);
  background: #fff8e6;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.rar-pill img { width: 16px; height: 16px; object-fit: contain; }
.rar-pill:hover { transform: translateY(-1px); }
.rar-pill.active { background: var(--wood-800); color: var(--brass-bright); border-color: var(--brass); }

/* ===== ITEM CATALOG & SPRITES ===== */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}
.item-card {
  background: #fff9ec;
  border: 2px solid var(--wood-600);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.item-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(20,10,4,0.18); }
.item-top { display: flex; gap: 10px; align-items: center; }
.sprite-box {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 9px;
  border: 2px solid var(--wood-700);
  background: linear-gradient(180deg, #3c2213, #24120a);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.5);
}
.sprite-ico { width: 32px; height: 32px; image-rendering: pixelated; background-repeat: no-repeat; }
.item-title { font-weight: 900; font-size: 14px; color: var(--wood-900); line-height: 1.2; }
.item-meta { font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.item-econ {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
}
.drop-box {
  background: #f3e4bf;
  border: 1px solid #c9a76a;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.35;
}

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(12, 5, 2, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--parchment), var(--parchment-2));
  border: 3px solid var(--wood-700);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7), inset 0 0 0 2px var(--brass);
  border-radius: 16px;
  overflow: hidden;
  animation: modalPop 0.18s ease;
}
.modal-head {
  background: linear-gradient(180deg, var(--wood-800), var(--wood-900));
  color: var(--brass-bright);
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--brass);
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.modal-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 18px;
  background: var(--wood-700);
  overflow-x: auto;
}
.modal-tab {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.22);
  color: #f3e2c0;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.modal-tab.active { background: var(--brass-bright); color: var(--wood-950); border-color: #fff; }
.modal-body { padding: 18px; overflow-y: auto; display: grid; gap: 14px; }

/* ===== CHAT STREAM ===== */
.chat-feed {
  background: #231209;
  color: #fff5df;
  border: 2.5px solid var(--wood-700);
  border-radius: 12px;
  padding: 12px;
  height: 430px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  align-content: start;
}
.chat-line {
  background: rgba(255, 246, 224, 0.06);
  border: 1px solid rgba(212, 160, 36, 0.22);
  border-radius: 9px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.chat-line.is-staff { background: rgba(212, 160, 36, 0.16); border-color: var(--brass); }
.chat-ch { font-size: 10px; font-weight: 900; padding: 2px 7px; border-radius: 99px; background: var(--wood-700); color: var(--brass-bright); }

/* ===== DAILY 30 GRID ===== */
.daily-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 10px; }
.daily-cell {
  background: #fff9ec;
  border: 2px solid var(--wood-600);
  border-radius: 10px;
  padding: 9px;
  display: grid;
  gap: 5px;
}

/* ===== BRANDING PREVIEW ===== */
.brand-preview-box {
  position: relative;
  height: 170px;
  border-radius: 12px;
  border: 3px solid var(--wood-700);
  overflow: hidden;
  display: grid;
  place-items: center;
  background-size: cover;
  background-position: center;
}
.brand-preview-box img { max-width: 220px; max-height: 100px; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.8)); }

/* ===== TOAST & ERRORS ===== */
.err-banner {
  background: #ffd7d4;
  border: 2px solid var(--crimson);
  color: #7d140c;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 800;
}
.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; max-width: 360px; }
.toast-item {
  background: linear-gradient(180deg, var(--wood-800), var(--wood-950));
  color: #fff6e0;
  border: 2px solid var(--brass);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: var(--shadow);
  animation: toastSlide 0.2s ease;
}
.toast-item.err { border-color: #ff6b57; background: #4f120d; }

.sidebar-backdrop { display: none; }

@media (max-width: 920px) {
  .btn-wood.icon-only { display: inline-flex; }
  .sidebar-wood {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-105%);
  }
  .sidebar-wood.open { transform: translateX(0); }
  .sidebar-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 35;
  }
  .grid-2 { grid-template-columns: 1fr; }
}
