/* mysafespace — Professionelles Dark-Theme
   Reduziert: dunkle Grautöne, eine dezente Akzentfarbe, klare Linien,
   keine Verläufe, keine Glüheffekte. */

:root {
  --bg: #101215;
  --bg-soft: #14171b;
  --surface: #191d22;
  --surface-2: #1f242b;
  --border: #2a3038;
  --border-strong: #3a414c;
  --text: #e3e6ea;
  --text-dim: #9aa3ad;
  --text-faint: #6b7480;
  --accent: #6ea3c8;
  --accent-dim: #4c7a9e;
  --danger: #d98a8a;
  --ok: #8fbf9f;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  font-size: 15.5px;
  line-height: 1.65;
  min-height: 100vh;
}

.container { max-width: 1040px; margin: 0 auto; padding: 0 1.5rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }

code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.05rem 0.4rem;
  border-radius: 5px;
  font-size: 0.86em;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

.icon { vertical-align: -0.18em; }

/* ---------- Header / Footer ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(16, 18, 21, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand:hover { text-decoration: none; color: var(--accent); }
.brand .icon { color: var(--accent); }

.main-nav { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.main-nav a { color: var(--text-dim); font-size: 0.95rem; }
.main-nav a:hover { color: var(--text); text-decoration: none; }
.main-nav a.active { color: var(--text); font-weight: 600; }

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 1.4rem 0 1.8rem;
  color: var(--text-faint);
  font-size: 0.88rem;
}
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-projects span { margin: 0 0.4rem; color: var(--border-strong); }

/* ---------- Basis-Blöcke ---------- */

main { padding-top: 2.8rem; padding-bottom: 2rem; }

.page-head { margin-bottom: 2rem; max-width: 720px; }
.page-head h1 { margin: 0 0 0.4rem; font-size: 1.7rem; }
.page-head p { color: var(--text-dim); margin: 0; }

.section-title {
  font-size: 1.15rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
  margin: 2.5rem 0 1.2rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.5rem;
}

/* ---------- Hero ---------- */

.hero { padding: 2.5rem 0 1.5rem; max-width: 780px; }
.hero h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); margin: 0 0 1rem; line-height: 1.3; }
.hero .muted { color: var(--text-dim); font-weight: 500; }
.hero-sub { color: var(--text-dim); margin: 0 0 1.8rem; max-width: 640px; }
.hero-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
  font-size: 0.92rem;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.btn:hover {
  text-decoration: none;
  border-color: var(--accent-dim);
  background: #232a33;
}

.btn-primary {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: #0e1114;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }

.btn-ghost { background: transparent; }
.btn-small { padding: 0.3rem 0.65rem; font-size: 0.84rem; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: rgba(217, 138, 138, 0.08); }
.btn-block { display: flex; justify-content: center; margin-top: 1rem; }

/* ---------- Projekt-Karten ---------- */

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.1rem;
  margin: 2rem 0 1rem;
}

.project-card {
  display: block;
  padding: 1.4rem 1.5rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease;
}
.project-card:hover { border-color: var(--border-strong); text-decoration: none; }

.card-head { display: flex; align-items: center; gap: 0.6rem; color: var(--accent); }
.card-head h2 { margin: 0; font-size: 1.15rem; color: var(--text); }
.project-card p { color: var(--text-dim); margin: 0.7rem 0 1rem; font-size: 0.94rem; }
.card-cta { color: var(--accent); font-size: 0.92rem; font-weight: 500; }

