
:root {
  color-scheme: dark;
  --surface: #0c0e10;
  --surface-low: #111416;
  --surface-container: #161a1e;
  --surface-high: #1b2025;
  --surface-highest: #20262c;
  --text: #e0e6ed;
  --text-muted: #a6acb2;
  --primary: #b0c6ff;
  --primary-strong: #00429c;
  --danger: #ee7d77;
  --warning: #d3caeb;
  --shadow: 0 18px 48px rgba(155, 184, 255, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(0, 66, 156, 0.14), transparent 28%),
    radial-gradient(circle at top left, rgba(176, 198, 255, 0.08), transparent 24%),
    var(--surface);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
}

body {
  min-height: 100vh;
}

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

button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.app-shell {
  min-height: 100vh;
}

.login-shell {
  display: grid;
  place-items: center;
  padding: 24px;
}

.page-wrap {
  width: min(1680px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.login-wrap {
  width: min(460px, calc(100vw - 24px));
}

.login-card {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.login-card h1 {
  margin: 0;
  font-family: Manrope, sans-serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.04em;
}

.login-copy {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form .field span {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(238, 125, 119, 0.14);
  color: #ffb3ad;
  font-size: 0.88rem;
}

.login-actions {
  display: flex;
  justify-content: flex-end;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.hero h1 {
  margin: 0;
  font-family: Manrope, sans-serif;
  font-size: clamp(1.45rem, 2vw, 1.95rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.hero-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.logout-button {
  white-space: nowrap;
}

.panel {
  background: linear-gradient(180deg, rgba(22, 26, 30, 0.92), rgba(17, 20, 22, 0.96));
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow);
}

.summary-panel {
  margin-bottom: 10px;
}

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

.summary-card {
  min-height: 76px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(27, 32, 37, 0.9), rgba(17, 20, 22, 0.95));
}

.summary-card .label {
  color: var(--text-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.summary-card .value {
  margin-top: 8px;
  font-family: Manrope, sans-serif;
  font-size: 1.42rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.status-line {
  margin-bottom: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  background: rgba(22, 26, 30, 0.84);
  color: var(--text-muted);
  font-size: 0.84rem;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(32, 38, 44, 0.7);
}

.segmented.compact button {
  padding: 8px 10px;
  font-size: 0.72rem;
}

.segmented button {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.segmented button.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #06111f;
}

.segmented button:disabled {
  opacity: 0.35;
  cursor: default;
}

.filters-shell {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(4, minmax(170px, 1fr));
  gap: 10px;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 18px;
}

.field-wide {
  min-width: 0;
}

.field label {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 11px;
  background: rgba(32, 38, 44, 0.64);
  color: var(--text);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(176, 198, 255, 0.55);
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  line-height: 1;
}

.checkline input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
}

.toolbar-actions {
  display: flex;
  justify-content: flex-end;
}

.toolbar-actions-split {
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-title {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.list-card-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(32, 38, 44, 0.8);
  color: var(--text-muted);
  font-size: 0.72rem;
}

.button-primary {
  padding: 10px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #06111f;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.button-secondary {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(32, 38, 44, 0.8);
  color: var(--text);
  font-weight: 700;
}

.button-link {
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.content-panel {
  min-height: 420px;
  background: linear-gradient(180deg, rgba(22, 26, 30, 0.92), rgba(12, 14, 16, 0.98));
  border-radius: var(--radius-lg);
  padding: 14px;
}

.data-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.data-meta,
.subtle-text {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.empty-state,
.error-state,
.loading-state {
  padding: 28px 0;
  color: var(--text-muted);
  text-align: center;
}

.list-stack,
.json-stack {
  display: grid;
  gap: 8px;
}

.list-card,
.json-card {
  background: linear-gradient(180deg, rgba(27, 32, 37, 0.88), rgba(17, 20, 22, 0.96));
  border-radius: var(--radius-md);
  overflow: hidden;
}

.list-card.error {
  box-shadow: inset 2px 0 0 var(--danger);
}

.list-card.info {
  box-shadow: inset 2px 0 0 var(--primary);
}

.list-card.warning {
  box-shadow: inset 2px 0 0 var(--warning);
}

.list-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 0;
}

.list-card-head > div:first-child {
  min-width: 0;
}

.list-card-head .mono.subtle-text {
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
}

.list-card-title {
  margin: 0;
  font-family: Manrope, sans-serif;
  font-size: 1rem;
  letter-spacing: -0.03em;
}

.list-card-inline-body {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.list-card-body {
  padding: 4px 12px 8px;
  color: var(--text-muted);
  line-height: 1.5;
}

.list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 12px 8px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.list-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge.error {
  background: rgba(127, 41, 39, 0.32);
  color: var(--danger);
}

.badge.info {
  background: rgba(0, 66, 156, 0.28);
  color: var(--primary);
}

.badge.warning {
  background: rgba(211, 202, 235, 0.18);
  color: var(--warning);
}

.mono {
  font-family: "JetBrains Mono", monospace;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--text-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

tbody tr {
  background: rgba(22, 26, 30, 0.75);
}

.table-message {
  max-width: 360px;
  color: var(--text-muted);
}

.json-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(17, 20, 22, 0.88);
}

.json-body {
  padding: 14px;
  background: rgba(0, 0, 0, 0.22);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  z-index: 88;
}

.modal-backdrop.open {
  display: block;
}

.modal-shell {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(560px, calc(100vw - 24px));
  transform: translate(-50%, -46%);
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(22, 26, 30, 0.98), rgba(12, 14, 16, 0.98));
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
  z-index: 89;
  transition: transform 160ms ease-out, opacity 160ms ease-out;
}

.modal-shell.open {
  transform: translate(-50%, -50%);
  opacity: 1;
  pointer-events: auto;
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.modal-title {
  margin: 0;
  font-family: Manrope, sans-serif;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.modal-body {
  padding: 0 16px 8px;
}

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

.preset-button {
  padding: 14px 12px;
  border-radius: var(--radius-md);
  background: rgba(32, 38, 44, 0.74);
  color: var(--text);
  font-weight: 700;
  text-align: center;
}

.preset-button.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #06111f;
}

.pagination-controls {
  display: inline-flex;
  gap: 8px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  display: none;
  z-index: 70;
}

.drawer-backdrop.open {
  display: block;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(640px, 100vw);
  height: 100vh;
  background: rgba(17, 20, 22, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: -20px 0 48px rgba(0, 0, 0, 0.36);
  transform: translateX(100%);
  transition: transform 180ms ease-out;
  z-index: 80;
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.drawer-content {
  padding: 0 18px 18px;
  overflow: auto;
}

.drawer-section {
  padding: 14px 0;
}

.drawer-section + .drawer-section {
  border-top: 1px solid rgba(66, 73, 78, 0.1);
}

.notice {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(32, 38, 44, 0.74);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.notice.warning {
  background: rgba(127, 41, 39, 0.22);
  color: #ffb5b0;
}

@media (max-width: 1280px) {
  .summary-grid,
  .filter-row,
  .advanced-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page-wrap {
    width: min(100vw - 18px, 100%);
    padding-top: 12px;
  }

  .hero,
  .pagination,
  .data-head {
    flex-direction: column;
    align-items: stretch;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-row,
  .advanced-grid {
    grid-template-columns: 1fr;
  }

  .summary-card {
    min-height: 68px;
    padding: 9px 10px;
  }

  .summary-card .value {
    margin-top: 6px;
    font-size: 1.22rem;
  }

  .hero-controls,
  .toolbar-actions-split,
  .modal-head,
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .drawer {
    width: 100vw;
  }

  .list-card-head {
    align-items: flex-start;
  }

  .list-card-head .mono.subtle-text {
    font-size: 0.76rem;
  }
}
