* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--lh-navy); color: var(--lh-text); font-family: var(--lh-font); font-size: 15px; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border-radius: var(--lh-radius); border: 1px solid transparent; padding: .55em 1em; }
button.primary { background: var(--lh-teal); color: #04221f; font-weight: 600; }
button.primary:hover { background: var(--lh-teal-dark); color: #fff; }
button.ghost { background: transparent; color: var(--lh-text); border-color: var(--lh-navy-lighter); }
button.ghost:hover { border-color: var(--lh-teal); }
button.link { background: none; border: none; color: var(--lh-muted); padding: .2em .4em; }
button.link:hover { color: var(--lh-teal); }
button.wide { width: 100%; }
button:disabled { opacity: .5; cursor: default; }
input, textarea, select { font: inherit; color: var(--lh-text); background: var(--lh-navy); border: 1px solid var(--lh-navy-lighter); border-radius: var(--lh-radius); padding: .6em .7em; width: 100%; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--lh-teal); outline-offset: 0; }
code, pre { font-family: Consolas, "Cascadia Mono", monospace; }
.error { color: var(--lh-danger); min-height: 1.2em; }
.muted { color: var(--lh-muted); }

/* login */
.login { display: grid; place-items: center; height: 100%; padding: 1rem; }
.card { background: var(--lh-navy-light); border: 1px solid var(--lh-navy-lighter); border-radius: 16px; padding: 2rem; width: min(380px, 100%); display: grid; gap: .9rem; }
.card h1 { font-size: 1.25rem; margin: 0 0 .3rem; text-align: center; }
.card label { display: grid; gap: .35rem; color: var(--lh-muted); font-size: .9rem; }
.login-logo { width: 64px; height: 64px; margin: 0 auto; }

/* app layout */
.app { display: grid; grid-template-columns: 280px 1fr; height: 100%; }
.sidebar { background: var(--lh-navy-light); border-right: 1px solid var(--lh-navy-lighter); display: flex; flex-direction: column; gap: .8rem; padding: 1rem; min-height: 0; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.1rem; }
.brand img { width: 32px; height: 32px; }
.profile-switch label { display: grid; gap: .3rem; color: var(--lh-muted); font-size: .85rem; }
.sessions { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.sessions button { flex-shrink: 0; text-align: left; background: none; color: var(--lh-text); border: none; padding: .5em .6em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; justify-content: space-between; gap: .4rem; }
.sessions button:hover, .sessions button.active { background: var(--lh-navy-lighter); }
.sessions .del { color: var(--lh-muted); visibility: hidden; }
.sessions button:hover .del { visibility: visible; }
.sidebar-footer { display: grid; gap: .5rem; }
.me { display: flex; justify-content: space-between; align-items: center; color: var(--lh-muted); font-size: .9rem; }

.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-header { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1.2rem; border-bottom: 1px solid var(--lh-navy-lighter); }
.chat-header h2 { margin: 0; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn { font-size: .8rem; color: var(--lh-muted); }
.conn.bad { color: var(--lh-danger); }
.messages { flex: 1; overflow-y: auto; padding: 1.2rem; display: flex; flex-direction: column; gap: .9rem; }
.empty { color: var(--lh-muted); text-align: center; margin-top: 20vh; }
.msg { max-width: 860px; width: fit-content; padding: .7rem 1rem; border-radius: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--lh-teal-dark); color: #fff; }
.msg.assistant { align-self: flex-start; background: var(--lh-navy-light); border: 1px solid var(--lh-navy-lighter); }
.msg.tool, .msg.status { align-self: flex-start; color: var(--lh-muted); font-size: .85rem; background: none; padding: .2rem 1rem; }
.msg.error { align-self: center; color: var(--lh-danger); }
.msg pre { background: #06142a; padding: .7rem; border-radius: 8px; overflow-x: auto; }
.msg p { margin: .3em 0; }
.msg a { color: var(--lh-teal); }
.thinking { color: var(--lh-muted); font-style: italic; }
.card-req { align-self: flex-start; border: 1px solid var(--lh-teal); background: var(--lh-navy-light); border-radius: 12px; padding: .8rem 1rem; display: grid; gap: .5rem; max-width: 860px; }
.card-req .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.composer { display: flex; gap: .6rem; padding: .9rem 1.2rem; border-top: 1px solid var(--lh-navy-lighter); align-items: flex-end; }
.composer textarea { resize: none; max-height: 40vh; }

/* dialogs */
.dialog { background: var(--lh-navy-light); color: var(--lh-text); border: 1px solid var(--lh-navy-lighter); border-radius: 16px; width: min(560px, 95vw); padding: 1.2rem 1.4rem; }
.wide-dialog { width: min(1000px, 95vw); }
.dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dialog header { display: flex; justify-content: space-between; align-items: center; }
.dialog h2 { margin: 0; font-size: 1.15rem; }
.conn-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--lh-navy-lighter); }
.conn-row .desc { color: var(--lh-muted); font-size: .85rem; }
.oauth { display: grid; gap: .6rem; margin-top: 1rem; }
.audit { max-height: 40vh; overflow: auto; font-size: .78rem; background: #06142a; padding: .7rem; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
td, th { text-align: left; padding: .35rem .4rem; border-bottom: 1px solid var(--lh-navy-lighter); }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { max-height: 38vh; }
}
.licenses { color: var(--lh-muted); font-size: .75rem; text-align: center; text-decoration: none; }
.licenses:hover { color: var(--lh-teal); }
.banner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 1.2rem; background: #12384a; border-bottom: 1px solid var(--lh-teal); }
.banner-actions { display: flex; gap: .5rem; flex-shrink: 0; }
.stack { display: grid; gap: .6rem; }
.stack label { display: grid; gap: .3rem; color: var(--lh-muted); font-size: .9rem; }
.qr { width: 220px; height: 220px; background: #fff; border-radius: 8px; padding: 4px; }
.dialog h3 { margin: 1.2rem 0 .5rem; font-size: 1rem; }
