:root{
  /* Optik Aichinger inspired dark-first theme (light overrides below) */
  --bg: #0f1012;
  --surface: #17181b;
  --surface-2: #1d1f24;
  --text: rgba(242,242,243,.96);
  --muted: rgba(242,242,243,.72);
  --muted-2: rgba(242,242,243,.56);
  --card-border: rgba(255,255,255,.10);

  /* Brand */
  --brand: #d9314a;        /* primary red */
  --brand-2: #6a6a70;      /* neutral (rarely used) */
  --danger: #ef4444;

  /* Layout */
  --radius: 18px;
  --shadow: 0 10px 26px rgba(0,0,0,.38);
  --nav-h: 74px;

  /* Surfaces */
  --appbar-bg: rgba(15,16,18,.88);
  --nav-bg: rgba(15,16,18,.90);
  --divider: rgba(255,255,255,.10);
  --focus: rgba(217,49,74,.35);
}

*{ box-sizing:border-box; }
html, body { height:100%; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a{ color: inherit; text-decoration: none; }
a:hover{ opacity:.92; }

.app-shell{
  min-height: 100%;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
.container{
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 14px 20px;
}

.appbar{
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: var(--appbar-bg);
  border-bottom: 1px solid var(--divider);
}
.appbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 14px 14px;
  max-width: 980px;
  margin: 0 auto;
}
.app-title{
  font-size: 34px;
  line-height: 1.1;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-align:left;
  margin-left:8px;
}
.pill{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--divider);
  color: var(--muted);
  font-size: 12px;
}

.settings-pill{
  padding: 8px 12px;
  flex-shrink: 0;
}
.settings-pill-icon{
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 18px;
}
.settings-pill-text{
  display: inline-block;
}
@media (max-width: 680px){
  .settings-pill{
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
    gap: 0;
  }
  .settings-pill-text{
    display: none;
  }
}

.card{
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad{ padding: 14px; }

.row{
  display:grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 900px){
  .row{ grid-template-columns: 1fr 1fr; }
}

.h2{ font-size: 24px; margin: 12px 0 10px; letter-spacing:-0.01em; }
.muted{ color: var(--muted); }
.muted-2{ color: var(--muted-2); }

/* Auth (Login / Register) */
.auth-shell{
  min-height: calc(100vh - 84px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 22px 14px;
}
.auth-wrap{ width: 100%; max-width: 560px; }
.auth-card{ padding: 20px; }
.auth-header{
  display:flex;
  gap: 12px;
  align-items:center;
  margin-bottom: 10px;
}
.auth-badge{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #ffffff;
  background: var(--brand);
}
.auth-title{ font-size: 22px; font-weight: 850; letter-spacing:-0.02em; }
.auth-sub{ margin-top: 2px; line-height: 1.35; }
.auth-actions{
  display:flex;
  gap: 12px;
  margin-top: 16px;
  align-items:center;
  flex-wrap:wrap;
}
.auth-link{
  color: var(--brand);
  font-weight: 750;
  text-decoration:none;
}
.auth-link:hover{ text-decoration: underline; }
.auth-error{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(217,49,74,.25);
  background: rgba(217,49,74,.08);
  color: var(--text);
}

.auth-info{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.08);
  background: var(--surface);
  color: var(--text);
}
.auth-hint{
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--divider);
  font-size: 13px;
}

.label{ display:block; margin-top: .8rem; font-weight: 650; color: var(--muted); }
.input{
  width: 100%;
  padding: 12px 12px;
  margin-top: .35rem;
  border-radius: 14px;
  border: 1px solid var(--divider);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}
.input:focus{
  border-color: rgba(217,49,74,.55);
  box-shadow: 0 0 0 4px var(--focus);
}

/* Buttons: NO gradients */
.btn{
  background: var(--brand);
  border: 1px solid var(--brand);
  color: #ffffff;
  font-weight: 750;
  padding: 11px 14px;
  border-radius: 14px;
  cursor: pointer;
}
.btn:hover{ filter: brightness(.96); }
.btn:active{ filter: brightness(.93); }
.btn:disabled{ opacity:.55; cursor:not-allowed; filter:none; }

/* Secondary buttons (no gradients) */
.btn-outline{
  background: transparent;
  border: 1px solid var(--divider);
  color: var(--text);
}
.btn-outline:hover{ filter: none; background: rgba(255,255,255,.04); }

