:root {
  --bg: #0f1419;
  --panel: #1a222d;
  --panel-2: #243040;
  --text: #e8eef5;
  --muted: #9aabbc;
  --accent: #3dd6c6;
  --accent-2: #f0b429;
  --danger: #ff6b6b;
  --ok: #5bd67a;
  --border: #2e3b4a;
  --font: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1c2a3a, transparent),
              radial-gradient(900px 500px at 100% 0%, #17232f, transparent),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { max-width: 1200px; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.shell--landing {
  max-width: none;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 1.25rem;
}
.landing-hero {
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}
.landing-hero h1 {
  margin: 0.35rem 0;
  font-size: clamp(2rem, 5vw, 3rem);
  text-shadow: 0 2px 18px rgba(0,0,0,0.45);
}
.landing-hero p {
  color: var(--text);
  opacity: 0.9;
  text-shadow: 0 1px 10px rgba(0,0,0,0.4);
}
.landing-hero__logo {
  height: 72px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  margin: 0 auto 0.75rem;
  display: block;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.35));
}
.landing-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.25rem;
}
.landing-hero__actions .btn-ghost {
  background: rgba(15,20,25,0.35);
  backdrop-filter: blur(6px);
}
.landing-mini-nav {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.landing-mini-nav a,
.landing-mini-nav button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  padding: 0.25rem 0.4rem;
}
.landing-mini-nav a:hover,
.landing-mini-nav button:hover { color: var(--text); }
body.landing-page { position: relative; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.5rem; padding: 0.85rem 1rem;
  background: rgba(26,34,45,0.9); border: 1px solid var(--border); border-radius: 14px;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-weight: 800; letter-spacing: 0.04em; font-size: 1.15rem; color: var(--accent);
}
.brand-logo {
  height: 36px; width: auto; max-width: 120px; object-fit: contain; display: block;
}
.brand-text span { color: var(--muted); font-weight: 500; margin-left: 0.35rem; }
.brand-preview {
  margin: 0.4rem 0 0.65rem; padding: 0.65rem; border: 1px solid var(--border);
  border-radius: 10px; background: #111820; display: inline-block;
}
.brand-preview img { display: block; max-height: 72px; max-width: 220px; object-fit: contain; }
.brand-preview--sm img { max-height: 40px; max-width: 40px; }
.brand-preview--bg img { max-height: 140px; max-width: min(420px, 100%); object-fit: cover; border-radius: 6px; }
.nav { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.nav a {
  color: var(--muted); padding: 0.35rem 0.65rem; border-radius: 999px;
  border: 1px solid transparent; text-decoration: none; font-size: 0.9rem;
}
.nav a:hover, .nav a.active {
  color: var(--text); border-color: var(--border); background: var(--panel-2); text-decoration: none;
}
.nav-meta { color: var(--muted); font-size: 0.85rem; }

.page-head h1 { margin: 0 0 0.35rem; font-size: 1.6rem; }
.page-head p { margin: 0 0 1.25rem; color: var(--muted); }

.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 1.1rem 1.2rem; margin-bottom: 1.25rem;
}

.results-refineable { margin-top: 0.35rem; }
.refine-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  margin: 0.65rem 0 0.85rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #151c26;
}
.refine-bar__label {
  margin: 0;
  white-space: nowrap;
  color: var(--text);
  font-size: 0.9rem;
}
.refine-bar__input {
  margin: 0;
}
.refine-bar__meta {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}
.refine-empty { margin: 0.35rem 0 0.75rem; }
@media (max-width: 640px) {
  .refine-bar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .refine-bar__meta { justify-self: start; }
}

