:root {
  --navy: #0f3a5f;
  --navy-2: #1b5584;
  --gold: #f2a900;
  --ink: #1d2733;
  --muted: #637083;
  --line: #dde3ea;
  --bg: #f3f6f9;
  --card: #ffffff;
  --ok: #1f8a5b;
  --warn: #c2410c;
  --radius: 14px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
a { color: var(--navy-2); }
h1 { font-size: 1.7rem; margin: 0 0 .4rem; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0 0 .8rem; }
small { color: var(--muted); font-weight: 400; }
code { background: #eef2f6; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-block; border: 0; border-radius: 10px; background: var(--navy); color: #fff;
  font: inherit; font-weight: 600; padding: .65rem 1.2rem; cursor: pointer; text-decoration: none;
  transition: background .15s;
}
.btn:hover { background: var(--navy-2); }
.btn.big { width: 100%; font-size: 1.15rem; padding: .95rem 1rem; margin-top: .4rem; }
.btn.small { padding: .4rem .8rem; font-size: .88rem; }
.btn.ghost { background: transparent; color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { background: #e9eff5; }
.btn.danger { background: #b42318; }
.btn.danger:hover { background: #912018; }
.linkbtn { background: none; border: 0; color: #fff; font: inherit; cursor: pointer; opacity: .85; padding: .4rem .6rem; }
.linkbtn:hover { opacity: 1; text-decoration: underline; }
input, select, textarea {
  font: inherit; color: var(--ink); width: 100%; padding: .65rem .8rem; border: 1.5px solid var(--line);
  border-radius: 10px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy-2); box-shadow: 0 0 0 3px #1b558426; }
input[type=checkbox], input[type=radio] { width: auto; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.alert { background: #fdecea; color: #8a1c12; border-radius: 10px; padding: .7rem 1rem; }
.notice { background: #e7f6ee; color: #145c3c; border-radius: 10px; padding: .7rem 1rem; }

/* ---------- public review page ---------- */
.brand { background: #fff; border-bottom: 4px solid var(--navy); box-shadow: inset 0 -7px 0 -4px #8b1014; }
.brand-inner { max-width: 640px; margin: 0 auto; padding: .8rem 1rem; }
.logos { display: flex; align-items: center; justify-content: center; gap: 1.1rem 1.6rem; flex-wrap: wrap; }
.logos img { display: block; height: auto; max-width: 100%; }
.logos .logo-wtrt { width: 250px; }
.logos .logo-wts { width: 120px; }
@media (min-width: 700px) {
  .brand .logos .logo-wtrt { width: 330px; }
  .brand .logos .logo-wts { width: 155px; }
}
@media (max-width: 420px) {
  .logos { gap: .9rem; }
  .logos .logo-wtrt { width: 205px; }
  .logos .logo-wts { width: 98px; }
}
.public-main { max-width: 640px; margin: 0 auto; padding: 1.2rem 1rem 2rem; }
.card { background: var(--card); border-radius: var(--radius); padding: 1.6rem 1.4rem; box-shadow: 0 6px 24px #0f3a5f14; }
.card.narrow { max-width: 440px; margin: 1rem auto; }
.card.center { text-align: center; }
.intro { color: var(--muted); margin: 0 0 1.2rem; }
.field { margin: 0 0 1.3rem; }
.field-label { display: block; font-weight: 650; margin-bottom: .5rem; }
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.pill { position: relative; }
.pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pill span {
  display: inline-block; padding: .55rem 1rem; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; cursor: pointer; font-weight: 500; user-select: none;
}
.pill input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.pill input:focus-visible + span { box-shadow: 0 0 0 3px #1b558455; }
.tech-preview {
  display: flex; align-items: center; gap: .9rem; margin-top: .8rem; padding: .8rem; border-radius: 12px;
  background: #f0f5fa; border: 1px solid #dce7f1;
}
.tech-preview img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.tech-preview strong { display: block; font-size: 1.1rem; }
.tech-preview span:not(.avatar) { color: var(--muted); font-size: .92rem; }
.stars { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: .15rem; }
.stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars label { font-size: 2.8rem; line-height: 1; color: #d3dae3; cursor: pointer; transition: color .1s, transform .1s; }
.stars label:hover { transform: scale(1.1); }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: var(--gold); }
.stars input:focus-visible + label { outline: 2px solid var(--navy-2); border-radius: 6px; }
.rating-word { color: var(--muted); font-weight: 600; margin-top: .2rem; min-height: 1.4em; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.thanks .check {
  width: 74px; height: 74px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 2.4rem;
  display: grid; place-items: center; margin: .5rem auto 1rem;
}
.public-foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 0 1rem 2rem; }
.stack { display: grid; gap: .9rem; }
.stack label { display: grid; gap: .35rem; font-weight: 600; }

/* ---------- avatars & stars ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar.initials {
  display: inline-grid; place-items: center; background: linear-gradient(135deg, var(--navy-2), var(--navy));
  color: #fff; font-weight: 700; font-size: .95rem; letter-spacing: .5px;
}
.avatar.generic {
  display: inline-grid; place-items: end center; overflow: hidden;
  background: linear-gradient(160deg, #a9bccf, #6f86a0);
}
.avatar.generic svg { width: 100%; height: 100%; display: block; }
.inst-card .avatar.generic, .qr-card .avatar.generic { display: grid; }
.avatar.sm { width: 30px; height: 30px; font-size: .75rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.2rem; }
.avatar.big { width: 64px; height: 64px; font-size: 1.4rem; }
.avatar.xl { width: 96px; height: 96px; font-size: 2rem; }
.stars-view { letter-spacing: 1px; font-size: 1.05rem; }
.stars-view b { color: var(--gold); font-weight: 400; }
.stars-view i { color: #d3dae3; font-style: normal; }
.big-stars .stars-view { font-size: 1.8rem; }
.who { display: flex; align-items: center; gap: .6rem; }
.who.big { gap: 1rem; }
.who h1 { margin: 0; }

/* ---------- admin ---------- */
.topbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 5; }
.topbar-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem 1.2rem; flex-wrap: wrap; }
.brand-sm { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.brand-sm .icon { width: 34px; height: 34px; border-radius: 7px; display: block; }
.topbar nav { display: flex; align-items: center; gap: .2rem; flex-wrap: wrap; }
.topbar nav a { color: #fff; text-decoration: none; padding: .45rem .75rem; border-radius: 8px; opacity: .85; }
.topbar nav a:hover { opacity: 1; background: #ffffff1a; }
.topbar nav a.active { opacity: 1; background: #ffffff26; font-weight: 600; }
.topbar nav form { margin: 0; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.2rem 3rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
.stat { background: #fff; border-radius: var(--radius); padding: 1rem 1.2rem; border-top: 4px solid var(--navy-2); box-shadow: 0 2px 10px #0f3a5f0d; }
.stat.gold { border-top-color: var(--gold); }
.stat.alert { border-top-color: var(--warn); }
.stat-label { color: var(--muted); font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 2rem; font-weight: 700; margin: .2rem 0; }
.stat-sub { color: var(--muted); font-size: .88rem; }
.panel { background: #fff; border-radius: var(--radius); padding: 1.3rem 1.4rem; margin-bottom: 1.4rem; box-shadow: 0 2px 10px #0f3a5f0d; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.panel-head h2 { margin: 0; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.grid th { text-align: left; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; padding: .5rem .6rem; border-bottom: 2px solid var(--line); }
table.grid td { padding: .65rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.reviews td.comment { max-width: 340px; }
tr.st-new td:first-child { box-shadow: inset 4px 0 0 var(--navy-2); }
tr.st-followup td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
.status-select { padding: .35rem .5rem; font-size: .88rem; width: auto; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.filters select, .filters input { width: auto; padding: .45rem .6rem; font-size: .92rem; }
.filters input[type=search] { min-width: 220px; flex: 1; }
.filters .date { display: flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .9rem; }
.small-link { font-size: .9rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; border: 2px dashed var(--line); border-radius: 12px; }
.tag { display: inline-block; font-size: .75rem; padding: .15rem .55rem; border-radius: 999px; background: #eef1f5; color: var(--muted); font-weight: 600; }
.tag.ok { background: #e3f4ea; color: var(--ok); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.2rem; }
.form-grid label, .form-grid .label { display: grid; gap: .35rem; font-weight: 600; }
.form-grid .full, .form-grid h2 { grid-column: 1 / -1; }
.form-grid h2 { margin: 0; }
.actions { display: flex; gap: .6rem; }
.checks { display: grid; gap: .5rem; align-content: center; }
label.check { display: flex !important; align-items: center; gap: .5rem; font-weight: 500 !important; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.4rem; border-radius: var(--radius); border: 1.5px solid #f3c6c1; background: #fff8f7; color: #7a271a; }
.inst-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.inst-card { background: #fff; border-radius: var(--radius); padding: 1.3rem 1rem; text-align: center; box-shadow: 0 2px 10px #0f3a5f0d; }
.inst-card.off { opacity: .65; }
.inst-card .avatar { margin: 0 auto .6rem; display: grid; }
.inst-card h3 { margin: 0; }
.inst-meta { display: grid; gap: .35rem; justify-items: center; margin: .7rem 0; font-size: .9rem; color: var(--muted); }
.inst-actions { display: flex; gap: .4rem; justify-content: center; flex-wrap: wrap; }

/* ---------- printable QR card ---------- */
body.cardpage { background: #e9eef3; }
.print-bar { max-width: 460px; margin: 1.2rem auto; display: flex; gap: 1rem; align-items: center; }
.print-bar .btn { white-space: nowrap; }
.qr-card { max-width: 460px; margin: 0 auto 2rem; background: #fff; border-radius: 18px; padding: 1.6rem; text-align: center; border-top: 10px solid var(--navy); }
.qr-brand { margin-bottom: 1.3rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.qr-brand .logo-wtrt { width: 230px; }
.qr-brand .logo-wts { width: 110px; }
.qr-card .avatar { margin: 0 auto .6rem; display: grid; }
.qr-card h1 { margin: 0; }
.qr-title { color: var(--muted); }
.qr-ask { font-size: 1.2rem; font-weight: 600; margin: 1rem 0 .5rem; }
.qr svg { width: 260px; height: 260px; }
.qr-url { font-size: .85rem; color: var(--muted); word-break: break-all; }
@media print {
  body.cardpage { background: #fff; }
  .print-bar { display: none; }
  .qr-card { margin: 0 auto; box-shadow: none; }
}

@media (max-width: 860px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .danger-zone { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 520px) {
  .field.two { grid-template-columns: 1fr; }
  .card { padding: 1.3rem 1rem; }
  h1 { font-size: 1.45rem; }
  .stars label { font-size: 2.6rem; }
}
