:root {
  --bg: #0f172a;
  --panel: #16233d;
  --panel-2: #1e2f4d;
  --line: #2a3b5c;
  --text: #e6edf7;
  --muted: #9fb0cc;
  --brand: #3b82f6;
  --brand-strong: #2f6df6;
  --ok: #22c55e;
  --err: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 96px;
}

header.app {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0 14px;
}
header.app img { width: 40px; height: 40px; }
header.app h1 { font-size: 1.15rem; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
header.app p { margin: 2px 0 0; font-size: 0.8rem; color: var(--muted); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); font-size: 0.85rem; }
.label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; display: block; }

button {
  font: inherit;
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease, opacity 0.15s ease;
}
button:active { transform: translateY(1px); }
button.primary { background: var(--brand-strong); color: #fff; font-weight: 700; width: 100%; padding: 15px; font-size: 1.02rem; }
button.ghost { background: transparent; border: 1px solid var(--line); }
button:disabled { opacity: 0.5; cursor: default; }

input[type="text"], textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
input[type="text"]:focus, textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
textarea { min-height: 96px; resize: vertical; }
.field { margin-bottom: 12px; }

.pill { font-size: 0.75rem; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.pill.ok { background: rgba(34,197,94,0.15); color: #86efac; }
.pill.warn { background: rgba(248,113,113,0.15); color: #fca5a5; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .badge {
  position: absolute; bottom: 4px; left: 4px;
  font-size: 0.62rem; padding: 1px 6px; border-radius: 6px;
  background: rgba(0,0,0,0.6); color: #fff;
}
.thumb.video .glyph { font-size: 1.6rem; }

details.settings summary { cursor: pointer; font-weight: 600; }
details.settings[open] { padding-bottom: 4px; }
.settings .inner { margin-top: 12px; }

.status { margin-top: 10px; font-size: 0.9rem; min-height: 1.2em; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

/* Toast — fixed at the top so confirmations are always visible. */
.toast {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 92%;
  z-index: 1000;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.toast.ok { border-color: rgba(34, 197, 94, 0.5); color: #86efac; }
.toast.err { border-color: rgba(248, 113, 113, 0.55); color: #fca5a5; }
.toast.hide { display: none; }

ul.progress { list-style: none; margin: 10px 0 0; padding: 0; font-size: 0.85rem; }
ul.progress li { padding: 4px 0; color: var(--muted); border-bottom: 1px dashed var(--line); }
ul.progress li:last-child { border-bottom: 0; }

a.link { color: var(--brand); text-decoration: none; font-weight: 600; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 24px 10px;
  font-size: 0.92rem;
  line-height: 1.5;
}
.empty strong { color: var(--text); }

.hide { display: none !important; }

.sticky-actions {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.sticky-actions .wrap-inner { max-width: 640px; margin: 0 auto; }
