:root {
  --ink: #171a2b;
  --muted: #6b7280;
  --line: #e6e3dc;
  --bg: #fbf9f4;
  --card: #ffffff;
  --indigo: #4f46e5;
  --indigo-2: #6d5ef0;
  --saffron: #e8850c;
  --saffron-2: #f6a723;
  --ok: #14804a;
  --warn: #b45309;
  --err: #c02626;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(30, 27, 75, 0.08);
  --shadow-sm: 0 4px 14px rgba(30, 27, 75, 0.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, "Noto Sans", "Lohit Devanagari", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--indigo); }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 10px 22px;
  display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--indigo), var(--saffron));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px;
  box-shadow: var(--shadow-sm);
}
.brand h1 { font-size: 18px; margin: 0; letter-spacing: -0.2px; }
.brand .tag { font-size: 11.5px; color: var(--muted); margin-top: -2px; }
.topbar .spacer { flex: 1; }
select, input, textarea { font-family: inherit; }
select.locale {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 7px 10px; font-size: 13px; color: var(--ink);
}
.auth-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: 11px; padding: 10px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: transform .06s ease, box-shadow .2s ease, background .2s ease;
  background: var(--indigo); color: #fff;
}
.btn:hover { background: var(--indigo-2); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f6f5fb; }
.btn.gold { background: linear-gradient(135deg, var(--saffron), var(--saffron-2)); color: #3a2400; }
.btn.gold:hover { filter: brightness(1.04); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Nav tabs ---------- */
nav.tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 10px 22px; background: transparent; border-bottom: 1px solid var(--line);
  position: sticky; top: 55px; z-index: 30;
  background: rgba(251,249,244,0.9); backdrop-filter: blur(8px);
}
nav.tabs button {
  border: none; background: transparent; padding: 9px 14px; cursor: pointer;
  border-radius: 10px; font-size: 14px; color: var(--muted); font-weight: 600;
}
nav.tabs button:hover { background: #f1effb; color: var(--ink); }
nav.tabs button.active { background: var(--indigo); color: #fff; box-shadow: var(--shadow-sm); }

main { max-width: 1060px; margin: 0 auto; padding: 24px 22px 60px; }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Hero ---------- */
.hero {
  border-radius: 24px; padding: 34px 30px; margin-bottom: 22px; color: #fff;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(246,167,35,0.35) 0%, rgba(246,167,35,0) 45%),
    linear-gradient(135deg, #312e81 0%, #4f46e5 55%, #7c3aed 100%);
  box-shadow: var(--shadow);
}
.hero h2 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.4px; }
.hero p { margin: 0; opacity: .92; font-size: 15px; max-width: 620px; }
.hero .chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.hero .chip { background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.28); padding: 5px 11px; border-radius: 999px; font-size: 12.5px; }

/* ---------- Cards & forms ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow-sm);
}
.card h2 { margin: 0 0 4px; font-size: 19px; letter-spacing: -0.2px; }
.card p.sub { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input, select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14.5px; background: #fff; color: var(--ink); transition: border .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79,70,229,0.13); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > div { flex: 1; min-width: 140px; }

/* ---------- Place autocomplete ---------- */
.autocomplete { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); max-height: 260px; overflow: auto; display: none;
}
.ac-list.open { display: block; }
.ac-item { padding: 9px 13px; font-size: 13.5px; cursor: pointer; border-bottom: 1px solid #f3f1ea; }
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.active { background: #f4f2fe; }
.ac-item .muted { display: block; font-size: 11.5px; }

/* ---------- Stats & tables ---------- */
.stat { background: linear-gradient(180deg,#f7f6ff,#f2f1fb); border: 1px solid #e7e4f7; border-radius: var(--radius-sm); padding: 14px 16px; }
.stat .n { font-size: 21px; font-weight: 800; color: var(--indigo); letter-spacing: -0.3px; }
.stat .l { font-size: 12px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 10px; }
th, td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--line); }
th { background: #f6f5fb; color: #3b3a63; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill.ok { background: #e2f5ea; color: var(--ok); }
.pill.warn { background: #fdeedb; color: var(--warn); }
.muted { color: var(--muted); font-size: 13px; }

.list-item { display: flex; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: center; }
.list-item:last-child { border-bottom: none; }
.list-item .meta { font-size: 12px; color: var(--muted); }

.msg { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-top: 12px; display: none; }
.msg.show { display: block; }
.msg.err { background: #fdeaea; color: var(--err); }
.msg.ok { background: #e2f5ea; color: var(--ok); }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(23,26,43,0.45); backdrop-filter: blur(3px); display: none; z-index: 60; }
.modal-back.open { display: grid; place-items: center; padding: 20px; }
.modal { background: #fff; border-radius: 20px; width: 100%; max-width: 400px; padding: 26px; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 4px; font-size: 20px; }
.modal p.sub { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.modal .tabs { display: flex; gap: 6px; background: #f3f1fb; padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.modal .tabs button { flex: 1; border: none; background: transparent; padding: 8px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--muted); font-size: 13.5px; }
.modal .tabs button.active { background: #fff; color: var(--indigo); box-shadow: var(--shadow-sm); }
.modal .field { margin-bottom: 12px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.gbtn {
  display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%;
  border: 1px solid var(--line); background: #fff; border-radius: 11px; padding: 11px; font-weight: 600;
  font-size: 14px; cursor: pointer; color: var(--ink);
}
.gbtn:hover { background: #f7f7fb; }
.gbtn svg { width: 18px; height: 18px; }
.modal .close { float: right; border: none; background: transparent; font-size: 20px; cursor: pointer; color: var(--muted); }

footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 30px; border-top: 1px solid var(--line); }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
