:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #16181d; --muted: #6b7280; --line: #e3e6eb; --field: #ffffff;
  --accent: #d93025; --accent-ink: #ffffff; --accent-soft: #fdecea; --hover: #f0f2f5;
  --pos: #1e8e3e; --neu: #9aa0a6; --neg: #d93025; --warn: #b26a00; --ok: #1e8e3e;
  --radius: 14px; --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --card: #1a1d23; --text: #e8eaed; --muted: #9aa0a6; --line: #2c3038; --field: #14161b;
    --accent: #f28b82; --accent-ink: #1a1d23; --accent-soft: #3a2422; --hover: #22262e;
    --pos: #81c995; --neu: #6b7280; --neg: #f28b82; --warn: #fdd663; --ok: #81c995;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h3 { font-size: 15px; margin: 18px 0 8px; }
h4 { font-size: 15px; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.error { color: var(--neg); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hint { font-size: 13px; margin: 10px 0 0; }

.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M8 10h16v10H14l-4 4v-4H8z' fill='white'/%3E%3C/svg%3E") center/100% no-repeat; flex: none; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; display: grid; gap: 12px; text-align: center; justify-items: center; }
.login-card h1 { font-size: 20px; }
.login-card p { margin: 0; }
.login-card input, .login-card button { width: 100%; }

/* layout */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.wrap > *, .card, .tab { min-width: 0; }

/* fields and buttons */
.label { display: block; font-weight: 600; margin-bottom: 8px; }
textarea, input[type=text], input[type=search], input[type=password], input[type=number], select {
  background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none; min-width: 0;
}
textarea { width: 100%; resize: vertical; }
textarea:focus, input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
button { cursor: pointer; border-radius: 10px; padding: 9px 16px; border: 1px solid var(--line); background: var(--card); }
button:hover { background: var(--hover); }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { filter: brightness(.95); }
button.ghost { background: transparent; }
button.small { padding: 6px 12px; font-size: 14px; }
button.link { border: 0; background: none; padding: 4px 6px; color: var(--muted); }
button.link:hover { color: var(--text); }
button.wide { width: 100%; margin-top: 12px; }

.more-options { margin-top: 12px; }
.more-options summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.options { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-top: 12px; align-items: flex-end; }
.options label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.options input[type=number] { width: 120px; }
label.check { display: flex !important; align-items: center; gap: 8px; color: var(--text) !important; font-size: 14px; }
label.inline { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; }

/* videos */
.videos { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.videos li { min-width: 0; display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.v-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.v-state { flex: none; }
.v-state.ok { color: var(--ok); }
.v-state.warn { color: var(--warn); }
.v-state.err { color: var(--neg); }

/* tabs */
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.tabs [data-tab] { border-radius: 999px; }
.tabs [data-tab].active { background: var(--text); color: var(--bg); border-color: var(--text); }
.tabs .spacer { flex: 1; }
.badge { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; text-align: center; }
.active .badge { background: rgba(255, 255, 255, .2); color: inherit; }

/* analysis */
.summary { font-size: 17px; line-height: 1.55; margin: 0 0 16px; }
.sentiment .bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--line); }
.sentiment .bar span { height: 100%; }
.pos { background: var(--pos); } .neu { background: var(--neu); } .neg { background: var(--neg); }
.sentiment .legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.sentiment .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.theme, .idea { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.theme p, .idea p { margin: 6px 0; font-size: 14px; }
.theme-head, .idea-head { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; }
.share { color: var(--accent); font-weight: 600; font-size: 14px; flex: none; }
blockquote { margin: 8px 0 0; padding: 6px 10px; border-left: 3px solid var(--line); color: var(--muted); font-size: 13px; font-style: italic; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 0 24px; }
.block ul { margin: 0; padding-left: 18px; font-size: 14px; }
.block li { margin: 4px 0; }
.block p { margin: 0; font-size: 14px; }

.offer { display: grid; gap: 8px; max-width: 680px; }
.offer h3 { margin: 0; font-size: 18px; }
.offer p { margin: 0; }
.offer .actions { margin-top: 6px; }

/* ideas */
.ideas { display: grid; gap: 12px; margin-top: 16px; }
.idea-head { justify-content: flex-start; }
.idea-head h4 { flex: 1; font-size: 16px; }
.idea-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--hover); color: var(--muted); font-size: 12px; font-style: normal; white-space: nowrap; }
.tag.hot { background: var(--accent-soft); color: var(--accent); }

/* comments */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters input[type=search] { flex: 1 1 220px; }
.filters select { flex: 0 1 auto; max-width: 100%; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { position: sticky; top: 0; background: var(--card); font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.text { min-width: 280px; max-width: 560px; white-space: pre-wrap; word-break: break-word; }
tr.is-reply td.text { padding-left: 28px; }
.reply-mark { color: var(--muted); margin-right: 6px; }
tr.is-junk td { color: var(--muted); }

/* loading */
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 12px 0; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .card { padding: 16px; }
  .brand span { font-size: 14px; }
  .tabs .spacer { display: none; }
  .themes, .grid2 { grid-template-columns: 1fr; }
  td.text { min-width: 220px; }
}
