:root {
  --bg: #ffffff; --bg-2: #f7f7f8; --panel: #f4f4f5; --hover: #ececf0; --active: #e4e4ea;
  --text: #18181b; --muted: #71717a; --border: #e4e4e7; --user: #f0f0f3;
  --accent: #10a37f; --accent-2: #3b82f6; --accent-3: #a855f7; --accent-soft: #e7f6f2;
  --danger: #dc2626; --code-bg: #0d1117; --code-head: #1b222c;
  --shadow: 0 6px 24px rgba(0,0,0,.08); --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --sidebar-w: 288px; --radius: 14px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #212121; --bg-2: #171717; --panel: #2a2a2a; --hover: #2d2d2d; --active: #373737;
  --text: #ececec; --muted: #a1a1aa; --border: #373737; --user: #2f2f2f;
  --accent-soft: #12332b; --danger: #f87171;
  --shadow: 0 6px 24px rgba(0,0,0,.5); --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); overflow: hidden;
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; border: 2px solid transparent; }

.app { display: flex; height: 100vh; height: 100dvh; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px; padding: 12px; padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(12px, env(safe-area-inset-bottom)); padding-left: max(12px, env(safe-area-inset-left));
  transition: margin-left .25s ease, transform .25s ease;
}
.app.collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w) - 1px); }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 4px; font-weight: 700; font-size: 17px; }
.logo {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: var(--shadow-sm); flex: none;
}
.brand .grow { flex: 1; }
.btn-new {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg); font-weight: 600; transition: background .15s, box-shadow .15s;
}
.btn-new:hover { background: var(--hover); box-shadow: var(--shadow-sm); }
.btn-new kbd { margin-left: auto; font: 11px/1 ui-monospace, Consolas, monospace; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 3px 5px; }
.search { position: relative; }
.search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search input {
  width: 100%; padding: 9px 12px 9px 34px; border-radius: 10px; border: 1px solid transparent; background: var(--hover);
  color: var(--text); font: inherit; font-size: 14px; outline: none;
}
.search input:focus { border-color: var(--accent); background: var(--bg); }
.chat-list { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.group { font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 5px; font-weight: 600; }
.item {
  position: relative; display: flex; align-items: center; gap: 4px; border-radius: 10px; cursor: pointer; padding: 0 4px 0 10px; min-height: 40px;
}
.item:hover { background: var(--hover); }
.item.active { background: var(--active); }
.item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; padding: 8px 0; }
.item .pin { width: 13px; height: 13px; color: var(--accent); }
.item .more { border: 0; background: none; color: var(--muted); border-radius: 8px; width: 30px; height: 30px; display: grid; place-items: center; opacity: 0; }
.item:hover .more, .item.active .more, .item .more:focus-visible { opacity: 1; }
@media (hover: none) { .item .more { opacity: 1; } }
.item .more:hover { background: var(--bg); color: var(--text); }
.item input.rename { flex: 1; min-width: 0; font: inherit; font-size: 14px; background: var(--bg); color: var(--text); border: 1px solid var(--accent); border-radius: 8px; padding: 6px 8px; margin: 4px 0; outline: none; }
.empty-list { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 8px; }
.side-bottom { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); flex: none; }
.who { flex: 1; min-width: 0; font-size: 13px; line-height: 1.3; }
.who b, .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { color: var(--muted); font-size: 12px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); border-radius: 10px; width: 36px; height: 36px; display: grid; place-items: center; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.note { font-size: 11.5px; color: var(--muted); line-height: 1.4; padding: 0 4px; }

.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .25s; cursor: pointer; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------------- Main ---------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.topbar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); padding-right: max(12px, env(safe-area-inset-right)); }
.topbar .name { font-weight: 650; font-size: 16px; padding: 0 6px; }
.badge { font-size: 11px; background: var(--hover); color: var(--muted); padding: 2px 9px; border-radius: 999px; }
.grow { flex: 1; }
.messages { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.thread { max-width: 780px; margin: 0 auto; padding: 8px 18px 28px; min-height: 100%; display: flex; flex-direction: column; }
.to-bottom {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 112px; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg); box-shadow: var(--shadow); display: grid; place-items: center; z-index: 5;
}
.to-bottom:hover { background: var(--hover); }

