:root {
  --mg-bg: #f7f2e8;
  --mg-bg-soft: #efe6d6;
  --mg-panel: #fffdf8;
  --mg-panel-2: #f4ecde;
  --mg-line: rgba(141, 107, 47, 0.22);
  --mg-gold: #b0893d;
  --mg-gold-2: #8d6b2f;
  --mg-gold-deep: #6f5324;
  --mg-text: #2c261e;
  --mg-muted: #6f6557;
  --mg-danger: #b85a4c;
  --mg-ok: #4f8a3e;
  --mg-shadow: 0 18px 42px rgba(80, 60, 20, 0.10);
  --mg-radius: 18px;
  --mg-font: "Manrope", "Segoe UI", sans-serif;
  --mg-serif: "Cormorant Garamond", Georgia, serif;
  --mg-logo-bg: #1c1813;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  background: var(--mg-bg);
  color: var(--mg-text);
  font-family: var(--mg-font);
}

body.mg-body {
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(201, 169, 98, 0.22), transparent 52%),
    radial-gradient(900px 400px at 100% 0%, rgba(232, 214, 176, 0.55), transparent 46%),
    var(--mg-bg);
}

a { color: var(--mg-gold-2); text-decoration: none; }
a:hover { color: var(--mg-gold); }

.mg-serif { font-family: var(--mg-serif); }

.mg-guest {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.mg-card {
  width: 100%;
  max-width: 520px;
  background: linear-gradient(180deg, #fffdf8, #f8f1e4);
  border: 1px solid var(--mg-line);
  border-radius: var(--mg-radius);
  box-shadow: var(--mg-shadow);
  overflow: hidden;
}

.mg-card-wide { max-width: 880px; }

.mg-brand-bar {
  background: var(--mg-logo-bg);
  border-bottom: 1px solid var(--mg-line);
  text-align: center;
  padding: 22px 20px 18px;
}

.mg-brand-bar img {
  max-width: min(420px, 88%);
  height: auto;
}

.mg-card-body { padding: 28px 26px 30px; }

.mg-kicker {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--mg-gold);
  margin-bottom: 8px;
}

.mg-title {
  font-family: var(--mg-serif);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.1;
  margin: 0 0 8px;
  color: var(--mg-text);
}

.mg-subtitle {
  color: var(--mg-muted);
  margin-bottom: 24px;
  font-size: 15px;
}

.form-control, .form-select {
  background: #fff;
  border: 1px solid rgba(141, 107, 47, 0.28);
  color: var(--mg-text);
  min-height: 48px;
  border-radius: 12px;
}

.form-control::placeholder {
  color: #8a7d6b;
  opacity: 1;
}

.form-control:focus, .form-select:focus {
  background: #fff;
  color: var(--mg-text);
  border-color: var(--mg-gold);
  box-shadow: 0 0 0 0.2rem rgba(176, 137, 61, 0.18);
}

.form-select option {
  background: #fff;
  color: var(--mg-text);
}

.form-label {
  color: var(--mg-gold-deep);
  font-size: 13px;
  margin-bottom: 6px;
}

.btn-mg {
  background: linear-gradient(180deg, #d7b56b, #b0893d);
  border: 0;
  color: #1a140c;
  font-weight: 700;
  min-height: 50px;
  border-radius: 12px;
  letter-spacing: 0.04em;
}

.btn-mg:hover, .btn-mg:focus {
  background: linear-gradient(180deg, #e4c57c, #c49a4b);
  color: #1a140c;
}

.btn-ghost {
  background: #fff;
  border: 1px solid var(--mg-line);
  color: var(--mg-gold-2);
  min-height: 44px;
  border-radius: 12px;
}

.btn-ghost:hover {
  background: var(--mg-panel-2);
  color: var(--mg-gold-deep);
}

.alert-mg {
  background: rgba(184, 90, 76, 0.10);
  border: 1px solid rgba(184, 90, 76, 0.35);
  color: #8a3d34;
  border-radius: 12px;
}

.alert-ok {
  background: rgba(79, 138, 62, 0.10);
  border: 1px solid rgba(79, 138, 62, 0.35);
  color: #3d6b30;
  border-radius: 12px;
}

.alert-dark {
  background: #f3ead9;
  border-color: var(--mg-line);
  color: var(--mg-text);
}

.text-warning { color: var(--mg-gold-deep) !important; }
.text-secondary { color: var(--mg-muted) !important; }
.border-secondary { border-color: var(--mg-line) !important; }

.mg-req {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--mg-line);
  font-size: 14px;
}

.mg-badge-ok, .mg-badge-no {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.mg-badge-ok { background: rgba(79, 138, 62, 0.14); color: var(--mg-ok); }
.mg-badge-no { background: rgba(184, 90, 76, 0.14); color: var(--mg-danger); }

.mg-credentials {
  background: #fff;
  border: 1px dashed var(--mg-line);
  border-radius: 12px;
  padding: 16px;
}

.mg-shell {
  min-height: 100vh;
  display: flex;
  background: var(--mg-bg);
}

.mg-sidebar {
  width: 280px;
  background: #fffaf2;
  border-right: 1px solid var(--mg-line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.mg-sidebar-brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--mg-line);
  text-align: center;
  background: var(--mg-logo-bg);
}

.mg-sidebar-brand img { max-width: 100%; height: auto; }

.mg-nav { padding: 14px 12px; overflow: auto; flex: 1; }

.mg-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--mg-muted);
  padding: 11px 12px;
  border-radius: 12px;
  margin-bottom: 4px;
}

.mg-nav a.active, .mg-nav a:hover {
  background: rgba(176, 137, 61, 0.12);
  color: var(--mg-gold-deep);
}

.mg-soon {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mg-gold);
}

