/* Registon kechasi: lojuvard fon, firuza asosiy rang, za'faron — mashhur/saqlangan, anor — xato */
:root {
  --bg: #0F1B2D;
  --bg-2: #13223A;
  --card: #16263D;
  --card-hover: #1A2D48;
  --border: #253A5A;
  --text: #EEF1F6;
  --text-2: #B3BFD2;
  --muted: #7F8DA6;
  --accent: #34C3B5;
  --accent-2: #7FE0D6;
  --accent-soft: rgba(52, 195, 181, 0.14);
  --on-accent: #06221F;
  --star: #F2B33D;
  --danger: #E0525B;
  --ok: #3CCB7F;
  --news: #7DB7F2;
  --github: #C7A6F5;
  --video: #F07B7B;
  --radius: 14px;
  --shadow: 0 12px 32px rgba(3, 10, 22, 0.45);
  --font: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Unbounded", "Onest", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #EEF2F7;
  --bg-2: #F7F9FC;
  --card: #FFFFFF;
  --card-hover: #FBFCFE;
  --border: #D8E0EB;
  --text: #13263F;
  --text-2: #3E516D;
  --muted: #6D7D96;
  --accent: #0E8A7E;
  --accent-2: #0B6F66;
  --accent-soft: rgba(14, 138, 126, 0.10);
  --on-accent: #FFFFFF;
  --star: #B97A06;
  --news: #1F6FC5;
  --github: #7B4FD0;
  --video: #C8414A;
  --shadow: 0 10px 28px rgba(19, 38, 63, 0.10);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 22px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.brand .logo { font-size: 30px; filter: drop-shadow(0 0 12px var(--accent)); }
.brand h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); }
.search { flex: 1; max-width: 640px; }
.search input {
  width: 100%; padding: 11px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg-2); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); cursor: pointer; font-weight: 600; font-size: 14px;
  transition: background .15s, transform .1s, border-color .15s;
}
.btn:hover { background: var(--card-hover); border-color: var(--accent); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #5b4bff); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; }
.btn.icon-only { padding: 9px 11px; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn .icon.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Banner ---------- */
.banner {
  margin: 14px 22px 0; padding: 12px 16px; border-radius: 12px;
  background: rgba(245, 184, 61, 0.12); border: 1px solid rgba(245, 184, 61, 0.35); color: var(--text);
  font-size: 14px;
}
.banner code { font-family: var(--mono); font-size: 12px; background: var(--bg-2); padding: 2px 6px; border-radius: 6px; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 270px 1fr; gap: 24px; padding: 20px 22px 60px; max-width: 1600px; margin: 0 auto; }
.sidebar { position: sticky; top: 76px; align-self: start; display: flex; flex-direction: column; gap: 18px; max-height: calc(100vh - 96px); overflow-y: auto; padding-right: 4px; }
.tabs { display: flex; flex-direction: column; gap: 4px; }
.tab {
  display: flex; align-items: center; gap: 8px; text-align: left;
  padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; font-weight: 600;
  color: var(--text-2);
}
.tab:hover { background: var(--card); color: var(--text); }
.tab.active { background: var(--accent-soft); color: var(--text); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.tab .count { margin-left: auto; font-size: 12px; color: var(--muted); font-family: var(--mono); }

.side-block h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.side-block h3 small { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--card);
  cursor: pointer; font-size: 13px; color: var(--text-2); transition: all .15s;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .n { opacity: .7; margin-left: 4px; font-family: var(--mono); font-size: 11px; }

.user-cats { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.ucat {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; color: var(--text-2);
}
.ucat:hover { background: var(--card); color: var(--text); }
.ucat.active { background: var(--accent-soft); color: var(--text); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.ucat .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ucat .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ucat .n { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.ucat .del { opacity: .45; border: none; background: none; cursor: pointer; color: var(--muted); padding: 0 2px; }
.ucat:hover .del { opacity: 1; }
.ucat .del:hover { color: var(--danger); }
.cat-form { display: flex; gap: 6px; align-items: center; }
.cat-form input[type="color"] { width: 32px; height: 32px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; cursor: pointer; }
.cat-form input[type="text"] { flex: 1; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-2); outline: none; min-width: 0; }

.status #status-text { font-size: 13px; line-height: 1.5; }
.progress { height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 8px 0; }
.progress .bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s; }
#log-details summary { cursor: pointer; font-size: 12px; color: var(--muted); margin-top: 6px; }
#log { font-family: var(--mono); font-size: 11px; color: var(--text-2); white-space: pre-wrap; max-height: 200px; overflow: auto; background: var(--bg-2); padding: 8px; border-radius: 8px; margin: 6px 0 0; }

/* ---------- Content ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.view-switch { display: flex; gap: 6px; }
.cards.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.cards.list { display: flex; flex-direction: column; gap: 10px; }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: transform .18s, box-shadow .18s, border-color .18s;
  animation: fadeIn .3s ease both;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.card.saved { border-color: color-mix(in srgb, var(--star) 55%, var(--border)); }
.card .media { position: relative; aspect-ratio: 16/9; background: var(--bg-2); overflow: hidden; cursor: pointer; }
.card .media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.card:hover .media img { transform: scale(1.03); }
.card .media .placeholder { width: 100%; height: 100%; display: grid; place-items: center; font-size: 44px; opacity: .5; background: linear-gradient(135deg, var(--bg-2), var(--card)); }
.card .media .play {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
}
.card .media .play span {
  width: 58px; height: 58px; border-radius: 50%; background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  display: grid; place-items: center; color: #fff; font-size: 24px; padding-left: 4px; transition: transform .2s, background .2s;
}
.card:hover .media .play span { transform: scale(1.08); background: var(--video); }
.card .type-badge {
  position: absolute; top: 10px; left: 10px; padding: 4px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em; color: #fff; text-transform: uppercase;
  background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
}
.type-badge.news { background: color-mix(in srgb, var(--news) 80%, black); }
.type-badge.github { background: color-mix(in srgb, var(--github) 80%, black); }
.type-badge.video { background: color-mix(in srgb, var(--video) 80%, black); }

.card .body { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.card .meta .src { font-weight: 600; color: var(--text-2); }
.card .meta .aicat { padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.card h2 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; }
.card h2 a:hover { color: var(--accent-2); }
.card .orig { font-size: 12px; color: var(--muted); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .summary { margin: 0; font-size: 14px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .gh { display: flex; gap: 12px; font-size: 12px; color: var(--muted); font-family: var(--mono); flex-wrap: wrap; }
.card .gh .lang::before { content: "●"; margin-right: 4px; color: var(--github); }
.card .ucats { display: flex; flex-wrap: wrap; gap: 5px; }
.card .ucats span { font-size: 11px; padding: 2px 8px; border-radius: 999px; color: #fff; font-weight: 600; }
.card .note { font-size: 13px; padding: 8px 10px; border-left: 3px solid var(--star); background: var(--bg-2); border-radius: 6px; color: var(--text-2); }

.card .foot {
  display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-2) 60%, transparent);
}
.card .foot .time { margin-right: auto; font-size: 12px; color: var(--muted); padding-left: 6px; }
.ibtn {
  border: none; background: transparent; cursor: pointer; padding: 6px 9px; border-radius: 8px; font-size: 15px;
  color: var(--text-2); transition: background .15s, color .15s, transform .1s;
}
.ibtn:hover { background: var(--card-hover); color: var(--text); transform: scale(1.1); }
.ibtn.on { color: var(--star); }
.ibtn.danger:hover { color: var(--danger); }

/* list view */
.cards.list .card { flex-direction: row; align-items: stretch; }
.cards.list .card .media { width: 220px; aspect-ratio: auto; flex-shrink: 0; }
.cards.list .card .body { flex: 1; }
.cards.list .card .foot { flex-direction: column; border-top: none; border-left: 1px solid var(--border); justify-content: center; }
.cards.list .card .foot .time { margin: 0 0 6px; padding: 0; text-align: center; }

.empty { text-align: center; padding: 70px 20px; color: var(--muted); font-size: 16px; }
.empty .big { font-size: 48px; margin-bottom: 10px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 28px; }

/* ---------- Modals ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); padding: 20px; }
.modal-card { width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); animation: fadeIn .2s ease; }
.modal-card h3 { margin: 0 0 6px; }
.modal-card.video { max-width: 900px; position: relative; padding: 14px; }
.modal-card .close { position: absolute; top: -14px; right: -14px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); cursor: pointer; }
.video-wrap { aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: #000; }
.video-wrap iframe { width: 100%; height: 100%; border: 0; }
.modal-card.video h3 { margin: 12px 4px 4px; font-size: 16px; }
.modal-card.video p { margin: 0 4px; }
.cat-check-list { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; max-height: 260px; overflow: auto; }
.cat-check-list label { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border); cursor: pointer; }
.cat-check-list label:hover { background: var(--card-hover); }
.cat-check-list input { accent-color: var(--accent); }
.cat-check-list .dot { width: 10px; height: 10px; border-radius: 50%; }
#cat-modal-note { width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-2); resize: vertical; outline: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60;
  padding: 10px 18px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow); animation: fadeIn .2s ease;
}

/* skeleton */
.skeleton { height: 320px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card) 25%, var(--card-hover) 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .brand { min-width: 0; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .layout { padding: 16px; }
  .cards.list .card { flex-direction: column; }
  .cards.list .card .media { width: 100%; aspect-ratio: 16/9; }
  .cards.list .card .foot { flex-direction: row; border-left: none; border-top: 1px solid var(--border); }
  .btn .label { display: none; }
}

/* ---------- Settings modal ---------- */
.link-btn { border: none; background: none; color: var(--accent-2); cursor: pointer; font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; margin-left: 6px; }
.link-btn:hover { text-decoration: underline; }
.modal-card.wide { max-width: 860px; position: relative; max-height: 90vh; overflow-y: auto; overflow-x: hidden; }
.modal-card.wide .close { top: 12px; right: 12px; }
.seg { display: flex; gap: 6px; margin: 10px 0 14px; }
.form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.form-row input[type="text"], .form-row select { padding: 8px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-2); outline: none; min-width: 0; }
.form-row input[type="text"] { flex: 1 1 160px; }
.form-row .emoji-in { flex: 0 0 56px; text-align: center; }
.form-row select { flex: 0 0 auto; }
.settings-list { display: flex; flex-direction: column; gap: 8px; }
.srow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--bg-2); flex-wrap: wrap; }
.srow.off { opacity: .5; }
.srow .emo { font-size: 20px; }
.srow .info { flex: 1; min-width: 200px; }
.srow .info b { display: block; font-size: 14px; }
.srow .info small { color: var(--muted); font-size: 12px; word-break: break-all; }
.srow .info .err { color: var(--danger); }
.srow .kind { font-size: 11px; font-family: var(--mono); padding: 2px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-2); }
.srow .ctl { display: flex; gap: 4px; align-items: center; }
.srow input.inline { padding: 5px 8px; border-radius: 7px; border: 1px solid var(--border); background: var(--card); outline: none; font-size: 13px; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--border); cursor: pointer; border: none; transition: background .15s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on { background: var(--ok); }
.switch.on::after { left: 19px; }
.test-result { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); margin-bottom: 12px; font-size: 13px; }
.test-result ul { margin: 6px 0 0; padding-left: 18px; }
.test-result.err { border-color: var(--danger); color: var(--danger); }
.card .meta .interest { color: var(--muted); }

