/* PocketWatch — iOS / macOS design language */
:root {
  --bg: #f2f2f7;                    /* iOS grouped background */
  --card: #ffffff;
  --fill: rgba(120, 120, 128, 0.12); /* iOS system fill */
  --fill-strong: rgba(120, 120, 128, 0.2);
  --text: #1c1c1e;                  /* iOS label */
  --text2: #8e8e93;                 /* iOS secondaryLabel */
  --sep: rgba(60, 60, 67, 0.18);
  --accent: #007aff;                /* iOS blue */
  --accent-press: #0062cc;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --radius: 16px;
  --radius-s: 12px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
        Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 680px; margin: 0 auto; padding: 8px 16px 48px; }
a { color: var(--accent); text-decoration: none; }
a:hover { opacity: .8; }
h1 { font-size: 30px; font-weight: 700; letter-spacing: -.5px; margin: 14px 0 6px; }
h2 { font-size: 19px; font-weight: 650; letter-spacing: -.2px; margin: 2px 0 10px; }
.small { font-size: 13px; font-weight: 400; }
.muted { color: var(--text2); }

/* ---------- top bar (iOS translucent) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: rgba(242, 242, 247, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--sep);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 650; font-size: 17px; }
.app-icon {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: linear-gradient(180deg, #3fa2ff, var(--accent));
  display: grid; place-items: center; font-size: 16px;
  box-shadow: 0 1px 2px rgba(0, 122, 255, .35);
}
.topbar nav { display: flex; gap: 18px; font-size: 15px; }

/* ---------- cards (iOS grouped list) ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin: 12px 0;
  box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.04);
}
.card summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 6px; }
.card summary::-webkit-details-marker { display: none; }
.card summary::before { content: "􀆏"; visibility: hidden; width: 14px; }
details[open] > summary::before { content: "􀆏"; visibility: hidden; }
.add-card summary, .admin-card summary { color: var(--accent); }
.card > p { margin: 8px 0; }

/* ---------- page head ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.head-actions { display: flex; gap: 10px; align-items: center; }
.badge {
  background: var(--accent); color: #fff; border-radius: 999px;
  padding: 3px 12px; font-weight: 700; font-size: 13px;
}
.badge-link:hover { opacity: 1; filter: brightness(1.08); }

/* ---------- "Was ist neu?" ---------- */
.whatsnew { border: 1px solid rgba(0, 122, 255, .25); }
.news-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; padding: 11px 0; border-bottom: 0.5px solid var(--sep);
}
.news-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.steps { padding-left: 20px; display: grid; gap: 10px; }
.steps strong { font-weight: 650; }
.welcome code {
  background: var(--fill); padding: 2px 8px; border-radius: 7px; font-size: 14px;
}
.list-hint { margin: 2px 6px 10px; font-size: 13px; }

