/*
 * ========================================================================
 *   Onyx Chat  |  Developed by Dr. Anmol Agarwal
 *   https://dranmolagarwal.com
 *   File: public/css/onyx.css
 * ========================================================================
 */
:root {
  --white: #FFFFFF;
  --paper: #F5F7FA;
  --line: #E3E7EE;
  --line-strong: #CBD2DD;
  --soft: #E9EDF3;
  --ink: #0B0E14;
  --ink-2: #1B2030;
  --ink-3: #3B4252;
  --muted: #5B6477;
  --violet: #7C3AED;
  --violet-deep: #6D28D9;
  --violet-tint: #EDE7FD;
  --violet-text: #5B21B6;
  --rose: #BE123C;
  --rose-tint: #FFE4E8;
  --green: #0B6B60;
  --green-tint: #DDF6F2;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Newsreader', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--white); font-size: 15px; line-height: 1.5; }
a { color: var(--violet-deep); }
button { font-family: inherit; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }

/* Signature strip: six facets of the Onyx mark, clockwise from the top */
.strip { height: 4px; background: linear-gradient(90deg, #7C3AED 0 16.66%, #D946EF 0 33.33%, #F59E0B 0 50%, #14B8A6 0 66.66%, #3B82F6 0 83.33%, #F43F5E 0 100%); }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent; font-size: 14px; font-weight: 600; text-decoration: none; }
.btn-primary { background: var(--violet); color: #fff; }
.btn-primary:hover { background: var(--violet-deep); }
.btn-outline { background: var(--white); color: var(--violet-deep); border-color: var(--violet); }
.btn-danger { background: var(--rose-tint); color: var(--rose); }
.btn-light { background: #fff; color: var(--violet-text); }
.btn-small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 12px; font: inherit; color: var(--ink); background: var(--white); }
.input:focus, .composer-box:focus-within { outline: 2px solid var(--violet); outline-offset: 1px; }
textarea.input { min-height: 140px; font-family: var(--mono); font-size: 13px; line-height: 1.6; }
.error-text { color: var(--rose); font-size: 13px; }
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; }
.alert.ok { background: var(--green-tint); color: var(--green); }
.alert.bad { background: var(--rose-tint); color: var(--rose); }
.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--ink-3); }
.badge.ok { background: var(--violet-tint); color: var(--violet-text); }
.badge.off { background: var(--rose-tint); color: var(--rose); }

/* Impersonation banner */
.imp-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; padding: 8px 16px; background: var(--ink); color: #fff; font-size: 14px; }
.imp-banner form { margin: 0; }

/* Login */
.auth-wrap { min-height: calc(100vh - 4px); display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--paper); }
.auth-card { width: 100%; max-width: 400px; background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: 0 8px 30px rgba(11, 14, 20, 0.06); }
.auth-card h1 { margin: 16px 0 4px; font-size: 24px; letter-spacing: -0.02em; }
.auth-card p.sub { margin: 0 0 24px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; font-size: 14px; color: var(--ink-3); }

