/* Lendi chat layout, on top of the portal's variables.css and base.css */
html, body { height: 100%; }
body { overflow: hidden; }
.muted { color: var(--text-secondary); }
.small { font-size: 12px; }
.error { color: var(--status-rejected); margin-top: 10px; }
.btn-primary { background: var(--navy); color: #fff; border: 0; border-radius: var(--radius-sm); padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: var(--navy-2); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--cyan-2); cursor: pointer; font: inherit; }
button.icon-btn { background: transparent; border: 0; cursor: pointer; position: relative; }
.badge { position: absolute; top: -4px; right: -4px; background: var(--cyan); color: var(--navy); border-radius: 9px; font-size: 10px; font-weight: 700; padding: 0 5px; line-height: 16px; }

/* sign-in */
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); overflow: auto; }
.login-card { width: 100%; max-width: 380px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-lg); }
.login-card h1 { font-size: 22px; margin: 18px 0 4px; }
.login-card label { display: block; font-weight: 600; margin: 14px 0 6px; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit; }
.login-card .btn-primary { width: 100%; margin-top: 18px; padding: 11px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--navy); }
.login-brand .portal-tag { color: var(--text-secondary); font-weight: 400; border-left: 1px solid var(--border); padding-left: 10px; }
.google-btn { margin-top: 18px; min-height: 44px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--text-muted); margin: 16px 0 0; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--border); }

/* app frame */
#app-view { height: 100vh; display: flex; flex-direction: column; }
.app-header-inner { max-width: none; }
.layout { flex: 1; display: flex; min-height: 0; }
.sidebar { width: 300px; flex-shrink: 0; background: var(--card-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 14px; gap: 10px; min-height: 0; }
.new-chat { width: 100%; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab { flex: 1; background: none; border: 0; padding: 8px; font: inherit; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--navy); border-bottom-color: var(--cyan); font-weight: 600; }
.list { list-style: none; overflow-y: auto; flex: 1; min-height: 0; }
.list li { padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.list li:hover { background: var(--row-hover); }
.list li.active { background: var(--cyan-soft); }
.list .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .s { font-size: 12px; color: var(--text-secondary); display: flex; gap: 6px; align-items: center; }
.pill { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--status-neutral-bg); color: var(--status-neutral); font-weight: 600; }
.pill.SUBMITTED { background: var(--status-uploaded-bg); color: var(--status-uploaded); }
.pill.PROMOTED { background: var(--status-approved-bg); color: var(--status-approved); }
.pill.ARCHIVED { background: var(--status-neutral-bg); color: var(--text-muted); }

/* chat */
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; background: var(--bg); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--card-bg); }
.chat-head h2 { font-size: 16px; margin: 0; }
.sidebar-toggle { display: none; color: var(--navy); font-size: 18px; }
.messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 860px; width: fit-content; padding: 12px 16px; border-radius: var(--radius); line-height: 1.55; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--navy); color: #fff; white-space: pre-wrap; }
.msg.user.other { background: var(--navy-3); }
.msg.assistant { align-self: flex-start; background: var(--card-bg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.msg.event { align-self: center; background: var(--cyan-soft); color: var(--navy); font-size: 13px; }
.msg .who { font-size: 11px; opacity: .75; margin-bottom: 4px; }
.msg .files { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.msg .file { font-size: 12px; background: rgba(255, 255, 255, .15); border-radius: 6px; padding: 2px 8px; }
.msg .file.reading { opacity: .7; }
.msg.assistant.draft { opacity: .92; }
.msg.assistant p { margin: 0 0 8px; } .msg.assistant p:last-child { margin-bottom: 0; }
.msg.assistant ul, .msg.assistant ol { margin: 4px 0 8px 20px; }
.msg.assistant table { border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.msg.assistant th, .msg.assistant td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; }
.msg.assistant code { font-family: 'Geist Mono', monospace; font-size: 12px; background: var(--row-stripe); padding: 1px 4px; border-radius: 4px; }
.msg.assistant h1, .msg.assistant h2, .msg.assistant h3 { font-size: 15px; margin: 10px 0 6px; }
.empty { margin: auto; max-width: 640px; text-align: center; }
.empty h3 { font-size: 20px; margin-bottom: 8px; }
.examples { display: grid; gap: 8px; margin-top: 18px; }
.example { text-align: left; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font: inherit; cursor: pointer; color: var(--text); }
.example:hover { border-color: var(--cyan); }
.new-pill { position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; border: 0; border-radius: 16px; padding: 6px 14px; cursor: pointer; box-shadow: var(--shadow-lg); }
.working { padding: 0 24px 8px; color: var(--text-secondary); font-size: 13px; display: flex; align-items: center; gap: 4px; }
.working .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: blink 1.2s infinite; }
.working .dot:nth-child(2) { animation-delay: .2s; } .working .dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.composer { border-top: 1px solid var(--border); background: var(--card-bg); padding: 12px 24px 16px; }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; max-height: 240px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit; line-height: 1.45; }
.composer textarea:focus { outline: 2px solid var(--cyan-soft); border-color: var(--cyan); }
.attach { color: var(--navy); cursor: pointer; padding: 10px 4px; }
.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.attachments:empty { display: none; }
.chip { font-size: 12px; background: var(--cyan-soft); border-radius: 12px; padding: 3px 4px 3px 10px; display: flex; align-items: center; gap: 4px; }
.chip button { background: none; border: 0; cursor: pointer; color: var(--text-secondary); padding: 0 4px; }
.ask-lendi { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.composer.dragover { outline: 2px dashed var(--cyan); outline-offset: -6px; }
.drawer { position: fixed; top: 64px; right: 16px; width: 360px; max-width: calc(100vw - 32px); max-height: 70vh; display: flex; flex-direction: column;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px; z-index: 60; }
.drawer-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.drawer li.unread .t { font-weight: 700; }

/* embedded in another app (?embed=1): no header or sidebar */
body.embed .app-header, body.embed .sidebar { display: none; }

@media (max-width: 800px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 70; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar-toggle { display: inline-block; }
  .messages { padding: 16px; }
  .composer, .chat-head { padding-left: 16px; padding-right: 16px; }
  .user-name, .btn-logout-text { display: none; }
  .msg { max-width: 100%; }
}

/* link to the pattern library, for its reviewers */
.header-link { color: #cbd5e1; text-decoration: none; font-size: 13px; font-weight: 500; padding: 6px 10px; border-radius: var(--radius-sm); }
.header-link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
@media (max-width: 700px) { .header-link { display: none; } }
