/* Hönö Bio personalportal */

@font-face { font-family: "Avenir Next"; src: url(/fonts/avenir-regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Avenir Next"; src: url(/fonts/avenir-bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Avenir Cn"; src: url(/fonts/avenir-mediumcn.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Avenir Cn"; src: url(/fonts/avenir-boldcn.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --red: #931A1D;
  --red-deep: #6E1417;
  --red-tint: #F6E9E9;
  --salong: #2B1517;
  --salong-2: #3A1D20;
  --duk: #F2F1EF;
  --paper: #FFFFFF;
  --ink: #221B1C;
  --muted: #6F6264;
  --line: #E3DCDC;
  --brass: #A07A2C;
  --brass-tint: #F5EEDD;
  --ok: #2F6B45;
  --ok-tint: #E5F0E8;

  --sans: "Avenir Next", "Avenir", "Segoe UI", system-ui, sans-serif;
  --cn: "Avenir Cn", "Avenir Next Condensed", "Arial Narrow", var(--sans);

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(43, 21, 23, .06), 0 6px 20px rgba(43, 21, 23, .06);
  --tabbar: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--duk); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--red); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--red) 55%, white); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { font-family: var(--cn); font-weight: 700; line-height: 1.1; margin: 0; letter-spacing: .005em; }
