/* City Nightfall admin: the game's sunset palette (purples, magenta, coral), Poppins. */
:root {
  --ink: #221537; --ink-2: #5b4a73; --muted: #8a7ba0; --line: #ece6f5; --paper: #fbf9fe; --surface: #ffffff;
  --accent: #8d5bd1; --accent-2: #ff5bd6; --grad: linear-gradient(135deg, #8d5bd1, #ff5bd6); --danger: #e0445c;
  --shadow: 0 10px 30px rgba(40, 18, 80, 0.12); --r: 16px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Poppins, system-ui, sans-serif; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
button { font: inherit; cursor: pointer; }
input { font: inherit; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; height: 2.7rem; padding: 0 1.2rem; border: 0; border-radius: 999px; font-weight: 700; transition: transform 0.12s, box-shadow 0.2s, opacity 0.2s; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(141, 91, 209, 0.35); }
.btn-ghost { background: #f1ebfa; color: var(--accent); }
.btn-danger { background: #ffe8ec; color: var(--danger); }
.btn-sm { height: 2.1rem; padding: 0 0.9rem; font-size: 0.8rem; }
.link { border: 0; background: none; color: var(--accent); font-weight: 700; font-size: 0.8rem; }

.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand-mark { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 12px; background: var(--grad); color: #fff; font-weight: 800; letter-spacing: 0.02em; box-shadow: 0 6px 16px rgba(255, 91, 214, 0.35); }
.brand strong { display: block; font-size: 1rem; }
.brand > div span { display: block; font-size: 0.72rem; color: var(--muted); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------- Login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 1.5rem; position: relative; overflow: hidden;
  background: linear-gradient(180deg, #1c1036 0%, #4b1f6e 45%, #d9477a 78%, #ff9a6b 100%); }
.login-sky { position: absolute; inset: 0; pointer-events: none; }
.sun { position: absolute; left: 50%; bottom: 14%; width: 26rem; height: 26rem; margin-left: -13rem; border-radius: 50%;
  background: radial-gradient(circle, #ffe7a3 0%, #ffb36b 45%, rgba(255, 120, 120, 0) 70%); opacity: 0.8; }
.skyline { position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background:
  linear-gradient(transparent 0 0) , repeating-linear-gradient(90deg, #1a0d2e 0 38px, #25143f 38px 64px, #150a26 64px 90px, #2b1747 90px 130px);
  clip-path: polygon(0 60%, 6% 60%, 6% 30%, 12% 30%, 12% 50%, 18% 50%, 18% 15%, 25% 15%, 25% 45%, 31% 45%, 31% 25%, 38% 25%, 38% 55%, 45% 55%, 45% 10%, 52% 10%, 52% 40%, 58% 40%, 58% 20%, 66% 20%, 66% 50%, 72% 50%, 72% 30%, 80% 30%, 80% 45%, 87% 45%, 87% 18%, 94% 18%, 94% 52%, 100% 52%, 100% 100%, 0 100%); }
.login-card { position: relative; width: min(100%, 25rem); display: flex; flex-direction: column; gap: 0.9rem; padding: 2rem;
  border-radius: 24px; background: rgba(255, 255, 255, 0.96); box-shadow: 0 30px 80px rgba(20, 5, 40, 0.45); backdrop-filter: blur(10px); }
.login-card h1 { font-size: 1.6rem; margin-top: 0.6rem; }
.login-card p { margin: 0; font-size: 0.9rem; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.8rem; font-weight: 700; color: var(--ink-2); }
label input { height: 2.9rem; padding: 0 1rem; border-radius: 12px; border: 1.5px solid var(--line); background: #faf8fd; color: var(--ink); font-weight: 500; font-size: 0.95rem; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
label input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(141, 91, 209, 0.15); background: #fff; }
.error { color: var(--danger); font-size: 0.85rem; min-height: 1.2em; }
.login-card .btn { width: 100%; }
.back { text-align: center; font-size: 0.8rem; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--accent); }

/* ---------- Panel ---------- */
.panel { display: grid; grid-template-columns: 16rem 1fr; min-height: 100%; }
.nav { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.6rem; padding: 1.4rem 1rem; background: #1d1231; color: #fff; }
.nav .brand > div span { color: rgba(255, 255, 255, 0.55); }
.nav nav { display: flex; flex-direction: column; gap: 0.3rem; }
.nav nav button, .nav-link { display: flex; align-items: center; gap: 0.7rem; height: 2.8rem; padding: 0 0.9rem; border: 0; border-radius: 12px; background: none; color: rgba(255, 255, 255, 0.75); font-weight: 600; font-size: 0.9rem; text-decoration: none; text-align: left; }
.nav nav button:hover, .nav-link:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav nav button.is-active { background: var(--grad); color: #fff; box-shadow: 0 8px 18px rgba(255, 91, 214, 0.3); }
.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.6rem; font-size: 0.8rem; }
.nav-foot .muted { color: rgba(255, 255, 255, 0.55); }
.main { padding: 2rem clamp(1rem, 3vw, 2.5rem); min-width: 0; }
.view { display: flex; flex-direction: column; gap: 1.3rem; animation: fade 0.25s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.view-head h2 { font-size: 1.7rem; }
.view-head p { margin: 0.2rem 0 0; font-size: 0.85rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; }
.card { position: relative; display: flex; flex-direction: column; gap: 0.15rem; padding: 1.2rem; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.card::after { content: ''; position: absolute; right: -2rem; top: -2rem; width: 6rem; height: 6rem; border-radius: 50%; background: var(--grad); opacity: 0.1; }
.card-icon { font-size: 1.3rem; }
.card-label { font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.4rem; }
.card strong { font-size: 2rem; line-height: 1.1; }
.card .muted { font-size: 0.78rem; }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; }
.box { padding: 1.2rem; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.box-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.9rem; }
.box-head h3 { font-size: 1rem; }
.chart { height: 13rem; }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); align-items: end; gap: 0.35rem; height: 100%; }
.bar { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bar span { width: 100%; min-height: 3px; border-radius: 8px 8px 3px 3px; background: var(--grad); transition: height 0.4s; }
.bar em { position: absolute; top: -0.2rem; font-style: normal; font-size: 0.7rem; font-weight: 700; color: var(--ink-2); }
.bar i { font-style: normal; font-size: 0.65rem; color: var(--muted); margin-top: 0.3rem; }
.recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.recent li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.8rem; padding: 0.55rem; border-radius: 12px; cursor: pointer; font-size: 0.85rem; }
.recent li:hover { background: #f6f1fc; }
.recent li div { display: flex; flex-direction: column; min-width: 0; }
.recent li .muted { font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 800; flex: none; }
.avatar-lg { width: 3.4rem; height: 3.4rem; font-size: 1.3rem; }
.search { height: 2.7rem; width: min(100%, 22rem); padding: 0 1rem; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; outline: none; }
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(141, 91, 209, 0.15); }
.table-box { padding: 0; overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.table th { text-align: left; padding: 0.9rem 1.2rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 0.75rem 1.2rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tbody tr { cursor: pointer; transition: background 0.15s; }
.table tbody tr:hover { background: #faf6ff; }
.table .right { text-align: right; }
.table .empty { text-align: center; padding: 2.5rem; }
.who { display: flex; align-items: center; gap: 0.75rem; }
.who div { display: flex; flex-direction: column; }
.who .muted { font-size: 0.75rem; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1.2rem; }
.form { display: flex; flex-direction: column; gap: 0.9rem; max-width: 28rem; }
.form .btn { align-self: flex-start; }

/* ---------- Drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 10; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(20, 8, 40, 0.45); animation: fade 0.2s both; }
.drawer-card { position: absolute; right: 0; top: 0; bottom: 0; width: min(100%, 30rem); overflow: auto; padding: 1.6rem; background: #fff; box-shadow: -20px 0 50px rgba(20, 8, 40, 0.25); animation: slide 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; display: flex; flex-direction: column; gap: 1rem; }
@keyframes slide { from { transform: translateX(100%); } }
.drawer-close { position: absolute; right: 1rem; top: 1rem; width: 2.2rem; height: 2.2rem; border: 0; border-radius: 50%; background: #f1ebfa; color: var(--ink); }
.drawer-head { display: flex; align-items: center; gap: 0.9rem; }
.drawer-card h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-top: 0.4rem; }
.kvs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.kv { display: flex; flex-direction: column; padding: 0.7rem 0.8rem; border-radius: 12px; background: #f8f4fd; }
.kv span { font-size: 0.7rem; color: var(--muted); font-weight: 600; }
.kv strong { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; }
.meters { display: flex; flex-direction: column; gap: 0.45rem; }
.meter { display: grid; grid-template-columns: 5.5rem 1fr 2.5rem; align-items: center; gap: 0.6rem; font-size: 0.8rem; }
.meter span { text-transform: capitalize; color: var(--ink-2); }
.meter div { height: 0.5rem; border-radius: 999px; background: #efe8f8; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--grad); border-radius: inherit; }
.meter b { text-align: right; font-size: 0.78rem; }
.drawer-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: auto; padding-top: 1rem; }

@media (max-width: 900px) {
  .panel { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.8rem; padding: 0.9rem 1rem; }
  .nav nav { flex-direction: row; flex-wrap: wrap; }
  .nav nav button, .nav-link { height: 2.3rem; font-size: 0.8rem; padding: 0 0.7rem; }
  .nav-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .grid2 { grid-template-columns: 1fr; }
}
