@font-face {
  font-family: "Caveat";
  src: url("/static/caveat-variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #eef4ff;
  --surface-muted: #f0f2f7;
  --line: #dbe0ea;
  --line-strong: #c4ccda;
  --text: #20232b;
  --muted: #626b7b;
  --blue: #087ff5;
  --blue-hover: #006ee0;
  --blue-soft: #e9f3ff;
  --green: #19b93d;
  --pink: #ff315d;
  --violet: #8d36ed;
  --danger: #d72d4f;
  --warning: #a45b00;
  --radius: 16px;
  --shadow: 0 18px 46px rgb(33 46 73 / .10);
  --focus: 0 0 0 3px rgb(8 127 245 / .24);
  font-family: Aptos, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); overflow-x: hidden; }
body { margin: 0; min-width: 320px; min-height: 100dvh; overflow-x: hidden; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-underline-offset: .2em; }
::selection { background: #cce6ff; color: var(--text); }

.skip-link { position: fixed; top: 8px; left: 8px; z-index: 20; transform: translateY(-150%); padding: 10px 14px; background: var(--text); color: #fff; border-radius: 10px; }
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: none; box-shadow: var(--focus); }

.app-header { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid rgb(219 224 234 / .85); background: rgb(255 255 255 / .96); }
.header-inner { min-height: 68px; width: min(100%, 1200px); margin: 0 auto; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; letter-spacing: -.02em; text-decoration: none; }
.brand-logo { width: 42px; height: 42px; object-fit: contain; filter: drop-shadow(0 5px 8px rgb(33 46 73 / .16)); }
.text-button { min-height: 44px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 650; }
.text-button:hover { color: var(--text); }

.app-shell { width: min(100%, 1200px); margin: 0 auto; padding: 18px 14px 44px; }
.muted { color: var(--muted); }

.create-panel { padding: 22px 18px 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.section-heading { margin-bottom: 18px; }
.section-heading h1, .section-heading h2 { margin: 0; letter-spacing: -.03em; }
.section-heading h1 { max-width: 15ch; font-size: 30px; line-height: 1.08; }
.section-heading h2 { font-size: 22px; line-height: 1.2; }
.section-heading p { margin: 8px 0 0; max-width: 65ch; color: var(--muted); line-height: 1.5; }
.section-heading.compact { margin: 30px 0 14px; display: flex; align-items: center; gap: 10px; }
.count { min-width: 28px; height: 28px; display: grid; place-items: center; border-radius: 999px; background: var(--surface-muted); color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.create-form, .create-primary, .advanced-grid, .stack, .field { display: grid; gap: 9px; }
.create-primary { gap: 14px; }
label { color: #4f5867; font-size: 13px; font-weight: 700; }
input, select { width: 100%; min-height: 50px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--text); padding: 0 14px; font-size: 16px; transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease; }
input::placeholder { color: #8a94a4; }
input:hover, select:hover { border-color: var(--line-strong); }
input:focus, select:focus { border-color: var(--blue); box-shadow: var(--focus); outline: none; }
.field small { color: var(--muted); font-size: 12px; line-height: 1.45; }

.advanced-filters { margin-top: 14px; border-top: 1px solid var(--line); }
.advanced-filters summary, .edit-search summary { min-height: 48px; display: flex; align-items: center; color: var(--blue); font-size: 14px; font-weight: 750; cursor: pointer; }
.advanced-filters summary::marker, .edit-search summary::marker { color: var(--blue); }
.advanced-grid { padding: 2px 0 6px; gap: 14px; }

.button { min-height: 46px; border-radius: 12px; border: 1px solid transparent; padding: 10px 16px; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; font-weight: 760; cursor: pointer; transition: background-color .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .58; cursor: wait; }
.button-primary { background: var(--blue); color: #fff; box-shadow: 0 8px 18px rgb(8 127 245 / .22); }
.button-primary:hover { background: var(--blue-hover); }
.button-secondary { border-color: var(--text); background: var(--text); color: #fff; }
.button-secondary:hover { background: #343945; }
.button-quiet { border-color: var(--line); background: #fff; color: var(--text); }
.button-quiet:hover { background: var(--surface-muted); }
.button-danger { background: transparent; color: var(--danger); }
.button-danger:hover { background: #fff0f3; }

.alert { margin: 0 0 16px; border-radius: 12px; padding: 12px 14px; line-height: 1.45; }
.alert-error { background: #fff0f3; color: #9f1f3b; }
.content-grid { display: grid; gap: 8px; }
.search-list, .listing-list { display: grid; gap: 12px; }
.search-card { padding: 17px; border-radius: var(--radius); background: var(--surface); box-shadow: 0 10px 28px rgb(33 46 73 / .08); }
.search-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.search-top h3 { margin: 0 0 7px; font-size: 18px; letter-spacing: -.02em; }
.search-link { color: var(--blue); font-size: 13px; font-weight: 700; text-decoration: none; }
.search-link:hover { text-decoration: underline; }
.state { flex: none; border-radius: 999px; padding: 6px 9px; font-size: 12px; font-weight: 760; background: var(--surface-muted); color: var(--muted); }
.state-ok, .state-running { background: #eaf9ee; color: #13752c; }
.state-warning, .state-action_required { background: #fff5df; color: var(--warning); }
.state-error { background: #fff0f3; color: var(--danger); }
.search-error { margin: 13px 0 0; color: var(--warning); font-size: 13px; line-height: 1.45; }
.search-meta { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 7px 14px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.search-actions { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.search-actions form:first-child { grid-column: 1 / -1; }
.search-actions .button { width: 100%; }
.edit-search { margin-top: 12px; border-top: 1px solid var(--line); }
.edit-form { display: grid; gap: 12px; padding: 4px 0; }

.empty-state { min-height: 190px; padding: 28px 20px; display: grid; justify-items: start; align-content: center; border: 1px dashed #bdcae0; border-radius: var(--radius); background: var(--surface-soft); color: var(--muted); }
.empty-mark { position: relative; width: 34px; height: 34px; margin-bottom: 14px; border-radius: 10px; background: #fff; box-shadow: 0 5px 16px rgb(33 46 73 / .08); }
.empty-mark::before, .empty-mark::after { content: ""; position: absolute; top: 50%; left: 50%; width: 14px; height: 2px; border-radius: 2px; background: var(--blue); transform: translate(-50%, -50%); }
.empty-mark::after { transform: translate(-50%, -50%) rotate(90deg); }
.empty-state h3 { margin: 0 0 8px; color: var(--text); }
.empty-state p { margin: 0; max-width: 58ch; line-height: 1.5; }
.empty-state.small { min-height: 112px; background: #fff; }
.listing-list { overflow: hidden; border-radius: var(--radius); background: #fff; box-shadow: 0 10px 28px rgb(33 46 73 / .06); }
.listing-row { min-height: 76px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); text-decoration: none; }
.listing-row:last-child { border-bottom: 0; }
.listing-row:hover { background: var(--blue-soft); }
.listing-row:hover strong { color: var(--blue); }
.listing-row strong, .listing-row span { display: block; }
.listing-row strong { margin-bottom: 5px; line-height: 1.3; }
.listing-row span, .listing-row small { color: var(--muted); font-size: 13px; }

.site-footer { width: min(100%, 1200px); min-height: 116px; margin: 0 auto; padding: 24px 16px 48px; display: flex; justify-content: center; align-items: center; }
.creator-signature { position: relative; display: inline-block; padding: 0 8px 8px; color: #292d37; font-family: "Caveat", cursive; font-size: 31px; font-weight: 650; line-height: 1; letter-spacing: .01em; transform: rotate(-1deg); }
.creator-signature::before, .creator-signature::after { content: ""; position: absolute; left: 4%; right: 2%; height: 3px; border-radius: 999px; background: var(--pink); transform-origin: left center; }
.creator-signature::before { bottom: 2px; transform: rotate(-1deg); }
.creator-signature::after { bottom: -3px; left: 13%; right: 8%; opacity: .72; transform: rotate(1.4deg); }

.login-shell { min-height: calc(100dvh - 112px); display: grid; place-items: center; padding: 36px 16px 24px; }
.login-panel { width: min(100%, 410px); padding: 28px 24px; border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
.login-logo { display: block; width: 82px; height: 82px; margin: -7px 0 15px -8px; object-fit: contain; filter: drop-shadow(0 8px 12px rgb(33 46 73 / .16)); }
.login-panel h1 { margin: 0; font-size: 32px; letter-spacing: -.035em; }
.login-panel > p { margin: 9px 0 24px; line-height: 1.5; }
.login-panel .button { margin-top: 8px; }
.login-footer { min-height: 112px; padding-top: 0; }

@media (min-width: 768px) {
  .app-shell { padding: 28px 24px 58px; }
  .header-inner { padding: 0 24px; }
  .create-panel { padding: 28px; }
  .create-primary { grid-template-columns: minmax(0, 1.5fr) minmax(190px, .8fr) auto; align-items: end; }
  .advanced-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .field-wide { grid-column: 1 / -1; }
  .search-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer { padding-inline: 24px; }
  .creator-signature { font-size: 36px; }
}

@media (min-width: 1100px) {
  .content-grid { grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); gap: 42px; }
  .search-list { grid-template-columns: 1fr; }
  .section-heading.compact { margin-top: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