.btn-danger{
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.error{ margin-top: 12px; color: var(--danger); }

.badge{
  display:inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(217,49,74,.14);
  border: 1px solid rgba(217,49,74,.22);
  color: var(--text);
  font-size: 12px;
}

/* Contact page helpers */
.page-head{ margin: 6px 0 14px; }

/* Quick actions (chips) */
.contact-quick{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.chip{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--divider);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-weight: 750;
  text-decoration:none;
  user-select:none;
}
html[data-theme="light"] .chip{ background: rgba(27,27,29,.03); }
.chip-ic{
  width: 28px; height: 28px;
  border-radius: 999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border: 1px solid rgba(217,49,74,.20);
  background: rgba(217,49,74,.10);
  color: var(--brand);
  flex: 0 0 auto;
}
.chip-ic svg{
  width: 14px !important;
  height: 14px !important;
  max-width: 14px;
  max-height: 14px;
  display:block;
}

/* Contact lines */
.contact-block{
  border: 1px solid var(--divider);
  border-radius: 18px;
  overflow:hidden;
}
.contact-line{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,.02);
}
html[data-theme="light"] .contact-line{ background: rgba(27,27,29,.02); }
.contact-line + .contact-line{ border-top: 1px solid var(--divider); }
.cl-label{ color: var(--muted-2); font-weight: 750; }
.cl-value{ color: var(--text); font-weight: 850; text-decoration:none; }
.cl-value:hover{ color: var(--brand); }

/* Opening hours - compact */
.openings2{
  margin-top: 14px;
  border-radius: 18px;
  border: 1px solid rgba(217,49,74,.22);
  background: rgba(217,49,74,.08);
  padding: 14px;
}
.openings2-title{ font-size: 16px; font-weight: 900; letter-spacing: -0.01em; }
.openings2-sub{ margin-top: 2px; color: var(--muted-2); font-weight: 750; }
.openings2-grid{ margin-top: 12px; display:grid; gap: 10px; }
.og-row{ display:flex; justify-content:space-between; gap: 10px; }
.og-day{ color: var(--text); font-weight: 850; }
.og-time{ color: var(--text); font-weight: 750; }

.btn-wide{ display:block; text-align:center; width: 100%; }

.map-wrap{ width: 100%; }
.map-img{ width: 100%; height: auto; display:block; }

/* Feed */
.feed{ display:grid; gap: 14px; }
.feed-card{
  overflow:hidden;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--divider);
}
.feed-hero{
  width: 100%;
  aspect-ratio: 16/11;
  background: var(--surface-2);
  display:flex; align-items:center; justify-content:center;
  color: var(--muted-2);
  font-weight: 750;
  border-bottom: 1px solid var(--divider);
}
.feed-body{ padding: 14px; }
.feed-date{ color: var(--brand); font-weight: 750; margin-bottom: 6px; }
.feed-title{ font-size: 22px; font-weight: 750; margin: 0 0 10px; letter-spacing:-0.01em; }
.feed-meta{
  display:flex; align-items:center; justify-content:space-between;
  color: var(--muted-2);
  gap: 10px;
}
.avatar{
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(217,49,74,.90);
  display:inline-flex; align-items:center; justify-content:center;
  color: #ffffff;
  font-weight: 900;
}

/* Bottom nav */
.bottom-nav{
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--nav-bg);
  border-top: 1px solid var(--divider);
  backdrop-filter: blur(14px);
}
.bottom-nav-inner{
  max-width: 980px;
  margin: 0 auto;
  display:flex;
  justify-content:space-around;
  gap: 2px;
  padding: 10px 10px;
  height: var(--nav-h);
}
.bn-item{
  flex: 1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 6px;
  padding: 8px 6px;
  border-radius: 14px;
  color: var(--muted-2);
}
.bn-item .bn-icon{ width: 22px; height: 22px; display:block; }
.bn-item .bn-label{ font-size: 12px; }
.bn-item.active{
  color: var(--brand);
  background: rgba(217,49,74,.12);
  border: 1px solid rgba(217,49,74,.22);
}

/* Light theme overrides */
html[data-theme="light"]{
  --bg: #ffffff;
  --surface: #f6f6f7;
  --surface-2: #ffffff;
  --text: rgba(27,27,29,.96);
  --muted: rgba(27,27,29,.70);
  --muted-2: rgba(27,27,29,.50);

  --card-border: rgba(27,27,29,.12);
  --shadow: 0 10px 22px rgba(0,0,0,.10);

  --appbar-bg: rgba(255,255,255,.88);
  --nav-bg: rgba(255,255,255,.92);
  --divider: rgba(27,27,29,.10);
  --focus: rgba(217,49,74,.18);
}

