.topics-open { overflow: hidden; }
.choose-topics { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 9px; border: 1px solid #d8e2f7; border-radius: 7px; color: var(--accent); background: #f5f8ff; font-size: 12px !important; font-weight: 500; letter-spacing: 0; text-transform: none; cursor: pointer; }
.choose-topics svg { width: 14px; height: 14px; }
.choose-topics:hover:not(:disabled) { border-color: #a8bce9; background: var(--accent-soft); }
.choose-topics:disabled { color: #8993a3; border-color: var(--line); background: #f7f8fa; cursor: not-allowed; }
.topics-count { min-width: 18px; padding: 0 5px; border-radius: 20px; background: #dfe8ff; font-size: 10px; }
.topics-count[hidden] { display: none; }
.topics-dialog { width: min(640px, calc(100% - 32px)); max-height: min(780px, calc(100dvh - 48px)); padding: 0; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: white; box-shadow: 0 24px 80px #14264229; font-family: inherit; overflow: hidden; }
.topics-dialog[open] { display: flex; flex-direction: column; }
.topics-dialog::backdrop { background: #17233966; backdrop-filter: blur(3px); }
.topics-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 25px 26px 10px; flex-shrink: 0; }
.topics-kicker { margin: 0 0 4px; color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.topics-header h2 { margin: 0; font-size: 23px; line-height: 1.4; letter-spacing: -.5px; }
.topics-close { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--muted); cursor: pointer; }
.topics-close svg { width: 18px; height: 18px; }
.topics-description { margin: 0; padding: 0 26px 20px; color: var(--muted); font-size: 13px; flex-shrink: 0; }
.topics-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 12px; min-height: 0; }
.topic-tree, .topic-children { margin: 0; padding: 0; list-style: none; }
.topic-tree > .topic-node { border-top: 1px solid #edf0f5; }
.topic-row { display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 5px 6px; border-radius: 8px; }
.topic-row:hover { background: #f7f9fd; }
.topic-toggle, .topic-toggle-space { flex: 0 0 28px; width: 28px; }
.topic-toggle { display: grid; place-items: center; height: 34px; padding: 0; border: none; border-radius: 5px; background: transparent; color: #7d8ca5; cursor: pointer; }
.topic-toggle svg { width: 15px; height: 15px; transition: transform .15s; }
.topic-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.topic-checkbox { width: 17px; height: 17px; margin: 0; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }
.topic-checkbox:focus-visible { outline: 3px solid #8da9ff; outline-offset: 3px; }
.topic-row label, .topic-label { flex: 1; padding: 6px 0; font-size: 13px; line-height: 1.5; cursor: pointer; overflow-wrap: anywhere; }
.topic-tree > .topic-node > .topic-row label, .topic-label { font-weight: 600; }
.topic-number { color: #8190a5; font-size: 11px; margin-right: 5px; }
.topic-children { margin-left: 19px; padding-left: 6px; border-left: 1px solid #e7ecf4; }
.topic-children[hidden] { display: none; }
.topics-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 26px; border-top: 1px solid var(--line); background: #fbfcfe; flex-shrink: 0; }
.topics-footer p { margin: 0 0 3px; color: var(--muted); font-size: 12px; }
.topics-clear { padding: 0; border: none; background: transparent; color: var(--accent); font-size: 12px !important; cursor: pointer; }
.topics-done { padding: 10px 22px; border: none; border-radius: 9px; background: var(--accent); color: white; font-size: 13px !important; font-weight: 600; cursor: pointer; }
@media (max-width: 599px) {
  .topics-dialog { max-height: calc(100dvh - 24px); width: calc(100% - 20px); border-radius: 14px; }
  .topics-header { padding: 20px 18px 10px; }
  .topics-description { padding: 0 18px 16px; }
  .topics-body { padding: 0 8px 10px; }
  .topics-footer { padding: 15px 18px; }
  .topic-row { gap: 7px; }
  .topic-children { margin-left: 12px; padding-left: 3px; }
}

.topic-label { color: var(--muted); cursor: default; }

.topic-icon { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; margin-left: auto; border-radius: 9px; color: var(--topic-icon-color); background: var(--topic-icon-bg); }
.topic-icon svg { width: 22px; height: 22px; }
.topic-row label { min-width: 0; }

.topic-tree > .topic-node > .topic-row > label { display: flex; align-items: center; gap: 12px; }
.topic-title { flex: 1; min-width: 0; }

.topics-dialog > form { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.topics-selection-actions { display: flex; flex-wrap: wrap; gap: 6px 15px; }
.topics-all { padding: 0; border: none; background: transparent; color: var(--accent); font-size: 12px !important; cursor: pointer; }
.topics-reset-form { display: inline-block; margin-left: 16px; }
