:root {
  color-scheme: dark;
  --bg: #0d0616;
  --bg-2: #080b12;
  --panel: #211033;
  --panel-2: #31164d;
  --line: rgba(255, 255, 255, .12);
  --text: #ffffff;
  --muted: #bda8d2;
  --pink: #ff2bbd;
  --violet: #8b2cff;
  --cyan: #18ccff;
  --danger: #ff355f;
  --ok: #26d36d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(139, 44, 255, .28), transparent 34%),
    radial-gradient(circle at 90% 15%, rgba(24, 204, 255, .12), transparent 32%),
    linear-gradient(135deg, #070910 0%, #111019 48%, #08040f 100%);
  color: var(--text);
}

button, input, textarea, select {
  font: inherit;
}

button {
  border: 0;
  color: white;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

button:hover { filter: brightness(1.12); }
button.ghost { background: rgba(255,255,255,.08); }
button.danger, .danger { background: var(--danger); }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  outline: none;
  border-radius: 8px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, .08);
  color: white;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

select option { color: #171020; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }

.hidden { display: none !important; }

.login-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(430px, 100%);
  display: grid;
  gap: 14px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(21, 8, 34, .86);
  box-shadow: 0 25px 90px rgba(0,0,0,.45);
}

.login-card img {
  width: 96px;
  height: 96px;
  object-fit: contain;
}

.login-card h1, .login-card p { margin: 0; }
.login-card p, small, .muted { color: var(--muted); }

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

aside {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: rgba(8, 10, 16, .92);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 18px;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.nav-label {
  display: block;
  margin: 18px 8px 7px;
  color: rgba(255,255,255,.52);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

aside button {
  width: 100%;
  margin: 4px 0;
  text-align: left;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}

aside button.active {
  color: white;
  background: linear-gradient(135deg, rgba(139, 44, 255, .30), rgba(255, 43, 189, .12));
  border-color: rgba(139, 44, 255, .35);
}

main {
  min-width: 0;
  padding: 24px;
}

.page { display: none; }
.page.active { display: grid; gap: 18px; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h1, h2 { margin: 0; }
h1 { font-size: 30px; }
h2 { font-size: 18px; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.grid.two { grid-template-columns: 1.1fr .9fr; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.agency-console {
  display: grid;
  grid-template-columns: minmax(360px, .95fr) minmax(420px, 1.25fr);
  gap: 16px;
  align-items: start;
}

.agency-editor {
  position: static;
}

.agency-data-layout {
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(460px, 1.2fr);
  gap: 16px;
  align-items: start;
}

.card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.032));
  box-shadow: 0 18px 60px rgba(0,0,0,.24);
}

.compact-head {
  gap: 10px;
  margin-bottom: 12px;
}

.compact-head h2 {
  margin: 0;
}

.status-active,
.status-paid {
  color: #48df7b;
}

.status-expired,
.status-pending {
  color: #ffb84d;
}

.status-danger {
  color: #ff6868;
}

.metrics .card {
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.card span { color: var(--muted); }
.card b { font-size: 24px; }

.form {
  display: grid;
  gap: 11px;
  align-content: start;
}

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

.toolbar input { max-width: 620px; }

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.list {
  display: grid;
  gap: 10px;
  max-height: 540px;
  overflow: auto;
  padding-right: 4px;
}

.list.compact { max-height: 330px; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.052);
}

.row:hover {
  border-color: rgba(139, 44, 255, .42);
  background: rgba(139, 44, 255, .08);
}

.row > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.row button {
  padding: 8px 10px;
  font-size: 13px;
}

.agency-list .row {
  align-items: flex-start;
}

.agency-list .row b {
  font-size: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(24, 204, 255, .12);
  color: #9beaff;
  border: 1px solid rgba(24, 204, 255, .26);
}

.profile-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0,0,0,.18);
}

.page h1 + .muted,
.page-head .muted {
  margin-top: 4px;
}

.profile-preview img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--pink);
}

.profile-preview div {
  display: grid;
  gap: 4px;
}

.profile-preview span { color: var(--muted); }

.mini-log {
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: rgba(0,0,0,.22);
  color: var(--muted);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.info-line {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.055);
}

.info-line span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.info-line b {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.room-warning-preview {
  padding: 14px;
  border-radius: 8px;
  color: #77fff0;
  background: rgba(29, 255, 218, .12);
  border: 1px solid rgba(29, 255, 218, .22);
  line-height: 1.45;
}

h3 {
  margin: 14px 0 10px;
  font-size: 15px;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 8px 0 0;
  color: #d8c8e7;
}

.toggles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.toggles label,
.card.form > label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.06);
}

input[type="checkbox"] {
  width: auto;
}

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 1fr; }
  aside {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }
  .brand { grid-column: 1 / -1; }
  .grid, .grid.two, .grid.three { grid-template-columns: 1fr; }
  .agency-console, .agency-data-layout { grid-template-columns: 1fr; }
  .agency-editor { position: static; }
  .info-grid { grid-template-columns: 1fr; }
  .toolbar { flex-wrap: wrap; }
}

@media (max-width: 620px) {
  main { padding: 14px; }
  h1 { font-size: 24px; }
  .split, .toggles { grid-template-columns: 1fr; }
}
