:root {
  color-scheme: light;
  --primary: #5ec297;
  --primary-dark: #349b72;
  --surface: #ffffff;
  --surface-muted: #ebebeb;
  --surface-page: #f6f6f7;
  --surface-hover: #dff4ea;
  --border: #ebebeb;
  --text: #444444;
  --text-muted: #6b7280;
  --text-inverse: #ffffff;
  --shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

[x-cloak] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Roboto, "Segoe UI", Arial, sans-serif;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface-page);
}

button,
input,
select {
  font: inherit;
}

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

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem;
  overflow-x: hidden;
}

.hero,
.region-strip,
.panel {
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero {
  padding: 2rem;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(16rem, 0.9fr);
  gap: 1.5rem 2rem;
}

.hero-kicker {
  margin-bottom: 0.75rem;
  color: var(--primary-dark);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 500;
  color: #23252c;
}

.hero p {
  margin: 0;
  max-width: 46rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  align-self: start;
  background: var(--surface-muted);
}

.hero-stat {
  min-height: 6rem;
  padding: 1rem;
  background: var(--surface-page);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
}

.hero-stat-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.hero-stat strong {
  font-size: 1rem;
  font-weight: 500;
  color: #23252c;
  word-break: break-word;
}

.filter-bar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem;
  padding-top: 0.5rem;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 18rem;
}

.filter-field-type {
  min-width: 12rem;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.filter-input {
  width: 100%;
  height: 2.75rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.filter-input:hover,
.filter-input:focus {
  outline: 0;
  border-color: transparent;
  border-bottom: 2px solid var(--primary);
  background: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)), var(--primary);
}

.region-strip {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem 1.25rem;
}

.region-strip-label {
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tab-button {
  min-width: 11rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tab-button:hover,
.tab-button.active {
  border-color: var(--primary);
  background: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)), var(--primary);
}

.tab-button-label {
  font-weight: 700;
  letter-spacing: 0.08em;
}

.tab-button-domain {
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-word;
}

.panel {
  margin-top: 1.5rem;
  overflow: hidden;
}

.panel-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-page);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.panel-header h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 500;
  color: #23252c;
}

.panel-header p,
.meta {
  margin: 0;
  color: var(--text-muted);
}

.panel-actions {
  min-width: 14rem;
}

.panel-domain {
  margin-bottom: 0.75rem;
  text-align: right;
}

.table-wrap {
  overflow-x: auto;
}

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

th {
  padding: 0.85rem 1rem;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
}

td {
  padding: 1rem;
  vertical-align: top;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover td {
  background: linear-gradient(rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.82)), var(--primary);
}

.app-name {
  margin-bottom: 0.35rem;
  font-weight: 500;
  color: #23252c;
}

.app-meta,
.frame-meta {
  font-size: 0.8rem;
}

.endpoint {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.84rem;
  line-height: 1.6;
  word-break: break-all;
}

.iframe-shell {
  min-width: 240px;
  max-width: 340px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface-page);
}

.version-frame {
  display: block;
  width: 100%;
  height: 48px;
  border: 0;
  background: transparent;
}

.action-column {
  width: 1%;
  white-space: nowrap;
}

.refresh-button {
  min-width: 7rem;
  height: 2.25rem;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 0;
  background: var(--primary-dark);
  color: var(--text-inverse);
  cursor: pointer;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.refresh-button:hover {
  filter: brightness(0.94);
}

.refresh-button:focus-visible {
  outline: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
}

.refresh-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.panel-refresh {
  width: 100%;
}

.empty-state {
  padding: 1.5rem;
  color: var(--text-muted);
}

@media (max-width: 1080px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page {
    padding: 1rem;
  }

  .hero,
  .region-strip,
  .panel-header {
    padding: 1rem;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .filter-field,
  .filter-field-type,
  .tab-button,
  .panel-actions {
    min-width: 100%;
  }

  .panel-domain {
    text-align: left;
  }

  .panel-header {
    flex-direction: column;
  }

  th,
  td {
    min-width: 10rem;
  }
}
