/* Hönö Missionskyrka – personalsidan.
   Samma formspråk som intranätet: Playfair Display i rubrikerna,
   DM Sans i texten, dämpad turkos och guld. */

:root {
  --teal: #718B94;
  --teal-dark: #4a6670;
  --teal-deep: #3a5159;
  --gold: #C1A051;
  --gold-dark: #a8873c;
  --dark: #282626;
  --olive: #8d907f;
  --bg: #eef0ee;
  --card: #ffffff;
  --line: #e6e3dd;
  --soft: #f7f8f6;
  --ok: #4d7a3a;
  --warn: #a7483f;
  --warn-bg: #fdf1ef;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(40, 38, 38, .05), 0 10px 30px rgba(40, 38, 38, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--dark);
  background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { font-family: 'Playfair Display', Georgia, serif; font-weight: 600; line-height: 1.25; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

a { color: var(--teal-dark); }
.muted { color: var(--olive); }
.small { font-size: 13.5px; }
.num { font-variant-numeric: tabular-nums; }
.r { text-align: right; }

/* ---------------------------------------------------------------- ram */

.topbar { background: var(--teal-dark); border-bottom: 3px solid var(--gold); position: sticky; top: 0; z-index: 30; }
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 18px;
  display: flex; align-items: center; gap: 20px;
}
.wordmark { color: #fff; text-decoration: none; display: block; }
.wordmark b { font-family: 'Playfair Display', Georgia, serif; font-size: 17px; font-weight: 600; display: block; }
.wordmark span { display: block; font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: #cdd8da; margin-top: 1px; }
.topbar nav { display: none; margin-left: auto; gap: 4px; }
.topbar nav a {
  color: #dde5e6; text-decoration: none; font-size: 14px; padding: 7px 12px; border-radius: 8px;
}
.topbar nav a:hover { background: rgba(255, 255, 255, .10); color: #fff; }
.topbar nav a[aria-current] { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 500; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar nav + .who { margin-left: 0; }
.admin-link { color: #fff; text-decoration: none; font-size: 13px; padding: 6px 11px; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; }
.admin-link[aria-current] { background: var(--gold); border-color: var(--gold); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #fff;
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  font-size: 12.5px; font-weight: 600; letter-spacing: .02em; flex: none;
}

main { max-width: 1080px; margin: 0 auto; padding: 20px 18px 96px; }
main.narrow { max-width: 740px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 14px rgba(40, 38, 38, .06);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px 8px; text-decoration: none; color: var(--olive); font-size: 10.5px;
}
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a[aria-current] { color: var(--teal-dark); font-weight: 500; }

@media (min-width: 760px) {
  .topbar nav { display: flex; }
  .tabbar { display: none; }
  main { padding-bottom: 40px; }
  h1 { font-size: 30px; }
}

/* ---------------------------------------------------------------- byggdelar */

.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head > div:first-child { flex: 1 1 260px; }
.page-head p { margin-top: 4px; font-size: 14.5px; }

.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel > h2 { margin-bottom: 12px; }

.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1fr 1fr; align-items: start; } }

.note {
  background: var(--soft); border: 1px solid var(--line); border-left: 3px solid var(--teal);
  border-radius: 10px; padding: 13px 15px; font-size: 14.5px; line-height: 1.6;
}
.note svg { width: 20px; height: 20px; color: var(--teal-dark); flex: none; }

.error-msg {
  background: var(--warn-bg); border-left: 3px solid var(--warn); color: #7e3730;
  border-radius: 9px; padding: 11px 14px; font-size: 14.5px; margin-bottom: 14px;
}

.empty { text-align: center; padding: 26px 16px; color: var(--olive); }
.empty b { display: block; color: var(--dark); font-family: 'Playfair Display', Georgia, serif; font-size: 17px; }

.badge {
  display: inline-block; font-size: 11.5px; font-weight: 500; padding: 2px 9px;
  border-radius: 999px; background: #e9ece8; color: #5c6057; white-space: nowrap;
}
.badge.ok { background: #e7f0e2; color: var(--ok); }
.badge.warn { background: #fae7e4; color: var(--warn); }
.badge.gold { background: #f6eed9; color: #8a6c1f; }

/* fält och knappar */

.field { display: block; margin-bottom: 15px; }
.field > span, .check > span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; font-weight: 600; color: var(--olive); margin-bottom: 6px; }
.field small { display: block; font-size: 12.5px; color: var(--olive); margin-top: 5px; line-height: 1.5; }
.fields-2 { display: grid; gap: 0 14px; }
@media (min-width: 600px) { .fields-2 { grid-template-columns: 1fr 1fr; } }

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=date], input[type=number], textarea, select {
  font: inherit; font-size: 16px; color: var(--dark); background: var(--soft);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; width: 100%;
  outline: none; -webkit-appearance: none; appearance: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); background: #fff; box-shadow: 0 0 0 3px rgba(193, 160, 81, .16); }
textarea { resize: vertical; line-height: 1.55; }

.check { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); flex: none; }
.check > span { margin: 0; text-transform: none; letter-spacing: 0; font-size: 15px; font-weight: 400; color: var(--dark); }

.btn {
  font: inherit; font-size: 15px; font-weight: 500; color: #fff; background: var(--gold);
  border: 1px solid var(--gold); border-radius: 10px; padding: 11px 20px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  text-decoration: none; transition: background .14s, border-color .14s;
}
.btn:hover:not(:disabled) { background: var(--gold-dark); border-color: var(--gold-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn.secondary { background: #fff; color: var(--teal-dark); border-color: var(--line); }
.btn.secondary:hover:not(:disabled) { background: var(--soft); border-color: var(--teal); }
.btn.ghost { background: transparent; color: var(--olive); border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: #e7eae6; color: var(--dark); }
.btn.small { font-size: 13.5px; padding: 7px 14px; }
.btn.block { width: 100%; }
.btn.danger { background: #fff; color: var(--warn); border-color: #eccfca; }
.btn.danger:hover:not(:disabled) { background: var(--warn-bg); }

.linkish { font: inherit; background: none; border: none; padding: 0; color: var(--teal-dark); text-decoration: underline; cursor: pointer; }

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

/* undermeny i admin */
.subnav { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 18px; padding-bottom: 2px; }
.subnav a {
  text-decoration: none; color: var(--olive); font-size: 14px; padding: 7px 14px;
  border-radius: 999px; white-space: nowrap; border: 1px solid transparent;
}
.subnav a:hover { background: #e7eae6; }
.subnav a[aria-current] { background: #fff; color: var(--teal-deep); border-color: var(--line); font-weight: 500; box-shadow: var(--shadow); }

/* tabeller */
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; padding: 0 20px 20px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--olive); font-weight: 600; padding: 0 12px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 11px 12px 11px 0; border-bottom: 1px solid #f1efeb; vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--soft); }

/* ---------------------------------------------------------------- sjukanmälan */

.sick-status {
  background: linear-gradient(135deg, var(--teal-dark), var(--teal-deep));
  color: #fff; border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow);
}
.sick-status .label { font-size: 13px; color: #d6e0e2; }
.sick-status .big { font-family: 'Playfair Display', Georgia, serif; font-size: 34px; font-weight: 600; line-height: 1.1; margin-top: 2px; }
.sick-status .meta { margin-top: 10px; font-size: 14px; color: #e3eaeb; }

.cert.locked { opacity: .72; }
.cert.needed { border-left: 4px solid var(--warn); }
.cert.needed h2 { color: var(--warn); }
.cert.ok { border-left: 4px solid var(--ok); }
.cert-status { color: var(--ok); font-weight: 500; margin: 0 0 12px; }

.drop {
  display: flex; align-items: center; gap: 14px; cursor: pointer;
  border: 2px dashed #d7d3cb; border-radius: 12px; padding: 18px; background: var(--soft);
}
.drop:hover { border-color: var(--gold); background: #fffdf7; }
.drop svg { width: 30px; height: 30px; color: var(--teal-dark); flex: none; }
.drop input[type=file] { display: none; }

.doc-link {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--dark);
  border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; background: var(--soft);
}
.doc-link:hover { border-color: var(--teal); }
.doc-link svg { width: 24px; height: 24px; color: var(--teal-dark); flex: none; }
.doc-link span { display: block; font-size: 13px; color: var(--olive); }

.period-list { list-style: none; }
.period-list li {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 0; border-bottom: 1px solid #f1efeb;
}
.period-list li:last-child { border-bottom: none; }
.period-list .what { flex: 1 1 200px; }
.period-list .what b { font-weight: 500; }
.period-list .what div { font-size: 13.5px; color: var(--olive); }

.quote { white-space: pre-wrap; background: var(--soft); border-left: 3px solid var(--teal); border-radius: 8px; padding: 11px 14px; font-size: 14.5px; }

/* markdown-text (rutiner) */
.md h3 { margin: 18px 0 8px; }
.md h3:first-child { margin-top: 0; }
.md p { margin-bottom: 11px; }
.md ul { margin: 0 0 12px 20px; }
.md li { margin-bottom: 5px; }
.md > *:last-child { margin-bottom: 0; }

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

.login {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 28px 18px; background: linear-gradient(160deg, var(--teal-dark), var(--teal-deep) 70%, #32474e);
}
.login-box { width: 100%; max-width: 420px; text-align: center; }
.login-box .wordmark { margin-bottom: 20px; }
.login-box .wordmark b { font-size: 22px; }
.login-card {
  background: #fff; border-radius: 18px; box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
  padding: 26px 24px; text-align: left;
}
.login-card h1 { font-size: 24px; margin-bottom: 8px; }
.login-card > p { font-size: 14.5px; color: #5f635a; margin-bottom: 20px; }
.login-card .btn { margin-top: 4px; }
.login-or { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; color: var(--olive); font-size: 13px; }
.login-or::before, .login-or::after { content: ''; height: 1px; background: var(--line); flex: 1; }
.code-input { text-align: center; font-size: 28px !important; letter-spacing: 10px; font-weight: 600; padding: 12px !important; }
.login-foot { margin-top: 18px; font-size: 13px; color: #cfdadc; line-height: 1.6; }

/* ---------------------------------------------------------------- fönster, notis, laddning */

dialog.sheet {
  /* margin: auto behövs eftersom nollställningen högst upp tar bort
     webbläsarens egen centrering av dialogrutor. */
  margin: auto; border: none; padding: 0; background: var(--card); color: var(--dark);
  border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
  width: min(640px, calc(100vw - 28px)); max-height: calc(100vh - 56px);
}
dialog.sheet::backdrop { background: rgba(40, 38, 38, .5); }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; }
.sheet-head .x { background: none; border: none; cursor: pointer; color: var(--olive); padding: 4px; line-height: 0; }
.sheet-head .x svg { width: 22px; height: 22px; }
.sheet-body { padding: 20px; overflow-y: auto; max-height: calc(100vh - 190px); }
.sheet-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--soft); border-radius: 0 0 16px 16px; }

#toast {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 18px);
  background: var(--dark); color: #fff; font-size: 14.5px; padding: 12px 20px;
  border-radius: 999px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 90;
  max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 760px) { #toast { bottom: 28px; } }

.loading { display: flex; justify-content: center; padding: 56px 0; }
.spinner {
  width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--gold);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media print {
  .topbar, .tabbar, .subnav, .btn, #toast { display: none !important; }
  body { background: #fff; }
  .panel { box-shadow: none; border: 1px solid var(--line); }
}
