/* SACPKG chat page: calm, premium, SeneQa teal */
:root {
  --bg: #FFFFFF; --bg-2: #F7F7F4; --side: #F9F9F7; --card: #FFFFFF; --hover: #F1F2EE; --active: #E9F4F2;
  --ink: #1B1F2E; --ink-2: #4A5068; --muted: #858A9C; --faint: #B4B8C4; --line: #E8E9E4; --line-2: #DEDFD9;
  --teal: #0E8C7E; --teal-ink: #0B6F64; --teal-soft: #E7F3F1; --amber: #A76A06; --amber-soft: #FBF1DE; --red: #B4402F; --red-soft: #FBE9E6;
  --user: #F1F1EC; --code: #F5F5F1;
  --shadow-sm: 0 1px 2px rgba(20, 24, 40, .05); --shadow: 0 2px 6px rgba(20, 24, 40, .04), 0 10px 30px rgba(20, 24, 40, .07);
  --serif: "Source Serif 4", Georgia, serif; --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --r: 14px;
}
:root[data-theme="dark"] {
  --bg: #16181F; --bg-2: #1C1F27; --side: #121419; --card: #1F222B; --hover: #242833; --active: #1B3533;
  --ink: #ECEDF1; --ink-2: #BCC0CC; --muted: #8C91A1; --faint: #5B6070; --line: #2A2E39; --line-2: #343846;
  --teal: #3CC2B1; --teal-ink: #6BD6C8; --teal-soft: #17302E; --amber: #E2B05A; --amber-soft: #352A16; --red: #E58474; --red-soft: #3A211D;
  --user: #252935; --code: #1A1D25;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 2px 6px rgba(0, 0, 0, .25), 0 12px 32px rgba(0, 0, 0, .35);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181F; --bg-2: #1C1F27; --side: #121419; --card: #1F222B; --hover: #242833; --active: #1B3533;
    --ink: #ECEDF1; --ink-2: #BCC0CC; --muted: #8C91A1; --faint: #5B6070; --line: #2A2E39; --line-2: #343846;
    --teal: #3CC2B1; --teal-ink: #6BD6C8; --teal-soft: #17302E; --amber: #E2B05A; --amber-soft: #352A16; --red: #E58474; --red-soft: #3A211D;
    --user: #252935; --code: #1A1D25;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 2px 6px rgba(0, 0, 0, .25), 0 12px 32px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15.5px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
kbd { font: 500 12px var(--sans); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--card); color: var(--ink-2); }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 14px; height: 14px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; } ::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid var(--bg); }

/* ---------- sign-in ---------- */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px;
          background: radial-gradient(1200px 600px at 50% -10%, var(--teal-soft), transparent 70%), var(--bg-2); }
.signin-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 40px 32px 30px;
               text-align: center; box-shadow: var(--shadow); }
.signin-logo { height: 34px; margin: 0 auto 22px; display: block; }
.signin h1 { font: 600 30px/1.2 var(--serif); margin: 0 0 10px; letter-spacing: -.01em; }
.signin p { color: var(--ink-2); margin: 0 0 24px; }
#gbtn { display: flex; justify-content: center; min-height: 44px; }
.fine { font-size: 13px; color: var(--muted) !important; margin: 16px 0 0 !important; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 268px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 18px 18px 10px; }
.brand img { height: 26px; display: block; }
.brand .on-dark { display: none; }
:root[data-theme="dark"] .brand .on-light { display: none; } :root[data-theme="dark"] .brand .on-dark { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand .on-light { display: none; }
  :root:not([data-theme="light"]) .brand .on-dark { display: block; } }
.new-chat { margin: 6px 12px 10px; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px;
            border: 1px solid var(--line-2); background: var(--card); font-weight: 500; font-size: 14px; box-shadow: var(--shadow-sm);
            transition: border-color .15s, background .15s; }
.new-chat:hover { border-color: var(--teal); }
.chats { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.group { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--muted); padding: 14px 10px 6px; }
.chat-item { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 9px; font-size: 14px; color: var(--ink-2);
             cursor: pointer; transition: background .12s; }
.chat-item:hover { background: var(--hover); }
.chat-item.on { background: var(--active); color: var(--ink); font-weight: 500; }
.chat-item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .del { opacity: 0; border: 0; background: none; color: var(--muted); padding: 2px; border-radius: 6px; display: grid; }
.chat-item:hover .del { opacity: 1; }
.chat-item .del:hover { color: var(--red); background: var(--card); }
.side-foot { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center;
          font: 600 14px var(--sans); }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.who { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage { font-size: 12px; color: var(--muted); }
.text-btn { border: 0; background: none; color: var(--muted); font-size: 12.5px; padding: 4px 6px; border-radius: 6px; }
.text-btn:hover { color: var(--ink); background: var(--hover); }
.scrim { display: none; }
.clear-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 6px 10px; border-radius: 10px; }
.clear-btn:hover { color: var(--red); background: var(--red-soft); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.top { display: flex; align-items: center; gap: 10px; padding: 12px 18px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--ink-2); }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
#menu-btn { display: none; }
.graph-pill { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 0; border-radius: 999px;
              border: 1px solid var(--line); background: var(--card); color: var(--ink-2); font-size: 13.5px; font-weight: 500; max-width: 60vw; }
