/* Rowebot. Drawn from josephrowelaw.com: the sky blue and navy of the logo, the sea of the
   home page photograph, one amber accent, Caslon for display and Open Sans for everything else.
   Layout: an airy reading column of fee schedules on a pale ground, with the assistant as a
   floating panel beside it. */
:root {
  --navy: #223a5e; --ink: #1c2a3f; --sky: #3aa9dc; --sky-deep: #1b7fb3; --sea: #0e7f8c; --amber: #e2a93b;
  --muted: #667588; --faint: #93a1b1; --line: #e2e8ee; --ground: #f4f7f9; --surface: #ffffff;
  --sky-wash: #eaf5fb; --amber-wash: #fcf2dc; --amber-ink: #7d5606; --red-wash: #fbe6e3; --red-ink: #a12a20;
  --display: "Libre Caslon Text", "Adobe Caslon Pro", "Big Caslon", Georgia, serif;
  --sans: "Open Sans", "Segoe UI", Helvetica, Arial, sans-serif;
  --r-lg: 18px; --r-md: 12px; --r-sm: 8px;
  --lift: 0 1px 2px rgba(34,58,94,.05), 0 10px 30px rgba(34,58,94,.07);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 15.5px; line-height: 1.6; color: var(--ink); background: var(--ground); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; color: var(--navy); text-wrap: balance; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--sky-deep); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.only-mobile { display: none; }
.quiet-btn { background: none; border: 0; padding: 7px 12px; border-radius: 999px; color: var(--muted); font-size: .84rem; font-weight: 600; }
.quiet-btn:hover { background: var(--ground); color: var(--navy); }
.btn { background: var(--navy); color: #fff; border: 0; border-radius: 999px; padding: 13px 22px; font-weight: 600; transition: background .15s; }
.btn:hover { background: var(--sky-deep); }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- Sign-in ---------- */
.login { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--surface); }
.login-art { position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; padding: 56px;
  color: #fff; background:
    radial-gradient(120% 80% at 80% 0%, rgba(255,255,255,.28), transparent 60%),
    linear-gradient(180deg, #8fd0e6 0%, #3aa9c9 38%, #12838f 70%, #0b5f70 100%); }
.login-quote { font-family: var(--display); font-style: italic; font-size: clamp(1.9rem, 3.4vw, 3rem); line-height: 1.2; max-width: 20ch; text-shadow: 0 1px 18px rgba(8,60,72,.35); }
.login-place { font-size: .9rem; opacity: .9; }
.login-form { align-self: center; justify-self: center; width: 100%; max-width: 380px; padding: 40px 28px; display: flex; flex-direction: column; gap: 10px; }
.login-logo { max-width: 230px; max-height: 84px; object-fit: contain; align-self: flex-start; margin-bottom: 26px; }
.login-form h1 { font-family: var(--display); font-weight: 400; font-size: 2.5rem; line-height: 1.1; }
.login-sub { color: var(--muted); margin-bottom: 22px; }
.login-form label { font-size: .82rem; font-weight: 600; color: var(--navy); }
.login-form input { padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--ground); }
.login-form input:focus { background: var(--surface); border-color: var(--sky); outline: 3px solid var(--sky-wash); }
.login-form .btn { margin-top: 8px; }
.form-error { color: var(--red-ink); background: var(--red-wash); padding: 10px 14px; border-radius: var(--r-sm); font-size: .9rem; }
.login-note { font-size: .8rem; color: var(--faint); margin-top: 14px; }

/* ---------- Header ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.top { flex: none; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px 28px; padding: 0 28px; min-height: 72px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; padding-block: 10px; }
.brand-logo { height: 46px; max-width: 200px; object-fit: contain; }
.brand-name { font-family: var(--display); font-style: italic; font-size: 1.3rem; color: var(--sea); padding-left: 16px; border-left: 1px solid var(--line); line-height: 1.6; }
.brand-logo[hidden] + .brand-name { padding-left: 0; border-left: 0; color: var(--navy); font-size: 1.5rem; }
/* The firm's own navigation: small capitals in grey, a sky bar above the current page. */
.tabs { display: flex; align-self: stretch; gap: 4px; margin-left: auto; }
.tab { background: none; border: 0; border-top: 3px solid transparent; padding: 0 14px; font-size: .8rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); transition: color .15s; }
.tab:hover { color: var(--navy); }
.tab[aria-current="page"] { color: var(--navy); font-weight: 600; border-top-color: var(--sky); }