/* ---------- Chat (muhokama) ---------- */
.modal-card.chat { max-width: 760px; position: relative; display: flex; flex-direction: column; max-height: 92vh; padding: 18px 20px 14px; }
.modal-card.chat .close { top: 12px; right: 12px; }
.chat-head { padding-right: 40px; margin-bottom: 10px; }
.chat-head h3 { margin: 0 0 4px; font-size: 16px; line-height: 1.3; }
.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 8px 4px; min-height: 220px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; line-height: 1.5; font-size: 14px; white-space: pre-wrap; word-break: break-word; animation: fadeIn .2s ease; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--bg-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.system { align-self: center; background: transparent; color: var(--muted); font-size: 12px; text-align: center; padding: 4px; }
.msg.thinking { color: var(--muted); font-style: italic; }
.msg.thinking::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--accent); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.msg strong { font-weight: 700; }
.msg code { font-family: var(--mono); font-size: 12px; background: var(--card); padding: 1px 5px; border-radius: 5px; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 4px; }
.chat-form textarea { flex: 1; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-2); outline: none; resize: none; font-size: 14px; line-height: 1.4; }
.chat-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-tools { display: flex; gap: 14px; margin-top: 8px; }
.chat-tools .link-btn { margin: 0; font-size: 12px; }
.ibtn.chat-btn.has { color: var(--accent-2); }
#profile-text { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); outline: none; resize: vertical; font-size: 14px; }