.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.85rem;
}
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 0.65rem 0.75rem; border-radius: 10px;
  border: 1px solid var(--border); background: #111820; color: var(--text);
}
.mode-list { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin: 0.5rem 0 1rem; }
.mode-list label { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--text); }
.state-picker { margin-bottom: 0.85rem; padding: 0.65rem 0.85rem; border: 1px solid var(--border); border-radius: 12px; background: #151c26; }
.state-picker__head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.state-picker__actions { display: flex; gap: 0.4rem; }
.state-checks { margin: 0; }
.state-checks #id_states,
.state-checks {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.1rem;
}
.state-checks #id_states > div {
  display: inline-flex;
  margin: 0;
  padding: 0;
}
.state-checks label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  white-space: nowrap;
  margin: 0;
}
.actions { margin-top: 1rem; display: flex; gap: 0.75rem; align-items: center; }
.btn.is-cooling,
.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.btn {
  appearance: none; border: 0; border-radius: 10px; padding: 0.7rem 1.1rem;
  background: linear-gradient(135deg, #2bb8a9, #1f8f9e); color: #041014;
  font-weight: 700; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--text); font-weight: 600;
}

.summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem;
  margin-bottom: 1rem;
}
.summary-card {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 0.8rem;
}
.summary-card .src { font-weight: 700; }
.summary-card .count { font-size: 1.4rem; margin-top: 0.25rem; }
.summary-card.ok .count { color: var(--ok); }
.summary-card.err .count { color: var(--danger); }
.summary-card .err-text { color: var(--danger); font-size: 0.8rem; margin-top: 0.35rem; word-break: break-word; }

.tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.85rem; }
.tab-btn {
  border: 1px solid var(--border); background: var(--panel-2); color: var(--muted);
  border-radius: 999px; padding: 0.4rem 0.8rem; cursor: pointer; font-size: 0.85rem;
}
.tab-btn.active { color: var(--text); border-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.table-wrap { overflow: auto; border-radius: 10px; border: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th, table.data td {
  padding: 0.55rem 0.65rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top;
}
table.data th { background: #151c26; color: var(--muted); position: sticky; top: 0; }
table.data tr:hover td { background: rgba(61,214,198,0.05); }
.pre { white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }

.badge {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
}
.badge-ok { background: rgba(91,214,122,0.15); color: var(--ok); }
.badge-err { background: rgba(255,107,107,0.15); color: var(--danger); }

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1rem;
}
.login-card { width: min(420px, 100%); }
.errorlist { color: var(--danger); padding-left: 1.1rem; }
.messages { list-style: none; padding: 0; }
.messages li { margin-bottom: 0.5rem; padding: 0.6rem 0.8rem; border-radius: 8px; background: var(--panel-2); }
.paytm-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 0.9rem; margin-bottom: 0.75rem; background: #151c26;
}
.paytm-card h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.paytm-card__main { display: flex; gap: 0.85rem; align-items: flex-start; }
.paytm-card__media {
  flex: 0 0 64px; width: 64px; height: 64px; border-radius: 10px; overflow: hidden;
  background: #0f1419; border: 1px solid var(--border);
}
.paytm-card__media img { width: 64px; height: 64px; object-fit: contain; display: block; background: #fff; }
.paytm-card__media-ph {
  width: 64px; height: 64px; display: grid; place-items: center;
  color: var(--muted); font-size: 0.7rem; font-weight: 700;
}
.paytm-card__body { flex: 1; min-width: 0; }
.paytm-card__top { display: flex; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.paytm-card__side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.paytm-card__amount { color: var(--accent-2); font-size: 1.15rem; }
.paytm-card__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.45rem 0.75rem; margin-top: 0.7rem;
}
.paytm-card__grid span { display: block; color: var(--muted); font-size: 0.75rem; }
.paytm-card__grid strong { font-size: 0.88rem; font-weight: 600; word-break: break-word; }
.paytm-card__actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.75rem; }
.paytm-card__actions .btn-ghost { padding: 0.4rem 0.75rem; font-size: 0.82rem; }
.paytm-more {
  margin-top: 0.85rem; padding-top: 0.75rem; border-top: 1px solid var(--border);
}
.paytm-more h4 { margin: 0 0 0.5rem; font-size: 0.95rem; color: var(--accent); }
.paytm-timeline { list-style: none; padding: 0; margin: 0; }
.paytm-timeline li {
  display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0;
  border-bottom: 1px solid rgba(46,59,74,0.6); font-size: 0.88rem;
}
.paytm-timeline time, .paytm-timeline strong { color: var(--muted); white-space: nowrap; }
@media (max-width: 640px) {
  .paytm-card__side { text-align: left; align-items: flex-start; }
}
.meta { color: var(--muted); font-size: 0.85rem; }
.empty { color: var(--muted); padding: 1rem 0; }

.section-title {
  margin: 1.35rem 0 0.75rem;
  font-size: 1.05rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}
.section-title:first-of-type { margin-top: 0.25rem; }

.row-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center; }
.inline-form { display: inline; margin: 0; }
.link-danger {
  appearance: none; border: 0; background: transparent; color: var(--danger);
  cursor: pointer; padding: 0; font: inherit; text-decoration: underline;
}
.check-field { display: flex; align-items: flex-end; padding-bottom: 0.35rem; }
.check-label { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--text); margin: 0; }
.check-label input { width: auto; }

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #151c26;
}
.filter-actions { display: flex; align-items: flex-end; gap: 0.5rem; flex-wrap: wrap; }
.notice-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  background: #151c26;
}
.notice-card h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.link-action {
  appearance: none; border: 0; background: transparent; color: var(--accent);
  cursor: pointer; padding: 0; font: inherit; text-decoration: underline;
}
.query-cell { max-width: 320px; word-break: break-word; }
.msg-error, .msg-error { color: var(--danger); }
.messages li.msg-success { border-left: 3px solid var(--ok); }
.messages li.msg-error { border-left: 3px solid var(--danger); }