/* Admin */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--white); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.topnav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.topnav a { display: flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 10px; color: var(--ink-3); text-decoration: none; font-weight: 500; }
.topnav a.active { background: var(--violet-tint); color: var(--violet-text); font-weight: 600; }
.topbar form { margin: 0; }
.container { max-width: 1100px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 24px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 20px; }
.card h2 { margin: 0 0 12px; font-size: 16px; }
.stat .label { color: var(--muted); font-size: 14px; }
.stat .value { font-size: 30px; font-weight: 700; margin-top: 4px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 10px 12px; background: var(--paper); }
.table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table form { display: inline; margin: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.form-narrow { max-width: 560px; }
.two-col { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.search { display: flex; gap: 8px; }
.pagination { margin-top: 16px; }

/* Customer app shell */
.app { display: flex; height: calc(100vh - 4px); }
.sidebar { width: 280px; flex: none; background: var(--paper); border-right: 1px solid var(--line); padding: 18px 14px 14px; display: flex; flex-direction: column; gap: 14px; overflow: hidden; }
.side-top { display: flex; align-items: center; padding: 0 8px; }
.new-chat { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border-radius: 14px; background: var(--violet); color: #fff; text-decoration: none; font-weight: 600; box-shadow: 0 4px 14px rgba(124, 58, 237, 0.28); }
.side-search { display: flex; gap: 8px; }
.side-search input { flex: 1; min-width: 0; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; font: inherit; background: var(--white); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--ink-2); text-decoration: none; }
.side-nav a.active { background: var(--violet-tint); color: var(--violet-text); font-weight: 600; box-shadow: inset 3px 0 0 var(--violet); }
.convs { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.group-label { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 10px 12px 2px; }
.conv { display: block; min-height: 40px; line-height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid transparent; color: var(--ink-3); text-decoration: none; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.active { background: var(--white); border-color: var(--line); color: var(--ink); font-weight: 600; }
.side-foot { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.meter-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.meter { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 6px; }
.meter span { display: block; height: 100%; background: var(--violet); border-radius: 999px; }
.me { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--violet-tint); color: var(--violet-text); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; }
.me .name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.me .role { font-size: 13px; color: var(--muted); }
.me form { margin: 0 0 0 auto; }
.link-btn { background: none; border: 0; color: var(--muted); font-size: 13px; padding: 8px; min-height: 40px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--white); }
.main-head { display: flex; align-items: center; gap: 12px; padding: 10px 20px; min-height: 56px; }
.head-title { font-weight: 600; font-size: 15px; }
.head-title[data-editable] { cursor: text; }
.main-head form { margin: 0 0 0 auto; }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.icon-btn:hover { background: var(--paper); }
.menu-btn { display: none; }

.messages { flex: 1; overflow-y: auto; padding: 16px 20px; }
.thread { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 26px; }
.msg-user { align-self: flex-end; max-width: 80%; background: var(--soft); border-radius: 20px; padding: 12px 18px; font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-assistant { font-family: var(--serif); font-size: 19px; line-height: 1.65; color: var(--ink-2); overflow-wrap: anywhere; white-space: pre-wrap; }
.msg-assistant.rendered { white-space: normal; }
.msg-assistant p { margin: 0 0 12px; }
.msg-assistant ul, .msg-assistant ol { margin: 0 0 12px; padding-left: 24px; }
.msg-assistant h4 { margin: 18px 0 8px; font-family: var(--sans); font-size: 16px; }
.msg-assistant code { font-family: var(--mono); font-size: 0.85em; background: var(--soft); padding: 1px 6px; border-radius: 6px; }
.msg-assistant pre.codeblock { margin: 0 0 14px; padding: 14px 16px; background: var(--ink); color: #ECEEF4; border-radius: 12px; overflow-x: auto; }
.msg-assistant pre.codeblock code { background: none; padding: 0; font-size: 13.5px; line-height: 1.6; color: inherit; }
.msg-assistant.typing::after { content: ''; display: inline-block; width: 8px; height: 18px; margin-left: 4px; vertical-align: -3px; background: var(--violet); border-radius: 2px; animation: blink 1s steps(2) infinite; }
.msg-assistant .err, .msg-assistant.error { color: var(--rose); font-family: var(--sans); font-size: 15px; }
@keyframes blink { 50% { opacity: 0; } }
.empty { max-width: 720px; margin: 12vh auto 0; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 28px; letter-spacing: -0.02em; margin: 16px 0 6px; }

.composer-wrap { padding: 8px 20px 6px; }
.composer-box { max-width: 720px; margin: 0 auto; background: var(--white); border: 1px solid var(--line-strong); border-radius: 28px; padding: 14px 14px 10px 18px; box-shadow: 0 4px 20px rgba(11, 14, 20, 0.08); }
.composer-box textarea { width: 100%; border: 0; outline: 0; resize: none; font: inherit; font-size: 17px; line-height: 1.5; max-height: 200px; min-height: 28px; background: transparent; color: var(--ink); }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.round { width: 44px; height: 44px; border: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--line); color: var(--ink); }
.round.primary { background: var(--violet); color: #fff; }
.round:disabled { opacity: 0.5; cursor: default; }
.fineprint { text-align: center; font-size: 13px; color: #6B7385; padding: 4px 20px 14px; }

/* Memory page */
.memory-layout { display: flex; gap: 24px; padding: 8px 24px 40px; overflow-y: auto; flex-wrap: wrap; align-items: flex-start; }
.memory-list { flex: 1 1 280px; max-width: 360px; }
.memory-edit { flex: 999 1 420px; min-width: 0; }
.memory-list a { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--ink-3); border: 1px solid transparent; }
.memory-list a.active { background: var(--violet-tint); border-color: var(--violet); }
.memory-list .path { font-family: var(--mono); font-size: 13px; color: var(--ink); }
.memory-list .meta { font-size: 12px; color: var(--muted); }

.scrim { display: none; }

@media (max-width: 820px) {
  .sidebar { position: fixed; z-index: 20; left: 0; top: 4px; bottom: 0; transform: translateX(-100%); transition: transform 0.2s; width: 300px; max-width: 86vw; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 10; background: rgba(11, 14, 20, 0.4); }
  .menu-btn { display: inline-flex; }
  .two-col { grid-template-columns: 1fr; }
  .msg-assistant { font-size: 18px; }
}

/* Model picker */
.picker { position: relative; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--line); font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); }
.chip-sub { font-weight: 500; color: var(--muted); }
.pop { position: absolute; left: 0; bottom: calc(100% + 10px); z-index: 30; width: 380px; max-width: calc(100vw - 32px); max-height: min(70vh, 560px); overflow-y: auto; background: var(--white); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 40px rgba(11, 14, 20, 0.14); padding: 8px; }
.pick-item { display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border: 0; border-radius: 12px; background: var(--white); color: var(--ink); }
.pick-item:hover { background: var(--paper); }
.pick-item.selected { background: var(--violet-tint); }
.pick-item.slim { align-items: center; min-height: 48px; padding: 0 14px; }
.pick-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pick-name { font-weight: 700; font-size: 16px; }
.pick-item.slim .pick-name { font-size: 15px; font-weight: 600; }
.pick-desc { font-size: 14px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--soft); border-radius: 999px; padding: 2px 9px; }
.tick { visibility: hidden; color: var(--violet-deep); font-weight: 700; }
.selected > .tick { visibility: visible; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--violet); }
.dot-comet { background: #14B8A6; } .dot-orbit { background: #7C3AED; } .dot-nova { background: #3B82F6; } .dot-galaxy { background: #D946EF; }
.pop-sep { height: 1px; background: var(--line); margin: 6px 8px; }
.pop-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--white); color: var(--ink); font-size: 15px; font-weight: 600; text-align: left; }
button.pop-row:hover { background: var(--paper); }
.pop-row .muted { color: var(--muted); font-weight: 500; font-size: 14px; }
.row-title { display: block; }
.row-sub { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
#long-row { min-height: 56px; }
#long-row.disabled { opacity: 0.5; }
.switch { width: 44px; height: 26px; padding: 3px; border: 0; border-radius: 999px; background: var(--line-strong); display: inline-flex; align-items: center; flex: none; }
.switch span { width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch[aria-checked="true"] { background: var(--violet); }
.switch[aria-checked="true"] span { transform: translateX(18px); }
.pop-back { border: 0; background: none; min-height: 44px; padding: 0 14px; color: var(--violet-deep); font-weight: 600; font-size: 14px; }
.pop-note { margin: 0; padding: 4px 14px 10px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.pop-group { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 12px 14px 4px; }
.pill { margin-left: 10px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--ink-3); border-radius: 6px; padding: 2px 8px; }
.pill.warn { background: var(--rose-tint); color: var(--rose); }

/* Rendered answers: tables, quotes, rules, links */
.msg-assistant h3, .msg-assistant h4, .msg-assistant h5 { font-family: var(--sans); color: var(--ink); line-height: 1.3; margin: 20px 0 8px; }
.msg-assistant h3 { font-size: 22px; } .msg-assistant h4 { font-size: 18px; } .msg-assistant h5 { font-size: 16px; }
.msg-assistant li > ul, .msg-assistant li > ol { margin: 6px 0 4px; }
.msg-assistant li { margin-bottom: 4px; }
.msg-assistant a { color: var(--violet-deep); text-decoration: underline; text-underline-offset: 2px; }
.msg-assistant hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.msg-assistant blockquote { margin: 0 0 14px; padding: 2px 0 2px 16px; border-left: 3px solid var(--violet); color: var(--ink-3); }
.msg-assistant blockquote p:last-child { margin-bottom: 0; }
.table-scroll { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 12px; -webkit-overflow-scrolling: touch; }
.md-table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: 14.5px; line-height: 1.45; min-width: 320px; }
.md-table th { text-align: left; background: var(--paper); color: var(--ink); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.md-table td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
.md-table tbody tr:first-child td { border-top: 0; }
.md-table td code, .md-table th code { white-space: nowrap; }

/* Code blocks: line height must be set on the block itself, or each line takes the 19px body line box */
.msg-assistant pre.codeblock { font-family: var(--mono); font-size: 13.5px; line-height: 1.6; white-space: pre; tab-size: 4; }
.msg-assistant pre.codeblock code { font-size: inherit; line-height: inherit; }

/* App shell with the Onyx GPT top bar */
.app-body { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.app-body .app { flex: 1; height: auto; min-height: 0; }
.topbar-app { flex: none; display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 12px 0 20px; background: var(--white); border-bottom: 1px solid var(--line); position: relative; z-index: 15; }
.topbar-app .brand { flex: none; }
.crumb-sep { color: var(--line-strong); font-size: 20px; flex: none; }
.topbar-app .head-title { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt-wrap { position: relative; flex: none; }
.opt-wrap .icon-btn { font-size: 22px; line-height: 1; }
.opt-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 170px; background: var(--white); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px rgba(11, 14, 20, 0.14); padding: 6px; z-index: 40; }
.opt-menu form { margin: 0; }
.opt-item { display: block; width: 100%; min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--white); text-align: left; font-size: 15px; font-weight: 500; color: var(--ink); }
.opt-item:hover { background: var(--paper); }
.opt-item.danger { color: var(--rose); }
.memory-bar { display: flex; justify-content: flex-end; padding: 12px 24px 0; }
.composer-wrap { padding-bottom: calc(6px + env(safe-area-inset-bottom)); }

/* Effort slider */
.effort-box { padding: 12px 14px 8px; }
.effort-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.effort-head .row-title { font-size: 15px; font-weight: 600; }
.effort-val { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--violet-deep); }
.range { --p: 25%; -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 6px; margin: 11px 0; border-radius: 999px; background: linear-gradient(to right, var(--violet) var(--p), var(--line) var(--p)); outline: none; cursor: pointer; touch-action: pan-y; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 3px solid var(--violet); box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35); }
.range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--violet); box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35); }
.range:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--violet); outline-offset: 3px; }
.effort-scale { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; }
.effort-warn { margin: 12px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--rose-tint); color: var(--rose); font-size: 13px; }
.effort-note { margin: 10px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5; }

