.agent-page{display:grid;gap:17px;color:var(--text)}.agent-page-hero{padding:22px 24px;border-radius:18px;color:#fff;background:linear-gradient(115deg,#15366e,#2459bd 58%,#6941d8);box-shadow:0 13px 34px rgba(25,65,145,.2)}.agent-page-hero h2{margin:5px 0;font-size:25px}.agent-page-hero p{margin:0;color:#d7e2f7}.agent-page-hero .eyebrow{color:#68e3c1}.agent-page-grid{display:grid;grid-template-columns:minmax(520px,1.25fr) minmax(330px,.75fr);gap:17px}.agent-page-panel{overflow:hidden;border:1px solid var(--border);border-radius:17px;background:var(--surface,#fff);box-shadow:0 8px 25px rgba(30,50,88,.06)}.agent-page-head{display:flex;justify-content:space-between;padding:17px 18px 11px}.agent-page-head h3{margin:0}.agent-page-head small{color:var(--muted)}.agent-page-tools{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;padding:4px 17px 17px}.agent-page-tool{min-height:124px;padding:14px;border:1px solid var(--border);border-radius:14px;background:var(--surface,#fff);color:inherit;text-align:left;cursor:pointer}.agent-page-tool:hover,.agent-page-tool.active{border-color:#4b80e8;box-shadow:0 8px 20px rgba(45,92,178,.11)}.agent-page-tool i{display:grid;place-items:center;width:39px;height:39px;margin-bottom:9px;border-radius:11px;background:#eaf1ff;font-style:normal;font-size:19px}.agent-page-tool strong,.agent-page-tool span{display:block}.agent-page-tool span{margin-top:4px;color:var(--muted);font-size:10px}.agent-page-actions{padding:0 17px 17px}.agent-page-actions b{display:block;margin-bottom:8px}.agent-page-chips{display:flex;flex-wrap:wrap;gap:7px}.agent-page-chips button{border:1px solid var(--border);border-radius:18px;padding:7px 10px;background:var(--bg,#f7f9fc);color:inherit;font-size:10px;cursor:pointer}.agent-page-chat{display:flex;flex-direction:column;min-height:520px}.agent-page-messages{flex:1;max-height:440px;overflow:auto;padding:15px}.agent-page-message{max-width:88%;margin-bottom:10px;padding:10px 12px;border-radius:13px;background:var(--bg,#eef3fa);font-size:12px}.agent-page-message.me{margin-left:auto;color:#fff;background:linear-gradient(120deg,#2871ef,#6747d9)}.agent-page-message small{display:block;margin-top:5px;opacity:.62}.agent-page-form{display:flex;gap:8px;padding:13px;border-top:1px solid var(--border)}.agent-page-form input{min-width:0;flex:1;padding:11px;border:1px solid var(--border);border-radius:11px;background:var(--surface,#fff);color:inherit}.agent-page-form button{width:44px;border:0;border-radius:11px;background:#286eef;color:#fff}.agent-page-forward{margin:0 17px 17px;padding:13px;border:1px dashed #c8d6eb;border-radius:13px;background:var(--bg,#f7f9fc);font-size:11px;color:var(--muted)}
@media(max-width:1050px){.agent-page-grid{grid-template-columns:1fr}.agent-page-chat{min-height:440px}}
@media(max-width:820px){.coming-soon:has(.agent-page){padding:0;border:0;background:transparent;box-shadow:none}.agent-page{gap:11px}.agent-page-hero{padding:17px;border-radius:15px}.agent-page-hero h2{font-size:20px}.agent-page-hero p{font-size:11px}.agent-page-tools{grid-template-columns:1fr 1fr;padding:4px 11px 12px}.agent-page-tool{min-height:108px;padding:11px}.agent-page-head{padding:14px 12px 9px}.agent-page-actions{padding:0 11px 12px}.agent-page-chat{min-height:430px;margin-bottom:70px}.mobile-nav{grid-template-columns:repeat(5,1fr)}}

/* V6.66: AI Agent starts at the top and uses an even desktop split. */
.agent-page{gap:12px}.agent-page-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:stretch}.agent-page-head{align-items:flex-start;gap:12px}.agent-page-delete{display:grid;place-items:center;flex:0 0 42px;width:42px;height:42px;padding:0;border:1px solid var(--border);border-radius:12px;background:var(--surface,#fff);font-size:20px;line-height:1;cursor:pointer}.agent-page-delete:hover{border-color:#ef4444;background:#fff1f2}.agent-page-delete:focus-visible{outline:3px solid rgba(40,110,239,.24);outline-offset:2px}
@media(max-width:820px){.agent-page-chat{min-height:500px}.agent-page-delete{flex-basis:38px;width:38px;height:38px;font-size:18px}}
.agent-page-chips .agent-task-button{border-color:#3979e8;background:#eaf2ff;color:#1854ae;font-weight:700}.agent-page-message{white-space:pre-wrap;overflow-wrap:anywhere}
.agent-page-message details{margin-top:8px;background:#f0f4fb;border:1px solid #c9d7ec;border-radius:10px;padding:8px 12px;font-size:12px;line-height:1.6;transition:background .2s;white-space:normal;word-break:break-word}
.agent-page-message details[open]{background:#fff;border-color:#3b82f6;box-shadow:0 2px 12px rgba(40,113,239,.08)}
.agent-page-message summary{cursor:pointer;font-weight:700;color:#1e5bb8;outline:none;user-select:none;padding:3px 0;display:list-item}
.agent-page-message summary:hover{color:#123e85}
.agent-page-message details[open] summary{margin-bottom:8px;padding-bottom:6px;border-bottom:1px dashed #dbe5f3}

/* Local R7: questions are visible on opening and submit with one click. */
.agent-page-starters h4 { margin: 0 0 5px; font-size: 17px; }
.agent-page-starters > p { margin: 0 0 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.agent-page-starter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
.agent-page-starter-group { display: grid; align-content: start; gap: 7px; min-width: 0; }
.agent-page-starter-group > b { color: var(--primary, #286eef); font-size: 11px; }
.agent-page-starter-group button { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 56px; padding: 10px 12px; border: 1px solid var(--line, #dbe3ef); border-radius: 12px; background: var(--bg, #f7f9fc); color: inherit; text-align: left; font: inherit; font-size: 12px; line-height: 1.5; cursor: pointer; }
.agent-page-starter-group button span { min-width: 0; overflow-wrap: anywhere; }
.agent-page-starter-group button i { color: var(--primary, #286eef); font-style: normal; flex: 0 0 auto; }
.agent-page-starter-group button:hover { border-color: var(--primary, #286eef); background: var(--primary-soft, #eaf1ff); }
.agent-page-starter-group button:focus-visible, .agent-page-chips button:focus-visible { outline: 2px solid var(--primary, #286eef); outline-offset: 2px; }
.agent-page button:disabled { opacity: .5; cursor: wait; }
@media (max-width: 540px) {
  .agent-page-starter-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .agent-page-starter-group button { min-height: 48px; font-size: 13px; }
}

/* Admin AI page: the V6.66 desktop split must not override mobile layouts. */
#comingSoonView:has(.agent-page) {
  min-height: 0;
  min-width: 0;
  padding: 0;
  place-content: stretch;
  justify-items: stretch;
  text-align: left;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.agent-page { width: 100%; min-width: 0; }
.agent-page-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.agent-page-panel { min-width: 0; border-color: var(--line); border-radius: 16px; }
.agent-page-head { align-items: center; padding: 16px; }
.agent-page-head > div { min-width: 0; }
.agent-page-head h3 { font-size: 18px; line-height: 1.35; }
.agent-page-head small { display: block; font-size: 11px; line-height: 1.5; }
.agent-page-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.agent-page-tool { min-width: 0; min-height: 112px; }
.agent-page-tool strong { font-size: 13px; line-height: 1.4; }
.agent-page-tool span { font-size: 11px; line-height: 1.5; }
.agent-page-tool i { background: var(--primary-soft); color: var(--primary); }
.agent-page-tool.active { background: var(--primary-soft); box-shadow: none; }
.agent-page-tool:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.agent-page-actions b { font-size: 12px; line-height: 1.5; }
.agent-page-chips button { min-height: 36px; font-size: 11px; line-height: 1.4; text-align: left; }
.agent-page-forward { line-height: 1.5; }
.agent-page-chat { min-height: 0; height: 520px; margin-bottom: 0; }
.agent-page-chat .agent-page-head { flex: 0 0 auto; border-bottom: 1px solid var(--line); }
.agent-page-messages { min-height: 0; max-height: none; padding: 16px; overscroll-behavior: contain; }
.agent-page-message { max-width: 94%; font-size: 13px; line-height: 1.55; }
.agent-page-message small { font-size: 10px; line-height: 1.5; }
.agent-page-form { flex: 0 0 auto; padding: 12px; border-top-color: var(--line); }
.agent-page-form input { min-height: 44px; padding: 10px 12px; font-size: 14px; border-color: var(--line); }
.agent-page-form button { flex: 0 0 44px; min-height: 44px; cursor: pointer; }
.agent-page-delete { border-color: var(--line); }

/* The full AI page already has its own chat. Keep the floating robot off its composer. */
body:has(#comingSoonView:not(.hidden) .agent-page) #aiAgentWidgetRoot { display: none; }

@media (max-width: 1100px), (hover: none) and (pointer: coarse) {
  .agent-page { gap: 12px; }
  .agent-page-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .agent-page-chat { order: -1; height: min(480px, 70svh); min-height: 340px; margin-bottom: 0; }
  .agent-page-head { padding: 14px; gap: 10px; }
  .agent-page-head h3 { font-size: 18px; }
  .agent-page-head small { font-size: 12px; }
  .agent-page-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0 12px 12px; }
  .agent-page-tool {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 60px;
    padding: 10px;
    border-radius: 12px;
  }
  .agent-page-tool i { width: 30px; height: 30px; margin: 0; border-radius: 9px; font-size: 17px; }
  .agent-page-tool strong { font-size: 13px; line-height: 1.4; }
  .agent-page-tool span { display: none; }
  .agent-page-actions { padding: 0 12px 12px; }
  .agent-page-forward { margin: 0 12px 12px; padding: 10px; font-size: 11px; }
  .agent-page-message { font-size: 14px; }
  .agent-page-form input { font-size: 16px; }
  .agent-page-delete { flex-basis: 38px; width: 38px; height: 38px; font-size: 18px; }
}

/* Local R8: one conversation, compact questions, optional tools. */
.agent-page-compact { max-width: 960px; margin: 0 auto; }
.agent-page-compact .agent-page-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.agent-page-compact .agent-page-chat { order: 0; height: min(640px, calc(100svh - 180px)); min-height: 500px; }
.agent-page-compact .agent-page-head { padding: 14px 22px; }
.agent-page-compact .agent-page-head h3 { font-size: 18px; }
.agent-page-compact .agent-page-head small { font-size: 11px; }
.agent-page-compact .agent-page-delete { width: 34px; height: 34px; flex-basis: 34px; font-size: 20px; border: 0; background: var(--bg); }
.agent-page-compact .agent-page-messages { padding: 24px; }
.agent-page-compact .agent-page-starters { max-width: 780px; margin: 12px auto 24px; }
.agent-page-compact .agent-page-starters h4 { margin: 0 0 6px; font-size: 23px; letter-spacing: -.025em; }
.agent-page-compact .agent-page-starters > p { margin: 0 0 20px; font-size: 13px; }
.agent-page-compact .agent-page-starter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.agent-page-starter-question { display: grid; align-content: center; gap: 4px; min-width: 0; min-height: 74px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); color: var(--text); text-align: left; cursor: pointer; }
.agent-page-starter-question small { color: var(--muted); font-size: 10px; line-height: 1.3; }
.agent-page-starter-question span { font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.agent-page-starter-question:hover { border-color: var(--primary); background: var(--primary-soft); }
.agent-page-starter-question:focus-visible, .agent-page-utilities > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.agent-page-compact .agent-page-form { padding: 12px 20px; }
.agent-page-utilities { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.agent-page-utilities > summary { padding: 13px 18px; cursor: pointer; color: var(--muted); font-size: 12px; }
.agent-page-utilities > summary b { color: var(--text); font-size: 12px; font-weight: 650; }
.agent-page-utilities > summary span { margin-left: 12px; font-size: 11px; }
.agent-page-compact .agent-page-tools { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 16px 14px; }
.agent-page-compact .agent-page-tool { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: none; }
.agent-page-compact .agent-page-tool i { width: auto; height: auto; margin: 0; font-size: 14px; background: transparent; }
.agent-page-compact .agent-page-tool strong { font-size: 11px; font-weight: 600; }
.agent-page-compact .agent-page-tool.active { background: var(--primary-soft); border-color: var(--primary); }
.agent-page-compact .agent-page-actions { padding: 0 16px 16px; }
@media (max-width: 540px) {
  .agent-page-compact .agent-page-chat { height: min(780px, calc(100svh - 110px)); min-height: 500px; }
  .agent-page-compact .agent-page-head { padding: 12px 16px; }
  .agent-page-compact .agent-page-messages { padding: 16px; }
  .agent-page-compact .agent-page-starters { margin-top: 4px; }
  .agent-page-compact .agent-page-starters h4 { font-size: 21px; }
  .agent-page-compact .agent-page-starters > p { margin-bottom: 14px; font-size: 12px; }
  .agent-page-compact .agent-page-starter-grid { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .agent-page-starter-question { min-height: 62px; padding: 10px 12px; }
  .agent-page-compact .agent-page-form { padding: 10px 12px; }
  .agent-page-utilities > summary span { display: none; }
}

/* Adapted from Uiverse.io by Tsiangana; scoped to the AI chat delete button. */
.agent-page-compact .agent-page-delete {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
  width: 45px;
  height: 45px;
  padding: 0;
  border: none;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  color: #fff;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, .199);
  background: linear-gradient(250deg, rgb(255, 135, 65) 15%, rgb(255, 65, 65) 65%);
  transition: width .3s, border-radius .3s;
}
.agent-page-delete .agent-delete-sign {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  transition: width .3s, padding .3s;
}
.agent-page-delete .agent-delete-sign svg { width: 17px; height: 18px; }
.agent-page-delete .agent-delete-sign svg path { fill: white; }
.agent-page-delete .agent-delete-text {
  position: absolute;
  right: 0;
  width: 0;
  opacity: 0;
  color: white;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity .3s, width .3s, padding .3s;
}
@media (hover: hover) and (pointer: fine) {
  .agent-page-compact .agent-page-delete:hover:not(:disabled) { width: 125px; border-radius: 40px; }
  .agent-page-delete:hover:not(:disabled) .agent-delete-sign { width: 30%; padding-left: 20px; }
  .agent-page-delete:hover:not(:disabled) .agent-delete-text { opacity: 1; width: 70%; padding-right: 10px; }
}
.agent-page-compact .agent-page-delete:focus-visible { width: 125px; border-radius: 40px; outline: 3px solid var(--primary); outline-offset: 3px; }
.agent-page-delete:focus-visible .agent-delete-sign { width: 30%; padding-left: 20px; }
.agent-page-delete:focus-visible .agent-delete-text { opacity: 1; width: 70%; padding-right: 10px; }
.agent-page-compact .agent-page-delete:active:not(:disabled) { transform: translate(2px, 2px); }
@media (prefers-reduced-motion: reduce) {
  .agent-page-compact .agent-page-delete, .agent-page-delete .agent-delete-sign, .agent-page-delete .agent-delete-text { transition: none; }
}

/* Local R10: choose a topic before choosing a question. */
.agent-page-topic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.agent-page-topic { min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; }
.agent-page-topic[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.agent-page-topic:hover { border-color: var(--primary); }
.agent-page-topic-content { margin-top: 20px; }
.agent-page-topic-content h5 { margin: 0 0 9px; font-size: 13px; }
.agent-page-topic-questions { display: grid; gap: 7px; }
.agent-page-topic-question { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 42px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); text-align: left; font-size: 13px; cursor: pointer; }
.agent-page-topic-question:hover { border-color: var(--primary); background: var(--surface-soft); }
.agent-page-topic-question span { min-width: 0; overflow-wrap: anywhere; }
.agent-page-topic-question i { color: var(--muted); font-style: normal; }
.agent-page-month-picker { display: flex; align-items: flex-end; gap: 10px; margin-top: 10px; padding: 12px; border-radius: 10px; background: var(--surface-soft); }
.agent-page-month-picker label { display: grid; flex: 1; gap: 6px; min-width: 0; color: var(--muted); font-size: 11px; }
.agent-page-month-picker input { min-width: 0; min-height: 42px; font-size: 14px; padding: 7px 10px; background: var(--surface); }
.agent-page-month-picker button { min-height: 42px; padding: 9px 14px; border: 0; border-radius: 9px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; }
.agent-page-topic:focus-visible, .agent-page-topic-question:focus-visible, .agent-page-month-picker button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.agent-page-topic-content[hidden], .agent-page-month-picker[hidden] { display: none; }
.agent-page-month-picker a[data-tcb-open] { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 18px; border-radius: 9px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 600; text-decoration: none; cursor: pointer; }
.agent-page-month-picker a[data-tcb-open]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
[data-tcb-note] { margin: 8px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
[data-tcb-steps] { margin: 6px 0 0 18px; padding: 0; color: var(--text, inherit); font-size: 12px; line-height: 1.6; }
@media (max-width: 540px) {
  .agent-page-topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agent-page-topic { font-size: 12px; }
  .agent-page-month-picker { flex-wrap: wrap; }
  .agent-page-month-picker input { font-size: 16px; }
}

/* R11: two views of the same recorded expenditure. */
.agent-page-compact .agent-expense-modes{display:flex;gap:6px;padding:4px;border-radius:12px;background:var(--bg)}
.agent-page-compact .agent-expense-modes button{flex:1;min-height:40px;border:0;border-radius:9px;background:transparent;color:var(--muted);font:inherit;font-weight:600;cursor:pointer}
.agent-page-compact .agent-expense-modes button[aria-pressed="true"]{background:var(--surface);color:var(--primary);box-shadow:0 1px 4px #0001}
.agent-page-compact .agent-expense-period{display:flex;gap:12px;flex-wrap:wrap;margin:14px 0}
.agent-page-compact .agent-expense-period label{display:grid;gap:5px;font-size:12px;color:var(--muted);flex:1;min-width:130px}
.agent-page-compact .agent-expense-period [hidden]{display:none}
.agent-page-compact .agent-expense-period select,.agent-page-compact .agent-expense-period input{width:100%;min-height:42px;border:1px solid var(--line);border-radius:9px;padding:8px 10px;background:var(--surface);color:var(--text);font:inherit;font-size:14px;box-sizing:border-box}
.agent-page-compact .agent-expense-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
.agent-page-compact .agent-expense-choices button{min-width:0;text-align:left}
.agent-page-compact .agent-expense-note{font-size:12px;color:var(--muted);margin-top:12px}
.agent-page-compact .agent-expense-modes button:focus-visible,.agent-page-compact .agent-expense-period select:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
@media(max-width:540px){.agent-page-compact .agent-expense-period select,.agent-page-compact .agent-expense-period input{font-size:16px}.agent-page-compact .agent-expense-choices button{font-size:13px;padding:9px}}