/* ---------- Projekte-Seite (/projekte) ---------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.1rem;
  margin: 1.6rem 0 1rem;
}
.project-grid .project-card h2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.project-grid .project-card h2 .badge { font-weight: 500; }
.project-summary { font-weight: 500; color: var(--text); }
.project-desc { color: var(--text-dim); font-size: 0.9rem; }
.progress { margin-top: 0.9rem; }
.progress-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 0.35rem;
}
.progress-track {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--accent, #6ea3c8);
  transition: width 0.4s ease;
}

.offline-note { max-width: 640px; margin: 0 auto; text-align: center; }
.offline-note p:last-child { margin-bottom: 0; }
.offline-note .btn { margin-top: 0.5rem; }

.admin-table .project-icon {
  display: inline-flex;
  vertical-align: -2px;
  margin-right: 0.3rem;
  color: var(--accent, #6ea3c8);
}

/* ---------- Grundsätze ---------- */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.1rem;
  margin-top: 1.2rem;
}
.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
}
.feature .icon { color: var(--accent); }
.feature h3 { margin: 0.6rem 0 0.3rem; font-size: 0.98rem; }
.feature p { color: var(--text-dim); font-size: 0.89rem; margin: 0; }

/* ---------- Aktuelle Apps ---------- */

.featured { margin: 2.5rem 0; }
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.1rem;
  margin-top: 1.2rem;
}
.featured-app {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 1.1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.featured-app:hover { border-color: var(--border-strong); text-decoration: none; }
.featured-text small { display: block; color: var(--text-faint); }

/* App-Monogramm statt Emoji: Kürzel in einer Kachel */
.app-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  overflow: hidden;
}
.app-glyph.big { width: 3.4rem; height: 3.4rem; font-size: 1.2rem; }

/* ---------- Store ---------- */

.platform-tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.platform-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  background: var(--surface);
  font-size: 0.9rem;
}
.platform-tab:hover { text-decoration: none; color: var(--text); border-color: var(--border-strong); }
.platform-tab.active {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--accent-dim);
  font-weight: 600;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.1rem;
}

.app-card {
  padding: 1.2rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}
.app-card:hover { border-color: var(--border-strong); }
.app-card-head { display: flex; align-items: center; gap: 0.8rem; }
.app-card-head h3 { margin: 0; font-size: 1.02rem; }
.app-card-head h3 a { color: var(--text); }
.app-version { color: var(--text-faint); font-size: 0.82rem; }
.app-tagline { color: var(--text-dim); font-size: 0.92rem; margin: 0.7rem 0 0.8rem; flex-grow: 1; }
.app-platforms { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.platform-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.76rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1rem 0.5rem;
  color: var(--text-faint);
  background: var(--bg-soft);
}
.app-card-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }

.badge-unpublished {
  margin-left: auto;
  font-size: 0.74rem;
  color: var(--danger);
  border: 1px solid rgba(217, 138, 138, 0.4);
  border-radius: 5px;
  padding: 0.08rem 0.5rem;
}

/* ---------- App-Detail ---------- */

.app-detail-head { display: flex; align-items: center; gap: 1.1rem; }
.app-detail-head .app-version { font-size: 0.95rem; margin-left: 0.4rem; }
.app-detail-body {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.2rem;
}
@media (max-width: 720px) { .app-detail-body { grid-template-columns: 1fr; } }

.app-detail-body h2 { margin-top: 0; font-size: 1.02rem; }

.download-table { width: 100%; border-collapse: collapse; }
.download-table td { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.download-table tr:last-child td { border-bottom: none; }
.dl-cell { text-align: right; }

/* ---------- Suche ---------- */

.search-head { text-align: center; margin-left: auto; margin-right: auto; }
.search-box-wrap { max-width: 620px; margin: 0 auto 2rem; }
.search-form { display: flex; gap: 0.55rem; }
.search-form input[type="search"] {
  flex: 1;
  padding: 0.65rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.98rem;
  outline: none;
}
.search-form input[type="search"]:focus { border-color: var(--accent-dim); }
.search-hint { color: var(--text-faint); font-size: 0.85rem; text-align: center; margin: 0.6rem 0 0; }

.search-results { max-width: 720px; margin: 0 auto; }

.result {
  padding: 0.95rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 0.8rem;
}
.result h3 { margin: 0 0 0.1rem; font-size: 1rem; }
.result h3 a { color: var(--accent); }
.result .result-url { color: var(--ok); font-size: 0.8rem; word-break: break-all; }
.result .result-snippet { color: var(--text-dim); font-size: 0.92rem; margin: 0.35rem 0 0; }

.result mark { background: rgba(110, 163, 200, 0.22); color: inherit; border-radius: 2px; padding: 0 1px; }
.result h3 a mark { color: var(--accent); }

/* ---------- Admin ---------- */

.admin-form {
  display: grid;
  gap: 0.3rem;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
}
.admin-form label { font-size: 0.86rem; color: var(--text-dim); margin-top: 0.6rem; }
.admin-form input, .admin-form textarea, .admin-form select {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 0.93rem;
  font-family: inherit;
}
.admin-form input:focus, .admin-form textarea:focus, .admin-form select:focus {
  outline: none;
  border-color: var(--accent-dim);
}
.admin-form .checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.9rem;
  color: var(--text);
}
.admin-form button[type="submit"] { margin-top: 1rem; justify-self: start; }

