:root {
  --bg: #f3f3f5;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #e6e6ea;
  --soft: #ececef;
  --white: #ffffff;
  --bad: #c41e3a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.bar,
.main {
  width: min(980px, calc(100% - 40px));
  margin-inline: auto;
}

.bar {
  min-height: 58px;
  display: flex;
  align-items: center;
}

.brand {
  display: grid;
  gap: 1px;
}

.brand strong {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.main {
  padding: 24px 0 72px;
}

.stack {
  display: grid;
  gap: 16px;
}

.form-stack {
  gap: 14px;
}

.head {
  display: grid;
  gap: 6px;
}

.note {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.field input[type="text"] {
  width: 100%;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  background: var(--white);
  padding: 11px 12px;
}

.field input[type="text"]::placeholder {
  color: #a1a1a6;
}

.seg {
  display: inline-flex;
  background: #e6e6ea;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  width: fit-content;
}

.seg label {
  cursor: pointer;
}

.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg span {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #3a3a3c;
}

.seg label:has(input:checked) span {
  background: var(--white);
  color: var(--ink);
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  width: fit-content;
}

.btn.secondary {
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px #d2d2d7;
}

.btn.danger {
  background: #fff;
  color: var(--bad);
  box-shadow: inset 0 0 0 1px #f0c2c8;
  padding: 6px 10px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.save-tabs {
  margin-bottom: 8px;
}

.save-tabs .tab {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #3a3a3c;
  cursor: pointer;
}

.save-tabs .tab.on {
  background: var(--white);
  color: var(--ink);
  font-weight: 600;
}

.saves-list {
  display: grid;
}

.save-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.save-row:first-child {
  border-top: 0;
}

.save-row strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.save-row .meta {
  margin-top: 2px;
}

.save-row .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.save-row .row-actions .btn {
  padding: 6px 10px;
  font-size: 13px;
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.summary strong {
  color: var(--ink);
  font-weight: 600;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.group {
  overflow: hidden;
  padding-top: 4px;
}

.group > summary.group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
  cursor: pointer;
  list-style: none;
}

.group > summary.group-head::-webkit-details-marker {
  display: none;
}

.group-head strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.group-head small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

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

.result-tools {
  margin-top: -4px;
}

.hit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.hit-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
  min-height: 84px;
}

.logos {
  position: relative;
  width: 40px;
  height: 40px;
  flex: none;
}

.logo,
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--soft);
  border: 1px solid var(--line);
  display: block;
}

.avatar {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid #fff;
}

.hit-body {
  min-width: 0;
}

.hit-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.hit-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.badge.ok {
  background: #e8f5e9;
  color: #1d7a34;
}

.hit-card a {
  color: var(--ink);
  text-underline-offset: 3px;
  word-break: break-all;
  font-size: 13px;
}

.meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.empty,
.error {
  margin: 0;
  padding: 14px 0 2px;
  color: var(--muted);
  font-size: 14px;
}

.error {
  color: var(--bad);
}

.disclaimer {
  max-width: 42rem;
}

@media (max-width: 720px) {
  .bar,
  .main {
    width: min(980px, calc(100% - 28px));
  }

  .main {
    padding-top: 20px;
  }

  h1 {
    font-size: 26px;
  }
}