/* Welcome */
.welcome { margin: auto; text-align: center; padding: 24px 0; width: 100%; animation: fade .5s ease both; }
.welcome .logo { width: 56px; height: 56px; border-radius: 18px; font-size: 24px; margin: 0 auto 18px; box-shadow: var(--shadow); }
.welcome h1 { font-size: clamp(26px, 5vw, 36px); margin: 0 0 6px; letter-spacing: -.02em; line-height: 1.2;
  background: linear-gradient(90deg, var(--accent), var(--accent-2) 55%, var(--accent-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome p { color: var(--muted); margin: 0 0 26px; }
.starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: left; }
.starter {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg);
  transition: transform .15s, box-shadow .15s, background .15s, border-color .15s; animation: rise .5s ease both;
}
.starter:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.starter .si { color: var(--accent); margin-top: 2px; }
.starter span.tx { font-size: 14.5px; line-height: 1.45; }
@media (max-width: 560px) { .starters { grid-template-columns: 1fr; } }

/* Messages */
.msg { display: flex; gap: 12px; padding: 12px 0; }
.msg.enter { animation: rise .4s cubic-bezier(.2,.7,.2,1) both; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--user); padding: 10px 16px; border-radius: 20px 20px 6px 20px; max-width: min(85%, 560px); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot .avatar { width: 30px; height: 30px; font-size: 12px; margin-top: 2px; border-radius: 10px; }
.body { flex: 1; min-width: 0; }
.err { color: var(--danger); font-size: 15px; }

/* Thinking indicator */
.thinking { display: flex; align-items: center; gap: 12px; padding: 6px 0 2px; }
.orb { width: 22px; height: 22px; border-radius: 50%; position: relative; flex: none; background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent)); animation: spin 1.4s linear infinite; }
.orb::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--bg); }
.orb::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent)); filter: blur(7px); opacity: .45; animation: pulse 2s ease-in-out infinite; }
.shimmer {
  background: linear-gradient(90deg, var(--muted) 0%, var(--muted) 35%, var(--text) 50%, var(--muted) 65%, var(--muted) 100%); background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; animation: shimmer 2.2s linear infinite; font-size: 15px;
}
.thinking .shimmer { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; margin-left: auto; }
.skeleton { display: grid; gap: 8px; margin: 10px 0 4px; max-width: 520px; }
.skeleton i { display: block; height: 11px; border-radius: 6px; background: linear-gradient(90deg, var(--hover) 25%, var(--active) 50%, var(--hover) 75%); background-size: 300% 100%; animation: sk 1.6s ease infinite; }
.skeleton i:nth-child(1) { width: 92%; } .skeleton i:nth-child(2) { width: 78%; } .skeleton i:nth-child(3) { width: 55%; }

