:root {
  --bg: #f6f3ed;
  --panel: #fffdf8;
  --ink: #20242a;
  --muted: #66706d;
  --line: #dcd4c7;
  --accent: #0d6b63;
  --accent-dark: #074d47;
  --rose: #9f3f52;
  --gold: #a87513;
  --blue: #315f89;
  --shadow: 0 12px 30px rgba(39, 31, 22, 0.08);
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: none;
}

.brand h1,
.topbar h2 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
}

.brand h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 700;
}

.topbar h2 {
  font-size: 30px;
  font-weight: 750;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.filter-block {
  padding: 18px 0;
  border-top: 1px solid rgba(118, 103, 82, 0.25);
}

.filter-block h2 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #514b42;
}

.filter-heading,
.topbar,
.toolbar,
.table-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.range-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input[type="number"],
input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 10px 11px;
}

input[type="range"] {
  width: min(240px, 100%);
  accent-color: var(--accent);
}

.toggle {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  margin-top: 12px;
  color: var(--ink);
  font-weight: 650;
}

.toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.check-list {
  display: grid;
  gap: 7px;
  max-height: 178px;
  overflow: auto;
  padding-right: 4px;
}

.check-list-tall {
  max-height: 230px;
}

.check-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.check-option input {
  margin-top: 1px;
  accent-color: var(--accent);
}

.content {
  min-width: 0;
  padding: 28px;
}

.topbar {
  margin-bottom: 22px;
}

.primary-button,
.secondary-button,
.icon-button,
.tabs button {
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 760;
}

.primary-button {
  background: var(--accent);
  color: white;
  padding: 11px 16px;
}

.secondary-button {
  background: transparent;
  border-color: var(--line);
  color: var(--accent-dark);
  padding: 9px 12px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: rgba(255, 253, 248, 0.7);
  color: var(--accent-dark);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metrics article {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow);
}

.metrics span {
  display: block;
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.metrics strong {
  display: block;
  margin-top: 10px;
  color: var(--accent-dark);
  font-size: 32px;
  line-height: 1;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow: auto;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.tabs button {
  background: transparent;
  color: var(--muted);
  padding: 12px 10px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  white-space: nowrap;
}

.tabs button.active {
  color: var(--accent-dark);
  border-color: var(--line);
  border-bottom-color: var(--panel);
  background: var(--panel);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

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

figure,
.note-band,
.table-shell,
details {
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

figure {
  padding: 14px;
}

figcaption,
.note-band h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  color: #3a352e;
}

.chart {
  width: 100%;
  height: 430px;
}

.chart-large {
  height: 620px;
}

.note-band {
  padding: 18px;
}

.note-band p {
  margin: 0;
  max-width: 980px;
  color: #4f554f;
  line-height: 1.6;
}

.toolbar {
  margin-bottom: 14px;
}

.toolbar output {
  color: var(--ink);
  font-weight: 800;
}

.table-shell {
  overflow: auto;
  max-width: 100%;
}

.table-shell-tall {
  max-height: 640px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 13px;
}

#records-table {
  min-width: 1900px;
}

#lines-table {
  min-width: 1300px;
}

th,
td {
  border-bottom: 1px solid #e9e2d8;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6efe4;
  color: #4f463b;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  color: #2f3438;
  white-space: pre-wrap;
}

.greek-token {
  display: inline-block;
  border-radius: 5px;
  padding: 0 3px;
  margin: 0 1px 2px 0;
  font-weight: 760;
}

.greek-token.exact {
  background: rgba(13, 107, 99, 0.15);
  color: #074d47;
  box-shadow: inset 0 -2px 0 rgba(13, 107, 99, 0.38);
}

.greek-token.near {
  background: rgba(168, 117, 19, 0.16);
  color: #6d4b08;
  box-shadow: inset 0 -2px 0 rgba(168, 117, 19, 0.36);
}

.greek-token.aural {
  background: rgba(49, 95, 137, 0.15);
  color: #244a6d;
  box-shadow: inset 0 -2px 0 rgba(49, 95, 137, 0.34);
}

.similarity-cell {
  display: grid;
  gap: 6px;
  min-width: 124px;
  color: #3d433f;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.similarity-bar {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ddd2;
}

.similarity-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--accent));
}

details {
  padding: 0;
}

summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 800;
}

.table-meta {
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 750;
}

.loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--accent-dark);
  font-weight: 850;
}

.loading.hidden {
  display: none;
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 680px) {
  .content,
  .sidebar {
    padding: 18px 14px;
  }

  .topbar,
  .toolbar,
  .table-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .chart {
    height: 360px;
  }

  .topbar h2 {
    font-size: 24px;
  }
}