/* ---------- Layout ---------- */
.layout { --chat-w: clamp(440px, 38vw, 600px); flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--chat-w); transition: grid-template-columns .2s; }
body.chat-wide .layout { --chat-w: min(62vw, 960px); }
.content { overflow-y: auto; padding: 44px 36px 72px; min-width: 0; }
.pane { max-width: 920px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.pane-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.pane-head h1 { font-family: var(--display); font-weight: 400; font-size: clamp(2rem, 3.2vw, 2.7rem); line-height: 1.12; letter-spacing: -.01em; }
.lede { color: var(--muted); max-width: 62ch; font-size: 1rem; }
.stack { display: flex; flex-direction: column; gap: 24px; }
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--lift); min-width: 0; overflow: hidden; }
.scroll { overflow-x: auto; }

/* ---------- Tables ---------- */
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .93rem; }
th, td { padding: 13px 16px; text-align: right; vertical-align: top; white-space: nowrap; }
tbody tr + tr td { border-top: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; white-space: normal; min-width: 210px; padding-left: 26px; }
th:last-child, td:last-child { padding-right: 26px; }
thead th { font-size: .78rem; font-weight: 600; color: var(--faint); padding-block: 16px 10px; border-bottom: 1px solid var(--line); }
tr.sub td:first-child { padding-left: 46px; color: var(--muted); }
tr.subtotal td { color: var(--faint); font-size: .86rem; }
tr.total td { font-weight: 700; color: var(--navy); background: var(--sky-wash); border-top: 0; padding-block: 16px; }
.fn { display: block; font-size: .82rem; color: var(--faint); line-height: 1.45; margin-top: 2px; font-weight: 400; }
.chip { display: inline-block; font-size: .7rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; margin-left: 8px; vertical-align: 1px; white-space: nowrap; background: var(--amber-wash); color: var(--amber-ink); }

