:root {
  --navy-950: #070c13;
  --navy-900: #0b131f;
  --navy-850: #0e192b;
  --navy-800: #142238;
  --navy-700: #1e314f;
  --cream-50: #fdfcf9;
  --cream-100: #f9f8f3;
  --cream-200: #f5f3ed;
  --cream-300: #ebe7dc;
  --gold-400: #e5c158;
  --gold-500: #d4af37;
  --gold-600: #c8a251;
  --gold-700: #9e7d31;
  --ink: #1a2332;
  --muted: #64748b;
  --line: #e5e0d4;
  --ok: #047857;
  --danger: #b91c1c;
  --radius: 12px;
  --shadow: 0 10px 40px rgba(11, 19, 31, 0.08);
  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-sans: "Plus Jakarta Sans", system-ui, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.55) rgba(11, 19, 31, 0.06);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: rgba(11, 19, 31, 0.05);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.75), rgba(158, 125, 49, 0.85));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--gold-500), var(--gold-700));
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-corner { background: transparent; }

body.vg-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(212, 175, 55, 0.08), transparent 55%),
    linear-gradient(180deg, var(--cream-100) 0%, var(--cream-200) 100%);
  -webkit-font-smoothing: antialiased;
}
body.vg-busy-on,
body.vg-busy-on * {
  cursor: wait !important;
}
body.vg-busy-on .vg-btn,
body.vg-busy-on button,
body.vg-busy-on [type="submit"] {
  cursor: not-allowed !important;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

.vg-shell { min-height: 100vh; display: flex; flex-direction: column; }

.vg-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 42%, var(--navy-850) 100%);
  border-bottom: 1px solid rgba(212, 175, 55, 0.22);
  box-shadow: 0 8px 28px rgba(7, 12, 19, 0.22);
}

.vg-topbar {
  border-bottom: 1px solid rgba(212, 175, 55, 0.14);
  color: #94a3b8;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.vg-topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 7px 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 34px;
}
.vg-secure {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #cbd5e1;
  font-weight: 500;
  white-space: nowrap;
}
.vg-secure .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
  flex-shrink: 0;
}
.vg-topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.vg-firm {
  color: var(--gold-600);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.vg-userchip {
  color: #94a3b8;
  font-size: 12px;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .vg-userchip { display: none; }
  .vg-secure span:last-child { font-size: 11px; }
}

.vg-header-main {
  background: transparent;
}
.vg-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}
.vg-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}
.vg-brand img {
  height: 42px;
  width: auto;
  object-fit: contain;
}

.vg-nav {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  justify-content: flex-end;
  overflow: hidden;
}
.vg-nav-track {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding: 2px 2px 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.45) transparent;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}
.vg-nav-track::-webkit-scrollbar { height: 4px; }
.vg-nav-track::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.45);
  border-radius: 999px;
}
.vg-nav a {
  flex: 0 0 auto;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.vg-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.vg-nav a.is-active {
  background: rgba(212, 175, 55, 0.16);
  color: var(--gold-400);
}
.vg-nav a.danger { color: #fda4af; }
.vg-nav a.danger:hover { background: rgba(244, 63, 94, 0.12); color: #fecdd3; }

.vg-main {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.vg-page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 22px;
}
.vg-page-head h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 2.4vw, 2.25rem);
  font-weight: 600;
  color: var(--navy-900);
  letter-spacing: 0.01em;
}
.vg-page-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: min(72ch, 100%);
  white-space: normal;
}
.vg-page-head.wide p { max-width: none; }

.vg-sig-pad {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}
.vg-sig-pad canvas {
  display: block;
  width: 100%;
  height: 180px;
  border: 1px dashed #d4d4d8;
  border-radius: 6px;
  cursor: crosshair;
  touch-action: none;
  background: #fff;
}
.vg-id-uploads[hidden] { display: none !important; }

.vg-flash {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
  font-size: 14px;
}
.vg-flash.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.vg-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px;
  margin-bottom: 18px;
}
.vg-card h2 {
  margin: 0 0 14px;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--navy-900);
}
.vg-card h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy-800);
}

