:root {
  --bg: #f4f2ee;
  --card: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6b66;
  --line: #e2dfd8;
  --accent: #1f6f5c;
  --accent-text: #ffffff;
  --ok-bg: #e3f3ec;
  --err-bg: #fbe5e2;
  --err: #a3271b;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161715;
    --card: #222420;
    --text: #ecebe6;
    --muted: #a3a29b;
    --line: #34362f;
    --accent: #4fb596;
    --accent-text: #0e1a16;
    --ok-bg: #1d3a30;
    --err-bg: #4a221d;
    --err: #ff9b8e;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
main { max-width: 720px; margin: 0 auto; padding: 0 16px 32px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }

.top {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 720px; margin: 0 auto; padding: 14px 16px;
}
.brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.brand span { color: var(--accent); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.card.narrow { max-width: 360px; margin: 40px auto; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.muted { color: var(--muted); }

label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 14px; }
input[type=url], input[type=password], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px;
  font: inherit; font-weight: 400; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
textarea { resize: vertical; }
input[type=file] { font: inherit; max-width: 100%; }

button, .button {
  display: inline-block; padding: 10px 16px; font: inherit; font-weight: 600;
  color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; text-decoration: none;
}
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.danger { color: var(--err); }
button.link { background: none; border: none; padding: 0 4px; color: var(--accent); font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input[type=url] { flex: 1 1 220px; margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.card.actions { margin-top: 0; }

.flash { padding: 10px 12px; border-radius: 8px; margin: 0 0 14px; }
.flash.ok { background: var(--ok-bg); }
.flash.err { background: var(--err-bg); color: var(--err); }

.services { list-style: none; padding: 0; margin: 14px 0 0; display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.services li::before { content: "●"; margin-right: 4px; }
.services .on::before { color: var(--accent); }
.services .off { color: var(--muted); }
.services .off::before { color: var(--err); }

.items { list-style: none; padding: 0; margin: 0; }
.items li + li { border-top: 1px solid var(--line); }
.items a { display: flex; gap: 12px; align-items: center; padding: 10px 0; color: var(--text); text-decoration: none; }
.items img, .thumb-ph { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; flex: none; background: var(--line); }
.items .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.items .meta .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }

.status { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--line); white-space: nowrap; }
.s-ready, .s-posted { background: var(--ok-bg); }
.s-error { background: var(--err-bg); color: var(--err); }
.s-processing, .s-translated { background: var(--accent); color: var(--accent-text); }

.head { display: flex; gap: 14px; align-items: flex-start; }
.head img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; flex: none; }
.head p { margin: 0; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tile { position: relative; aspect-ratio: 1; }
.tile form, .tile a, .tile-btn { display: block; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 4px; overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: 12px; padding: 1px 6px; border-radius: 99px; }

video { width: 100%; max-height: 70vh; border-radius: 8px; background: #000; margin: 10px 0; }
progress { width: 100%; margin-top: 8px; }

.spinner {
  display: inline-block; width: 14px; height: 14px; vertical-align: -2px;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