.graph-pill:hover { border-color: var(--line-2); color: var(--ink); }
.graph-pill .dot { position: absolute; left: 13px; top: 50%; margin-top: -3.5px; width: 7px; height: 7px; border-radius: 50%; background: var(--teal);
                  box-shadow: 0 0 0 3px var(--teal-soft); pointer-events: none; }
.graph-pill > .ic { position: absolute; right: 11px; top: 50%; margin-top: -7px; pointer-events: none; }   /* clicks reach the menu */
.graph-pill select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit; font: inherit; padding: 7px 32px 7px 30px;
                     border-radius: 999px;
                     cursor: pointer; outline: none; min-width: 0; max-width: 52vw; text-overflow: ellipsis; }
.graph-pill select option { color: #1B1F2E; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; padding: 6px 8px; border-radius: 10px; }
.switch:hover { color: var(--ink-2); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.track { width: 30px; height: 18px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; }
.knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .track { background: var(--teal); }
.switch input:checked + .track .knob { transform: translateX(12px); }

/* ---------- thread ---------- */
.thread { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.hello { max-width: 720px; margin: 0 auto; padding: 0 24px; text-align: center; }
.hello-mark { width: 44px; height: 44px; margin: 0 auto 18px; border-radius: 14px; background: var(--teal); color: #fff; display: grid; place-items: center;
              font: 600 22px var(--serif); box-shadow: 0 6px 18px rgba(14, 140, 126, .28); }
.hello h1 { font: 500 34px/1.2 var(--serif); letter-spacing: -.015em; margin: 0 0 8px; }
.hello p { color: var(--muted); margin: 0; font-size: 15px; }
.msgs { max-width: 760px; margin: 0 auto; padding: 8px 24px 28px; display: flex; flex-direction: column; gap: 26px; }

/* empty chat: greeting and composer centred, then cards */
.main.empty-state .thread { flex: 0 0 auto; padding-top: max(10vh, 40px); overflow: visible; }
.main.empty-state .msgs { display: none; }
.main.empty-state .dock { flex: 1; padding-top: 26px; }
.main:not(.empty-state) .hello, .main:not(.empty-state) .cards { display: none; }
.cards { max-width: 720px; margin: 18px auto 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.card { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line);
        background: var(--card); transition: border-color .15s, box-shadow .15s, transform .15s; }
.card:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.card .ci { width: 32px; height: 32px; border-radius: 9px; background: var(--teal-soft); color: var(--teal); display: grid; place-items: center; flex: none; }
.card b { display: block; font-weight: 500; font-size: 14px; color: var(--ink); margin-bottom: 2px; }
.card span { font-size: 13px; color: var(--muted); line-height: 1.45; }

.m-user { align-self: flex-end; max-width: 78%; background: var(--user); border-radius: 18px 18px 6px 18px; padding: 10px 16px;
          white-space: pre-wrap; overflow-wrap: anywhere; animation: rise .25s ease both; }
.m-user .pick { color: var(--teal-ink); background: var(--teal-soft); border-radius: 6px; padding: 0 5px; font-weight: 500; }
.m-bot { display: flex; gap: 14px; align-items: flex-start; animation: rise .35s ease both; }
.m-bot .mark { flex: none; width: 28px; height: 28px; border-radius: 9px; background: var(--teal); color: #fff; display: grid; place-items: center;
               font: 600 14px var(--serif); margin-top: 2px; }
.m-bot .body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.m-bot .body p { margin: 0 0 .75em; }
.m-bot .body p:last-child { margin-bottom: 0; }
.m-bot .body ul { margin: .25em 0 .8em; padding-left: 1.25em; }
.m-bot .body li { margin: .15em 0; }
.m-bot .body pre { background: var(--code); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto;
                   font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; }
.m-bot .body code { background: var(--code); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; font: 13px ui-monospace, Menlo, monospace; }
.m-bot .body table { border-collapse: separate; border-spacing: 0; margin: .5em 0 1em; font-size: 14px; display: block; overflow-x: auto;
                     border: 1px solid var(--line); border-radius: 10px; width: fit-content; max-width: 100%; }
.m-bot .body th, .m-bot .body td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.m-bot .body tr:last-child td { border-bottom: 0; }
.m-bot .body th { background: var(--bg-2); font-weight: 600; font-size: 13px; color: var(--ink-2); }
.answer { font-size: 15.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 3px 10px 3px 8px; border-radius: 999px;
        background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line); }
.chip .ic { width: 13px; height: 13px; stroke-width: 2.2; }
.chip.exact { background: var(--teal-soft); color: var(--teal-ink); border-color: transparent; }
.chip.agent { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.chip.none { background: var(--red-soft); color: var(--red); border-color: transparent; }
.note { color: var(--muted); font-size: 13px; }
.method { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); font-size: 13.5px; color: var(--ink-2); overflow: hidden; }
.method summary { list-style: none; cursor: pointer; padding: 9px 14px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; user-select: none; }
.method summary::-webkit-details-marker { display: none; }
.method summary .ic { transition: transform .15s; }
.method[open] summary .ic { transform: rotate(90deg); }
.method summary:hover { color: var(--ink); }
.method .inner { padding: 0 16px 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.method .inner pre { background: var(--card); }
.actions { display: flex; align-items: center; gap: 4px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.actions .when { margin-right: 6px; }
.actions button { border: 0; background: none; color: var(--muted); padding: 4px 6px; border-radius: 7px; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.actions button:hover { background: var(--hover); color: var(--ink); }
.thinking { display: flex; align-items: center; gap: 12px; color: var(--muted); min-height: 28px; }
.shimmer { background: linear-gradient(90deg, var(--muted) 0%, var(--ink) 45%, var(--muted) 90%); background-size: 200% 100%;
           -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2.2s linear infinite; font-weight: 500; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); animation: pulse 1.4s ease-in-out infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: .25; transform: scale(.8); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- composer ---------- */
.dock { padding: 8px 24px 14px; }
.composer { position: relative; max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; background: var(--card);
            border: 1px solid var(--line-2); border-radius: 22px; padding: 10px 10px 10px 18px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: color-mix(in srgb, var(--teal) 55%, var(--line-2)); box-shadow: var(--shadow), 0 0 0 4px var(--teal-soft); }
textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; color: var(--ink); font: 15.5px/1.55 var(--sans); max-height: 240px; padding: 6px 0; }
textarea::placeholder { color: var(--faint); }
.send { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); display: grid; place-items: center;
        transition: background .15s, opacity .15s, transform .1s; }
.send:not(:disabled):hover { background: var(--teal); }
.send:not(:disabled):active { transform: scale(.94); }
.send:disabled { opacity: .25; cursor: default; }
.send.stop { background: var(--ink); opacity: 1; }
.send.stop:hover { background: var(--red); }
.send .ic { stroke-width: 2.2; }
.dock-note { max-width: 760px; margin: 8px auto 0; text-align: center; font-size: 11.5px; color: var(--faint); }
.main.empty-state .dock-note { margin-top: 22px; }
.picker { position: absolute; left: 0; right: 0; bottom: calc(100% + 10px); background: var(--card); border: 1px solid var(--line-2); border-radius: 16px;
          box-shadow: var(--shadow); max-height: 340px; overflow-y: auto; display: none; z-index: 20; padding: 6px; }
.main.empty-state .picker { bottom: auto; top: calc(100% + 10px); }
.picker .head { padding: 6px 10px 8px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.picker .row { padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; font-size: 14px; border-radius: 10px; }
.picker .row.on { background: var(--active); }
.picker .row .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.picker .meta { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 12px; color: var(--muted); }
.picker .lk { font-size: 10.5px; letter-spacing: .03em; padding: 1px 7px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-2); }

.picker .empty-row { padding: 10px; color: var(--muted); font-size: 13px; }
.join { position: absolute; left: 0; bottom: calc(100% + 10px); background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; padding: 9px 12px;
        font-size: 13px; color: var(--ink-2); box-shadow: var(--shadow); z-index: 15; }
.join button { margin-left: 6px; border: 1px solid var(--teal); background: transparent; color: var(--teal); border-radius: 999px; padding: 2px 11px; font-size: 12.5px; }
.join button:hover { background: var(--teal-soft); }

/* ---------- phones ---------- */
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .main { overflow-x: hidden; }
  .side { position: fixed; z-index: 40; inset: 0 auto 0 0; width: 284px; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .app.side-open .side { transform: none; }
  .app.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 12, 20, .35); z-index: 30; }
  #menu-btn { display: grid; }
  .switch-text { display: none; }
  .top { padding: 10px 12px; }
  .hello h1 { font-size: 27px; }
  .cards { grid-template-columns: 1fr; }
  .dock { padding: 6px 12px max(10px, env(safe-area-inset-bottom)); }
  .msgs { padding: 6px 14px 20px; }
  .m-user { max-width: 88%; }
  .m-bot .mark { display: none; }
}