.vg-grid {
  display: grid;
  gap: 12px;
}
.vg-grid.cols-2 { grid-template-columns: 1fr; }
@media (min-width: 768px) {
  .vg-grid.cols-2 { grid-template-columns: 1fr 1fr; }
}
.vg-grid .span-2,
.vg-settings-split .span-all { grid-column: 1 / -1; }
.vg-settings-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}
.vg-settings-split > .vg-card { margin-bottom: 0; }
@media (min-width: 960px) {
  .vg-settings-split { grid-template-columns: 1fr 1fr; }
}

.vg-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.vg-field input,
.vg-field select,
.vg-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--cream-50);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.vg-field input:focus,
.vg-field select:focus,
.vg-field textarea:focus {
  border-color: var(--gold-600);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
  background: #fff;
}

.vg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, opacity .15s ease;
}
.vg-btn:hover { transform: translateY(-1px); }
.vg-btn:disabled,
.vg-btn.is-loading {
  opacity: .6;
  cursor: not-allowed !important;
  transform: none;
  pointer-events: none;
}
.vg-btn.is-loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: currentColor;
  animation: vg-spin 0.7s linear infinite;
  margin-left: 2px;
}
.vg-btn-primary {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-700));
  color: var(--navy-950);
}
.vg-btn-dark {
  background: var(--navy-900);
  color: #fff;
}
.vg-btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--navy-800);
}
.vg-btn-danger {
  background: #fff;
  border: 1px solid #fecaca;
  color: var(--danger);
}
.vg-btn-sm { padding: 7px 11px; font-size: 12px; border-radius: 8px; }

.vg-table-wrap { overflow-x: auto; overflow-y: visible; }
.vg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.vg-table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
.vg-table td {
  padding: 14px 8px;
  border-bottom: 1px solid #f0ebe1;
  vertical-align: top;
}
.vg-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.vg-muted { color: var(--muted); }
.vg-assigned {
  position: relative;
  min-width: 110px;
  vertical-align: middle !important;
}
.vg-assigned-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  border: 0;
  background: transparent;
  padding: 2px 0;
  margin: 0;
  font: inherit;
  font-size: 13px;
  color: var(--navy-800);
  cursor: pointer;
  text-align: left;
}
.vg-assigned-toggle:hover { color: var(--navy-950); }
.vg-assigned-summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vg-assigned-caret {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted);
  transition: transform .15s ease;
}
.vg-assigned.is-open .vg-assigned-caret { transform: rotate(180deg); }
.vg-assigned-list {
  position: fixed;
  z-index: 390;
  min-width: 140px;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(11, 19, 31, 0.12);
}
.vg-assigned-list[hidden] { display: none !important; }
.vg-assigned-list li {
  padding: 7px 12px;
  font-size: 13px;
  color: var(--navy-900);
  white-space: nowrap;
}
.vg-assigned-list li + li { border-top: 1px solid #f1f5f9; }
.vg-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.vg-row-actions {
  width: 52px;
  text-align: right;
  vertical-align: middle !important;
  position: relative;
  overflow: visible;
}
.vg-menu {
  position: relative;
  display: inline-block;
  text-align: left;
}
.vg-menu-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy-800);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.vg-menu-btn:hover,
.vg-menu.is-open .vg-menu-btn {
  border-color: rgba(158, 125, 49, 0.45);
  background: #fffbeb;
}
.vg-menu-panel {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 400;
  min-width: 196px;
  padding: 6px 0;
  margin: 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(11, 19, 31, 0.16);
}
.vg-menu-panel.is-open {
  display: block;
}
.vg-menu-panel li {
  list-style: none;
  margin: 0;
  padding: 0;
}
.vg-menu-item,
.vg-menu-panel .vg-menu-item,
.vg-menu-panel button.vg-menu-item,
.vg-menu-panel a.vg-menu-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--navy-900);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
}
.vg-menu-item:hover,
.vg-menu-panel .vg-menu-item:hover {
  background: var(--cream-100) !important;
}
.vg-menu-item.is-danger {
  color: var(--danger) !important;
}
.vg-menu-panel form {
  margin: 0;
  padding: 0;
  display: block;
  width: 100%;
}