/* ---------- Sozlama formalari ---------- */
.form-col { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 12px; }
.form-col label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.form-col input, .form-col select { padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-2); outline: none; font-size: 14px; color: var(--text); font-weight: 400; }
.form-col input:focus, .form-col select:focus { border-color: var(--accent); }

.sep { border: none; border-top: 1px solid var(--border); margin: 18px 0 12px; }

.usage-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0; }
.usage-table th, .usage-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--border); }
.usage-table th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.usage-table td.num { font-family: var(--mono); text-align: right; }
.usage-table th.num { text-align: right; }

.quota { margin: 6px 0 10px; }
.quota .bar-wrap { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; margin: 4px 0; }
.quota .bar { height: 100%; background: linear-gradient(90deg, var(--ok), var(--star)); transition: width .3s; }
.quota .bar.warn { background: var(--danger); }

/* ---------- Internet qidiruv ---------- */
.search { display: flex; gap: 8px; align-items: center; }
.search-mode { display: flex; gap: 4px; flex-shrink: 0; }
.search-mode .chip { padding: 8px 10px; font-size: 12px; }
.web-group { margin-bottom: 22px; }
.web-group h3 { margin: 0 0 10px; font-size: 14px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.web-group h3 .n { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.web-group .err { color: var(--danger); font-size: 13px; }
.web-hint { margin: 0 0 16px; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (max-width: 980px) { .search { flex-wrap: wrap; } .search-mode { order: 2; } }

/* ---------- AI qidiruv ---------- */
.ai-thread { display: flex; flex-direction: column; gap: 14px; max-width: 980px; }
.ai-q { align-self: flex-end; background: var(--accent); color: #fff; padding: 10px 14px; border-radius: 14px 14px 4px 14px; max-width: 80%; font-size: 14px; }
.ai-a { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.ai-a .ans { font-size: 15px; line-height: 1.6; white-space: pre-wrap; }
.ai-a .ans a.ref { color: var(--accent-2); font-weight: 700; text-decoration: none; font-size: 12px; vertical-align: super; }
.ai-a .qs { font-size: 12px; color: var(--muted); margin-top: 8px; }
.ai-a details { margin-top: 10px; }
.ai-a summary { cursor: pointer; font-size: 13px; color: var(--text-2); font-weight: 600; }
.ai-a .cards { margin-top: 10px; }
.ai-a .followups { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ai-start { padding: 26px; border-radius: 14px; background: var(--accent-soft); font-size: 14px; line-height: 1.6; }
.ai-start .ex { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

#chat-input { min-height: 44px; max-height: 140px; overflow-y: auto; }

/* ---------- Keyinroq / eslatmalar / Claude ---------- */
.chat-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.chat-actions .chip.on { background: var(--star); border-color: var(--star); color: #1b1b1b; }
#chat-later-box { margin-top: 6px; }
#chat-later-note { width: 100%; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-2); outline: none; font-size: 13px; }
.msg.assistant { position: relative; }
.msg .pin { position: absolute; right: 6px; bottom: 4px; border: none; background: none; cursor: pointer; font-size: 13px; opacity: .45; padding: 2px 4px; }
.msg .pin:hover { opacity: 1; }
.msg .pin.done { opacity: 1; cursor: default; }
.msg.assistant { padding-bottom: 22px; }
.card .later-note { font-size: 13px; padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 6px; color: var(--text); }
.ibtn.later-on { color: var(--accent-2); }
.notes-list { display: flex; flex-direction: column; gap: 12px; max-width: 900px; }
.note-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.note-card.done { opacity: .55; }
.note-card .nq { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.note-card .nt { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.note-card .nt a.ref { color: var(--accent-2); font-size: 11px; vertical-align: super; font-weight: 700; }
.note-card .nf { display: flex; gap: 10px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.note-card .nf .grow { flex: 1; }
.note-card .nf button { border: none; background: none; cursor: pointer; color: var(--accent-2); font-size: 12px; font-weight: 600; padding: 2px 4px; }
.note-card .nf button.del { color: var(--muted); }
.note-card .nf button.del:hover { color: var(--danger); }
#claude-prompt { width: 100%; font-family: var(--mono); font-size: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); resize: vertical; }
.msg h4 { margin: 8px 0 4px; font-size: 14px; }
@media (max-width: 980px) {
  .modal { padding: 0; align-items: stretch; }
  .modal-card.chat, .modal-card.wide { max-width: none; max-height: none; height: 100%; border-radius: 0; }
  .modal-card.chat .close, .modal-card.wide .close { top: 10px; right: 10px; }
  .card .foot .ibtn { padding: 6px 7px; }
}

.ai-top { display: flex; justify-content: flex-end; }

.tg-steps { font-size: 13px; color: var(--text-2); padding-left: 20px; line-height: 1.7; margin: 10px 0; }
.tg-steps code { font-family: var(--mono); font-size: 12px; background: var(--bg-2); padding: 1px 5px; border-radius: 5px; }

/* =================== Dizayn qatlami (2026-09) =================== */
body { font-size: 15.5px; }
.brand .logo { width: 34px; height: 34px; color: var(--accent); filter: none; display: grid; place-items: center; flex-shrink: 0; }
.brand .logo .girih { width: 34px; height: 34px; }
.brand h1 { font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.brand p { color: var(--muted); }
.topbar { background: color-mix(in srgb, var(--bg) 92%, transparent); }

.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); border-color: transparent; }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tab.active { background: var(--accent-soft); border-color: transparent; box-shadow: inset 3px 0 0 var(--accent); }
.tab .count, .chip .n, .ucat .n, .card .gh { font-family: var(--font); font-variant-numeric: tabular-nums; }
.side-block h3 { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text-2); font-weight: 600; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Kartalar: soya va ko'tarilishsiz, faqat chegara rangi o'zgaradi */
.card { animation: none; }
.card:hover { transform: none; box-shadow: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.card:hover .media img { transform: none; }
.card h2 { font-size: 16.5px; font-weight: 650; line-height: 1.35; }
.card h2 a:hover { color: var(--accent-2); }
.card .type-badge { text-transform: none; letter-spacing: 0; font-size: 11.5px; font-weight: 600; padding: 3px 9px; }
.card .meta .aicat { color: var(--accent-2); background: var(--accent-soft); }
.card.saved { border-color: color-mix(in srgb, var(--star) 55%, var(--border)); }
.card .later-note { border-left-color: var(--accent); }

/* Mashhur rejimi: katta reyting raqami */
.card.ranked { position: relative; }
.card .rank {
  position: absolute; z-index: 2; top: 8px; right: 12px;
  font: 800 30px/1 var(--display); color: #fff; letter-spacing: -0.02em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.card.ranked:nth-child(-n+3) .rank { color: var(--star); font-size: 38px; }
.cards.list .card .rank { position: static; align-self: center; padding: 0 6px 0 14px; text-shadow: none; color: var(--muted); font-size: 22px; }
.cards.list .card.ranked:nth-child(-n+3) .rank { color: var(--star); font-size: 26px; }

/* Tartib almashtirgich */
.toolbar { gap: 12px; flex-wrap: wrap; }
.toolbar #result-info { margin-right: auto; }
.seg-sort { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 3px; background: var(--bg-2); }
.seg-btn { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); }
.seg-btn.active { background: var(--accent-soft); color: var(--accent-2); }
.seg-btn:hover:not(.active) { color: var(--text); }

/* "Bugun" bloki — lenta tepasidagi kunlik dayjest */
#digest-hero {
  position: relative; overflow: hidden;
  margin-bottom: 22px; padding: 22px 26px;
  border: 1px solid var(--border); border-radius: 18px; background: var(--card);
}
#digest-hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; opacity: 0.07; pointer-events: none;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M24 2l6.4 8.6L41 9.1l-1.5 10.6L48 24l-8.5 4.3L41 38.9l-10.6-1.5L24 46l-6.4-8.6L7 38.9l1.5-10.6L0 24l8.5-4.3L7 9.1l10.6 1.5z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M24 2l6.4 8.6L41 9.1l-1.5 10.6L48 24l-8.5 4.3L41 38.9l-10.6-1.5L24 46l-6.4-8.6L7 38.9l1.5-10.6L0 24l8.5-4.3L7 9.1l10.6 1.5z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.hero-meta { font-size: 13px; color: var(--star); font-weight: 600; }
.hero-title { font: 700 clamp(20px, 2.4vw, 28px)/1.2 var(--display); margin: 6px 0 10px; max-width: 30ch; letter-spacing: -0.015em; }
.hero-intro { margin: 0 0 10px; color: var(--text-2); max-width: 72ch; }
.hero-list { margin: 0 0 16px; padding-left: 20px; max-width: 72ch; color: var(--text); }
.hero-list li { margin: 4px 0; }
.hero-list li::marker { content: "✦  "; color: var(--accent); }
.hero-btn { border-color: var(--accent); color: var(--accent-2); background: transparent; }

/* Dayjest sahifasi */
.digest-list { display: flex; flex-direction: column; gap: 18px; max-width: 780px; }
.digest-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.digest { border: 1px solid var(--border); border-radius: 16px; background: var(--card); padding: 22px 26px; }
.digest-day { font-size: 13px; color: var(--star); font-weight: 600; }
.digest h2 { font: 700 22px/1.25 var(--display); margin: 6px 0 12px; letter-spacing: -0.01em; }
.digest-body { white-space: pre-wrap; line-height: 1.7; font-size: 15.5px; max-width: 70ch; color: var(--text); }
.digest-body h4 { font: 600 16px/1.3 var(--font); margin: 14px 0 2px; color: var(--accent-2); }
.digest-body a.ref, .ai-a .ans a.ref, .note-card .nt a.ref {
  display: inline-block; min-width: 18px; padding: 0 5px; margin: 0 1px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-2); font-size: 11.5px; font-weight: 700; line-height: 18px; text-align: center; vertical-align: 2px; text-decoration: none;
}
.digest-refs { margin-top: 12px; font-size: 14px; }
.digest-refs summary { cursor: pointer; color: var(--text-2); font-weight: 600; }
.digest-refs ol { margin: 8px 0 0; padding-left: 22px; }
.digest-refs li { margin: 4px 0; }
.digest-refs a:hover { color: var(--accent-2); }

/* Kirish qulayligi */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 980px) {
  #digest-hero { padding: 18px; }
  .hero-title { font-size: 20px; }
  .digest { padding: 18px; }
}
.card .foot .time { white-space: nowrap; }
.card .foot { gap: 2px; }
.card .foot .ibtn { padding: 6px 7px; }

.msg a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.msg a.ref { display: inline-block; min-width: 18px; padding: 0 5px; margin: 0 1px; border-radius: 6px; background: var(--accent-soft); font-size: 11.5px; font-weight: 700; line-height: 18px; text-align: center; vertical-align: 2px; text-decoration: none; word-break: normal; }

/* ---------- Akkaunt ---------- */
.me-btn { padding: 5px 10px 5px 5px; gap: 8px; }
.me-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); font: 700 13px/1 var(--display); text-transform: uppercase; }
.role-user .admin-only { display: none !important; }
.srow .role { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.srow .role.admin { background: color-mix(in srgb, var(--star) 18%, transparent); color: var(--star); }
.srow .ctl button.link-btn { font-size: 12px; margin: 0; }