/* Overview matrix: every figure is a button; the open one is filled. */
#overview td { padding-block: 9px; vertical-align: middle; }
.row-btn { background: none; border: 0; padding: 0; text-align: left; color: var(--navy); font-weight: 600; }
.row-btn:hover { color: var(--sky-deep); }
.cell-btn { background: none; border: 0; padding: 7px 12px; margin-right: -12px; border-radius: 999px; color: var(--ink); font-variant-numeric: tabular-nums; transition: background .12s, color .12s; }
td:last-child .cell-btn { margin-right: -12px; }
.cell-btn:hover { background: var(--sky-wash); color: var(--sky-deep); }
.cell-btn[aria-pressed="true"] { background: var(--navy); color: #fff; font-weight: 600; }

/* ---------- Schedule detail ---------- */
.sched-head { padding: 30px 26px 8px; display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: flex-end; justify-content: space-between; }
.sched-head h2 { font-family: var(--display); font-weight: 400; font-size: 1.6rem; line-height: 1.2; }
.sched-head .who { color: var(--muted); font-size: .9rem; margin-top: 6px; max-width: 52ch; }
.figure { text-align: right; flex: none; }
.figure span { display: block; font-size: .8rem; color: var(--faint); }
.figure strong { display: inline-block; font-family: var(--display); font-weight: 400; font-size: clamp(1.9rem, 3vw, 2.5rem); line-height: 1.15; color: var(--navy); font-variant-numeric: lining-nums; border-bottom: 3px solid var(--amber); padding-bottom: 2px; }
.controls { padding: 18px 26px 10px; display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--ground); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: none; border-radius: 999px; padding: 7px 15px; font-size: .86rem; font-weight: 600; color: var(--muted); transition: background .12s, color .12s; }
.seg button:hover { color: var(--navy); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--navy); box-shadow: 0 1px 3px rgba(34,58,94,.16); }
.ask-btn { margin-left: auto; background: var(--sky-wash); color: var(--sky-deep); border: 0; border-radius: 999px; padding: 9px 16px; font-size: .86rem; font-weight: 600; white-space: nowrap; transition: background .12s, color .12s; }
.ask-btn:hover { background: var(--sky); color: #fff; }
.card-head { padding: 26px 26px 6px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.card-head h2 { font-family: var(--display); font-weight: 400; font-size: 1.4rem; line-height: 1.25; }
.card-head .who { color: var(--faint); font-size: .86rem; }
.card-head .ask-btn { margin-left: 0; }
.notes { padding: 14px 26px 22px; font-size: .83rem; color: var(--faint); display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); }
.caution { margin: 8px 26px 6px; padding: 11px 16px; background: var(--amber-wash); color: var(--amber-ink); border-radius: var(--r-md); font-size: .88rem; }

/* ---------- Courses ---------- */
.search { display: flex; align-items: center; gap: 10px; max-width: 520px; background: var(--surface); border-radius: 999px; padding: 0 18px; box-shadow: var(--lift); color: var(--faint); }
.search:focus-within { outline: 2px solid var(--sky); }
.search svg { width: 18px; height: 18px; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 14px 0; color: var(--ink); outline: none; }
.course-group { font-family: var(--display); font-style: italic; font-size: 1.15rem; color: var(--sea); margin-top: 10px; }
.course-list { margin: 0; padding: 6px 26px 24px 48px; display: flex; flex-direction: column; gap: 6px; color: var(--ink); }
.course-list li::marker { color: var(--faint); font-size: .85em; }
.empty { color: var(--muted); padding: 8px 0; }

/* ---------- Assistant ---------- */
.chat { display: flex; flex-direction: column; min-height: 0; background: var(--surface); margin: 18px 18px 18px 0; border-radius: var(--r-lg); box-shadow: var(--lift); overflow: hidden; }
.chat-head { flex: none; padding: 16px 16px 14px 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-family: var(--display); font-style: italic; font-size: 1.2rem; background: linear-gradient(140deg, var(--sky), var(--sea)); }
.chat-title { flex: 1; min-width: 0; }
.chat-title h2 { font-size: 1rem; font-weight: 700; }
.chat-title p { font-size: .78rem; color: var(--faint); line-height: 1.35; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 16px; display: flex; flex-direction: column; gap: 20px; }
.msg { display: flex; flex-direction: column; min-width: 0; }
.msg.user { align-items: flex-end; }
.bubble { font-size: .94rem; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 18px 18px 4px 18px; max-width: 86%; white-space: pre-wrap; }
.msg.error .bubble { background: var(--red-wash); color: var(--red-ink); padding: 11px 16px; border-radius: var(--r-md); }
.bubble > * + * { margin-top: 12px; }
.bubble h4 { margin: 0; font-size: .98rem; color: var(--navy); }
.bubble ul, .bubble ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.bubble li > ul, .bubble li > ol { margin-top: 4px; }
.bubble strong { color: var(--navy); }
.bubble code { background: var(--ground); padding: 1px 5px; border-radius: 4px; font-size: .88em; }
.bubble .tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.bubble table { font-size: .8rem; }
.bubble th, .bubble td { padding: 8px 8px; min-width: 0; white-space: normal; text-align: left; }
.bubble th:not(:first-child) { text-align: right; }
.bubble td.num { white-space: nowrap; text-align: right; }
.bubble th, .bubble td { overflow-wrap: normal; word-break: normal; hyphens: none; }
.bubble th:first-child, .bubble td:first-child { min-width: 84px; padding-left: 12px; }
.bubble th:last-child, .bubble td:last-child { padding-right: 12px; }
.bubble thead th { padding-block: 10px 8px; background: var(--ground); }
.typing { display: inline-flex; gap: 5px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--sky); animation: blink 1.2s infinite both; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; } * { transition: none !important; } }
.welcome { margin: auto 0; display: flex; flex-direction: column; gap: 10px; color: var(--muted); font-size: .94rem; }
.welcome strong { font-family: var(--display); font-style: italic; font-weight: 400; font-size: 1.9rem; line-height: 1.15; color: var(--navy); }
.chips { flex: none; padding: 0 20px 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.chips:empty { display: none; }
.chips button { border: 0; background: var(--sky-wash); color: var(--sky-deep); border-radius: 999px; padding: 8px 14px; font-size: .84rem; font-weight: 600; text-align: left; line-height: 1.35; transition: background .12s, color .12s; }
.chips button:hover { background: var(--sky); color: #fff; }
.chat-form { flex: none; display: flex; gap: 8px; margin: 4px 16px 16px; padding: 6px 6px 6px 18px; background: var(--ground); border-radius: 26px; align-items: flex-end; border: 1px solid transparent; }
.chat-form:focus-within { background: var(--surface); border-color: var(--sky); box-shadow: 0 0 0 3px var(--sky-wash); }
.chat-form textarea { flex: 1; min-width: 0; resize: none; max-height: 140px; padding: 9px 0; border: 0; background: none; outline: none; line-height: 1.45; }
.chat-form button { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; display: grid; place-items: center; transition: background .15s; }
.chat-form button:hover { background: var(--sky-deep); }
.chat-form button:disabled { background: var(--faint); cursor: default; }
.chat-form button svg { width: 19px; height: 19px; }
.fab { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--navy); color: #fff; border: 0; border-radius: 999px; padding: 14px 22px; font-weight: 600; box-shadow: 0 8px 26px rgba(34,58,94,.38); z-index: 4; }

@media (max-width: 1500px) {
  .content { padding-inline: 24px; }
  #overview th, #overview td { padding-inline: 8px; }
  #overview .cell-btn { padding-inline: 8px; margin-right: -8px; }
  #overview td:last-child { padding-right: 26px; }
  #overview th:first-child, #overview td:first-child { padding-left: 22px; min-width: 170px; }
}
@media (max-width: 1360px) {
  body:not(.chat-wide) .bubble table { font-size: .74rem; }
  body:not(.chat-wide) .bubble th, body:not(.chat-wide) .bubble td { padding-inline: 5px; }
  body:not(.chat-wide) .bubble th:first-child, body:not(.chat-wide) .bubble td:first-child { padding-left: 10px; min-width: 0; }
  body:not(.chat-wide) .bubble th:last-child, body:not(.chat-wide) .bubble td:last-child { padding-right: 10px; }
}
@media (max-width: 1020px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .chat { position: fixed; inset: 0; z-index: 10; margin: 0; border-radius: 0; display: none; }
  .chat.open { display: flex; }
  .only-mobile { display: inline-block; }
  .not-mobile { display: none; }
  body.chat-open .fab { display: none; }
  .content { padding: 28px 16px 100px; }
}
@media (max-width: 720px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { display: none; }
  .top { padding: 0 16px; }
  .tabs { order: 3; width: 100%; margin-left: 0; overflow-x: auto; }
  .tab { padding: 10px 12px 12px; white-space: nowrap; border-top: 0; border-bottom: 3px solid transparent; }
  .tab[aria-current="page"] { border-bottom-color: var(--sky); }
  #logoutBtn { margin-left: auto; }
  .brand-logo { height: 38px; }
  th, td { padding: 11px 10px; }
  th:first-child, td:first-child { min-width: 168px; padding-left: 18px; }
  th:last-child, td:last-child { padding-right: 18px; }
  .sched-head, .controls, .card-head, .notes { padding-inline: 18px; }
  .caution { margin-inline: 18px; }
  .figure { text-align: left; }
  .ask-btn { margin-left: 0; }
  .course-list { padding-inline: 40px 18px; }
}
