header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.skip {
  position: absolute;
  left: var(--space-2);
  top: -60px;
  z-index: 50;
  padding: var(--space-2) var(--space-4);
  background: var(--action);
  color: var(--on-action);
  border-radius: var(--radius-md);
  font-weight: 600;
}

.skip:focus {
  top: var(--space-2);
}

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

#app:focus {
  outline: none;
}

.loadbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  height: 3px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}

.loadbar::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  background: var(--action);
  animation: loadbar 1.1s ease-in-out infinite;
}

body.loading .loadbar {
  opacity: 1;
  transition-delay: .15s;
}

@keyframes loadbar {
  from {
    left: -40%;
  }

  to {
    left: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loadbar::after {
    animation: none;
    left: 0;
    width: 100%;
    opacity: .5;
  }
}

.top {
  display: flex;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding-top: var(--space-2);
  padding-bottom: var(--space-1);
  min-height: 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
  text-decoration: none;
  flex: none;
}

.brand svg {
  width: 26px;
  height: 26px;
}

.side {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  line-height: 18px;
  min-width: 0;
}

#pill {
  min-width: 0;
}

.iconbtn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-round);
  background: none;
  color: var(--ink-muted);
  cursor: pointer;
}

.iconbtn:hover {
  color: var(--ink);
  background: var(--surface-sunken);
}

.ic {
  width: 22px;
  height: 22px;
  flex: none;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-5);
}

nav a {
  color: var(--ink-muted);
  text-decoration: none;
  padding: var(--space-2) 0 var(--space-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 500;
  font-size: 14px;
}

nav a .ic,
nav a .ns {
  display: none;
}

nav a:hover {
  color: var(--ink);
}

nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--action);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 1px solid var(--action);
  border-radius: var(--radius-md);
  background: var(--action);
  color: var(--on-action);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
}

.btn.ghost {
  background: var(--surface);
  color: var(--action);
  border-color: var(--line-strong);
}

@media (max-width: 640px) {
  .brand-sub,
  .pill-x,
  .syncerr {
    display: none;
  }

  #nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0 max(4px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(4px, env(safe-area-inset-left, 0px));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }

  #nav a {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-height: 58px;
    margin: 0;
    padding: 7px 1px 6px;
    border: 0;
    font-size: 11px;
    line-height: 14px;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
  }

  #nav a .ic {
    display: block;
    width: 44px;
    height: 26px;
    padding: 2px 11px;
    border-radius: 13px;
    box-sizing: border-box;
  }

  #nav a[aria-current="page"] {
    color: var(--ink);
    font-weight: 600;
  }

  #nav a[aria-current="page"] .ic {
    background: var(--action-soft);
    color: var(--action);
  }

  #nav a[data-short] .nl {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  #nav a .ns {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #nav a .nl {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:not(.wrapped-mode) {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }

  /* Admins erreichen HA am Handy über das Menü, die Leiste hat höchstens sieben Einträge */
  #nav #nav-ha {
    display: none;
  }
}

@media (min-width: 641px) {
  .melinks .meha {
    display: none;
  }
}

@media (max-width: 400px) {
  #nav a {
    font-size: 10.5px;
  }
}

.linkbtn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--action);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  font-size: 13px;
}

.inline {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.glyph {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-round);
  flex: none;
}

.glyph.open {
  background: var(--open);
}

.glyph.closed {
  box-shadow: inset 0 0 0 2px var(--closed);
}

.glyph.unknown {
  border: 2px dashed var(--ink-muted);
}

.hero {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  min-height: 76px;
}

.hero svg {
  width: 48px;
  height: 48px;
  flex: none;
}

.hero .w {
  font-size: 28px;
  line-height: 34px;
  font-weight: 600;
}

.hero .s {
  font-size: 13px;
  line-height: 19px;
}

.hero.open {
  background: var(--open);
  color: var(--on-open);
}

.hero.closed {
  background: var(--closed);
  color: var(--on-closed);
}

.hero.unknown {
  background: var(--surface);
  color: var(--ink);
  border: 1px dashed var(--line-strong);
}

.pagehead {
  padding-top: var(--space-6);
}

.pagehead .sub {
  margin-top: var(--space-1);
  color: var(--ink-muted);
}

.sec {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}

.sec>h2 {
  margin-bottom: var(--space-4);
}

