:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-strong: #eef3ee;
  --border: #d7ded6;
  --text: #18221d;
  --muted: #657269;
  --accent: #1e6f5c;
  --accent-dark: #155142;
  --warn: #a95f18;
  --shadow: 0 12px 30px rgba(19, 38, 30, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Malgun Gothic", Arial, sans-serif;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

button:hover:not(:disabled) {
  background: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.app-header h1 {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 750;
}

.app-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 8px;
}

main {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px clamp(12px, 3vw, 32px) 32px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(220px, 1.8fr) minmax(120px, 0.8fr) minmax(96px, 0.6fr) minmax(110px, 0.7fr) minmax(360px, 2fr) 96px 96px auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

label,
fieldset {
  min-width: 0;
}

label span,
legend {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
}

input:disabled {
  background: var(--surface-strong);
  color: var(--muted);
}

fieldset {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-height: 38px;
  margin: 0;
  border: 0;
  padding: 0;
}

fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
}

fieldset input {
  width: auto;
  min-height: auto;
}

.results-shell {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--muted);
}

.result-meta strong {
  color: var(--text);
}

.table-wrap {
  overflow: auto;
}

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fbfcfa;
  color: #344139;
  font-size: 13px;
  font-weight: 750;
}

td {
  font-size: 14px;
}

tbody tr:hover {
  background: #f8faf7;
}

.check-col {
  width: 44px;
  text-align: center;
}

.check-col input {
  width: 16px;
  min-height: 16px;
}

.title-cell {
  min-width: 360px;
  font-weight: 650;
}

.file-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  min-height: 26px;
  border-radius: 999px;
  background: #e7f0eb;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.download-link {
  color: var(--accent);
  font-weight: 750;
  text-decoration: none;
}

.download-link:hover {
  text-decoration: underline;
}

.empty {
  height: 180px;
  color: var(--muted);
  text-align: center;
}

.is-loading {
  color: var(--warn);
}

@media (max-width: 1180px) {
  .toolbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  fieldset {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  fieldset {
    grid-column: auto;
  }
}