.vg-subcard {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--cream-50);
  margin-bottom: 12px;
}
.vg-bulkbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--cream-100);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.vg-bulk-selectall {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-800);
  margin-right: 4px;
  cursor: pointer;
}
.vg-sub-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 6px;
}
.vg-sub-check input,
.vg-bulk-selectall input,
.vg-sub-cb {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  flex: 0 0 auto;
  accent-color: var(--navy-800);
}
.vg-subcard .title { font-weight: 600; margin-bottom: 6px; }

.vg-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: #fff;
}
.vg-footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.vg-footer img { height: 28px; opacity: 0.9; }

/* Auth / public forms */
.vg-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(900px 420px at 80% 0%, rgba(212,175,55,.14), transparent 50%),
    linear-gradient(160deg, var(--navy-950), var(--navy-800));
}
.vg-auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
  overflow: hidden;
}
.vg-auth-brand {
  background: var(--navy-950);
  padding: 28px 28px 22px;
  text-align: center;
  border-bottom: 1px solid rgba(212,175,55,.25);
}
.vg-auth-brand img {
  height: 56px;
  margin: 0 auto 12px;
}
.vg-auth-brand p {
  margin: 0;
  color: var(--gold-600);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.vg-auth-body { padding: 28px; }
.vg-auth-body h1 {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--navy-900);
}
.vg-note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}
.vg-note.warn {
  color: #9f1239;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 10px;
  padding: 12px 14px;
}
.vg-check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--ink);
}
details.vg-details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px 12px;
}
details.vg-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  color: var(--navy-800);
  list-style: none;
}
details.vg-details summary::-webkit-details-marker { display: none; }

.vg-map-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding-right: 4px;
}
.vg-map-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--cream-50);
  align-items: flex-start;
}
.vg-map-item:hover { border-color: rgba(212, 175, 55, 0.45); }
.vg-map-item span { display: flex; flex-direction: column; gap: 2px; }
.vg-map-item strong { font-size: 14px; color: var(--navy-900); }

.vg-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy-800);
  background: #e8eef5;
  border-radius: 4px;
  vertical-align: middle;
}

body.vg-modal-open { overflow: hidden; }
.vg-modal[hidden] { display: none !important; }
.vg-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: vg-modal-in 0.2s ease;
}
.vg-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 19, 31, 0.55);
  backdrop-filter: blur(2px);
}
.vg-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(11, 19, 31, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: vg-dialog-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.vg-modal-dialog.wide {
  width: min(640px, 100%);
  max-height: min(92vh, 860px);
}
.vg-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 12px;
  border-bottom: 1px solid var(--line);
}
.vg-modal-head h3 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--navy-900);
  line-height: 1.2;
}
.vg-modal-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.vg-modal-x {
  border: 0;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
}
.vg-modal-x:hover { color: var(--navy-900); }
.vg-modal-body { padding: 18px 22px 8px; }
.vg-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 0 18px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
}
@keyframes vg-modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes vg-dialog-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.vg-busy {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(7, 12, 19, 0.28);
  backdrop-filter: blur(3px);
  animation: vg-modal-in 0.18s ease;
}
.vg-busy[hidden] { display: none !important; }
.vg-busy-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 22px 28px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(7, 12, 19, 0.25);
  min-width: 160px;
}
.vg-busy-label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-800);
  letter-spacing: 0.02em;
}
.vg-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(11, 19, 31, 0.1);
  border-top-color: var(--gold-500);
  animation: vg-spin 0.75s linear infinite;
}
@keyframes vg-spin {
  to { transform: rotate(360deg); }
}

.vg-toast-host {
  position: fixed;
  top: 88px;
  right: 18px;
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 28px));
  pointer-events: none;
}
.vg-toast {
  pointer-events: auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  box-shadow: 0 14px 36px rgba(11, 19, 31, 0.16);
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .22s ease, transform .22s ease;
}
.vg-toast.is-in {
  opacity: 1;
  transform: translateY(0);
}
.vg-toast.is-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

@media (max-width: 720px) {
  .vg-brand img { height: 36px; }
  .vg-nav a { padding: 7px 10px; font-size: 12px; }
  .vg-card { padding: 16px; }
  .vg-modal { padding: 12px; }
  .vg-modal-dialog { border-radius: 12px; }
  .vg-toast-host { top: 76px; right: 12px; }
}