/* Code block copy button */
.code-wrap { position: relative; margin: 0 0 14px; }
.code-wrap pre.codeblock { margin: 0; padding-top: 34px; }
.copy-btn { position: absolute; top: 6px; right: 8px; min-height: 28px; padding: 0 10px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, 0.12); color: #ECEEF4; font-size: 12px; font-weight: 600; }
.copy-btn:hover { background: rgba(255, 255, 255, 0.22); }

@media (max-width: 820px) {
  .topbar-app { padding-left: 4px; gap: 6px; }
  .topbar-app .brand span { font-size: 16px; }
  .memory-bar { padding: 12px 16px 0; }
}

/* Attachments */
.main { position: relative; }
.row-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.attach { position: relative; }
#attach-btn[aria-expanded="true"] { background: var(--violet-tint); color: var(--violet-text); }
.att-pop { position: absolute; left: 0; bottom: calc(100% + 10px); z-index: 30; width: 270px; max-width: calc(100vw - 32px); background: var(--white); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgba(11, 14, 20, 0.14); padding: 6px; }
.att-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--white); color: var(--ink); font: inherit; font-size: 15px; font-weight: 500; text-align: left; }
.att-item:hover, .att-item:focus-visible { background: var(--violet-tint); }
.att-item svg { color: var(--violet-deep); flex: none; }
.att-cam { display: none; }
@media (pointer: coarse) { .att-cam { display: flex; } }
.att-limits { margin: 0; padding: 4px 12px 8px; font-size: 12px; line-height: 1.45; color: var(--muted); }