/* Reasoning panel */
.think { margin: 2px 0 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); overflow: hidden; }
.think summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 13.5px; color: var(--muted); user-select: none; }
.think summary::-webkit-details-marker { display: none; }
.think summary .chev { margin-left: auto; transition: transform .2s; }
.think[open] summary .chev { transform: rotate(180deg); }
.think summary:hover { color: var(--text); }
.think .live-ico { color: var(--accent); }
.steps { list-style: none; margin: 0; padding: 2px 14px 12px 14px; position: relative; max-height: 360px; overflow-y: auto; overscroll-behavior: contain; }
.step { position: relative; display: flex; gap: 12px; padding: 5px 0; font-size: 13.5px; margin-left: calc(var(--d, 0) * 20px); }
.step.error .dot { border-color: var(--danger); background: var(--danger); }
.step.thought.done .dot { background: var(--bg); border-color: var(--accent); }
.step.thought .st b { font-weight: 600; color: var(--muted); }
.step.thought .sd { font-style: italic; }
.step .sa { margin-top: 3px; font: 11.5px/1.5 ui-monospace, Consolas, monospace; color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; overflow-wrap: anywhere; white-space: pre-wrap; max-height: 90px; overflow: auto; }
.step::before { content: ""; position: absolute; left: 6px; top: 22px; bottom: -6px; width: 1px; background: var(--border); }
.step:last-child::before { display: none; }
.step .dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--border); margin-top: 4px; flex: none; background: var(--bg); position: relative; z-index: 1; }
.step.running .dot { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.step.done .dot { border-color: var(--accent); background: var(--accent); }
.step .st { flex: 1; min-width: 0; }
.step .st b { font-weight: 600; display: block; }
.step.running .st b { color: var(--text); }
.step .sd { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin-top: 1px; overflow-wrap: anywhere; }
.step .ms { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 2px; }

/* Markdown */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md blockquote, .md table { margin: 0 0 14px; }
.md h1, .md h2, .md h3, .md h4 { line-height: 1.3; margin: 20px 0 8px; letter-spacing: -.01em; }
.md h1 { font-size: 1.4em; } .md h2 { font-size: 1.22em; } .md h3 { font-size: 1.08em; }
.md ul, .md ol { padding-left: 24px; } .md li { margin: 3px 0; }
.md a { color: var(--accent); text-underline-offset: 2px; }
.md blockquote { border-left: 3px solid var(--accent); padding: 2px 0 2px 14px; color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.md .tw { overflow-x: auto; margin: 0 0 14px; border: 1px solid var(--border); border-radius: 10px; }
.md table { border-collapse: collapse; margin: 0; width: 100%; font-size: .94em; }
.md th, .md td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.md th { background: var(--panel); font-weight: 600; white-space: nowrap; }
.md tr:last-child td { border-bottom: 0; }
.md :not(pre) > code { background: var(--hover); padding: 2px 6px; border-radius: 6px; font-size: .88em; }
.md pre { background: var(--code-bg); border-radius: 12px; overflow: hidden; }
.md pre code { display: block; padding: 14px 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.55; background: transparent; color: #e6edf3; }
.code-head { display: flex; justify-content: space-between; align-items: center; background: var(--code-head); color: #9ca3af; font-size: 12px; padding: 4px 8px 4px 14px; }
.code-head button { background: none; border: 0; color: #9ca3af; font-size: 12px; padding: 4px 8px; border-radius: 6px; display: inline-flex; gap: 6px; align-items: center; }
.code-head button:hover { color: #fff; background: rgba(255,255,255,.08); }
.md.caret > :last-child::after { content: ""; display: inline-block; width: 8px; height: 1.05em; margin-left: 3px; vertical-align: text-bottom; background: var(--accent); border-radius: 2px; animation: blink 1s steps(2) infinite; }
sup.cite { font-size: .72em; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 1px 5px; margin: 0 1px; font-weight: 700; cursor: help; }

/* Sources / cards / suggestions / actions */
.sources { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; animation: fade .4s ease both; }
.src-label { width: 100%; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 5px 11px 5px 6px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); font-size: 13px; text-decoration: none; color: var(--text); transition: background .15s, border-color .15s; }
a.chip:hover { background: var(--hover); border-color: var(--accent); }
.chip .n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; flex: none; }
.chip .tt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cards { display: grid; gap: 12px; margin-top: 12px; }
.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); padding: 14px 16px; animation: rise .4s ease both; overflow: hidden; }
.card .ac-adaptiveCard { background: transparent !important; padding: 0 !important; }
.card .ac-actionSet { flex-wrap: wrap !important; gap: 8px; margin-top: 4px; }
.card .ac-pushButton {
  border: 1px solid var(--accent) !important; color: var(--accent) !important; background: transparent !important; border-radius: 999px !important;
  padding: 6px 14px !important; font: inherit !important; font-size: 14px !important; font-weight: 600 !important; margin: 0 !important; cursor: pointer;
  transition: background .15s, color .15s;
}
.card .ac-pushButton:hover { background: var(--accent) !important; color: #fff !important; }
.card .ac-pushButton div { color: inherit !important; font: inherit !important; }
.card .ac-input, .card input, .card textarea, .card select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.card img.hero-img { width: 100%; border-radius: 10px; margin-bottom: 10px; display: block; }
.card h4 { margin: 0 0 2px; font-size: 16px; } .card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 6px; } .card .tx { font-size: 14.5px; }
.card .btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn { border: 1px solid var(--accent); color: var(--accent); background: transparent; border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 600; transition: background .15s, color .15s; }
.btn:hover { background: var(--accent); color: #fff; }
.img-att { max-width: min(100%, 420px); border-radius: 12px; display: block; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.suggest .btn { animation: rise .4s ease both; }
.actions { display: flex; align-items: center; gap: 2px; margin-top: 8px; margin-left: -6px; animation: fade .3s ease both; }
.actions button { border: 0; background: none; color: var(--muted); border-radius: 8px; width: 32px; height: 32px; display: grid; place-items: center; }
.actions button:hover { background: var(--hover); color: var(--text); }
.actions button.on { color: var(--accent); }
.actions .meta { font-size: 12px; color: var(--muted); margin-left: 8px; }
details.dbg { margin-top: 10px; font-size: 12px; color: var(--muted); }
details.dbg pre { max-height: 260px; overflow: auto; background: var(--panel); border-radius: 10px; padding: 10px; font-size: 11.5px; white-space: pre-wrap; }

/* Composer */
.composer-wrap { padding: 0 16px max(14px, env(safe-area-inset-bottom)); }
.composer { max-width: 780px; margin: 0 auto; background: var(--panel); border: 1px solid var(--border); border-radius: 26px; display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 20px; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font: inherit; font-size: 16px; max-height: 200px; padding: 8px 0; line-height: 1.5; }
.send { width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; flex: none; background: var(--accent); color: #fff; transition: transform .15s, opacity .15s, background .15s; }
.send:hover:not(:disabled) { transform: scale(1.06); }
.send:disabled { background: var(--active); color: var(--muted); cursor: default; }
.send.stop { background: var(--text); color: var(--bg); }
.footnote { text-align: center; color: var(--muted); font-size: 12px; padding-top: 8px; }

/* Menu & toast */
.menu { position: fixed; z-index: 60; min-width: 190px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; animation: fade .12s ease both; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left; padding: 9px 10px; border-radius: 8px; font-size: 14px; }
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--danger); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 80; max-width: min(90vw, 460px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Login */
.login { position: fixed; inset: 0; background: var(--bg); display: flex; overflow-y: auto; z-index: 90; padding: 24px; }
.login::before { content: ""; position: absolute; inset: 0; background: radial-gradient(600px 300px at 50% 30%, var(--accent-soft), transparent 70%); pointer-events: none; }
.login-card { position: relative; text-align: center; width: min(100%, 400px); animation: rise .6s ease both;
  background: color-mix(in srgb, var(--panel) 45%, var(--bg)); border: 1px solid var(--border); border-radius: 22px; padding: 32px 28px; box-shadow: var(--shadow); }
.login-card .logo { width: 60px; height: 60px; font-size: 26px; border-radius: 19px; margin: 0 auto; }
.login-card h1 { margin: 16px 0 6px; font-size: 28px; letter-spacing: -.02em; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.btn-ms { display: inline-flex; align-items: center; gap: 10px; padding: 12px 22px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); font-weight: 600; box-shadow: var(--shadow-sm); transition: background .15s, transform .15s; }
.btn-ms:hover { background: var(--hover); transform: translateY(-1px); }
.ms-logo { display: grid; grid-template-columns: 9px 9px; gap: 2px; }
.ms-logo i { width: 9px; height: 9px; display: block; }
.ms-logo i:nth-child(1) { background: #f25022; } .ms-logo i:nth-child(2) { background: #7fba00; }
.ms-logo i:nth-child(3) { background: #00a4ef; } .ms-logo i:nth-child(4) { background: #ffb900; }
.login .err { margin-top: 16px; font-size: 14px; }

/* Animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.92); } 50% { opacity: .6; transform: scale(1.08); } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -150% 0; } }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* Layar sentuh: area ketuk lebih besar, tanpa petunjuk keyboard */
@media (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .item { min-height: 48px; }
  .item .more { width: 40px; height: 40px; }
  .actions button { width: 40px; height: 40px; }
  .btn-new kbd { display: none; }
  .btn, .card .ac-pushButton { padding: 9px 16px !important; }
  .menu button { padding: 12px 12px; }
}

/* ---------------- Tablet / HP: sidebar jadi laci ---------------- */
@media (max-width: 1024px) {
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; margin-left: 0 !important; transform: translateX(-105%); box-shadow: var(--shadow); width: min(86vw, 320px); }
  .sidebar.open { transform: none; }
  .thread { padding: 4px 14px 24px; }
}
@media (max-width: 560px) {
  .msg { gap: 9px; }
  .to-bottom { bottom: 104px; }
}

/* ================= Identitas per orang (layar masuk, ganti PIN) ================= */
.person-card { text-align: left; }
.person-card .logo, .person-card h1, .person-card > p { text-align: center; }
.person-card h1 { font-size: 24px; }
.person-card > p { margin-bottom: 18px; }
.logo.lock { background: linear-gradient(135deg, var(--accent-2), var(--accent-3)); }
.logo.lock svg.i { width: 26px; height: 26px; }
.acct-chip { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 auto 18px; padding: 6px 12px; width: fit-content; max-width: 100%;
  border: 1px solid var(--border); border-radius: 999px; font-size: 13px; color: var(--muted); background: var(--panel); }
.acct-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13.5px; font-weight: 600; }
.field > span small { font-weight: 400; color: var(--muted); }
.field input, .field select {
  font: inherit; font-size: 16px; font-weight: 400; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 12px; outline: none; width: 100%; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.pin-wrap { position: relative; display: block; }
.pin-wrap input { padding-right: 46px; letter-spacing: .12em; }
.peek { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; background: none; color: var(--muted); border-radius: 8px; display: grid; place-items: center; }
.peek:hover { color: var(--text); background: var(--hover); }
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px 18px; border: 0; border-radius: 12px;
  background: var(--accent); color: #fff; font-weight: 650; transition: filter .15s, opacity .15s; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-primary.sm { width: auto; padding: 9px 16px; font-size: 14px; border-radius: 10px; }
.btn-primary.busy { pointer-events: none; opacity: .75; }
.btn-primary.busy::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; border-top-color: transparent; animation: spin .8s linear infinite; }
.btn-outline { padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); font-size: 14px; font-weight: 600; }
.btn-outline:hover { background: var(--hover); }
.btn-ghost { display: block; width: 100%; margin-top: 10px; padding: 11px 18px; border: 1px solid var(--border); border-radius: 12px;
  background: none; color: var(--text); font-size: 14.5px; font-weight: 600; }
.btn-ghost:hover { background: var(--hover); }
.link-btn { display: block; margin: 14px auto 0; border: 0; background: none; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--text); }
.hint { font-size: 12.5px; color: var(--muted); text-align: center; margin: 14px 0 0 !important; }
.person-card .err { text-align: center; margin-top: 12px; min-height: 1em; }
.rules { list-style: none; margin: 2px 0 16px; padding: 0; display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.rules li { display: flex; align-items: center; gap: 8px; }
.rules li::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); flex: none; transition: all .15s; }
.rules li.ok { color: var(--text); }
.rules li.ok::before { border-color: var(--accent); background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center/10px no-repeat; }
.rules li.bad { color: var(--danger); }
.rules li.bad::before { border-color: var(--danger); }

/* Lencana peran di tombol akun */
.role-badge { display: inline-block !important; margin-top: 3px; font-size: 10.5px !important; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--accent) !important; background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; width: fit-content; }

/* ================= Kelola pengguna ================= */
.admin { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 20px 28px; animation: fade .25s ease both; }
.admin-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; max-width: 1100px; margin: 0 auto 14px; }
.admin-head h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.muted { color: var(--muted); font-size: 13.5px; margin: 2px 0 0; display: block; }
.admin-filters { display: flex; gap: 8px; flex-wrap: wrap; max-width: 1100px; margin: 0 auto 12px; }
.admin-filters .search { flex: 1 1 220px; }
.admin-filters select { font: inherit; font-size: 14px; color: var(--text); background: var(--hover); border: 1px solid transparent; border-radius: 10px; padding: 8px 10px; }
.table-wrap { max-width: 1100px; margin: 0 auto; border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; background: var(--bg); }
.utable { width: 100%; border-collapse: collapse; font-size: 14px; }
.utable th { position: sticky; top: 0; background: var(--panel); text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; white-space: nowrap; z-index: 1; }
.utable td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: middle; }
.utable tr:hover td { background: var(--hover); }
.utable td.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.utable td .nm { font-weight: 600; }
.utable td .sub { color: var(--muted); font-size: 12px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; background: var(--hover); color: var(--muted); }
.meter-wrap { margin: 10px 0 14px; }
.meter-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.meter-bar { height: 8px; border-radius: 999px; background: var(--hover); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .3s; }
.meter-fill.warn { background: #f59e0b; }
.meter-fill.bad { background: var(--danger); }
a.pill { text-decoration: none; cursor: pointer; }
a.pill:hover { filter: brightness(0.92); }
.pill.role-SUPER_ADMIN { background: color-mix(in srgb, var(--accent-3) 18%, transparent); color: var(--accent-3); }
.pill.role-SHOP_ADMIN { background: color-mix(in srgb, var(--accent-2) 18%, transparent); color: var(--accent-2); }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #d97706; }
.pill.bad { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.pill.off { background: var(--hover); color: var(--muted); }
.row-btn { border: 1px solid var(--border); background: var(--bg); border-radius: 8px; padding: 5px 12px; font-size: 13px; font-weight: 600; }
.row-btn:hover { background: var(--hover); }

/* Dialog */
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; animation: fade .15s ease both;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.modal-card { width: min(100%, 640px); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 18px 20px; animation: rise .25s ease both; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; margin: 2px 0 14px; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 40px; height: 22px; border-radius: 999px; background: var(--active); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }
.modal-card .danger { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border)); border-radius: 12px; }
.modal-card .danger b { display: block; font-size: 14px; }
.danger-btn { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); white-space: nowrap; }
.danger-btn.armed { background: var(--danger); color: #fff; }
.modal-card .err { margin-top: 10px; min-height: 1em; font-size: 14px; }

@media (max-width: 700px) {
  .admin { padding: 4px 12px 24px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-card .danger { flex-direction: column; align-items: flex-start; }
  /* tabel jadi kartu */
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  .utable thead { display: none; }
  .utable, .utable tbody, .utable tr, .utable td { display: block; width: 100%; }
  .utable tr { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--bg); position: relative; }
  .utable tr:hover td { background: transparent; }
  .utable td { border: 0; padding: 2px 0; }
  .utable td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 12px; }
  .utable td.act { position: absolute; top: 10px; right: 10px; width: auto; }
}

