/* Toolbox — Layout & Komponenten. Farben ausschließlich über die
   Depot-Tokens (design/tokens.css). */

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; -webkit-font-smoothing: antialiased; }
body { display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- Menüleiste ---------- */
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.brand {
  font-family: var(--font-display); font-weight: 800; font-size: 19px;
  letter-spacing: -0.02em; color: inherit; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.brand svg { width: 22px; height: 22px; }
.crumb { color: var(--muted-foreground); font-size: 14px; }
.crumb::before { content: '/'; margin: 0 8px 0 2px; opacity: .5; }
.topbar-spacer { flex: 1; }
.topnav { display: flex; gap: 2px; }
.topnav a {
  color: var(--muted-foreground); text-decoration: none; font-size: 13.5px; font-weight: 600;
  padding: 6px 10px; border-radius: var(--radius-sm);
}
.topnav a:hover { background: var(--muted); color: var(--foreground); }
.topnav a[aria-current] { color: var(--foreground); background: var(--muted); }
@media (max-width: 640px) { .topnav { display: none; } }

.icon-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius-sm); background: transparent; color: var(--foreground);
  cursor: pointer; padding: 0;
}
.icon-btn:hover { background: color-mix(in oklab, var(--foreground) 8%, transparent); }
.icon-btn svg { width: 17px; height: 17px; }
#btn-theme .ic-sun { display: none; }
[data-theme="dark"] #btn-theme .ic-sun { display: block; }
[data-theme="dark"] #btn-theme .ic-moon { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 15px; border-radius: var(--radius);
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; text-decoration: none; white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover:not(:disabled) { background: color-mix(in oklab, var(--primary) 88%, var(--foreground)); }
.btn-outline { background: var(--card); border-color: var(--border); color: var(--foreground); }
.btn-outline:hover:not(:disabled) { background: var(--muted); }
.btn-destructive { background: color-mix(in oklab, var(--destructive) 12%, transparent); color: var(--destructive); }
.btn-destructive:hover:not(:disabled) { background: color-mix(in oklab, var(--destructive) 20%, transparent); }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14.5px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Seite ---------- */
.page { width: 100%; max-width: 860px; margin: 0 auto; padding: 32px 20px 64px; flex: 1; }
.page-narrow { max-width: 620px; }
h1 { font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: -.02em; margin: 0 0 6px; line-height: 1.15; }
h2 { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -.015em; margin: 0 0 12px; }
.lead { color: var(--muted-foreground); font-size: 15px; margin: 0 0 24px; }
.hint { color: var(--muted-foreground); font-size: 13px; line-height: 1.5; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }

/* ---------- Kacheln (Startseite) ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.tile {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow-soft);
  transition: transform .12s ease, border-color .12s ease;
}
.tile:hover { transform: translateY(-2px); border-color: color-mix(in oklab, var(--primary) 45%, var(--border)); color: inherit; }
.tile-icon {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px;
  background: var(--secondary); color: var(--secondary-foreground);
}
.tile-icon.peach { background: var(--accent); color: var(--accent-foreground); }
.tile-icon.sky { background: color-mix(in oklab, var(--info) 16%, transparent); color: var(--info); }
.tile-icon svg { width: 22px; height: 22px; }
.tile h3 { font-family: var(--font-display); font-size: 17px; font-weight: 700; margin: 0 0 6px; }
.tile p { margin: 0; color: var(--muted-foreground); font-size: 13.5px; line-height: 1.5; }

/* ---------- Karte / Formular ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-soft);
}
.card + .card { margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; }
.field .hint { margin-top: -2px; }
input[type=text], input[type=url], input[type=password], input[type=number], textarea, select {
  font: inherit; font-size: 14px; color: var(--foreground);
  background: var(--background); border: 1px solid var(--input); border-radius: var(--radius);
  height: 38px; padding: 0 12px; width: 100%;
}
textarea { height: auto; min-height: 120px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
textarea.mono, input.mono { font-family: var(--font-mono); font-size: 13.5px; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 25%, transparent);
}
input[type=number] { width: 110px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row .field { flex: 1 1 200px; margin-bottom: 0; }
.field-inline { display: flex; align-items: center; gap: 8px; }

/* Segment-Auswahl */
.segments { display: inline-flex; padding: 3px; background: var(--muted); border-radius: var(--radius); gap: 2px; }
.segments label {
  padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--muted-foreground);
}
.segments input { position: absolute; opacity: 0; pointer-events: none; }
.segments label:has(input:checked) { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-soft); }

.range { display: flex; align-items: center; gap: 12px; }
.range input[type=range] { flex: 1; accent-color: var(--primary); }
.range output { min-width: 3.5em; text-align: right; }

/* ---------- Ergebnis / Alerts ---------- */
.result-link {
  display: flex; align-items: center; gap: 8px;
  background: var(--code-bg); border: 1px solid var(--code-border); border-radius: var(--radius);
  padding: 8px 8px 8px 12px;
}
.result-link .url { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius); font-size: 13.5px; line-height: 1.5;
  border: 1px solid; margin: 0 0 16px;
}
.alert svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.alert-info { background: color-mix(in oklab, var(--info) 10%, transparent); border-color: color-mix(in oklab, var(--info) 35%, transparent); }
.alert-warn { background: color-mix(in oklab, var(--warning) 14%, transparent); border-color: color-mix(in oklab, var(--warning) 45%, transparent); }
.alert-ok { background: color-mix(in oklab, var(--success) 12%, transparent); border-color: color-mix(in oklab, var(--success) 40%, transparent); }
.alert-err { background: color-mix(in oklab, var(--destructive) 10%, transparent); border-color: color-mix(in oklab, var(--destructive) 40%, transparent); color: var(--destructive); }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600;
  background: color-mix(in oklab, var(--success) 14%, transparent); color: var(--success);
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-warn { background: color-mix(in oklab, var(--warning) 18%, transparent); color: var(--accent-foreground); }

/* ---------- QR ---------- */
.qr-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
@media (max-width: 720px) { .qr-layout { grid-template-columns: 1fr; } }
.qr-preview {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; box-shadow: var(--shadow-soft); display: flex; flex-direction: column; gap: 12px; align-items: center;
  position: sticky; top: 72px;
}
.qr-canvas-wrap {
  background: #fff; border-radius: 12px; padding: 12px; width: 100%; aspect-ratio: 1; display: grid; place-items: center;
}
.qr-canvas-wrap canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.qr-meta { font-size: 12.5px; color: var(--muted-foreground); text-align: center; }
.qr-preview .btn-row { justify-content: center; }

/* ---------- Geheimnis anzeigen ---------- */
.secret-box {
  position: relative; background: var(--code-bg); border: 1px solid var(--code-border); border-radius: var(--radius);
  padding: 14px 16px; font-family: var(--font-mono); font-size: 14px; white-space: pre-wrap; word-break: break-word;
  min-height: 60px; line-height: 1.55;
}
.countdown { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 16px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-soft); opacity: 0; transition: opacity .18s, transform .18s; pointer-events: none; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer.foot { text-align: center; color: var(--muted-foreground); font-size: 12.5px; padding: 20px; }
footer.foot a { color: inherit; }
[hidden] { display: none !important; }