h1 { font-size: clamp(30px, 6vw, 40px); }
h2 { font-size: 24px; }
h3 { font-size: 19px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- ramverk ---------- */

.topbar {
  background: var(--salong); color: #fff;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  position: sticky; top: 0; z-index: 20;
  border-bottom: 3px solid var(--red);
}
.topbar-inner { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 20px; }
.topbar .logo { height: 34px; width: auto; }
.topbar nav { display: none; gap: 4px; margin-left: 8px; }
.topbar nav a {
  color: rgba(255,255,255,.75); text-decoration: none; padding: 8px 12px; border-radius: var(--r-sm);
  font-family: var(--cn); font-weight: 500; font-size: 17px;
}
.topbar nav a:hover { color: #fff; background: var(--salong-2); }
.topbar nav a[aria-current="page"] { color: #fff; background: var(--red); }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--red); color: #fff;
  display: grid; place-items: center; font-family: var(--cn); font-weight: 700; font-size: 15px;
  text-decoration: none; border: 2px solid rgba(255,255,255,.25);
}
.topbar .admin-link {
  color: #fff; text-decoration: none; font-family: var(--cn); font-weight: 500; font-size: 15px;
  padding: 6px 10px; border: 1px solid rgba(255,255,255,.3); border-radius: var(--r-sm);
}
.topbar .admin-link[aria-current="page"] { background: #fff; color: var(--salong); }

main { max-width: 1040px; margin: 0 auto; padding: 24px 16px calc(var(--tabbar) + 40px + env(safe-area-inset-bottom)); }
main.narrow { max-width: 720px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--paper); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  height: var(--tabbar); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-family: var(--cn); font-weight: 500; font-size: 13px;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--red); }
.tabbar a[aria-current="page"] svg { stroke-width: 2.2; }

@media (min-width: 820px) {
  .topbar nav { display: flex; }
  .tabbar { display: none; }
  main { padding-bottom: 60px; }
  .topbar .logo { height: 40px; }
}

/* ---------- ytor ---------- */

.panel { background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px; }
.panel + .panel, .stack > * + * { margin-top: 16px; }
.panel h2 { margin-bottom: 12px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 820px) { .grid-2 { grid-template-columns: 1.15fr .85fr; align-items: start; } .grid-2 > * + * { margin-top: 0; } }

/* ---------- knappar ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: var(--r);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  font-family: var(--cn); font-weight: 700; font-size: 17px; letter-spacing: .01em;
  background: var(--red); color: #fff; transition: background .15s;
}
.btn:hover { background: var(--red-deep); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--duk); }
.btn.ghost { background: transparent; color: var(--red); padding: 0 10px; min-height: 40px; }
.btn.ghost:hover { background: var(--red-tint); }
.btn.danger { background: var(--paper); color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, white); }
.btn.small { min-height: 36px; font-size: 15px; padding: 0 12px; }
.btn.block { width: 100%; }
.btn svg { width: 20px; height: 20px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }

/* ---------- formulär ---------- */

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: var(--r);
  border: 1px solid #CFC5C6; background: #fff; font-size: 16px;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent); }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fields-3 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 640px) { .fields-3 { grid-template-columns: 1fr 1fr 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--red); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid #CFC5C6; background: #fff; border-radius: 999px; padding: 8px 14px; cursor: pointer;
  font-family: var(--cn); font-weight: 500; font-size: 16px;
}
.chip[aria-pressed="true"] { background: var(--salong); color: #fff; border-color: var(--salong); }

.error-msg { background: var(--red-tint); color: var(--red-deep); padding: 10px 12px; border-radius: var(--r); font-size: 15px; margin-bottom: 12px; }
.note { background: var(--brass-tint); color: #5C4515; padding: 12px 14px; border-radius: var(--r); font-size: 15px; }

/* ---------- inloggning ---------- */

.login {
  min-height: 100vh; min-height: 100dvh; background: var(--salong); color: #fff;
  display: grid; place-items: center; padding: 24px 16px;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 2px, transparent 2px 46px),
    radial-gradient(120% 70% at 50% 0%, #4A2226 0%, var(--salong) 60%);
}
.login-box { width: 100%; max-width: 400px; }
.login-box .logo { width: 210px; margin: 0 auto 28px; }
.login-card { background: var(--paper); color: var(--ink); border-radius: var(--r-lg); padding: 26px 22px; }
.login-card h1 { font-size: 30px; margin-bottom: 6px; }
.login-card p { margin: 0 0 18px; color: var(--muted); }
.code-input { font-family: var(--cn) !important; font-weight: 700; font-size: 32px !important; letter-spacing: .35em; text-align: center; }
.login-foot { text-align: center; color: rgba(255,255,255,.55); font-size: 13px; margin-top: 20px; }

/* ---------- biljetten (översikt) ---------- */

.ticket {
  --notch: 14px;
  display: grid; grid-template-columns: 1fr; color: #fff; position: relative;
  filter: drop-shadow(0 10px 22px rgba(43,21,23,.18));
}
.ticket-main, .ticket-stub { background: var(--red); padding: 22px 22px; position: relative; }
.ticket-main {
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  -webkit-mask: radial-gradient(circle var(--notch) at 0 100%, transparent 98%, #000) top left / 51% 100% no-repeat,
                radial-gradient(circle var(--notch) at 100% 100%, transparent 98%, #000) top right / 51% 100% no-repeat;
          mask: radial-gradient(circle var(--notch) at 0 100%, transparent 98%, #000) top left / 51% 100% no-repeat,
                radial-gradient(circle var(--notch) at 100% 100%, transparent 98%, #000) top right / 51% 100% no-repeat;
}
.ticket-stub {
  background: var(--red-deep); border-radius: 0 0 var(--r-lg) var(--r-lg);
  -webkit-mask: radial-gradient(circle var(--notch) at 0 0, transparent 98%, #000) top left / 51% 100% no-repeat,
                radial-gradient(circle var(--notch) at 100% 0, transparent 98%, #000) top right / 51% 100% no-repeat;
          mask: radial-gradient(circle var(--notch) at 0 0, transparent 98%, #000) top left / 51% 100% no-repeat,
                radial-gradient(circle var(--notch) at 100% 0, transparent 98%, #000) top right / 51% 100% no-repeat;
}
.ticket-stub::before {
  content: ""; position: absolute; left: var(--notch); right: var(--notch); top: 0;
  border-top: 2px dashed rgba(255,255,255,.35);
}
.ticket .label { font-family: var(--cn); font-weight: 500; font-size: 17px; color: rgba(255,255,255,.78); }
.ticket .big { font-family: var(--cn); font-weight: 700; font-size: clamp(64px, 17vw, 96px); line-height: .92; letter-spacing: -.01em; margin: 6px 0 4px; }
.ticket .big small { font-size: .38em; letter-spacing: 0; margin-left: 6px; font-weight: 500; }
.ticket .meta { color: rgba(255,255,255,.85); font-size: 15px; }
.ticket-stub { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ticket-stub .when { font-family: var(--cn); font-weight: 700; font-size: 24px; line-height: 1.1; }
.ticket-stub .days {
  text-align: center; font-family: var(--cn); line-height: 1; padding: 8px 12px;
  border: 2px solid rgba(255,255,255,.4); border-radius: var(--r);
}
.ticket-stub .days b { display: block; font-size: 34px; }
.ticket-stub .days span { font-size: 13px; color: rgba(255,255,255,.8); }
.ticket-cta { margin-top: 16px; }
@media (min-width: 640px) {
  .ticket { grid-template-columns: 1fr 230px; }
  .ticket-main {
    border-radius: var(--r-lg) 0 0 var(--r-lg);
    -webkit-mask: radial-gradient(circle var(--notch) at 100% 0, transparent 98%, #000) top / 100% 51% no-repeat,
                  radial-gradient(circle var(--notch) at 100% 100%, transparent 98%, #000) bottom / 100% 51% no-repeat;
            mask: radial-gradient(circle var(--notch) at 100% 0, transparent 98%, #000) top / 100% 51% no-repeat,
                  radial-gradient(circle var(--notch) at 100% 100%, transparent 98%, #000) bottom / 100% 51% no-repeat;
  }
  .ticket-stub {
    border-radius: 0 var(--r-lg) var(--r-lg) 0; flex-direction: column; align-items: flex-start; justify-content: space-between;
    -webkit-mask: radial-gradient(circle var(--notch) at 0 0, transparent 98%, #000) top / 100% 51% no-repeat,
                  radial-gradient(circle var(--notch) at 0 100%, transparent 98%, #000) bottom / 100% 51% no-repeat;
            mask: radial-gradient(circle var(--notch) at 0 0, transparent 98%, #000) top / 100% 51% no-repeat,
                  radial-gradient(circle var(--notch) at 0 100%, transparent 98%, #000) bottom / 100% 51% no-repeat;
  }
  .ticket-stub::before { left: 0; right: auto; top: var(--notch); bottom: var(--notch); border-top: 0; border-left: 2px dashed rgba(255,255,255,.35); }
}

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat { background: var(--paper); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--cn); font-size: 28px; line-height: 1.1; }
.stat span { font-size: 14px; color: var(--muted); }

/* ---------- listor ---------- */

.month-nav { display: inline-flex; align-items: center; gap: 4px; background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); padding: 4px; }
.month-nav button { width: 40px; height: 40px; border: 0; background: transparent; border-radius: var(--r-sm); cursor: pointer; display: grid; place-items: center; }
.month-nav button:hover { background: var(--duk); }
.month-nav button svg { width: 20px; height: 20px; }
.month-nav strong { font-family: var(--cn); font-size: 19px; min-width: 132px; text-align: center; }

.shift-list { list-style: none; margin: 0; padding: 0; }
.shift {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center;
  padding: 14px 4px; border-bottom: 1px solid var(--line);
}
.shift:last-child { border-bottom: 0; }
.shift .day { text-align: center; line-height: 1; }
.shift .day b { display: block; font-family: var(--cn); font-size: 30px; }
.shift .day span { font-size: 13px; color: var(--muted); }
.shift .what b { font-family: var(--cn); font-weight: 700; font-size: 19px; }
.shift .what div { font-size: 14px; color: var(--muted); }
.shift .hrs { text-align: right; font-family: var(--cn); font-weight: 700; font-size: 20px; }
.shift .hrs .btn { margin-top: 2px; }
button.shift { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; font: inherit; }
button.shift:hover { background: var(--duk); }

.badge { display: inline-block; font-family: var(--cn); font-weight: 500; font-size: 13px; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.badge.sent { background: var(--brass-tint); color: var(--brass); }
.badge.open { background: var(--ok-tint); color: var(--ok); }
.badge.warn { background: var(--red-tint); color: var(--red); }

.empty { text-align: center; padding: 34px 12px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-family: var(--cn); font-size: 20px; margin-bottom: 4px; }

.month-total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 4px 0; border-top: 2px solid var(--ink); margin-top: 4px; }
.month-total b { font-family: var(--cn); font-size: 24px; }

/* tabell (admin) */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--duk); }
table.data tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--ink); }

/* ---------- dialog/ark ---------- */

dialog.sheet {
  border: 0; padding: 0; width: 100%; max-width: 560px; max-height: 92dvh;
  border-radius: var(--r-lg) var(--r-lg) 0 0; margin: auto auto 0; background: var(--paper);
}
dialog.sheet::backdrop { background: rgba(43, 21, 23, .55); }
dialog.sheet[open] { animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (min-width: 640px) { dialog.sheet { border-radius: var(--r-lg); margin: auto; } }
dialog.wide { max-width: 900px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 8px; position: sticky; top: 0; background: var(--paper); z-index: 2; }
.sheet-body { padding: 8px 20px 20px; }
.sheet-foot { padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 10px; position: sticky; bottom: 0; background: var(--paper); }
.sheet-foot .btn { flex: 1; }
.x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--duk); cursor: pointer; display: grid; place-items: center; }
.x svg { width: 20px; height: 20px; }
.calc { display: flex; justify-content: space-between; align-items: baseline; background: var(--duk); padding: 12px 14px; border-radius: var(--r); margin: 4px 0 14px; }
.calc b { font-family: var(--cn); font-size: 26px; }
iframe.preview { width: 100%; height: 70dvh; border: 1px solid var(--line); border-radius: var(--r); background: #EEEDEB; }

/* ---------- kvitto ---------- */

.drop {
  display: flex; align-items: center; gap: 14px; border: 2px dashed #CFC5C6; border-radius: var(--r);
  padding: 14px; cursor: pointer; background: #fff;
}
.drop:hover { border-color: var(--red); }
.drop svg { width: 28px; height: 28px; color: var(--red); flex: none; }
.drop .thumb { width: 64px; height: 64px; object-fit: cover; border-radius: var(--r-sm); flex: none; }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }

/* ---------- textsidor ---------- */

.prose { max-width: 68ch; }
.prose h3 { margin: 18px 0 8px; font-size: 21px; }
.prose h3:first-child { margin-top: 0; }
.prose p { margin: 0 0 10px; }
.prose ul { margin: 0 0 12px; padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.prose li::marker { color: var(--red); }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; margin: 0; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-family: var(--cn); font-weight: 700; font-size: 19px; }

.doc-link {
  display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r);
  text-decoration: none; color: var(--ink); background: #fff;
}
.doc-link:hover { border-color: var(--red); }
.doc-link svg { width: 30px; height: 30px; color: var(--red); flex: none; }
.doc-link b { display: block; font-family: var(--cn); font-size: 18px; }
.doc-link span { font-size: 13px; color: var(--muted); }
.doc-link + .doc-link { margin-top: 10px; }

.subnav { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; }
.subnav a {
  padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink); background: var(--paper);
  font-family: var(--cn); font-weight: 500; font-size: 16px; white-space: nowrap; box-shadow: var(--shadow);
}
.subnav a[aria-current="page"] { background: var(--salong); color: #fff; }

/* ---------- toast/laddning ---------- */

#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--salong); color: #fff; padding: 12px 18px; border-radius: var(--r); z-index: 100;
  opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100% - 32px); font-size: 15px;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 820px) { #toast { bottom: 24px; } }
.loading { display: grid; place-items: center; min-height: 40vh; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--red); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