/* ---------- watch rows ---------- */
.watch { padding: 14px 16px; }
.watch.unseen { border-left: 4px solid var(--accent); }
.watch.paused { opacity: .5; }
.watch-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.watch-title { font-weight: 600; font-size: 17px; color: var(--text); letter-spacing: -.2px; }
.meta {
  color: var(--text2); font-size: 13px; margin-top: 5px;
  display: flex; flex-wrap: wrap; gap: 5px 8px;
}
.meta.big { font-size: 15px; flex-direction: column; gap: 4px; }
.err { color: var(--orange); font-weight: 500; }
.chg { color: #248a3d; font-weight: 500; }
.tag {
  background: var(--fill); border-radius: 999px; padding: 2px 10px;
  font-size: 12px; color: var(--text2);
}
.dot {
  display: inline-block; width: 9px; height: 9px; background: var(--accent);
  border-radius: 50%; margin-right: 3px; animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- buttons ---------- */
.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.news-row .actions { margin-top: 0; }
.btn {
  -webkit-appearance: none; appearance: none; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 600;
  border-radius: var(--radius-s); padding: 10px 16px; font-size: 15px;
  font-family: inherit; transition: filter .12s ease, transform .05s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); filter: brightness(.95); }
.btn-small { padding: 7px 13px; font-size: 14px; border-radius: 10px; }
.btn-ghost { background: var(--fill); color: var(--accent); }
.btn-ghost:hover { background: var(--fill-strong); }
.btn-danger { background: #fff; color: var(--red); box-shadow: inset 0 0 0 1.5px rgba(255,59,48,.55); }
.btn-danger:hover { background: rgba(255,59,48,.06); }
.btn-wide { width: 100%; margin-top: 8px; }

/* ---------- forms ---------- */
form.grid-form { display: grid; gap: 12px; margin-top: 14px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text2); }
input, select {
  -webkit-appearance: none; appearance: none; width: 100%;
  background: var(--fill); border: none; color: var(--text);
  border-radius: var(--radius-s); padding: 12px 13px; font-size: 16px;
  font-family: inherit;
}
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%238e8e93' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
input:focus, select:focus { outline: 3px solid rgba(0,122,255,.35); background: #fff; }
input::placeholder { color: rgba(60,60,67,.35); }

/* ---------- flash ---------- */
.flash { border-radius: var(--radius-s); padding: 12px 15px; margin: 12px 0; font-size: 15px; font-weight: 500; }
.flash.ok { background: rgba(52,199,89,.14); color: #1e7e34; }
.flash.error { background: rgba(255,59,48,.12); color: #c41e17; }

/* ---------- login ---------- */
.login-card {
  max-width: 380px; margin: 7vh auto 0; background: var(--card);
  padding: 30px 24px; border-radius: 22px; text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.06), 0 16px 40px rgba(0,0,0,.07);
}
.login-card .app-icon { width: 74px; height: 74px; border-radius: 18px; font-size: 38px; margin: 0 auto 14px; box-shadow: 0 6px 18px rgba(0,122,255,.35); }
.login-card h1 { font-size: 25px; margin: 0 0 2px; }
.login-card form { display: grid; gap: 12px; margin-top: 20px; text-align: left; }

/* ---------- lists / rows ---------- */
.snap-row, .user-row {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 8px; padding: 11px 0; border-bottom: 0.5px solid var(--sep);
}
.snap-row:last-child, .user-row:last-child { border-bottom: 0; }
.uname { font-weight: 600; }
.danger-zone summary { color: var(--red); }
.empty { text-align: center; margin-top: 32px; }

/* ---------- diff ---------- */
.diff { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; overflow-x: auto; line-height: 1.6; }
.diff .eq { color: var(--text2); }
.diff .del { background: rgba(255,59,48,.1); color: #c41e17; border-radius: 5px; padding: 0 5px; }
.diff .ins { background: rgba(52,199,89,.14); color: #1e7e34; border-radius: 5px; padding: 0 5px; }
.raw {
  white-space: pre-wrap; word-break: break-word; background: var(--bg);
  padding: 13px; border-radius: var(--radius-s); max-height: 60vh; overflow: auto;
  font-size: 13px;
}
.watch-url { word-break: break-all; margin: 0 0 10px; font-size: 14px; }

/* ---------- footer ---------- */
.foot { text-align: center; color: var(--text2); font-size: 12px; padding: 26px; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000; --card: #1c1c1e; --fill: rgba(120,120,128,.24); --fill-strong: rgba(120,120,128,.36);
    --text: #f2f2f7; --text2: #98989f; --sep: rgba(84,84,88,.6);
  }
  .topbar { background: rgba(20,20,22,.82); }
  .btn-danger { background: transparent; }
  input:focus, select:focus { background: var(--card); }
  .login-card { background: var(--card); }
}

/* ---------- iOS extras (sheet, loading, safe-area) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.35);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .2s ease;
}
.sheet-backdrop.open { opacity: 1; }
.sheet {
  width: min(420px, calc(100% - 16px));
  margin-bottom: max(10px, env(safe-area-inset-bottom));
  color: #1c1c1e;                     /* sheet is always light, like iOS */
  background: rgba(248, 248, 250, .97);
  border-radius: 16px; padding: 18px;
  display: grid; gap: 10px;
  transform: translateY(24px); transition: transform .22s ease;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.sheet-backdrop.open .sheet { transform: translateY(0); }
.sheet-msg { margin: 0 0 4px; text-align: center; font-size: 15px; font-weight: 600; color: #1c1c1e; }
.sheet .btn-ghost { background: rgba(120,120,128,.16); color: #007aff; }
.btn-sheet-danger { background: #fff; color: var(--red); box-shadow: inset 0 0 0 1.5px rgba(255,59,48,.55); }
.btn.is-loading { opacity: .55; pointer-events: none; }
.btn.is-loading::after {
  content: ""; display: inline-block; width: 12px; height: 12px;
  margin-left: 8px; vertical-align: -2px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@supports (padding: max(0px)) {
  body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .topbar { padding-top: max(12px, env(safe-area-inset-top)); }
}

/* ---------- control center ---------- */
.link-box {
  background: var(--fill); border-radius: var(--radius-s);
  padding: 14px; font-size: 15px; word-break: break-all;
}
.link-box strong { color: var(--accent); font-weight: 650; }
/* ---------- wizard (normalo flow) ---------- */
.wizard-steps {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  font-size: 13px;
}
.wizard-steps .step {
  padding: 5px 12px; border-radius: 999px;
  background: var(--fill); color: var(--text-2);
}
.wizard-steps .step.done { background: rgba(52,199,89,.15); color: #248a3d; }
.wizard-steps .step.current { background: var(--accent); color: #fff; font-weight: 600; }
.wizard-steps .step-sep { color: var(--text-2); }

.url-row { display: flex; gap: 10px; }
.url-row input { flex: 1; }
@media (max-width: 560px) { .url-row { flex-direction: column; } }

.focus-card {
  display: flex; gap: 16px; align-items: flex-start;
  border: 2px solid var(--accent);
}
.focus-icon { font-size: 40px; line-height: 1; }
.focus-body { flex: 1; }
.focus-headline { font-weight: 700; font-size: 17px; }
.focus-value {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size: 26px; font-weight: 700; color: var(--accent);
  margin: 6px 0 4px;
}

.interval-cards {
  border: none; padding: 0; margin: 16px 0 4px;
  display: grid; gap: 10px;
}
.interval-cards legend {
  font-weight: 600; padding: 0; margin-bottom: 10px;
  font-size: 15px;
}
.radio-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius-m, 14px);
  background: var(--fill); cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .15s, transform .1s;
}
.radio-card:hover { transform: scale(1.01); }
.radio-card input { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
.radio-card:has(input:checked) { border-color: var(--accent); background: rgba(0,122,255,.08); }
.rc-icon { font-size: 24px; }
.rc-text { display: flex; flex-direction: column; gap: 2px; }
.rc-text small { color: var(--text-2); font-size: 13px; }

.wizard-form .actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.wizard-form .btn-ghost { margin-left: 0; }

.status-card .status-line { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.status-card .big-ok { color: #248a3d; }
.status-card .big-warn { color: #c93400; }
.hint-card { border-left: 4px solid var(--accent); }

.btn-quiet { color: var(--text-2); }
.btn-quiet:hover { color: var(--danger, #ff3b30); }
