/*
source_date = "2025-08-27T19:31:46Z"
*/

  @import url('/assets/fonts/OfficinaSansITC-OSF/OfficinaSansITC-OS.css');
  body {
    font-family: 'OfficinaSansITC-OSF', system-ui, sans-serif;
  }

:root {
  --bg: #0f172a;
  --fg: #e5e7eb;
  --accent: #16a34a;
  --yellow: #decd1f;
  --card: rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.08);
  --officina-sans: 'OfficinaSansITC-OSF', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --monospace: monospace, monospace; /* use font-family: var(--monospace); to improve Quality */ 
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font-family: var(--officina-sans); }
a { color: var(--fg); }
code, .code { font-family: var(--monospace); }
.button { 
    background: var(--accent); 
    color: white; 
    padding: 0.6rem 1rem; 
    border-radius: 8px; 
    text-decoration: none; 
}
.log-actions .btn[data-act="toggle-debug"]:before {
    content: "hide ";
}
#cloud-log.suppress-lvl-debug .log-actions .btn[data-act="toggle-debug"]:before {
    content: "show ";
}
.app-header { 
  position: sticky;
  top: 0;
  z-index: 9000; /* unter Modal, über Content */
  display:flex; 
  align-items:center; 
  justify-content:space-between; 
  padding: .75rem 1rem; 
  padding-right: 3em; 1px solid var(--border); 
  position: sticky; top:0; 
  backdrop-filter: blur(4px); 
  background: color-mix(in oklab, var(--bg) 84%, transparent); z-index: 1;
}
.brand { display:flex; align-items:center; gap:.6rem; font-weight:600; }
.logo { border-radius: 6px; }
.actions button { background: var(--card); color: var(--fg); border: 1px solid var(--border); padding:.5rem .75rem; border-radius:8px; cursor:pointer; }
.container { max-width: 920px; margin: 2rem auto; padding: 0 1rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.status-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: .75rem; }
.pill { display:inline-block; padding:.25rem .5rem; border-radius:999px; border:1px solid var(--border); background:rgba(255,255,255,0.06); }
.hint { opacity:.8; }
.log { white-space: pre-wrap; background: #0009; padding: .75rem; border-radius: 8px; min-height: 96px; }
.app-footer { 
  text-align:center; 
  padding: 2rem 1rem; 
  opacity:.7; 
}

/* --- Growl-style toast --- */
#toast-host{ 
  position: fixed; 
  right: 16px; 
  top: 16px; 
  z-index: 9999; 
  display:flex; 
  flex-direction:column; 
  gap:8px; 

  .toast { 
    opacity:0; 
    transform: translateY(-6px); 
    transition: opacity .25s ease, transform .25s ease; 
    background: rgba(0,0,0,.85); 
    color: #fff; 
    padding: 10px 14px; 
    border-radius: 10px; 
    box-shadow: 0 6px 24px rgba(0,0,0,.25); 
    max-width: 320px; 
  
    &.show { 
      opacity:1; 
      transform: translateY(0); 
    }
  
    strong{ font-weight: 600; }
    small{ opacity:.9; }
  }
  @media (prefers-color-scheme: light){
    .toast { background: rgba(0,0,0,.82); color: #fff; }
  }
  @media (prefers-color-scheme: dark){
    .toast { background: rgba(20,33,39,.92); }
  }
}


/* Online/Offline Cloud Badge */
#cloud-status {
  /* Position / Container */
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  /* border-radius: 999px; */
  /* background: rgba(0, 0, 0, .25); */
  backdrop-filter: blur(6px);
  /* border: 1px solid var(--border, rgba(255,255,255,.15)); */

  /* Nested styles */
  & .icon {
    display: none;
    width: 24px;
    height: 24px;
    fill: currentColor; /* SVG übernimmt Textfarbe */

    /* Safari/Firefox-Sicherheit */
    & path,
    & use,
    & * {
      fill: currentColor;
    }
  }

  /* Sichtbarkeit + Farben */
  &.online .icon.online,
  &.checking .icon.checking,
  &.downloading .icon.downloading,
  &.updated .icon.updated {
    display: block;
    color: var(--yellow); 
  }
  &.offline .icon.offline {
    display: block;
    color: #dc2626; /* rot */
  }

  .sr-only {
    position: absolute; 
    width: 1px; 
    height: 1px; 
    padding: 0; 
    margin: -1px;
    overflow: hidden; 
    clip: rect(0,0,0,0); 
    white-space: nowrap; 
    border: 0;
  }
}
/* Cloud-Badge: X anzeigen, wenn das Modal offen ist */
#cloud-status .icon.close { display: none; }
body.log-open #cloud-status .icon { display: none; }     /* alle Icons verstecken … */
body.log-open #cloud-status .icon.close { display: block; } /* … außer dem X */
body.log-open #cloud-status { color: currentColor; }     /* übernimmt Schriftfarbe des Headers/Theme */

