:root {
  --bg: #0f0a09;
  --bg-elev: #1a1210;
  --bg-card: #221714;
  --border: #3c2a1e;
  --border-gold: rgba(212, 175, 55, 0.35);
  --gold: #e5be53;
  --gold-bright: #ffe184;
  --maroon: #5e111e;
  --text: #f7efe2;
  --muted: #b8a38d;
  --green: #22c55e;
  --red: #ef4444;
  --radius: 14px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top right, #2a1316 0%, #0f0a09 55%);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(18, 11, 10, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-gold);
  padding: 14px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: var(--maroon);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, serif;
  font-weight: 700;
  color: var(--gold-bright);
  overflow: hidden;
  flex-shrink: 0;
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-title { font-family: Georgia, serif; font-size: 1.25rem; font-weight: 700; color: var(--gold-bright); letter-spacing: 0.5px; }
.brand-sub { font-size: 0.78rem; color: var(--muted); }

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.ok .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.pill.warn .dot { background: #f59e0b; }
.pill.gold { border-color: var(--border-gold); color: var(--gold-bright); }

.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 24px 0 24px;
  max-width: 1440px;
  margin: 0 auto;
}
.tab-btn {
  background: var(--bg-elev);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.18s;
}
.tab-btn:hover { color: var(--gold-bright); border-color: var(--border-gold); }
.tab-btn.active {
  background: linear-gradient(135deg, #6b1524, #3d0b14);
  color: var(--gold-bright);
  border-color: var(--gold);
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.14);
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 48px 24px;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.grid-main {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 22px;
  align-items: start;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 1050px) {
  .grid-main, .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar, .container, .nav-tabs { padding-left: 14px; padding-right: 14px; }
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
}
.card + .card { margin-top: 20px; }
.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold-bright);
  margin: 0;
}
.card-sub { font-size: 0.82rem; color: var(--muted); margin: 2px 0 0 0; }

.rate-tile {
  background: linear-gradient(160deg, #271b16, #18110e);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 16px;
}
.rate-tile .metal { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.8px; color: var(--gold); font-weight: 700; }
.rate-tile .price { font-size: 1.9rem; font-weight: 800; color: #fff; margin: 6px 0 4px 0; }
.rate-tile .unit { font-size: 0.78rem; color: var(--muted); }
.diff-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.diff-up { background: rgba(34, 197, 94, 0.16); color: #4ade80; }
.diff-down { background: rgba(239, 68, 68, 0.16); color: #f87171; }
.diff-flat { background: rgba(184, 163, 141, 0.14); color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.16s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-gold {
  background: linear-gradient(135deg, #e5be53, #b88924);
  color: #1c080a;
}
.btn-gold:hover { filter: brightness(1.08); }
.btn-maroon {
  background: linear-gradient(135deg, #7c1829, #4c0d18);
  border-color: var(--gold);
  color: var(--gold-bright);
}
.btn-maroon:hover { filter: brightness(1.12); }
.btn-outline {
  background: var(--bg-card);
  border-color: var(--border-gold);
  color: var(--gold-bright);
}
.btn-outline:hover { background: #2d201a; }
.btn-danger {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}
.btn-sm { padding: 5px 10px; font-size: 0.78rem; border-radius: 7px; }

.dispatch-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}
.dispatch-box h4 { margin: 0; color: var(--gold-bright); font-size: 0.98rem; }
.dispatch-box p { margin: 4px 0 0 0; font-size: 0.82rem; color: var(--muted); line-height: 1.45; }

.poster-frame {
  background: #100b0a;
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.poster-frame img {
  width: 100%;
  max-width: 440px;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 0.82rem; font-weight: 600; color: var(--gold); }
input[type="text"], input[type="email"], input[type="time"], input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #130d0c;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.88rem;
}
.check-row input { width: 17px; height: 17px; accent-color: var(--gold); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td {
  padding: 10px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th { color: var(--gold); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.6px; }
tr:hover td { background: rgba(255, 255, 255, 0.02); }

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
}
.tag-sent { background: rgba(34, 197, 94, 0.16); color: #4ade80; }
.tag-sim { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
.tag-fail { background: rgba(239, 68, 68, 0.16); color: #f87171; }
.tag-chg { background: rgba(212, 175, 55, 0.2); color: var(--gold-bright); }

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  margin-bottom: 8px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  background: #231613;
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  display: none;
  max-width: 420px;
}
.toast.error { border-color: var(--red); color: #fecaca; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal-box {
  background: var(--bg-elev);
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 18px;
  max-width: 540px;
  width: 100%;
  text-align: center;
}
.modal-box img { max-width: 100%; max-height: 75vh; border-radius: 10px; }

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 430px;
  background: var(--bg-elev);
  border: 1.5px solid var(--gold);
  border-radius: 18px;
  padding: 30px 26px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.65);
}
.login-brand {
  text-align: center;
  margin-bottom: 22px;
}
.login-crest {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: var(--maroon);
  color: var(--gold-bright);
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.mode-switch {
  display: inline-flex;
  background: #130d0c;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}
.mode-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
}
.mode-btn.active {
  background: linear-gradient(135deg, #7c1829, #4c0d18);
  color: var(--gold-bright);
  border: 1px solid var(--gold);
}


