:root {
  --bg: #0d0d0d; --panel: #171717; --panel2: #1f1f1f; --line: #2c2c2c;
  --gold: #d4af37; --gold2: #f1d77a; --text: #f2f2f2; --muted: #9a9a9a;
  --ok: #3ecf8e; --bad: #ff6b6b; --warn: #f5b041;
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Tamil", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; }
a { color: var(--gold2); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 1.2em; }
.brand { font-weight: 800; font-size: 20px; color: var(--gold); letter-spacing: .5px; margin-bottom: 18px; }
.brand span { color: var(--text); font-weight: 400; }
.brand.big { font-size: 28px; }

#app { display: flex; min-height: 100vh; }
#nav { width: 230px; background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
#nav a { color: var(--text); text-decoration: none; padding: 9px 12px; border-radius: 8px; }
#nav a:hover { background: var(--panel2); }
#nav a.active { background: linear-gradient(90deg, rgba(212,175,55,.25), transparent); color: var(--gold2); border-left: 3px solid var(--gold); }
#nav #logout { margin-top: auto; }
main { flex: 1; padding: 26px 30px 60px; max-width: 1200px; min-width: 0; }
h1 { font-size: 24px; margin: 0 0 4px; }
h1 + .muted { margin: 0 0 20px; }
h2 { font-size: 17px; margin: 0 0 12px; color: var(--gold2); }
.menu-btn { display: none; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 16px; }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.stat .n { font-size: 28px; font-weight: 800; color: var(--gold); }
.stat .l { color: var(--muted); font-size: 13px; }

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
input, textarea, select { width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 10px 12px; font: inherit; }
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--gold); border-color: transparent; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1; min-width: 150px; }

.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 9px; padding: 9px 16px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--gold); }
.btn.gold { background: linear-gradient(135deg, var(--gold), #b8901f); color: #111; font-weight: 700; border: none; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; cursor: pointer; user-select: none; }
.chip input { width: auto; accent-color: var(--gold); }
.chip.on { border-color: var(--gold); color: var(--gold2); }
.badge { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); }
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.bad { color: var(--bad); border-color: var(--bad); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.gold { color: var(--gold2); border-color: var(--gold); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
.table-wrap { overflow-x: auto; }

.list-item { border-bottom: 1px solid var(--line); padding: 12px 0; }
.list-item:last-child { border-bottom: none; }
.stars { color: var(--gold); letter-spacing: 1px; }
.preview { max-width: 100%; max-height: 260px; border-radius: 10px; margin-top: 10px; }
.thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; background: var(--panel2); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }

.inbox { display: grid; grid-template-columns: 320px 1fr; gap: 16px; min-height: 60vh; }
.convo { padding: 10px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.convo:hover, .convo.active { background: var(--panel2); border-color: var(--line); }
.bubbles { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow-y: auto; padding: 4px; }
.bubble { max-width: 75%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.bubble.in { background: var(--panel2); align-self: flex-start; }
.bubble.out { background: rgba(212,175,55,.18); border: 1px solid rgba(212,175,55,.35); align-self: flex-end; }
.bubble small { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }

.report li { margin-bottom: 12px; line-height: 1.5; }
.prio { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; margin-right: 6px; }
.prio.h { background: rgba(255,107,107,.18); color: var(--bad); }
.prio.m { background: rgba(245,176,65,.18); color: var(--warn); }
.prio.l { background: rgba(62,207,142,.15); color: var(--ok); }
code, pre { background: var(--panel2); border-radius: 6px; padding: 2px 6px; font-size: 13px; }
pre { padding: 12px; overflow-x: auto; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--gold); padding: 12px 20px; border-radius: 10px; z-index: 50; max-width: 90vw; }
.toast.bad { border-color: var(--bad); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; text-align: center; }
.login-card input { margin: 14px 0; }
.login-card .btn { width: 100%; }

@media (max-width: 860px) {
  #nav { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  #nav.open { transform: none; }
  .menu-btn { display: block; position: fixed; top: 12px; left: 12px; z-index: 41; background: var(--panel); color: var(--gold); border: 1px solid var(--line); border-radius: 8px; font-size: 20px; padding: 4px 11px; }
  main { padding: 60px 16px 40px; }
  .grid2, .inbox { grid-template-columns: 1fr; }
}
