:root {
  --bg-1: #f8f7f2;
  --bg-2: #f0ece0;
  --surface: #ffffff;
  --ink: #1e2a2f;
  --muted: #5b6b73;
  --accent: #20b3ab;
  --accent-dark: #168982;
  --accent-2: #ed6a5a;
  --line: #d7ddd9;
  --shadow: 0 14px 30px rgba(12, 40, 48, 0.12);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 15%, #ffffff 0, transparent 42%),
    radial-gradient(circle at 90% 10%, #dff4ef 0, transparent 34%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
  min-height: 100vh;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

.topbar h1 {
  letter-spacing: 0.4px;
  font-size: 1.65rem;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
}

.session-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.panel h2 {
  margin-bottom: 12px;
  font-size: 1.15rem;
}

.subpanel {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.grid {
  display: grid;
  gap: 12px;
}

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

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

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

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.row-actions {
  justify-content: flex-start;
}

.inline-controls {
  justify-content: space-between;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
}

input,
select {
  border: 1px solid #c7d0ce;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus {
  outline: 2px solid rgba(32, 179, 171, 0.24);
  border-color: var(--accent);
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

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

.btn:active {
  transform: translateY(0);
}

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

.btn-secondary {
  background: #d9f2f0;
  color: #0f5f5a;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: #2d3a3f;
}

.tabbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.tab {
  border: 1px solid var(--line);
  background: #f5f9f8;
  color: #355159;
  border-radius: 999px;
  padding: 9px 13px;
  cursor: pointer;
}

.tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tab-panel {
  display: none;
}

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

.checkbox-grid label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.notice {
  margin-top: 12px;
  border-left: 4px solid var(--accent);
  background: #f3fbf9;
  padding: 10px 12px;
  border-radius: 8px;
  color: #21464c;
}

.notice.error {
  border-left-color: var(--accent-2);
  background: #fff2ef;
  color: #6d2218;
}

.hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 12px;
}

#noiseChartCanvas {
  width: 100%;
  display: block;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fffd 100%);
}

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

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.9rem;
}

th {
  background: #f6f8f7;
  color: #405860;
  font-weight: 600;
}

tr:last-child td {
  border-bottom: 0;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: var(--accent-dark);
  color: #fff;
  padding: 10px 13px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 30;
}

@media (max-width: 900px) {
  .grid.two,
  .grid.three,
  .grid.four {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .row.inline-controls {
    flex-direction: column;
    align-items: stretch;
  }
}
