:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1b2a3a;
  background: #f4f6f8;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; line-height: 1.55; }
a { color: #075b75; text-underline-offset: .18em; }
a:hover { color: #043e55; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #f0b84c; outline-offset: 3px; }
.wrap { width: min(100% - 2.5rem, 1180px); margin-inline: auto; }
.skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 100; padding: .7rem 1rem; background: #fff; color: #082e47; border-radius: .5rem; }
.skip-link:focus { top: 1rem; }

.site-header { background: #112c43; color: #fff; box-shadow: 0 3px 18px rgba(9,29,47,.12); position: sticky; top: 0; z-index: 20; }
.header-row { min-height: 100px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.header-identity { display: flex; align-items: center; gap: 1.15rem; min-width: 0; }
.def-link { display: inline-flex; align-items: center; flex: none; }
.brand { display: inline-flex; align-items: center; color: #fff; text-decoration: none; min-width: 0; }
.brand:hover { color: #fff; }
.brand-copy { display: grid; padding-left: 1.15rem; border-left: 1px solid rgba(255,255,255,.28); line-height: 1.2; white-space: nowrap; }
.brand-copy strong { font-size: 1.08rem; letter-spacing: -.02em; }
.brand-copy small { margin-top: .15rem; font-size: .74rem; color: #b9d0de; }
.header-actions { display: flex; align-items: center; gap: 1.1rem; min-width: 0; }
.def-logo { display: block; width: 240px; height: auto; flex: none; }
.workspace-label { display: grid; color: #b9d0de; font-size: .76rem; line-height: 1.25; text-align: right; }
.workspace-name { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-size: .88rem; font-weight: 650; }
.logout-form { margin: 0; }
.logout-button { margin: 0; padding: .48rem .8rem; color: #f1f7fa; background: transparent; border: 1px solid #5e7c90; font-size: .79rem; white-space: nowrap; }
.logout-button:hover { background: #24445d; border-color: #9bb7c6; }
.primary-nav { display: flex; gap: .2rem; overflow-x: auto; scrollbar-width: thin; border-top: 1px solid rgba(255,255,255,.13); }
.primary-nav a { flex: none; display: inline-flex; align-items: center; padding: .78rem .98rem .72rem; border-bottom: 3px solid transparent; color: #d3e1e9; text-decoration: none; font-size: .88rem; font-weight: 580; white-space: nowrap; }
.primary-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.primary-nav a[aria-current="page"] { border-bottom-color: #6bd2c3; background: rgba(255,255,255,.08); color: #fff; font-weight: 720; }

main.wrap { padding-block: 2.4rem 5rem; }
.page-heading { margin-bottom: 1.5rem; }
.page-heading h1 { margin: .22rem 0 .55rem; }
.page-intro { margin: 0; color: #56687a; font-size: 1rem; max-width: 48rem; }
.eyebrow { margin: 0; color: #146a73; font-size: .72rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
h1 { margin: 0 0 1.2rem; color: #102c42; font-size: clamp(1.9rem, 3.5vw, 2.6rem); line-height: 1.18; letter-spacing: -.035em; }
h2 { margin: 0 0 .6rem; color: #17384b; font-size: 1.24rem; line-height: 1.3; letter-spacing: -.015em; }
h3 { color: #1b394a; }
p { margin: .7rem 0 1rem; }
.breadcrumb { display: flex; gap: .65rem; align-items: center; margin: 0 0 1.1rem; color: #6b7b89; font-size: .85rem; }
.breadcrumb a { text-decoration: none; }
.section-nav { display: flex; flex-wrap: wrap; gap: .55rem; margin: 1.4rem 0 1.7rem; }
.section-nav a { display: inline-flex; align-items: center; padding: .48rem .8rem; background: #e5f0f0; border: 1px solid #c8dfdf; border-radius: 999px; color: #145360; font-size: .84rem; font-weight: 650; text-decoration: none; }
.section-nav a:hover { background: #d4e9e8; }
section[id] { scroll-margin-top: 9.5rem; }

.card { background: #fff; border: 1px solid #dde5e9; border-radius: 14px; box-shadow: 0 6px 24px rgba(21,49,66,.045); padding: clamp(1.35rem, 3vw, 2rem); min-width: 0; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card > form:not(.table-form), .card > .proposal { max-width: 780px; }
.card fieldset { border: 1px solid #dde5e9; border-radius: 10px; padding: .7rem 1rem 1rem; margin: 1.2rem 0; }
.card legend { color: #17384b; font-weight: 700; padding: 0 .35rem; }
.stack { margin-top: 1.2rem; }
.login { max-width: 600px; margin: clamp(.5rem, 5vw, 3rem) auto 0; }
.login h1 { font-size: clamp(1.7rem, 3vw, 2.2rem); }
.panel-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.panel-heading h2 { margin: 0; }
.text-action { font-size: .82rem; font-weight: 700; text-decoration: none; }
.workspace-grid { display: grid; grid-template-columns: minmax(245px, 300px) minmax(0, 1fr); align-items: start; gap: 1.15rem; }
.conversations-panel { padding: 1.45rem; }
.discussion-panel { min-height: 330px; }
.discussion-panel h2 { overflow-wrap: anywhere; }
.search-form { margin: .8rem 0 1rem; }
.search-form label { margin-top: 0; }
.search-row { display: flex; gap: .45rem; align-items: stretch; }
.search-row input { min-width: 0; }
.search-row button { flex: none; margin: 0; }
.search-feedback { margin: .5rem 0 0; color: #617285; font-size: .83rem; }
.rename-control { margin: -.25rem 0 1rem; max-width: 780px; }
.rename-control summary { color: #075b75; font-size: .88rem; font-weight: 700; cursor: pointer; }
.rename-control form { padding: .15rem 0 .75rem; }
.rename-control button { margin-top: .6rem; }
.manual-draft summary { cursor: pointer; color: #075b75; font-weight: 700; }
.manual-draft[open] summary { margin-bottom: .8rem; }
.discussion-history summary { cursor: pointer; color: #075b75; font-weight: 700; }
.conversation-list { list-style: none; padding: 0; margin: .8rem -.45rem -.4rem; max-height: 70vh; overflow: auto; }
.conversation-list li { display: grid; gap: .28rem; padding: .72rem .55rem; border-top: 1px solid #edf1f3; }
.conversation-list a { font-size: .9rem; font-weight: 650; text-decoration: none; overflow-wrap: anywhere; }
.conversation-list a:hover { text-decoration: underline; }
.conversation-list a[aria-current="page"] { color: #103e48; }
.status-badge { justify-self: start; display: inline-flex; border-radius: 999px; background: #e9f2f3; color: #2e6070; padding: .12rem .55rem; font-size: .72rem; font-weight: 700; }
.messages { list-style: none; padding: 0; margin: 1.3rem 0; }
.messages li { margin: .85rem 0; padding: .9rem 1rem; border: 1px solid #e2e9ed; border-left: 3px solid #78aab6; background: #f8fbfc; border-radius: 5px 10px 10px 5px; overflow-wrap: anywhere; }
.messages li.message-user { border-left-color: #75ab90; background: #f7faf7; }
.messages strong { display: block; color: #2c5967; font-size: .82rem; }
.messages p { margin: .4rem 0 0; white-space: normal; }
.ai-request { border-top: 1px solid #e2e9ed; margin-top: 1.4rem; padding-top: .35rem; }

form label { display: block; margin: 1.1rem 0 .32rem; color: #294153; font-size: .9rem; font-weight: 700; }
input:not([type=hidden]):not([type=checkbox]), textarea, select { display: block; width: 100%; min-height: 2.75rem; padding: .65rem .78rem; border: 1px solid #a8bac6; border-radius: 8px; background: #fff; color: #1b2a3a; }
input:not([type=hidden]):not([type=checkbox]):hover, textarea:hover, select:hover { border-color: #648598; }
textarea { resize: vertical; min-height: 8rem; }
select { max-width: 100%; }
.check { display: flex; align-items: flex-start; gap: .7rem; font-size: .87rem; font-weight: 500; }
.check input { flex: none; width: 1.05rem; height: 1.05rem; margin: .25rem 0 0; accent-color: #0c6270; }
button { margin-top: 1.2rem; padding: .65rem 1rem; border: 1px solid #0b5968; border-radius: 8px; background: #0b5968; color: #fff; font-weight: 700; cursor: pointer; line-height: 1.35; }
button:hover { background: #084755; border-color: #084755; }
button.secondary { background: #fff; border-color: #9eb8c3; color: #145366; }
button.secondary:hover { background: #eef6f6; border-color: #578c98; }
button:disabled { opacity: .6; cursor: not-allowed; }
.optional, .hint { color: #617285; font-size: .86rem; font-weight: 400; }
.hint { margin-top: .5rem; }
.alert, .success { border-radius: 8px; padding: .82rem 1rem; margin: 1rem 0; }
.alert { background: #fff3ed; border: 1px solid #f1d4c7; border-left: 4px solid #b95e38; color: #653b29; }
.success { background: #eaf6ef; border: 1px solid #cce6d5; border-left: 4px solid #38835b; color: #285842; }
.admin-list { padding-left: 1.25rem; }
.admin-list li { padding: .5rem 0; border-bottom: 1px solid #edf1f3; }
.inline-form { display: inline; margin-left: .5rem; }
.inline-form button { display: inline-flex; margin: .25rem 0; padding: .38rem .68rem; font-size: .82rem; }
.letter-body { white-space: pre-wrap; overflow-wrap: anywhere; padding: 1rem; background: #f7fafb; border: 1px solid #e4ecef; border-radius: 8px; }
.letter-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; margin-top: .35rem; }
.letter-actions button, .letter-actions .button-link { margin-top: .6rem; }
.button-link { display: inline-flex; align-items: center; padding: .65rem 1rem; border: 1px solid #9eb8c3; border-radius: 8px; background: #fff; color: #145366; font-weight: 700; line-height: 1.35; text-decoration: none; }
.button-link:hover { background: #eef6f6; border-color: #578c98; color: #145366; }
.copy-feedback { color: #285842; font-size: .86rem; }
.usage-summary { max-width: 28rem; padding: .8rem 1rem; margin: 0 0 1.3rem; background: #eaf3f4; border: 1px solid #cbdfe2; border-radius: 10px; }
.usage-summary div { display: flex; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; font-size: .85rem; }
.usage-summary span { color: #3d5b69; }
.usage-summary progress { display: block; width: 100%; height: .65rem; margin-top: .5rem; accent-color: #0b6875; }
.overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1.25rem; }
.overview-card { display: grid; align-content: center; gap: .15rem; min-height: 6rem; padding: 1rem 1.2rem; background: #fff; border: 1px solid #dce6e9; border-radius: 12px; text-decoration: none; box-shadow: 0 6px 20px rgba(21,49,66,.045); }
.overview-card:hover { border-color: #7aaab2; background: #f8fcfc; }
.overview-card strong { color: #17384b; font-size: 1.3rem; line-height: 1.2; }
.overview-card span { font-size: .84rem; }
.archive-entry summary { display: list-item; cursor: pointer; padding-left: .2rem; }
.archive-entry summary strong { display: inline; margin-left: .35rem; color: #17384b; font-size: 1.1rem; }
.archive-entry summary span { display: block; margin: .25rem 0 0 1.2rem; color: #617285; font-size: .88rem; }
.archive-entry[open] .letter-body { margin-top: 1.2rem; }
.proposal { border-top: 1px solid #dce5e9; padding: 1.15rem 0; }
.table-scroll { overflow-x: auto; border: 1px solid #e2e9ed; border-radius: 9px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .8rem .75rem; border-bottom: 1px solid #e6edf0; text-align: left; vertical-align: top; }
thead th { color: #3b5669; background: #f4f8f9; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f9fbfc; }
td small, th small { display: block; margin-top: .25rem; color: #67798a; font-size: .78rem; font-weight: 400; }
.table-form { min-width: 8rem; margin-bottom: .45rem; }
.table-form input:not([type=hidden]) { min-width: 7rem; }
.table-form button { margin-top: .35rem; padding: .42rem .65rem; font-size: .8rem; }
.event-filters { display: flex; align-items: end; flex-wrap: wrap; gap: .7rem; margin: 1rem 0 1.2rem; }
.event-filters > div { flex: 1 1 12rem; max-width: 20rem; }
.event-filters label { margin: 0 0 .3rem; }
.event-filters button { margin: 0; }
.quota-alert { display: block; margin-top: .35rem; color: #a3472a; font-size: .78rem; }
code { overflow-wrap: anywhere; background: #eef3f5; border-radius: 4px; padding: .13rem .25rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .def-logo { width: 205px; }
  .workspace-label { display: none; }
}
@media (max-width: 820px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .conversation-list { max-height: 17rem; }
}
@media (max-width: 620px) {
  .overview-grid { grid-template-columns: 1fr; }
  .overview-card { min-height: 0; }
  .site-header { position: static; }
  .wrap { width: min(100% - 1.5rem, 1180px); }
  .header-row { min-height: 82px; gap: .6rem; }
  .header-identity { gap: .55rem; }
  .brand-copy { padding-left: .55rem; }
  .workspace-label { display: none; }
  .brand-copy strong { font-size: .95rem; }
  .def-logo { width: 185px; }
  .header-actions { gap: .55rem; }
  .logout-button { font-size: .73rem; padding: .42rem .55rem; }
  .primary-nav a { padding: .7rem .78rem .64rem; font-size: .82rem; }
  main.wrap { padding-block: 1.5rem 3rem; }
  .card { padding: 1.25rem; }
  .conversations-panel { padding: 1.2rem; }
  .table-scroll { margin-inline: -.25rem; }
  .search-row { flex-wrap: wrap; }
  .search-row button { width: 100%; }
  section[id] { scroll-margin-top: 1rem; }
}
@media (max-width: 460px) {
  .header-row { flex-wrap: wrap; gap: .25rem; padding-block: .4rem .6rem; }
  .header-identity { width: 100%; gap: .45rem; }
  .brand-copy { padding-left: .45rem; }
  .brand-copy strong { font-size: .86rem; }
  .def-logo { width: clamp(155px, 44vw, 180px); }
  .header-actions { width: 100%; justify-content: space-between; }
  .workspace-label { display: grid; text-align: left; font-size: .68rem; }
  .workspace-name { max-width: 12rem; font-size: .76rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
