:root {
  color-scheme: light;
  --bg: #f2efe8;
  --surface: rgba(255, 252, 245, 0.88);
  --surface-strong: #fffaf0;
  --ink: #1f2a2e;
  --muted: #5e6b70;
  --line: rgba(31, 42, 46, 0.12);
  --accent: #0e7c66;
  --accent-strong: #095748;
  --accent-soft: rgba(14, 124, 102, 0.12);
  --shadow: 0 20px 60px rgba(31, 42, 46, 0.08);
  --error: #b42318;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(14, 124, 102, 0.10), transparent 28%),
    radial-gradient(circle at bottom right, rgba(195, 126, 71, 0.16), transparent 32%),
    linear-gradient(180deg, #f7f3eb 0%, var(--bg) 100%);
}

.page-shell {
  width: min(1680px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 14px 0 24px;
}

.hero,
.filters-card,
.table-card {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 24px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  font-weight: 600;
}

h1 {
  font-size: 20px;
  line-height: 1;
}

.metric-note,
.table-note,
.sidebar-copy {
  color: var(--muted);
}

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

.menu-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
}

.menu-button.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.metric-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-value {
  font-size: 16px;
  font-weight: 700;
}

.metric-note {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 12px;
  min-height: calc(100vh - 118px);
}

.filters-card,
.table-card {
  padding: 18px;
}

.sidebar-card {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar-header {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.sidebar-metrics {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--surface-strong) 0%, rgba(255, 248, 235, 0.86) 100%);
}

.sidebar-header h2,
.table-header h2 {
  font-size: 17px;
}

.sidebar-copy,
.table-note {
  font-size: 13px;
  line-height: 1.4;
}

.filters-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

button {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.actions-row {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.sidebar-actions-top {
  margin-top: 0;
  margin-bottom: 16px;
}

.actions-row button,
.export-controls button,
.export-controls select {
  width: 100%;
}

.export-controls {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.compact-button {
  min-height: 42px;
}

.table-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 118px);
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.table-header > div:first-child {
  display: grid;
  gap: 4px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: rgba(250, 247, 241, 0.96);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

tbody tr:hover {
  background: var(--accent-soft);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
}

.tag.error {
  background: rgba(180, 35, 24, 0.12);
  color: var(--error);
}

.tag.pending {
  background: rgba(207, 146, 41, 0.16);
  color: #8b5d0f;
}

.tag.info {
  background: rgba(35, 108, 214, 0.16);
  color: #1f5fb7;
}

.tag.success {
  background: rgba(14, 124, 102, 0.14);
  color: var(--accent-strong);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 36px 16px;
}

@media (max-width: 1100px) {
  .workspace-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .sidebar-card {
    position: static;
    max-height: none;
    overflow: visible;
  }

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

  .actions-row,
  .export-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-panel {
    min-height: calc(100vh - 220px);
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100vw - 18px, 1680px);
    padding-top: 10px;
  }

  .hero,
  .filters-card,
  .table-card {
    padding: 14px;
    border-radius: 18px;
  }

  .hero {
    justify-content: stretch;
  }

  .filters-grid,
  .actions-row,
  .export-controls {
    grid-template-columns: 1fr;
  }

  .table-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-panel {
    min-height: calc(100vh - 280px);
  }

  table {
    min-width: 820px;
  }
}