/* kskskr base: gemeinsame App-Komponenten der Dienste (Formulare, Buttons,
   Shell, Listen, Statistiken). Setzt core.css voraus. */

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  transition: background 0.3s ease, color 0.3s ease;
}

a { color: var(--accent); font-weight: 500; text-decoration: none; }

a:hover { text-decoration: underline; }

.card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 32px 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin-bottom: 26px;
}

.brand-mark {
  width: 14px; height: 14px; border-radius: 5px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.brand-text { letter-spacing: -0.01em; }

h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 6px;
}

.sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

form { display: grid; gap: 16px; }

label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

input, textarea, select {
  font: inherit;
  padding: 11px 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }

input:hover:not(:disabled, :focus),
textarea:hover:not(:disabled, :focus),
select:hover:not(:disabled, :focus) {
  border-color: color-mix(in srgb, var(--border) 35%, var(--text-muted));
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input:disabled, textarea:disabled, select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--bg-alt);
}

input:user-invalid, textarea:user-invalid, select:user-invalid {
  border-color: var(--danger);
}

input:user-invalid:focus, textarea:user-invalid:focus, select:user-invalid:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 16%, transparent);
}

textarea { resize: vertical; min-height: 90px; line-height: 1.5; }

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3 5l4 4 4-4' fill='none' stroke='%238a8a94' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  cursor: pointer;
}

select:disabled { cursor: not-allowed; }

input[type="checkbox"], input[type="radio"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}

input[type="color"] {
  padding: 4px;
  height: 42px;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }

input[type="color"]::-webkit-color-swatch { border: none; border-radius: 7px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 22px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn:active { transform: translateY(1px); }

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }

.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }

.msg {
  margin: 2px 0 0;
  font-size: 0.85rem;
  min-height: 1.2em;
  color: var(--danger);
}

.msg.ok { color: var(--ok); }

.card-links {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.legal-links {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.legal-links a { color: var(--text-muted); text-decoration: underline; }

.legal-links a:hover { color: var(--accent); }

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  display: grid;
  place-items: center;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover { border-color: var(--accent); transform: rotate(-15deg); }

.note {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 22px;
}

body.shell {
  display: block;
  place-items: initial;
  padding: 0;
}

.shell-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.shell-header-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.shell-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin-bottom: 0;
}

.shell-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.shell-nav a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.shell-nav a:hover,
.shell-nav a[aria-current="page"] { color: var(--text); text-decoration: none; }

.shell-nav a[aria-current="page"] { color: var(--accent); }

.shell-nav .theme-toggle {
  position: static;
  width: 34px; height: 34px;
}

.shell-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.shell-head { margin-bottom: 32px; }

.shell-head h1 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.shell-head .sub { margin-bottom: 0; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px 28px;
}

.settings-card-wide { grid-column: 1 / -1; }

.settings-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.card-hint {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.settings-card form { display: grid; gap: 16px; }

.settings-card .btn { width: auto; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.btn-ghost {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

.btn-sm { padding: 7px 14px; font-size: 0.85rem; width: auto; }

.session-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 18px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.session-item:last-child { border-bottom: none; }

.session-info { display: flex; flex-direction: column; gap: 4px; }

.session-device { font-size: 0.92rem; font-weight: 600; }

.session-meta { font-size: 0.8rem; color: var(--text-muted); }

.session-empty { color: var(--text-muted); font-size: 0.9rem; padding: 10px 0; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}

.chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
  margin: 3px 6px 3px 0;
}

.chip-empty { color: var(--text-muted); font-size: 0.9rem; }

@media (max-width: 680px) {
  .settings-grid { grid-template-columns: 1fr; }
  .shell-header-inner { height: auto; padding: 14px 20px; flex-wrap: wrap; }
  .session-item,
  .link-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .link-actions { width: 100%; flex-wrap: wrap; }
  .link-target { max-width: 100%; }
}

.shortener-card {
  width: min(560px, 100%);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 32px 30px;
}

.shortener-card form { display: grid; gap: 16px; }

.shortener-card .row-2 { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }

.shortener-card .row-2 label { min-width: 0; }

.result-box {
  display: none;
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-alt);
  gap: 10px;
}

.result-box.is-visible { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

.result-box .result-url {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
  word-break: break-all;
}

.result-box .result-target {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
  color: var(--text-muted);
  word-break: break-all;
}

.link-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.link-item:last-child { border-bottom: none; }

.link-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.link-code { font-weight: 700; font-size: 1rem; color: var(--accent); }

.link-target {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 42ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-meta { font-size: 0.78rem; color: var(--text-muted); }

.link-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.link-clicks {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 999px;
}

.link-empty { color: var(--text-muted); font-size: 0.9rem; padding: 14px 0; }

.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stats-summary .stat dt {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stats-summary .stat dd {
  margin-top: 4px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px 18px;
  margin-bottom: 24px;
}

.chart-card h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; }

.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; }

.bar-chart .bar {
  flex: 1;
  min-width: 3px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

.bar-chart .bar:hover { opacity: 1; }

.chart-empty { color: var(--text-muted); font-size: 0.9rem; }

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.breakdown-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.breakdown-card h3 { font-size: 0.92rem; font-weight: 700; margin-bottom: 12px; }

.breakdown-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.breakdown-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.88rem; }

.breakdown-row .bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-alt);
  border-radius: 999px;
  margin: 0 10px;
  overflow: hidden;
}

.breakdown-row .bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }

.breakdown-row .count { font-weight: 600; color: var(--text-muted); flex-shrink: 0; }

.back-link { display: inline-block; margin-bottom: 18px; font-weight: 600; font-size: 0.9rem; }

.hero-mini { text-align: center; margin-bottom: 36px; }

.hero-eyebrow {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 12px;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin-bottom: 14px;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 46ch;
  margin: 0 auto;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 48px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 22px;
}

.feature-icon {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  margin-bottom: 14px;
  position: relative;
}

.feature-icon::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 4px;
  background: var(--accent);
}

.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }

.feature-card p { font-size: 0.9rem; color: var(--text-muted); }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 60px;
}

.footer-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-inner a { color: var(--text-muted); font-weight: 500; }

.footer-inner a:hover { color: var(--accent); }

/* Impressum / Datenschutz / Nutzungsbedingungen - auf jeder Seite erreichbar */
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }

.legal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  padding: 20px 0 4px;
  font-size: 0.8rem;
}
.legal-footer a { color: var(--text-muted); font-weight: 500; }
.legal-footer a:hover { color: var(--accent); }

/* Karten-Seiten (Login usw.) zentrieren per Grid: Karte mittig, Footer unten */
body:not(.shell):has(> .legal-footer) { grid-template-rows: 1fr auto; }

.shell > .legal-footer {
  max-width: 880px;
  margin: 40px auto 0;
  padding: 20px 24px 28px;
  border-top: 1px solid var(--border);
}

@media (max-width: 680px) {
  .feature-grid { grid-template-columns: 1fr; }
}