.att-strip { display: flex; flex-wrap: wrap; gap: 12px 10px; padding: 4px 0 12px; max-height: 220px; overflow-y: auto; }
.att-chip { position: relative; display: flex; align-items: center; gap: 10px; min-height: 64px; max-width: 250px; padding: 0 14px 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.att-chip.is-image { padding: 0; width: 64px; max-width: 64px; overflow: visible; }
.att-chip .thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--soft); display: block; }
.att-chip.err { border-color: #DC2626; background: #FEF2F2; }
.att-ext { flex: none; width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: var(--soft); color: var(--ink-3); }
.att-ext.att-pdf { background: #FEE2E2; color: #B91C1C; }
.att-ext.att-text { background: #DCFCE7; color: #15803D; }
.att-ext.att-image { background: var(--violet-tint); color: var(--violet-text); }
.att-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.att-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.att-size { font-size: 12px; color: var(--muted); }
.att-size.bad { color: #B91C1C; }
.att-bar { display: block; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; min-width: 90px; }
.att-bar > span { display: block; height: 100%; width: 0; background: var(--violet); border-radius: 3px; transition: width 0.15s; }
.att-x { position: absolute; top: -9px; right: -9px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--white); background: var(--ink); color: #fff; font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center; padding: 0; }
.att-x::after { content: ''; position: absolute; inset: -8px; }
.att-img-pct { position: absolute; left: 0; right: 0; bottom: 0; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 0 0 12px 12px; background: rgba(11, 14, 20, 0.65); color: #fff; font-size: 12px; font-weight: 600; }
.att-sum { font-size: 13px; color: var(--muted); padding: 0 4px 10px; }

.msg-user-wrap { align-self: flex-end; max-width: 80%; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.msg-user-wrap .msg-user { max-width: 100%; }
.att-sent { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.att-img img { display: block; max-width: 220px; max-height: 220px; border-radius: 14px; border: 1px solid var(--line); object-fit: cover; }
.att-file { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 14px 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); text-decoration: none; }
.att-file:hover { border-color: var(--violet); }

.drop { position: absolute; inset: 8px; z-index: 40; border: 2px dashed var(--violet); border-radius: 18px; background: rgba(124, 58, 237, 0.08); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.drop-box { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 24px; border-radius: 16px; background: rgba(255, 255, 255, 0.92); }
.drop-box strong { font-size: 20px; color: #4C1D95; }
.drop-box span { font-size: 14px; color: var(--muted); }

@media (max-width: 820px) {
  .att-pop { position: fixed; left: 0; right: 0; bottom: 0; width: auto; max-width: none; border-radius: 24px 24px 0 0; border-width: 1px 0 0; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 28px rgba(11, 14, 20, 0.18); }
  .att-item { min-height: 52px; font-size: 16px; }
  .att-chip { max-width: 100%; }
  .msg-user-wrap { max-width: 92%; }
}
