:root {
  --accent: #0f766e;
  --bg: #f3f5f4;
  --bg-grad: color-mix(in srgb, var(--accent) 14%, var(--bg));
  --card: #ffffff;
  --card-hover: #fafbfb;
  --text: #16201e;
  --muted: #5f6b69;
  --border: #e2e7e5;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.05);
  --shadow-hover: 0 2px 4px rgb(0 0 0 / 0.06), 0 10px 28px rgb(0 0 0 / 0.1);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1413;
    --bg-grad: color-mix(in srgb, var(--accent) 22%, var(--bg));
    --card: #182020;
    --card-hover: #1d2726;
    --text: #e7eeec;
    --muted: #93a19e;
    --border: #26302f;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-hover: 0 8px 24px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--bg-grad), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 28px 40px;
}

.muted { color: var(--muted); font-weight: 400; }

/* --- Kopf ------------------------------------------------------------------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 1.05rem;
}

.brand img { height: 36px; max-width: 200px; object-fit: contain; }

.admin-link {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--muted);
  opacity: 0.5;
  transition: opacity 0.15s, background 0.15s;
}
.admin-link:hover { opacity: 1; background: var(--card); }

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 28px 0 24px;
  flex-wrap: wrap;
}

.greeting { font-size: 1.15rem; color: var(--muted); margin-bottom: 2px; }

.clock {
  font-size: clamp(3rem, 6vw, 4.5rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.date { margin-top: 8px; color: var(--muted); font-size: 1.05rem; }

.weather-now {
  display: flex;
  align-items: center;
  gap: 14px;
}
.weather-now .wi { width: 64px; height: 64px; }
.weather-now .temp { font-size: 2.6rem; font-weight: 300; line-height: 1; }
.weather-now .desc { color: var(--muted); font-size: 0.95rem; margin-top: 4px; }

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

.search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  height: 54px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  color: var(--muted);
  margin-bottom: 20px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 1.05rem;
  color: var(--text);
  min-width: 0;
}
.search-hint { font-size: 0.85rem; white-space: nowrap; }

/* --- Hinweis ------------------------------------------------------------------ */

.announcement {
  --tone: var(--accent);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 18px;
  margin-bottom: 24px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--tone) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--tone) 30%, transparent);
  line-height: 1.5;
  white-space: pre-line;
}
.announcement.warning { --tone: #d97706; }
.announcement.success { --tone: #16a34a; }
.announcement .dot {
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--tone);
}

/* --- Layout ------------------------------------------------------------------ */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
}
.layout.no-side { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .page { padding: 16px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .weather-now { display: none; }
}

/* --- Kacheln ------------------------------------------------------------------ */

.group + .group { margin-top: 28px; }

.group h2, .card h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 12px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.tile {
  --tile: #475569;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  min-height: 132px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s;
}
.tile::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--tile);
  opacity: 0.85;
}
.tile:hover, .tile:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--tile) 45%, var(--border));
  background: var(--card-hover);
  outline: none;
}
.tile.match { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.tile.dim { opacity: 0.3; }

.tile-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--tile) 14%, transparent);
  color: var(--tile);
  font-size: 1.5rem;
  font-weight: 700;
  overflow: hidden;
}
.tile-icon img { width: 30px; height: 30px; object-fit: contain; }

.tile-title { font-weight: 600; font-size: 1.02rem; }
.tile-desc { color: var(--muted); font-size: 0.87rem; margin-top: 3px; line-height: 1.35; }

.tile-ext {
  position: absolute;
  top: 14px;
  right: 14px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s;
}
.tile:hover .tile-ext { opacity: 0.8; }

.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
}

/* --- Seitenleiste ------------------------------------------------------------- */

.side { display: flex; flex-direction: column; gap: 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.forecast {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  text-align: center;
}
.forecast .day { padding: 6px 0; border-radius: 10px; }
.forecast .day:first-child { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.forecast .dname { font-size: 0.82rem; font-weight: 600; }
.forecast .wi { width: 34px; height: 34px; margin: 6px auto; display: block; }
.forecast .max { font-weight: 600; }
.forecast .min { color: var(--muted); font-size: 0.88rem; }
.forecast .rain { font-size: 0.75rem; color: #3b82f6; margin-top: 2px; min-height: 1em; }

.weather-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

.news-list { list-style: none; margin: 0; padding: 0; }
.news-list li + li { border-top: 1px solid var(--border); }
.news-list a {
  display: block;
  padding: 11px 0;
  text-decoration: none;
}
.news-list a:hover .news-title { color: var(--accent); }
.news-title {
  font-weight: 500;
  line-height: 1.35;
  font-size: 0.95rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-meta { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.news-meta .src { color: var(--accent); font-weight: 600; }

.skeleton {
  height: 14px;
  border-radius: 6px;
  margin: 12px 0;
  background: linear-gradient(90deg, var(--border), var(--card-hover), var(--border));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.footer {
  margin-top: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

/* --- Wetter-Icons --------------------------------------------------------------- */

.wi .sun { fill: #f59e0b; }
.wi .moon { fill: #cbd5e1; }
.wi .cloud { fill: #cbd5e1; }
.wi .cloud-dark { fill: #94a3b8; }
.wi .drop { stroke: #3b82f6; stroke-width: 2.5; stroke-linecap: round; fill: none; }
.wi .flake { fill: #7dd3fc; }
.wi .bolt { fill: #facc15; }
.wi .fog { stroke: #94a3b8; stroke-width: 3; stroke-linecap: round; }
@media (prefers-color-scheme: dark) {
  .wi .cloud { fill: #64748b; }
  .wi .cloud-dark { fill: #475569; }
}