#cloud-log {
  background-color: var(--bg);
  min-height: 100vh;
  /* position: fixed; */
  z-index: 9;

  &[hidden] {
    display: none;
  }

  .log-head{
    display: flex; 
    gap: 8px; 
    align-items: center; 
    justify-content: space-between;
    margin-bottom: 6px;
    position: sticky; 
    top: 0;                       /* bleibt sichtbar */
    height: 3.6em;
    padding: 0.5em 0;
    padding-right: 4em;           /* leave space for the cloud icons */ 
    background: inherit;
    z-index: 1;                   /* über dem Scroll-Content */
  }

  .list{
    flex: 1 1 auto;               /* füllt den Rest */
    min-height: 0;                /* WICHTIG: erlaubt Überscroll in Flex-Container */
    overflow-y: auto;             /* scrollt hier */
    overflow-x: hidden;
    display: grid;
    gap: 2px;
    -webkit-overflow-scrolling: touch; /* flüssig auf iOS */
  }

}

/* Modal-Overlay: nimmt das ganze Fenster ein, wenn offen */
#cloud-log {
  position: fixed;
  right: 12px;
  top: 54px;
  width: min(520px, 92vw);
  max-height: 60vh;
  z-index: 10000;

  display: flex;
  flex-direction: column;
  overflow: hidden;

  padding: 10px 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255,255,255,.15));
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  backdrop-filter: blur(8px);
  background: color-mix(in oklab, Canvas 90%, transparent);
  color: CanvasText;
}

/* Fullscreen-Modal-Layout wenn offen */
body.log-open #cloud-log {
  inset: 0;                 /* volle Fläche */
  right: 0; top: 0;
  width: 100vw;
  height: 100vh;
  max-height: none;
  border-radius: 0;
  border: 0;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  z-index: 20000;
  background: color-mix(in oklab, Canvas 85%, rgba(0,0,0,.35)); /* leicht verdunkelt */
}

/* Scrollbarer Inhalt im Log */
#cloud-log .log-head{
  display:flex; gap:8px; align-items:center; justify-content:space-between;
  margin-bottom:6px;
  position: sticky; top: 0;
  background: inherit;
  z-index: 1;
}
#cloud-log .list{
  flex: 0 0 auto; /* safari requires values 0, chrome ignores value */
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  gap: 2px;
  -webkit-overflow-scrolling: touch;
  max-height: 80vh;
}
#cloud-log.suppress-lvl-debug .row:has(span.lvl-debug) {
  display: none;
}
#cloud-log .row{
  display: grid; 
  grid-template-columns: 148px 42px 1fr; 
  gap: 8px;
  /* padding: 6px 8px;  */
  /* border-radius: 10px;  */
  /* border: 1px solid rgba(0,0,0,.05); */
  /* background: color-mix(in oklab, Canvas 92%, transparent); */
  /* word-break: break-word; */
  white-space: nowrap;
  max-width: 100%;
  /* overflow: scroll; */

  /* make rows scrollable horizontally with scrollbars hidden */
  height: 1.2em;
  box-sizing: content-box;
  overflow: clip;
  scrollbar-width: none;
  overflow-x: scroll;

  &:has(span.lvl-debug) {
    opacity: 0.4;
  }
  span {
    margin-right: 0.25em;
  }
  code { 
    white-space: nowrap;
    font-size: 0.8em;
    opacity: 0.7;
  }
}

@media (prefers-color-scheme: dark){
  #cloud-log { background: rgba(12,18,24,.90); color:#e5e7eb; border-color: rgba(255,255,255,.12); }
  #cloud-log .row{ background: rgba(255,255,255,.04); }
}

/* Body-Scroll sperren, wenn Modal offen (optional) */
body.log-open {
  overflow: hidden;
}