html[data-theme="light"] .card{ background: var(--surface); }
html[data-theme="light"] .input{ background: #ffffff; }

/* Contact page (v3) */
.contact-grid{
  display:grid;
  gap: 14px;
}
@media (min-width: 980px){
  .contact-grid{ grid-template-columns: 1fr 1.2fr; align-items: start; }
}

.card-title-row{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 12px; }

/* Icon action card */
.icon-actions{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.icon-action{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 10px;
  padding: 14px 12px;
  border-radius: 18px;
  border: 1px solid var(--divider);
  background: rgba(255,255,255,.03);
  text-decoration:none;
  color: var(--text);
  font-weight: 850;
  user-select:none;
}
html[data-theme="light"] .icon-action{ background: rgba(27,27,29,.02); }
.icon-action:hover{ border-color: rgba(217,49,74,.35); }

.ia-ic{
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display:flex;
  align-items:center;
  justify-content:center;
  border: 1px solid rgba(217,49,74,.20);
  background: rgba(217,49,74,.10);
  color: var(--brand);
}
.ia-ic svg{ width: 18px !important; height: 18px !important; display:block; }
.ia-text{ font-size: 14px; letter-spacing: -0.01em; }

/* Key/Value block */
.kv{
  border: 1px solid var(--divider);
  border-radius: 18px;
  overflow:hidden;
}
.kv-row{
  display:grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,.02);
}
html[data-theme="light"] .kv-row{ background: rgba(27,27,29,.02); }
.kv-row + .kv-row{ border-top: 1px solid var(--divider); }
.kv-k{ color: var(--muted-2); font-weight: 800; }
.kv-v{ font-weight: 850; }
.kv-v a{ color: var(--text); text-decoration:none; }
.kv-v a:hover{ color: var(--brand); }

.divider{ height:1px; background: var(--divider); width:100%; }

/* Opening hours (clean card inside) */
.openings-card{
  border-radius: 18px;
  border: 1px solid rgba(217,49,74,.22);
  background: rgba(217,49,74,.08);
  padding: 14px;
}
.openings-title{ font-size: 16px; font-weight: 900; letter-spacing: -0.01em; }
.openings-sub{ margin-top: 2px; color: var(--muted-2); font-weight: 750; }
.openings-grid{ margin-top: 12px; display:grid; gap: 10px; }
.openings-row{ display:flex; justify-content:space-between; gap: 10px; }
.openings-day{ color: var(--text); font-weight: 850; }
.openings-time{ color: var(--text); font-weight: 750; }

/* App loading screen (index.html) */
.app-loading{
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  padding: 24px;
}

.app-loading-spinner{
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 3px solid var(--divider);
  border-top-color: var(--brand);
  animation: appSpin .9s linear infinite;
}

.app-loading-text{
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--text);
}

@keyframes appSpin{
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce){
  .app-loading-spinner{ animation: none; }
}

.validation-message{
  display:block;
  margin-top: 6px;
  color: var(--danger);
  font-size: 13px;
}


.password-hints {
  margin: 8px 0 14px 0;
  font-size: .95rem;
}

.password-hints ul {
  margin: 6px 0 0 18px;
  padding: 0;
}

.error-list {
  margin: 0;
  padding-left: 18px;
}

/* Documents */
.docs-layout{
  display:grid;
  gap:14px;
}
@media (min-width: 960px){
  .docs-layout{ grid-template-columns: 320px minmax(0,1fr); align-items:start; }
}
.docs-sidebar,
.docs-list-card,
.docs-preview-card,
.docs-loading-card,
.docs-empty-card{ min-height: 120px; }
.docs-sidebar-text{ margin:0 0 14px; }
.docs-category-list{ display:grid; gap:10px; }
.docs-category-button{
  width:100%;
  text-align:left;
  border:1px solid var(--divider);
  border-radius:16px;
  padding:14px;
  background:var(--surface-2);
  color:var(--text);
  cursor:pointer;
}
.docs-category-button.active{
  border-color: rgba(217,49,74,.45);
  box-shadow: 0 0 0 4px var(--focus);
}
.docs-category-topline{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  font-weight:800;
}
.docs-category-count{
  min-width:30px;
  text-align:center;
  padding:3px 8px;
  border-radius:999px;
  background:rgba(255,255,255,.06);
  font-size:12px;
}
.docs-category-subline{
  margin-top:6px;
  color:var(--muted);
  font-size:14px;
}
.docs-main{ display:grid; gap:14px; }
.docs-list-header,
.docs-preview-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.docs-document-list{ display:grid; gap:10px; margin-top:14px; }
.docs-document-item{
  width:100%;
  text-align:left;
  border:1px solid var(--divider);
  border-radius:16px;
  padding:14px;
  background:var(--surface-2);
  color:var(--text);
  cursor:pointer;
}
.docs-document-item.selected{
  border-color: rgba(217,49,74,.45);
  background: rgba(217,49,74,.08);
}
.docs-document-title{ font-weight:800; }
.docs-document-subtitle{ color:var(--muted); margin-top:4px; font-size:14px; word-break:break-word; }
.docs-document-facts{
  margin-top:8px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  color:var(--muted-2);
  font-size:12px;
}
.docs-preview-actions{ display:flex; gap:10px; flex-wrap:wrap; }
.docs-detail-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap:10px;
  margin:14px 0;
}
.docs-detail-item{
  border:1px solid var(--divider);
  border-radius:14px;
  padding:12px;
  background:var(--surface-2);
}
.docs-detail-label{ color:var(--muted-2); font-size:12px; margin-bottom:4px; }
.docs-detail-value{ font-weight:700; word-break:break-word; }
.docs-pdf-frame{
  width:100%;
  min-height:72vh;
  border:1px solid var(--divider);
  border-radius:16px;
  background:#fff;
}
.docs-empty-state{
  border:1px dashed var(--divider);
  border-radius:16px;
  padding:18px;
  color:var(--muted);
  background:rgba(255,255,255,.02);
}
