:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --ink: #1a2330;
  --muted: #5c6b7a;
  --line: #d5dde5;
  --accent: #0b6e4f;
  --accent-ink: #fff;
  --best: #e8f6ef;
  --err: #9b1c1c;
  --err-bg: #fdecec;
  --mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;
  --sans: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    linear-gradient(180deg, #e9eef3 0%, var(--bg) 180px),
    var(--bg);
  min-height: 100vh;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.02em;
}
nav { display: flex; gap: .75rem; }
nav a {
  color: var(--muted);
  text-decoration: none;
  padding: .35rem .55rem;
  border-radius: 6px;
}
nav a.on, nav a:hover {
  color: var(--ink);
  background: #e8eef4;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

h1 { margin: 0 0 .35rem; font-size: 1.55rem; letter-spacing: -.02em; }
h2 { margin: 1.5rem 0 .75rem; font-size: 1.1rem; }
.muted { color: var(--muted); margin: 0 0 1rem; }
.tip { font-size: .9rem; margin-top: .65rem; }
.hint { color: var(--muted); font-weight: 400; font-size: .85em; }

.hero-search { margin-bottom: 1.25rem; }
.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-top: 1rem;
}
.flag {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-weight: 600;
  font-size: .92rem;
  color: var(--muted);
  margin: 0;
  white-space: nowrap;
}
.flag input { accent-color: var(--accent); }
.search-form input[type="search"] {
  flex: 1;
  min-width: 0;
  font-size: 1.05rem;
  padding: .75rem .9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
button, .btn-ghost {
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: .7rem 1rem;
  font: inherit;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
button.linkish {
  background: none;
  color: var(--err);
  padding: 0;
  border-radius: 0;
}

.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}
th, td {
  text-align: left;
  padding: .7rem .85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: #f8fafc;
}
tr:last-child td { border-bottom: 0; }
tr.best { background: var(--best); }
tr.row-err { background: #fff8f8; }
.price { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.title { font-weight: 600; }
.meta { color: var(--muted); font-size: .85rem; margin-top: .15rem; word-break: break-all; }
.mono { font-family: var(--mono); font-size: .88rem; }
.err-msg { color: var(--err); font-size: .85rem; margin-top: .25rem; }
.ok { color: var(--accent); font-weight: 600; }
.off { color: var(--muted); }

.card-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.15rem;
  margin: 1rem 0 1.5rem;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem 1rem;
}
label {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: .75rem;
}
label.check {
  flex-direction: row;
  align-items: center;
  align-self: end;
  margin-bottom: .75rem;
}
input, select, textarea {
  font: inherit;
  font-weight: 400;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
textarea {
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.4;
  resize: vertical;
}
.actions { display: flex; gap: .6rem; align-items: center; }
.row-actions {
  display: flex;
  gap: .75rem;
  align-items: center;
  white-space: nowrap;
}
.row-actions form { margin: 0; }
.flash.err {
  background: var(--err-bg);
  color: var(--err);
  padding: .65rem .8rem;
  border-radius: 8px;
}

.login-wrap {
  max-width: 420px;
  padding-top: 4rem;
}
.login-card h1 { margin-bottom: .15rem; }
.login-form { margin-top: 1rem; }
.login-form input[type="password"] { width: 100%; }

@media (max-width: 720px) {
  .grid2 { grid-template-columns: 1fr; }
  .search-form { flex-direction: column; }
}