/* ================= Layar sambutan (login) ================= */
.login-split { position: relative; margin: auto; width: 100%; max-width: 1060px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  gap: clamp(28px, 6vw, 72px); align-items: center; }
.login > .login-card { margin: auto; }
.login-split .login-card { justify-self: end; }
.hero { position: relative; display: grid; grid-template-columns: minmax(150px, 40%) minmax(0, 1fr); gap: 8px 28px; align-items: center; animation: rise .6s ease both; }
.hero-art { width: 100%; max-height: min(46vh, 380px); object-fit: contain; object-position: bottom; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .12)); user-select: none; -webkit-user-drag: none; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.hero-title { margin: 6px 0 8px; font-size: clamp(34px, 5vw, 52px); line-height: 1.02; letter-spacing: -.03em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-copy { text-align: left; }
.hero .hero-copy .hero-tag { color: var(--text); }
.hero-tag { margin: 0 0 12px; font-size: clamp(17px, 2vw, 21px); font-weight: 650; line-height: 1.3; letter-spacing: -.01em; }
.hero-sub { margin: 0 0 16px; color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.hero-chips { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-chips li { padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--panel); }
.hero-chips li.soon { color: var(--muted); border-style: dashed; font-weight: 500; background: none; }
.hero-full { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); letter-spacing: .01em; }
.hero-full b { color: var(--accent); font-weight: 800; }
.trial-note { margin: 0 0 14px; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.45; color: #92400e; background: #fef3c7; border: 1px solid #fcd34d; text-align: left; }
:root[data-theme="dark"] .trial-note { color: #fcd34d; background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .35); }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.side-trial { margin: 0 0 6px; padding: 5px 9px; border-radius: 8px; font-size: 11.5px; line-height: 1.4; color: #92400e; background: #fef3c7; }
:root[data-theme="dark"] .side-trial { color: #fcd34d; background: rgba(245, 158, 11, .12); }

@media (max-width: 880px) {
  .login-split { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .login-split .login-card { justify-self: center; }
  .hero { grid-template-columns: minmax(96px, 30%) minmax(0, 1fr); gap: 4px 18px; max-width: 520px; margin: 0 auto; }
  .hero-art { max-height: 190px; }
  .hero-sub, .hero-full { display: none; }
  .hero-chips { margin-bottom: 0; }
}
@media (max-width: 480px) {
  .login { padding: 16px; }
  .login-card { padding: 24px 20px; border-radius: 18px; }
  .hero { grid-template-columns: 84px minmax(0, 1fr); gap: 0 14px; }
  .hero-title { font-size: 30px; margin-bottom: 4px; }
  .hero-tag { font-size: 15px; margin-bottom: 10px; }
  .hero-chips li { font-size: 11.5px; padding: 4px 10px; }
}

/* Nama panjang di tombol akun boleh dua baris */
.who b#userName { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.role-badge[hidden] { display: none !important; }

/* Sambutan di jendela chat: logo Maestro, nama kapital, arti kecil di bawahnya */
.welcome .welcome-art { display: block; height: clamp(96px, 16vh, 138px); width: auto; margin: 0 auto 10px; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .14)); user-select: none; -webkit-user-drag: none; }
.welcome .w-brand { font-size: 13px; font-weight: 800; letter-spacing: .32em; text-indent: .32em; color: var(--accent); }
.welcome .w-full { margin: 4px auto 18px; max-width: 460px; font-size: 11px; line-height: 1.5; color: var(--muted); }
.welcome .w-full b { color: var(--accent); font-weight: 800; }
#brandName, #agentName { text-transform: uppercase; letter-spacing: .08em; }

/* ================= Kelola pengguna: tambahan (dialog, pager, impor, audit) ================= */
#messages[hidden], #composerWrap[hidden], .admin[hidden], .modal[hidden] { display: none !important; }
.admin-head .btn-outline { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 13.5px; }
.admin-head .btn-outline .i, .admin-head .btn-primary .i { width: 16px; height: 16px; }
.pager { display: flex; align-items: center; gap: 8px; max-width: 1100px; margin: 12px auto 0; }
.pager .btn-outline { padding: 6px 12px; font-size: 13px; }
.pager .btn-outline:disabled { opacity: .45; cursor: default; }
.modal-card.small { width: min(100%, 400px); }
.modal-card.wide { width: min(100%, 900px); }
.modal-note { margin: 0 0 12px; line-height: 1.5; }
.modal-foot .grow { flex: 1; }
.import-pick { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13.5px; }
.link-btn.inline { display: inline; margin: 0; }
#importText { width: 100%; box-sizing: border-box; font: 12.5px/1.45 ui-monospace, Consolas, monospace; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; resize: vertical; }
.import-sum { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.table-wrap.short { max-height: 260px; margin: 0; }
.utable td.chg { font-size: 12.5px; color: var(--muted); max-width: 340px; }
.utable td.chg b { color: var(--text); font-weight: 600; }
.modal-card .field input:disabled, .modal-card .field select:disabled { opacity: .6; }
#userModal .modal-foot .btn-outline[hidden], #userModal .btn-primary[hidden] { display: none; }

/* ================= Admin Center: pengalih area + navigasi (drawer admin) ================= */
.pane { display: contents; }
.pane[hidden], .mode-tabs[hidden], .mode-tab[hidden], .nav-item[hidden], .nav-label[hidden] { display: none !important; }
.admin-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; }
.mode-tabs { display: flex; gap: 4px; padding: 4px; background: var(--hover); border-radius: 12px; }
.mode-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 8px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .15s, color .15s; }
.mode-tab .i { width: 16px; height: 16px; }
.mode-tab:hover { color: var(--text); }
.mode-tab.active { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); }
.nav-group { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 8px; }
.nav-group + .nav-group { border-top: 1px solid var(--border); padding-top: 10px; }
.nav-group[hidden] { display: none !important; }
.nav-label { margin: 2px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.crumb { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 3px; }
.nav-item { text-decoration: none; display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px; background: none; font-size: 14px; text-align: left; color: var(--text); }
.nav-item .i { width: 18px; height: 18px; color: var(--muted); flex: none; }
.nav-item:hover:not(:disabled) { background: var(--hover); }
.nav-item.active { background: var(--hover); color: var(--accent); font-weight: 600; }
.nav-item.active .i { color: var(--accent); }
.nav-item:disabled { color: var(--muted); cursor: default; opacity: .8; }
.nav-item .pill.soon { margin-left: auto; background: var(--hover); color: var(--muted); font-size: 10.5px; padding: 1px 7px; border: 1px dashed var(--border); }
#newChat2[hidden] { display: none !important; }
/* Pendaftaran orang baru (Register) dan antrean persetujuan */
.admin-note { max-width: 1100px; margin: -4px auto 12px; font-size: 13px; }
.admin-sec[hidden] { display: none; }
.field textarea { font: inherit; font-size: 15px; font-weight: 400; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; outline: none; width: 100%; resize: vertical; transition: border-color .15s, box-shadow .15s; }
.field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input[type="file"] { padding: 8px 10px; font-size: 14px; }
.btn-knowledge { margin-bottom: 8px; }
/* Settings: satu kartu per kelompok, tiap pengaturan = baris (keterangan | kontrol | tombol) */
.set-jump { display: flex; flex-wrap: wrap; gap: 8px; max-width: 1100px; margin: 0 auto 14px; }
.jump-chip { border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 600; }
.jump-chip:hover { background: var(--hover); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); color: var(--accent); }
.set-alert { max-width: 1100px; margin: 0 auto 14px; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; color: var(--text);
  border: 1px solid color-mix(in srgb, #f59e0b 45%, var(--border)); background: color-mix(in srgb, #f59e0b 11%, transparent); }
.set-alert[hidden] { display: none; }
.set-card { max-width: 1100px; margin: 0 auto 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); overflow: hidden; scroll-margin-top: 8px; }
.set-card-head { display: flex; align-items: baseline; gap: 10px; padding: 12px 18px; background: var(--panel); border-bottom: 1px solid var(--border); }
.set-card-head .muted { margin: 0; font-size: 12.5px; }
.set-group { margin: 0; font-size: 15px; letter-spacing: .01em; }
.set-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, 300px) 130px; gap: 8px 22px; align-items: start; padding: 16px 18px; border-top: 1px solid var(--border); }
.set-item:first-child { border-top: 0; }
.set-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.set-title b { font-size: 14.5px; }
.set-info .hlp { color: var(--muted); font-size: 12.5px; margin-top: 4px; max-width: 520px; line-height: 1.5; }
.set-info .rng { color: var(--muted); font-size: 12px; margin-top: 4px; }
.set-info .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.set-ctl { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 0; }
.set-ctl input:not([type="checkbox"]), .set-ctl select, .set-ctl textarea { font: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 11px; width: 100%; box-sizing: border-box; outline: none; transition: border-color .15s, box-shadow .15s; }
.set-ctl input:not([type="checkbox"]):focus, .set-ctl select:focus, .set-ctl textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.set-ctl textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.set-ctl [hidden] { display: none !important; }
.set-ctl .switch { margin: 4px 0 0; position: relative; align-self: flex-start; }
.set-ctl .sw-text { font-weight: 600; min-width: 2.2em; }
.set-warn { font-size: 12.5px; color: #b45309; line-height: 1.4; }
:root[data-theme="dark"] .set-warn { color: #fbbf24; }
.set-act { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.set-act .btn-primary.sm { width: 100%; }
.set-act button:disabled { opacity: .45; cursor: default; }
.set-act .row-btn { width: 100%; }
@media (max-width: 860px) {
  .set-item { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .set-act { flex-direction: row; }
  .set-act button { width: auto !important; flex: 1; }
}
.brand-add { display: flex; gap: 8px; max-width: 1100px; margin: 0 auto 12px; }
.brand-add input { flex: 1 1 240px; max-width: 360px; font: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.utable td.act { white-space: nowrap; }
.file-preview { margin: -6px 0 12px; font-size: 13px; word-break: break-all; }
.file-preview b { color: var(--text); font-weight: 600; }
.appeal-box { margin: 4px 0 8px; padding: 12px 14px; border: 1px solid color-mix(in srgb, #f59e0b 40%, var(--border)); background: color-mix(in srgb, #f59e0b 9%, transparent); border-radius: 12px; font-size: 14px; }
.appeal-box p { margin: 0 0 8px; line-height: 1.5; }
.appeal-box p:last-child { margin-bottom: 0; }
.appeal-box[hidden] { display: none; }
.utable td .why { color: var(--muted); font-size: 12.5px; max-width: 320px; }
.bell { position: relative; }
.bell[hidden] { display: none; }
.bell-badge { position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 16px; text-align: center; pointer-events: none; }
.bell-badge[hidden] { display: none; }
.nav-item .nav-badge { margin-left: auto; font-size: 11px; padding: 0 7px; }
.nav-item .nav-badge[hidden] { display: none; }
.logo.ok { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.logo.ok svg.i { width: 26px; height: 26px; }
#regDone { text-align: center; }
#regDone .btn-primary { margin-top: 6px; }
.rq-note { width: 150px; max-width: 100%; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; font-size: 13px; }
.rq-note:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#regCta { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); font-weight: 600; }
.hint .link-btn.inline { font-size: inherit; }

/* ================= Menu akun (tombol di dasar sidebar + popover ke atas) ================= */
.account-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 12px; background: none; text-align: left; color: inherit; font: inherit; }
.account-btn:hover, .account-btn[aria-expanded="true"] { background: var(--hover); }
.account-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.account-btn .who { flex: 1; min-width: 0; }
.account-btn .chev { color: var(--muted); display: grid; place-items: center; flex: none; }
.account-btn .chev .i { width: 16px; height: 16px; }
.menu.account { min-width: 272px; max-width: min(340px, calc(100vw - 16px)); padding: 6px; }
.menu .menu-head { padding: 8px 10px 6px; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu .menu-id { display: flex; align-items: center; gap: 10px; padding: 6px 10px 8px; }
.menu .menu-id .avatar { width: 28px; height: 28px; font-size: 11px; }
.menu .menu-id .who b, .menu .menu-id .who span { white-space: nowrap; }
.menu .menu-id .ok { color: var(--accent); width: 18px; height: 18px; flex: none; }
.menu .sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu button .i { width: 18px; height: 18px; color: var(--muted); flex: none; }
.menu button.danger .i { color: var(--danger); }
.menu button .mhint { margin-left: auto; color: var(--muted); font-size: 12px; }
.kbd-list { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 4px 0 0; font-size: 14px; align-items: center; }
.kbd-list dt { white-space: nowrap; } .kbd-list dd { margin: 0; color: var(--muted); }
kbd { font: 11.5px/1 ui-monospace, Consolas, monospace; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 3px 6px; background: var(--bg-2); }

/* ================= Folder obrolan ================= */
.group.with-btn { display: flex; align-items: center; justify-content: space-between; padding-right: 4px; }
.mini-btn { border: 0; background: none; color: var(--muted); width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; }
.mini-btn:hover { background: var(--hover); color: var(--text); }
.mini-btn .i { width: 16px; height: 16px; }
.folder-row { display: flex; align-items: center; gap: 6px; padding: 0 4px 0 6px; border-radius: 10px; cursor: pointer; min-height: 38px; position: relative; user-select: none; }
.folder-row:hover { background: var(--hover); }
.folder-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.folder-row .chv { width: 14px; height: 14px; color: var(--muted); flex: none; transition: transform .15s; }
.folder-row.closed .chv { transform: rotate(-90deg); }
.folder-row .fico { width: 17px; height: 17px; color: var(--accent); flex: none; }
.folder-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.folder-row .count { font-size: 12px; color: var(--muted); }
.folder-row .more { border: 0; background: none; color: var(--muted); border-radius: 8px; width: 28px; height: 28px; display: grid; place-items: center; opacity: 0; }
.folder-row:hover .more, .folder-row .more:focus-visible { opacity: 1; }
.folder-row .more:hover { background: var(--bg); color: var(--text); }
.folder-row.editing { cursor: default; padding-left: 8px; }
.folder-row.editing input.rename { flex: 1; margin: 4px 0; }
.folder-children { margin: 0 0 4px 12px; padding-left: 8px; border-left: 1px solid var(--border); }
.folder-empty { font-size: 12.5px; color: var(--muted); padding: 6px 8px 8px; line-height: 1.4; }
.folder-row.drop, .folder-children.drop { background: var(--accent-soft); outline: 1.5px dashed var(--accent); outline-offset: -1.5px; }
.item.dragging { opacity: .45; }
@media (pointer: coarse) { .folder-row .more { opacity: 1; width: 40px; height: 40px; } .folder-row { min-height: 46px; } }

/* ================= Knowledge review (admin): antrean + pratinjau PDF di halaman ================= */
.rv-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; max-width: 1280px; margin: 0 auto; align-items: start; }
.rv-viewer { min-width: 0; }
.rv-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rv-tabs { display: inline-flex; gap: 4px; padding: 3px; background: var(--hover); border-radius: 10px; }
.rv-tab { border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 8px; }
.rv-tab.static { color: var(--text); }
.rv-tab:hover:not(.static) { color: var(--text); }
.rv-tab.active { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); }
.rv-bar .btn-outline.sm { padding: 6px 12px; font-size: 13px; }
.rv-bar .btn-outline:disabled { opacity: .5; cursor: default; }
.rv-frame { position: relative; height: calc(100dvh - 250px); min-height: 440px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.rv-frame iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.rv-state { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; color: var(--muted); font-size: 14px; background: var(--panel); }
.rv-state[hidden] { display: none; }
.rv-hint { margin: 6px 2px 0; font-size: 12.5px; }
.rv-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rv-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); padding: 14px 16px; }
.rv-card[hidden] { display: none; }
.rv-card h3 { margin: 0 0 6px; font-size: 15px; }
.rv-card p { margin: 0 0 10px; line-height: 1.5; font-size: 13.5px; }
.rv-dl { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: 13.5px; }
.rv-dl dt { color: var(--muted); }
.rv-dl dd { margin: 0; word-break: break-word; }
.rv-card .field { margin: 0 0 12px; }
.rv-card .field span small { font-weight: 400; }
.rv-actions { display: flex; gap: 8px; }
.rv-actions button { flex: 1; }
.rv-actions .btn-outline { padding: 8px 14px; font-size: 14px; }
.rv-actions button:disabled { opacity: .5; cursor: default; }
.rv-pin { margin: 10px 0 0 !important; font-size: 12.5px !important; }
.btn-primary.sm[data-act="open"] { padding: 5px 14px; }
@media (max-width: 980px) {
  .rv-grid { grid-template-columns: minmax(0, 1fr); }
  .rv-frame { height: 62dvh; min-height: 320px; }
}
