/* Roots Rotmästare – juryportal. Färger hämtade från rootsby3n.se */
:root {
  --ink: #0f1712;
  --forest: #1c2a21;
  --forest-2: #263429;
  --cream: #f1e8da;
  --paper: #fffaf1;
  --sand: #e3d1af;
  --gold: #d9ac43;
  --gold-dark: #a87f22;
  --orange: #cf4917;
  --orange-dark: #a93811;
  --brown: #2a1f17;
  --text: #2a1f17;
  --muted: #7a6c5d;
  --line: #e6dac6;
  --ok: #3f7a4f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(42, 31, 23, .06), 0 6px 24px rgba(42, 31, 23, .07);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--text);
  font-family: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--orange); }
a:hover { color: var(--orange-dark); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; color: var(--brown); }
h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 800; text-transform: uppercase; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 700; text-transform: uppercase; letter-spacing: .01em; }
h3 { font-size: 16px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.warn { color: var(--orange); }
code { background: var(--cream); padding: 1px 5px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--gold-dark);
}

/* ---------- Topbar ---------- */
.topbar { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-inner {
  max-width: 1320px; margin: 0 auto; padding: 10px 24px;
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand img { height: 40px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; border-left: 1px solid rgba(255,255,255,.25); padding-left: 14px; }
.brand-text strong { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); }
.brand-text span { font-size: 12px; color: rgba(255,255,255,.7); }
.mainnav { display: flex; gap: 4px; flex-wrap: wrap; }
.mainnav a {
  color: rgba(255,255,255,.85); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 8px 14px; border-radius: 999px;
}
.mainnav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.mainnav a.is-active { background: var(--orange); color: #fff; }
.userline { margin-left: auto; display: flex; gap: 12px; align-items: center; font-size: 13px; }
.userline .who { font-weight: 600; }
.progress-mini { background: rgba(217,172,67,.18); color: var(--gold); padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.logout { color: rgba(255,255,255,.8); }

/* ---------- Layout ---------- */
.wrap { max-width: 1320px; margin: 0 auto; padding: 28px 24px 60px; }
.foot {
  max-width: 1320px; margin: 0 auto; padding: 20px 24px 40px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted); border-top: 1px solid var(--line);
}
.card {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; margin-bottom: 20px;
}
.card.narrow { max-width: 640px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.grid-2 .card { margin-bottom: 0; }
.grid-2 + * { margin-top: 20px; }

/* ---------- Buttons & form ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--orange); color: #fff; border: 0; border-radius: 999px;
  padding: 11px 22px; font: inherit; font-weight: 600; font-size: 14px;
  text-decoration: none; cursor: pointer; transition: background .15s;
}
.btn:hover { background: var(--orange-dark); color: #fff; }
.btn-ghost { background: transparent; color: var(--brown); box-shadow: inset 0 0 0 1.5px var(--sand); }
.btn-ghost:hover { background: var(--cream); color: var(--brown); }
.btn-small { padding: 7px 14px; font-size: 13px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--muted); text-decoration: underline; cursor: pointer; }
.linkbtn.danger { color: var(--orange-dark); }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=password], input:not([type]), textarea {
  width: 100%; font: inherit; color: var(--text); background: #fff;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217,172,67,.25); }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.flash { border-radius: 10px; padding: 12px 16px; margin: 0 0 20px; font-size: 14px; }
.flash-ok { background: #e3efe2; color: #24502f; }
.flash-err { background: #f8e0d5; color: #8a2d0d; }
.flash-info { background: #f6ecd2; color: #6b5114; }

/* ---------- Hero ---------- */
.hero {
  background: var(--ink); color: #fff; border-radius: 20px; padding: 36px 40px;
  margin-bottom: 24px; display: flex; justify-content: space-between; align-items: center; gap: 32px;
  background-image: radial-gradient(circle at 85% 20%, rgba(217,172,67,.18), transparent 45%);
}
.hero h1 { color: var(--gold); }
.hero .eyebrow { color: rgba(255,255,255,.7); }
.hero .lead { font-size: 16px; max-width: 640px; color: rgba(255,255,255,.88); margin: 0; }
.hero a { color: var(--gold); }
.hero .muted { color: rgba(255,255,255,.6); }
.hero-small { display: block; }
.hero-small .lead { margin-bottom: 12px; }
.hero-stats { text-align: center; flex-shrink: 0; }
.hero-stats p { margin: 8px 0 0; }
.ring {
  --p: 0;
  width: 120px; height: 120px; border-radius: 50%; margin: 0 auto;
  background: conic-gradient(var(--gold) calc(var(--p) * 1%), rgba(255,255,255,.12) 0);
  display: grid; place-items: center;
}
.ring span {
  width: 96px; height: 96px; border-radius: 50%; background: var(--ink);
  display: grid; place-items: center; font-size: 15px; color: rgba(255,255,255,.7);
}
.ring strong { font-size: 30px; color: #fff; display: block; line-height: 1; }

/* ---------- Entry overview ---------- */
.toolbar { display: flex; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  background: var(--paper); color: var(--brown); border: 1.5px solid var(--line);
  padding: 7px 16px; border-radius: 999px;
}
.chip span { color: var(--muted); margin-left: 4px; }
.chip.is-active { background: var(--brown); border-color: var(--brown); color: #fff; }
.chip.is-active span { color: var(--gold); }

.entry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.entry-card {
  display: flex; flex-direction: column; background: var(--paper); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; text-decoration: none; color: inherit;
  transition: transform .15s, box-shadow .15s;
}
.entry-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(42,31,23,.14); color: inherit; }
.entry-card[data-state=done] .thumb::after {
  content: "✓"; position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--ok); color: #fff; display: grid; place-items: center; font-weight: 700;
}
.thumb { aspect-ratio: 4 / 3; background: var(--sand); position: relative; overflow: hidden; }
.thumb img, .thumb .noimg { width: 100%; height: 100%; object-fit: cover; display: block; }
.entry-card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.entry-card-body h3 { margin: 0 0 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.entry-card-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; }
.score { font-weight: 700; font-size: 18px; color: var(--brown); }
.score small { font-size: 12px; color: var(--muted); font-weight: 500; }

.badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge-done { background: #e3efe2; color: #24502f; }
.badge-part { background: #f6ecd2; color: #6b5114; }
.badge-todo { background: var(--cream); color: var(--muted); }

.noimg {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: var(--sand); color: var(--brown); font-size: 13px; text-align: center; padding: 12px; min-height: 80px;
}

/* ---------- Single entry ---------- */
.crumbs { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; font-size: 14px; flex-wrap: wrap; }
.crumbs > span { color: var(--muted); }
.crumbs a { text-decoration: none; font-weight: 600; }
.crumbs-nav { margin-left: auto; display: flex; gap: 16px; }
.entry-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 28px; align-items: start; }
.entry-head { margin-bottom: 18px; }
.entry-head h1 { margin-bottom: 6px; font-size: clamp(22px, 2.6vw, 32px); }
.entry-meta { margin: 0; font-size: 15px; }
.entry-photo { margin: 0 0 20px; }
.entry-photo .photo { width: 100%; max-height: 640px; object-fit: contain; background: var(--ink); border-radius: var(--radius); display: block; cursor: zoom-in; }
.entry-photo .noimg { border-radius: var(--radius); min-height: 220px; }
.entry-photo figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }
.recipe-text { white-space: normal; font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
.file-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.file-frame { width: 100%; height: 760px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.file-img { width: 100%; border-radius: 10px; cursor: zoom-in; }

.rate-panel { position: sticky; top: 84px; }
.rate-card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; max-height: calc(100vh - 104px); overflow: auto; }
.rate-head { display: flex; justify-content: space-between; align-items: baseline; }
.rate-head h2 { margin: 0; }
.save-state { font-size: 12px; color: var(--muted); }
.save-state.ok { color: var(--ok); }
.save-state.err { color: var(--orange); }
.total {
  display: flex; align-items: baseline; gap: 6px; margin: 12px 0 8px; padding: 12px 16px;
  background: var(--ink); color: #fff; border-radius: 12px;
}
.total-num { font-size: 34px; font-weight: 800; color: var(--gold); line-height: 1; }
.total-max { color: rgba(255,255,255,.7); }
.total-count { margin-left: auto; font-size: 12px; color: rgba(255,255,255,.7); }
.crit { border: 0; border-bottom: 1px solid var(--line); padding: 14px 0; margin: 0; }
.crit legend { font-weight: 700; font-size: 15px; padding: 0; }
.crit-desc { margin: 2px 0 10px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.dots { display: flex; gap: 6px; align-items: center; }
.dots button {
  width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--sand);
  background: #fff; color: var(--brown); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  transition: background .12s, border-color .12s, transform .12s;
}
.dots button:hover { border-color: var(--orange); transform: scale(1.06); }
.dots button.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.dots button.fill { background: #f7d9c9; border-color: #f0b89c; }
.dot-label { font-size: 12px; font-weight: 600; color: var(--orange); margin-left: 6px; }
.comment { display: block; margin-top: 16px; }
.comment span { display: block; font-weight: 700; margin-bottom: 6px; }
.rate-foot { margin-top: 16px; }
.rate-foot .btn { width: 100%; }
.rate-foot p { text-align: center; margin: 8px 0 0; }
.is-preview .dots button, .is-preview textarea { pointer-events: none; opacity: .5; }

/* ---------- Help ---------- */
.steps { padding-left: 20px; margin: 0 0 12px; }
.steps li { margin-bottom: 6px; }
.scale-list { list-style: none; padding: 0; margin: 0; }
.scale-list li { display: flex; align-items: center; gap: 12px; padding: 6px 0; font-weight: 500; }
.dot { width: 34px; height: 34px; border-radius: 50%; background: var(--orange); color: #fff; display: grid; place-items: center; font-weight: 700; }
.criteria-list { display: grid; grid-template-columns: 180px 1fr; gap: 10px 20px; margin: 0; }
.criteria-list dt { font-weight: 700; }
.criteria-list dd { margin: 0; color: var(--muted); }

/* ---------- Admin ---------- */
.login { max-width: 420px; margin: 40px auto; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat { background: var(--ink); color: rgba(255,255,255,.75); border-radius: var(--radius); padding: 18px 20px; font-size: 13px; }
.stat-num { display: block; font-size: 32px; font-weight: 800; color: var(--gold); line-height: 1.1; }
.stat-num small { font-size: 16px; color: rgba(255,255,255,.6); font-weight: 600; }
.bar { height: 6px; background: rgba(127,127,127,.2); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h1 { margin-bottom: 4px; }
.section-head p { margin: 0; max-width: 720px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.num { text-align: center; }
.rank { font-weight: 800; font-size: 18px; color: var(--gold-dark); width: 40px; }
.res-row { cursor: pointer; }
.res-row:hover, .res-row.is-open { background: #fbf3e4; }
.res-row.unranked, tr.unranked td { color: var(--muted); }
.who-cell { display: flex; gap: 12px; align-items: center; min-width: 280px; }
.mini-thumb { width: 54px; height: 54px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--sand); }
.mini-thumb img, .mini-thumb .noimg { width: 100%; height: 100%; object-fit: cover; min-height: 0; padding: 0; font-size: 9px; }
.mini-thumb .noimg a { display: none; }
.big { font-size: 20px; color: var(--brown); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--cream); font-size: 13px; font-weight: 600; }
.pill-ok { background: #e3efe2; color: #24502f; }
.detail-row > td { background: #fbf3e4; padding: 0 14px 18px; }
.detail { background: var(--paper); border-radius: 10px; padding: 16px 18px; }
.detail-info p { margin: 0 0 8px; }
.juror-table th, .juror-table td { padding: 8px 10px; font-size: 14px; }
.comment-cell { min-width: 240px; font-size: 13.5px; }

.entries-admin td { font-size: 14px; }
.entries-admin tr.is-hidden td { opacity: .55; }
.entries-admin tr.is-hidden td:last-child { opacity: 1; }
.title-input { min-width: 260px; padding: 7px 10px; }
.reason { margin-top: 4px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.switch input { width: 18px; height: 18px; accent-color: var(--orange); }
.big-switch { white-space: normal; align-items: flex-start; font-size: 15px; margin-bottom: 18px; }
.big-switch input { margin-top: 4px; }

.juror-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.juror-card { margin: 0; }
.inline-form { display: flex; gap: 8px; margin-bottom: 4px; }
.name-input { font-weight: 700; font-size: 17px; border-color: transparent !important; background: transparent !important; padding-left: 0 !important; }
.name-input:focus { border-color: var(--gold) !important; background: #fff !important; padding-left: 10px !important; }
.link-box { display: flex; gap: 8px; margin: 16px 0 12px; }
.link-box input { font-size: 12px; background: var(--cream); }
.juror-actions { display: flex; gap: 18px; }
.add-card { background: transparent; box-shadow: none; border: 2px dashed var(--sand); }

.upload { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.drop { flex: 1; min-width: 220px; border: 2px dashed var(--sand); border-radius: 12px; padding: 14px; background: #fff; cursor: pointer; }
.drop input { font: inherit; font-size: 13px; width: 100%; }
.drop span { display: none; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(10,14,11,.92); z-index: 100; display: grid; place-items: center; padding: 24px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.lightbox button { position: absolute; top: 16px; right: 20px; background: none; border: 0; color: #fff; font-size: 40px; cursor: pointer; line-height: 1; }

/* ---------- Responsivt ---------- */
@media (max-width: 1240px) {
  .entry-layout { grid-template-columns: minmax(0, 1fr) 350px; gap: 20px; }
  .dots button { width: 36px; height: 36px; }
}
@media (max-width: 860px) {
  .entry-layout { grid-template-columns: 1fr; }
  .jump-rate { display: inline-flex; }
  .rate-panel { position: static; }
  .rate-card { max-height: none; }
}
@media (max-width: 720px) {
  .topbar-inner { padding: 10px 16px; gap: 10px 16px; }
  .brand img { height: 32px; }
  .userline { margin-left: 0; width: 100%; }
  .mainnav { order: 3; width: 100%; }
  .wrap { padding: 20px 16px 48px; }
  .hero { flex-direction: column; align-items: flex-start; padding: 26px 22px; }
  .hero-stats { align-self: center; }
  .card { padding: 18px; }
  .criteria-list { grid-template-columns: 1fr; gap: 2px; }
  .criteria-list dd { margin-bottom: 10px; }
  .dots button { width: 44px; height: 44px; }
  .crit-col { display: none; }
  .file-frame { height: 520px; }
}

/* Snabbknapp till bedömningen på smala skärmar */
.jump-rate { display: none; position: fixed; right: 16px; bottom: 16px; z-index: 30; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