#notice-popup-root {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 0.65rem;
  max-width: min(420px, calc(100vw - 2rem));
  pointer-events: none;
}
.notice-popup { pointer-events: auto; width: 100%; }
.notice-popup__panel {
  background: #15202b;
  border: 1px solid var(--accent);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  padding: 0.9rem 1rem;
}
.notice-popup__head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.55rem;
}
.notice-popup__actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.notice-popup__actions .btn,
.notice-popup__actions .btn-ghost {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 8px;
}
.notice-popup__body {
  max-height: 180px;
  overflow: auto;
  color: var(--text);
  margin: 0;
}
.notice-popup__chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font-size: 0.82rem;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notice-popup__chip:hover { border-color: var(--accent); }
.notice-popup.is-minimized .notice-popup__panel { display: none; }
.notice-popup__status { color: var(--accent); font-size: 0.78rem; align-self: center; }

#notice-popup-root.notice-modal-mode {
  inset: 0;
  right: 0;
  bottom: 0;
  max-width: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  /* Don't block the page — only backdrop + cards receive clicks */
  pointer-events: none;
}
#notice-popup-root.notice-modal-mode .notice-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 16, 0.72);
  z-index: 9998;
  pointer-events: auto;
  cursor: pointer;
}
#notice-popup-root.notice-modal-mode .notice-popup-stack {
  position: relative;
  z-index: 9999;
  width: min(520px, calc(100vw - 2rem));
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}
#notice-popup-root.notice-modal-mode .notice-popup {
  pointer-events: auto;
}
#notice-popup-root.notice-modal-mode .notice-popup__panel {
  border-width: 2px;
}
/* After dismiss: free the page, keep minimized chips bottom-right */
#notice-popup-root.notice-modal-mode.notices-cleared {
  inset: auto;
  right: 1rem;
  bottom: 1rem;
  width: auto;
  height: auto;
  max-width: min(420px, calc(100vw - 2rem));
  align-items: flex-end;
  justify-content: flex-end;
  pointer-events: none;
}
#notice-popup-root.notice-modal-mode.notices-cleared .notice-modal-backdrop {
  display: none !important;
}
#notice-popup-root.notice-modal-mode.notices-cleared .notice-popup-stack {
  width: auto;
  pointer-events: none;
}
#notice-popup-root.notice-modal-mode.notices-cleared .notice-popup {
  pointer-events: auto;
}
.notice-popup__audio { display: none; }
