/* aigent.duxels.com — the page's own layout. The header and the footer are the common ones of duxels-shared (the Worker puts them in, src/site-chrome.js) and bring their own
   stylesheet, /shared/<version>/chrome/chrome.css, which loads AFTER this one: it has the palette (:root --bg --fg --mut --line), the links, the header and the footer.
   Here: the document's background and type, the focus ring, session cards and the chat. Same base as duxels-markeiter's app.css. */
html { background: var(--bg); color-scheme: dark; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: transparent; color: var(--fg); font-family: var(--font); line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
main { position: relative; z-index: 1; }
.privacy-page { background: radial-gradient(ellipse at 70% 0%, var(--bg2), var(--bg) 42%) fixed; }
.privacy-main { width: min(100% - 40px, 1200px); margin: 0 auto; padding: 40px 0 max(64px, env(safe-area-inset-bottom)); }
@media (max-width: 600px) { .privacy-main { width: calc(100% - 32px); padding-top: 24px; } }
.account-main { display: flex; justify-content: center; align-items: flex-start; min-height: 60vh; }
#app { width: 100%; display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
a:focus-visible, button:focus-visible { outline: 2px solid #2a86ff; outline-offset: 2px; }
.ag-card { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 10vh auto 0; max-width: 32rem; text-align: center; }
.ag-card h1 { font-size: 1.4rem; }
.ag-card p { color: var(--mut); }
.ag-btn { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-height: 44px; padding: 10px 20px; border: 1px solid var(--line); border-radius: 999px; background: #2a86ff; color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.ag-btn:disabled { opacity: .6; cursor: wait; }

/* The approved light chat surface sits inside the unmodified shared chrome. */
.ag-chat-page .account-main { width: 100%; margin: 0; padding: 0; min-height: 0; }
.ag-chat-page #app { gap: 0; }
.ag-chat {
  --ag-accent: #2f4ac0; --ag-line: #e4e4e0; --ag-muted: #5c5f66;
  width: 100%; min-width: 0; color: #15171a; background: #f7f7f5;
  color-scheme: light; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.55;
}
.ag-chat *, .ag-chat *::before, .ag-chat *::after { box-sizing: border-box; }
.ag-chat button, .ag-chat select, .ag-chat textarea { font: inherit; color: inherit; }
.ag-chat button, .ag-chat a { -webkit-tap-highlight-color: transparent; }
.ag-chat button { cursor: pointer; }
.ag-chat button:disabled { cursor: default; opacity: .65; }
.ag-chat-page .ag-chat :is(a, button, textarea, select):focus-visible { outline: 3px solid var(--ag-accent); outline-offset: 3px; }
.ag-chat :is(button, a, select) { min-height: 44px; }
.ag-chat .ag-primary, .ag-chat .ag-secondary { display: inline-flex; justify-content: center; align-items: center; border-radius: 10px; padding: 10px 20px; font-size: 14px; font-weight: 600; text-decoration: none; }
.ag-chat .ag-primary { border: 1px solid var(--ag-accent); background: var(--ag-accent); color: white; }
.ag-chat .ag-primary:hover:enabled { background: #1f3590; }
.ag-chat .ag-secondary { border: 1px solid #d6d6d1; background: white; color: #15171a; }
.ag-toolbar { min-height: 60px; display: flex; align-items: center; gap: 16px; padding: 8px 24px; background: white; border-bottom: 1px solid var(--ag-line); }
.ag-toolbar h1 { margin: 0 auto 0 0; font-size: 17px; font-weight: 700; }
.ag-toolbar .ag-usage { border: 0; background: transparent; padding: 8px 12px; border-radius: 8px; color: var(--ag-accent); font-size: 14px; }
.ag-balance { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 14px; border: 1px solid var(--ag-line); border-radius: 10px; }
.ag-balance span { font-size: 13px; color: var(--ag-muted); }
.ag-balance strong { font-size: 15px; font-weight: 600; white-space: nowrap; }
.ag-icon { width: 44px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--ag-line); border-radius: 10px; background: white; flex-shrink: 0; }
.ag-toolbar .ag-menu { display: none; }
.ag-workspace { display: flex; min-height: 680px; min-height: max(680px, calc(100dvh - var(--dxh-h, 64px) - 60px)); }
.ag-sidebar { width: 280px; flex: 0 0 280px; display: flex; flex-direction: column; gap: 18px; padding: 20px 16px; border-right: 1px solid var(--ag-line); background: #fbfbfa; }
.ag-new { width: 100%; }
.ag-caption { display: block; margin: 0; font-size: 12px; font-weight: 600; color: var(--ag-muted); letter-spacing: .04em; }
.ag-template-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.ag-template { min-width: 0; border: 1px solid var(--ag-line); border-radius: 9px; background: white; padding: 8px; font-size: 13px !important; }
.ag-template[aria-pressed="true"] { border: 1.5px solid var(--ag-accent); background: #eef1fc; font-weight: 600; }
.ag-conversations ul { list-style: none; margin: 0; padding: 0; }
.ag-history-note { margin: auto 0 0; font-size: 12px; color: var(--ag-muted); line-height: 1.5; }
.ag-center { display: flex; flex-direction: column; flex: 1; min-width: 0; padding-bottom: 22px; }
.ag-mobile-templates { display: none; }
.ag-transcript { flex: 1; min-width: 0; width: min(760px, calc(100% - 48px)); margin: 0 auto; padding: 24px 0; }
.ag-notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid #f1ddae; border-radius: 10px; background: #fff7e6; font-size: 13px; line-height: 1.5; color: #4a3a12; }
.ag-notice > span { flex-shrink: 0; color: #8a6414; font-size: 18px; line-height: 1.2; }
.ag-notice p { margin: 0; }
.ag-messages { display: flex; flex-direction: column; gap: 18px; }
.ag-messages:not(:empty), .ag-state:not(:empty) { margin-top: 18px; }
.ag-user-row { display: flex; justify-content: flex-end; min-width: 0; }
.ag-user-bubble { max-width: min(560px, 85%); padding: 12px 16px; border-radius: 14px 14px 4px 14px; background: #15171a; color: white; font-size: 15px; line-height: 1.55; }
.ag-user-bubble, .ag-answer-bubble { white-space: pre-wrap; overflow-wrap: anywhere; }
.ag-answer-row { display: flex; gap: 12px; min-width: 0; }
.ag-avatar { display: flex; align-items: center; justify-content: center; flex: 0 0 30px; height: 30px; border-radius: 8px; background: var(--ag-accent); color: white; font-size: 14px; font-weight: 700; }
.ag-answer-content { min-width: 0; }
.ag-answer-bubble { padding: 14px 16px; border: 1px solid var(--ag-line); border-radius: 14px; background: white; font-size: 15px; line-height: 1.6; }
.ag-answer-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--ag-muted); }
.ag-answer-meta button { border: none; padding: 0 8px; border-radius: 6px; background: transparent; font-size: 12px; color: var(--ag-accent); }
.ag-composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; width: min(760px, calc(100% - 48px)); margin: 0 auto; padding: 12px 12px 10px 16px; border: 1px solid #d6d6d1; border-radius: 14px; background: white; }
.ag-composer > label { grid-column: 1 / -1; }
.ag-composer label, .ag-maximum { font-size: 12px; color: var(--ag-muted); }
.ag-composer textarea { grid-column: 1 / -1; width: 100%; min-width: 0; min-height: 54px; border: none; padding: 0; resize: vertical; background: white; font-size: 15px; }
.ag-composer textarea::placeholder { color: var(--ag-muted); opacity: 1; }
.ag-composer-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; min-width: 0; }
.ag-composer select { max-width: 100%; min-width: 0; border: 1px solid var(--ag-line); border-radius: 8px; padding: 0 8px; background: white; font-size: 13px; }
.ag-send { align-self: end; }
.ag-send svg { display: none; }
.ag-status { width: min(760px, calc(100% - 48px)); margin: 8px auto 0; font-size: 13px; color: var(--ag-muted); overflow-wrap: anywhere; }
.ag-status:empty { margin-top: 0; }
.ag-state-card { display: flex; flex-direction: column; align-items: stretch; gap: 12px; max-width: 440px; border: 1px solid var(--ag-line); border-radius: 14px; background: white; padding: 22px; }
.ag-state-card h2 { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.4; }
.ag-state-card p { margin: 0; font-size: 14px; line-height: 1.55; color: #3a3d44; }
.ag-state-card > :is(a, button) { margin-top: 8px; text-align: center; }
@media (max-width: 640px) {
  .ag-chat-page .account-main { width: 100%; padding: 0; }
  .ag-toolbar { min-height: 56px; padding: 6px 12px; gap: 8px; flex-wrap: wrap; }
  .ag-toolbar .ag-menu { display: inline-flex; border: none; }
  .ag-toolbar h1 { font-size: 16px; }
  .ag-toolbar .ag-usage { padding: 4px; font-size: 12px; }
  .ag-toolbar .ag-settings { width: 44px; }
  .ag-balance { min-height: 44px; padding: 4px 8px; gap: 4px; flex-direction: column; align-items: flex-start; justify-content: center; background: #eef1fc; border: none; border-radius: 8px; line-height: 1.3; }
  .ag-balance span { font-size: 10px; }
  .ag-balance strong { font-size: 12px; }
  .ag-workspace { flex-direction: column; min-height: max(680px, calc(100dvh - var(--dxh-h, 56px) - 56px)); }
  .ag-sidebar { display: none; width: 100%; flex: none; border-right: 0; border-bottom: 1px solid var(--ag-line); gap: 14px; padding: 12px; }
  .ag-menu-open .ag-sidebar { display: flex; }
  .ag-sidebar .ag-assistants { display: none; }
  .ag-center { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .ag-mobile-templates { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
  .ag-mobile-templates .ag-template { flex: 1; padding: 8px 10px; border-radius: 22px; }
  .ag-transcript { width: auto; margin: 0 12px; padding: 4px 0 20px; }
  .ag-notice { padding: 10px 12px; font-size: 12px; }
  .ag-notice > span { display: none; }
  .ag-messages { gap: 14px; }
  .ag-user-bubble { max-width: min(300px, 90%); padding: 11px 14px; line-height: 1.5; }
  .ag-avatar { display: none; }
  .ag-answer-bubble { max-width: 100%; padding: 12px 14px; line-height: 1.55; }
  .ag-composer { width: 100%; margin: 0; padding: 10px 12px 0; gap: 8px; border: none; border-top: 1px solid var(--ag-line); border-radius: 0; }
  .ag-composer textarea { grid-column: 1; grid-row: 2; border: 1px solid #d6d6d1; border-radius: 12px; padding: 10px 12px; min-height: 68px; resize: vertical; }
  .ag-send { grid-column: 2; grid-row: 2; width: 48px; height: 48px; padding: 0 !important; border-radius: 12px !important; }
  .ag-send span { display: none; }
  .ag-send svg { display: block; }
  .ag-composer-tools { grid-row: 3; grid-column: 1 / -1; gap: 6px; }
  .ag-composer select { flex: 1; }
  .ag-maximum { flex-basis: 100%; }
  .ag-status { width: auto; margin-left: 12px; margin-right: 12px; }
  .ag-state-card { max-width: 100%; }
}

/* Settings is a disclosure in document flow; confirmations use the page UI. */
.ag-history-panel, .ag-history-confirm { margin: 16px 24px; padding: 20px; border: 1px solid var(--ag-line); border-radius: 12px; background: white; }
.ag-history-panel[hidden], .ag-history-confirm[hidden], .ag-history-preference[hidden], .ag-history-retry[hidden] { display: none; }
.ag-history-heading, .ag-history-preference, .ag-history-confirm > div { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.ag-history-heading { justify-content: space-between; }
.ag-history-heading h2 { font-size: 18px; }
.ag-history-preference { margin-top: 16px; }
.ag-history-preference label { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; }
.ag-history-preference input { width: 44px; height: 44px; margin: 0; accent-color: var(--ag-accent); cursor: pointer; }
.ag-history-panel :is(input, button):focus-visible, .ag-history-confirm button:focus-visible, .ag-history-row button:focus-visible { outline: 3px solid var(--ag-accent); outline-offset: 3px; }
.ag-history-panel button, .ag-history-confirm button, .ag-history-row button { min-width: 44px; min-height: 44px; }
.ag-history-privacy, .ag-history-availability { margin: 10px 0; max-width: 65ch; color: var(--ag-muted); font-size: 14px; }
.ag-history-availability:empty { display: none; }
.ag-history-clear, .ag-history-retry { margin-top: 8px; margin-right: 8px; }
.ag-history-confirm p { margin-bottom: 12px; }
.ag-history-status { margin: 0 24px; color: var(--ag-muted); font-size: 14px; }
.ag-history-status:empty { margin-top: 0; margin-bottom: 0; }
.ag-history-row { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.ag-history-row button { border: 1px solid var(--ag-line); border-radius: 8px; background: white; padding: 8px; font-size: 13px; }
.ag-history-open { flex: 1; min-width: 0; text-align: left; }
.ag-history-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-history-date { display: block; color: var(--ag-muted); font-size: 12px; }
.ag-history-delete { flex-shrink: 0; color: #982b26 !important; }
.ag-conversations ul { max-height: 50vh; overflow-y: auto; padding: 4px; }
@media (max-width: 640px) {
  .ag-history-panel, .ag-history-confirm { margin: 12px; padding: 16px; }
  .ag-history-status { margin: 0 12px; }
}

/* Usage follows the approved light surface inside the common site chrome. */
.ag-chat[hidden] { display: none; }
.ag-usage-screen { min-height: calc(100dvh - var(--dxh-h, 64px)); }
.ag-usage-screen .ag-toolbar { flex-wrap: wrap; }
.ag-usage-brand { font-size: 17px; font-weight: 700; }
.ag-usage-screen .ag-usage-back { border: 0; border-radius: 8px; padding: 8px 12px; background: transparent; color: var(--ag-accent); font-size: 14px; }
.ag-usage-screen .ag-balance { margin-left: auto; }
.ag-usage-main { max-width: 1440px; margin: 0 auto; padding: 28px 40px 40px; }
.ag-usage-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 16px; }
.ag-usage-heading h1 { font-size: 26px; font-weight: 700; line-height: 1.3; }
.ag-usage-account { font-size: 14px; color: var(--ag-muted); overflow-wrap: anywhere; }
.ag-usage-filter { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.ag-usage-filter label { font-size: 13px; color: var(--ag-muted); }
.ag-usage-filter select { min-height: 44px; border: 1px solid #d6d6d1; border-radius: 8px; padding: 0 10px; background: white; font-size: 14px; }
.ag-usage-status { min-height: 22px; margin: 10px 0; color: var(--ag-muted); font-size: 13px; }
.ag-usage-content { display: flex; flex-direction: column; gap: 22px; }
.ag-usage-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ag-usage-card, .ag-usage-panel { min-width: 0; padding: 18px 20px; border: 1px solid var(--ag-line); border-radius: 12px; background: white; }
.ag-usage-card { display: flex; flex-direction: column; gap: 10px; }
.ag-usage-card h2 { color: var(--ag-muted); font-size: 13px; font-weight: 500; }
.ag-usage-number { font-size: 28px; font-weight: 700; line-height: 1.3; }
.ag-usage-card p, .ag-usage-panel p, .ag-usage-footnote { color: var(--ag-muted); font-size: 12px; line-height: 1.5; }
.ag-usage-progress { display: block; width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 4px; background: #ecece8; color: var(--ag-accent); appearance: none; }
.ag-usage-progress::-webkit-progress-bar { background: #ecece8; border-radius: 4px; }
.ag-usage-progress::-webkit-progress-value { background: var(--ag-accent); border-radius: 4px; }
.ag-usage-progress::-moz-progress-bar { background: var(--ag-accent); border-radius: 4px; }
.ag-usage-period-title { font-size: 14px; font-weight: 600; }
.ag-usage-breakdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ag-usage-breakdown > :only-child { grid-column: 1 / -1; }
.ag-usage-panel { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.ag-usage-panel h2 { font-size: 16px; font-weight: 600; }
.ag-usage-table-wrap { max-width: 100%; overflow-x: auto; border-radius: 4px; }
.ag-usage-panel table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ag-usage-panel th, .ag-usage-panel td { padding: 11px 8px; text-align: left; overflow-wrap: anywhere; }
.ag-usage-panel th:first-child, .ag-usage-panel td:first-child { padding-left: 0; }
.ag-usage-panel thead th { padding-top: 8px; padding-bottom: 8px; color: var(--ag-muted); font-size: 12px; font-weight: 600; }
.ag-usage-panel tbody th { font-weight: 400; }
.ag-usage-panel tbody tr { border-top: 1px solid #efefeb; }
.ag-usage-panel :is(th, td):last-child { padding-right: 0; text-align: right; white-space: nowrap; }
.ag-usage-panel td:last-child { font-weight: 600; }
.ag-usage-screen .ag-usage-settings { display: inline-flex; align-items: center; align-self: flex-start; min-height: 44px; border-radius: 4px; color: var(--ag-accent); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.ag-usage-screen :is(a, button, select, [tabindex]):focus-visible { outline: 3px solid var(--ag-accent); outline-offset: 3px; }
.ag-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 1000px) {
  .ag-usage-breakdown { grid-template-columns: minmax(0, 1fr); }
  .ag-usage-main { padding: 24px; }
}
@media (max-width: 640px) {
  .ag-usage-main { padding: 22px 12px max(24px, env(safe-area-inset-bottom)); }
  .ag-usage-screen .ag-toolbar { gap: 8px; padding: 6px 12px; }
  .ag-usage-screen .ag-usage-back { padding: 8px 4px; font-size: 13px; }
  .ag-usage-brand { font-size: 16px; }
  .ag-usage-heading { gap: 8px; }
  .ag-usage-heading h1 { font-size: 24px; }
  .ag-usage-account { flex-basis: 100%; }
  .ag-usage-filter { justify-content: space-between; width: 100%; margin-top: 6px; }
  .ag-usage-filter select { flex: 1; max-width: 220px; }
  .ag-usage-cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .ag-usage-card, .ag-usage-panel { padding: 16px; }
  .ag-usage-panel table { min-width: 400px; }
  .ag-usage-content { gap: 18px; }
}