.sec>.lead {
  margin: calc(var(--space-2) * -1) 0 var(--space-4);
  color: var(--ink-muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.note {
  margin-top: var(--space-3);
  font-size: 13px;
  line-height: 19px;
  color: var(--ink-muted);
  max-width: 62ch;
}

.daynav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  padding-top: var(--space-5);
}

.navbtn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.navbtn:hover,
.dbtn:hover {
  border-color: var(--action);
}

.daynav .dsel {
  flex: 0 1 auto;
}

.daynav .dbtn {
  min-height: 44px;
}

.daynav .btn {
  margin-left: auto;
}

input[type=date],
input[type=time],
select {
  font-size: 15px;
  line-height: 20px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 4px var(--space-2);
  min-height: 32px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-5);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.tabs a,
.tabs button {
  color: var(--ink-muted);
  text-decoration: none;
  padding: 12px 2px;
  min-width: 44px;
  text-align: center;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 500;
  font-size: 14px;
}

.tabs a[aria-current="true"],
.tabs button[aria-current="true"] {
  color: var(--ink);
  border-bottom-color: var(--action);
}

details {
  margin-top: var(--space-4);
}

summary {
  cursor: pointer;
  padding-block: 13px;
  margin-block: -13px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: var(--action);
  text-decoration: underline;
  text-underline-offset: 3px;
}

details> :not(summary) {
  margin-top: var(--space-3);
}

.scroll {
  overflow-x: auto;
}

.tpick {
  position: relative;
  display: inline-block;
}

.tfield {
  width: 5.2em;
  font-size: 15px;
  line-height: 20px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 5px var(--space-2);
  min-height: 32px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tlist {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  width: 6.5em;
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
  padding: 4px 0;
}

.topt {
  padding: 5px var(--space-3);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.topt:hover {
  background: var(--bg);
}

.topt.on {
  color: var(--action);
  font-weight: 600;
}

.dsel {
  position: relative;
  display: inline-block;
}

.dsel input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.dbtn {
  font-size: 15px;
  line-height: 20px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 5px var(--space-3);
  min-height: 32px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.arrow-set {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
}

.tabs button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

@media (pointer: coarse) {
  .brand {
    min-height: 44px;
  }

  input[type=date],
  input[type=time],
  select,
  .tfield,
  .dbtn {
    min-height: 44px;
  }
}

.mebtn {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

@media (pointer: coarse) {
  .mebtn {
    min-height: 44px;
  }
}

.mebtn:hover {
  border-color: var(--action);
}

.mebtn .ic {
  width: 16px;
  height: 16px;
}

.mebtn.due {
  border-color: var(--action);
  background: var(--action-soft);
  color: var(--action);
}

.mebtn.in {
  border-color: var(--open);
  background: color-mix(in srgb, var(--open) 12%, var(--surface));
}

.mebtn b {
  font-variant-numeric: tabular-nums;
}

.medot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--open);
}

.mebtn.long .medot {
  background: #d97706;
}

.mepop {
  inset: 60px max(var(--space-4), calc((100vw - 792px) / 2 + var(--space-4))) auto auto;
  width: min(360px, calc(100vw - 2 * var(--space-4)));
  max-height: calc(100vh - 76px);
  margin: 0;
  padding: var(--space-4);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .2);
}

.mef {
  display: grid;
  gap: var(--space-3);
}

.mef h2,
.mef p {
  margin: 0;
}

.mef h2 {
  font-size: 17px;
}

.meh {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--line);
}

.meh .ic {
  width: 18px;
  height: 18px;
  color: var(--ink-muted);
}

.mef .ok {
  color: var(--open);
  font-weight: 500;
}

.mein {
  display: grid;
  gap: var(--space-2);
}

.meleft {
  white-space: nowrap;
  color: var(--open);
}

.mebtn2 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--action);
  font-weight: 600;
  text-decoration: none;
}

.melinks {
  display: flex;
  flex-direction: column;
  padding-top: var(--space-1);
  border-top: 1px solid var(--line);
}

.melinks a,
.mef .melinks button {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--action);
  font: inherit;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.iinfo>p+p {
  margin-top: var(--space-3);
}

.iinfo h3 {
  margin: var(--space-4) 0 var(--space-1);
  font-size: 15px;
}

.iinfo h3:first-child {
  margin-top: 0;
}

.iinfo ul {
  margin: 0;
  padding-left: 1.2em;
}

.iinfo li+li {
  margin-top: var(--space-2);
}

.ifb {
  display: grid;
  gap: var(--space-2);
}

.ifb textarea {
  width: 100%;
  padding: var(--space-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  resize: vertical;
}

.ifb p {
  margin: 0;
  min-height: 1.4em;
}

.ifb .ihp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
}

@media (max-width: 640px) {
  .mepop {
    inset: 56px var(--space-4) auto var(--space-4);
    width: auto;
  }
}

@media (max-width: 440px) {
  .brand>span:last-child,
  .mebtn.out .mel {
    display: none;
  }

  .mebtn.out,
  .mebtn.anon {
    padding: 4px 10px;
  }
}

@media (max-width: 380px) {
  .mebtn.anon .mel {
    display: none;
  }
}


#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  max-width: min(480px, calc(100vw - 32px));
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 4px solid var(--open);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-tip);
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 8px);
  transition: opacity .2s, transform .2s, visibility .2s;
}

#toast.on {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

#toast.bad {
  border-left-color: #c0392b;
}

@media (max-width: 640px) {
  #toast {
    bottom: calc(60px + var(--space-3) + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  #toast {
    transition: none;
  }
}