.mg-main { flex: 1; min-width: 0; }

.mg-topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--mg-line);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.mg-content { padding: 22px 20px 40px; }

.stat-card {
  background: var(--mg-panel);
  border: 1px solid var(--mg-line);
  border-radius: 16px;
  padding: 18px;
  height: 100%;
  box-shadow: 0 8px 22px rgba(80, 60, 20, 0.05);
}

.stat-card small { color: var(--mg-muted); letter-spacing: 0.12em; text-transform: uppercase; font-size: 11px; }
.stat-card strong {
  display: block;
  font-family: var(--mg-serif);
  font-size: 34px;
  margin-top: 6px;
  color: var(--mg-gold-2);
}

.mg-panel {
  background: var(--mg-panel);
  border: 1px solid var(--mg-line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 22px rgba(80, 60, 20, 0.04);
}

.table-mg { color: var(--mg-text); background: transparent; }
.table-mg td, .table-mg th { border-color: var(--mg-line); vertical-align: middle; }
.table-mg thead th { color: var(--mg-gold-deep); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }

.mg-userchip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mg-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--mg-gold);
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--mg-gold-deep);
  font-weight: 700;
  font-size: 13px;
}

.offcanvas { background: #fffaf2; color: var(--mg-text); }
.offcanvas-header {
  border-bottom: 1px solid var(--mg-line);
  background: var(--mg-logo-bg);
}

.navbar-toggler {
  border-color: var(--mg-line);
}

.navbar-toggler-icon {
  filter: none;
}

@media (max-width: 991.98px) {
  .mg-sidebar { display: none; }
  .mg-content { padding: 16px 12px 32px; }
  .mg-card-body { padding: 22px 16px 24px; }
}

@media (min-width: 992px) {
  .mg-mobile-toggle { display: none !important; }
}

.mg-badge-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #c45b4a;
  color: #fff;
  border-radius: 999px;
  font-size: 10px;
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding: 0 4px;
}

.pub-nav {
  background: rgba(255, 253, 248, 0.94);
  border-bottom: 1px solid var(--mg-line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.pub-logo { height: 42px; width: auto; background: var(--mg-logo-bg); border-radius: 8px; padding: 4px 8px; }
.pub-nav a { color: var(--mg-gold-2); }
.pub-login-form {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pub-login-form .form-control {
  width: 140px;
}
.pub-hero {
  text-align: center;
  padding: 28px 12px 8px;
}
.pub-foot { border-top: 1px solid var(--mg-line); color: var(--mg-muted); font-size: 13px; }
.listing-card {
  background: var(--mg-panel);
  border: 1px solid var(--mg-line);
  border-radius: 16px;
  overflow: hidden;
  height: 100%;
  box-shadow: 0 8px 22px rgba(80, 60, 20, 0.05);
}
.listing-card img { width: 100%; height: 180px; object-fit: cover; }
.listing-card .pad { padding: 14px; }
.chat-pane {
  background: var(--mg-panel);
  border: 1px solid var(--mg-line);
  border-radius: 16px;
  min-height: 60vh;
}
.bubble-me { background: rgba(176, 137, 61, 0.18); border-radius: 14px 14px 4px 14px; padding: 10px 12px; }
.bubble-them { background: #f0e6d4; border-radius: 14px 14px 14px 4px; padding: 10px 12px; }
.sig-pad { width: 100%; height: 180px; background: #fff; border-radius: 12px; touch-action: none; }
.creative-sheet {
  width: min(100%, 420px);
  aspect-ratio: 1;
  background: #1a1611;
  color: #f4eee3;
  border: 1px solid var(--mg-gold);
  padding: 18px;
  margin: 0 auto;
}
.mg-cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.mg-cal-head {
  font-size: 12px;
  color: var(--mg-muted);
  text-align: center;
}
.mg-cal-cell {
  min-height: 92px;
  background: var(--mg-panel);
  border: 1px solid var(--mg-line);
  border-radius: 10px;
  padding: 6px;
  font-size: 12px;
}
@media (max-width: 768px) {
  .mg-cal { font-size: 11px; }
  .mg-cal-cell { min-height: 70px; }
}