.login-form { margin: 0 auto 2rem; }

.platform-fieldset {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 1rem 1rem;
  margin-top: 0.8rem;
  display: grid;
  gap: 0.2rem;
}
.platform-fieldset legend { color: var(--text-dim); font-size: 0.86rem; padding: 0 0.4rem; }

.form-actions { display: flex; gap: 0.7rem; margin-top: 1rem; }
.form-actions a { align-self: center; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-value { font-size: 1.7rem; font-weight: 600; }
.stat-value.small { font-size: 0.92rem; line-height: 1.5; }
.stat-label { color: var(--text-faint); font-size: 0.83rem; }

.admin-panels {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 1.2rem;
  align-items: start;
}
@media (max-width: 860px) { .admin-panels { grid-template-columns: 1fr; } }

.admin-panel h2 { margin-top: 0; font-size: 1.02rem; }
.admin-panel h2:not(:first-child) { margin-top: 1.6rem; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th {
  text-align: left;
  color: var(--text-faint);
  font-weight: 600;
  border-bottom: 1px solid var(--border-strong);
  padding: 0.4rem 0.5rem;
}
.admin-table td { padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.pages-table td { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-message { color: var(--text-dim); }

.row-actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline; }
.inline-add { flex-direction: row; align-items: center; margin-top: 0.8rem; max-width: none; }
.inline-add input { flex: 1; }
.inline-add button { margin: 0 !important; white-space: nowrap; }

.badge {
  display: inline-block;
  font-size: 0.74rem;
  border-radius: 5px;
  padding: 0.06rem 0.5rem;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.badge-done { color: var(--ok); border-color: rgba(143, 191, 159, 0.4); }
.badge-error { color: var(--danger); border-color: rgba(217, 138, 138, 0.4); }
.badge-running { color: var(--accent); border-color: rgba(110, 163, 200, 0.4); }

.flash {
  border-radius: 6px;
  padding: 0.65rem 1rem;
  margin-bottom: 1.2rem;
  border: 1px solid;
  font-size: 0.92rem;
}
.flash-ok { border-color: rgba(143, 191, 159, 0.4); background: rgba(143, 191, 159, 0.07); }
.flash-error { border-color: rgba(217, 138, 138, 0.4); background: rgba(217, 138, 138, 0.07); }

.button-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.hint { color: var(--text-faint); font-size: 0.84rem; }

.subreq-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.subreq-bar {
  display: inline-block;
  width: 42px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.subreq-bar span { display: block; height: 100%; background: var(--ok, #3fb950); }

.external-head {
  margin: 0.4rem 0 0.9rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(110, 163, 200, 0.35);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--accent, #6ea3c8);
}
.subreq-chip.warn .subreq-bar span { background: #d29922; }
.subreq-chip.danger .subreq-bar span { background: var(--danger, #f85149); }
.sub-head {
  font-size: 0.95rem;
  margin: 1.4rem 0 0.4rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
}

.empty-state { color: var(--text-faint); font-style: italic; }
