* {
    box-sizing: border-box
}

:root {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1d302a;
    background: #f6f5f0;
    font-size: 15px;
    --ink: #183a30;
    --muted: #52665c;
    --green: #174936;
    --line: #d6ddd3;
    --paper: #fffef9;
    --orange: #99522b
}

body {
    margin: 0
}

button,
select,
input,
textarea {
    font: inherit
}

button,
a,
select {
    touch-action: manipulation
}

button {
    cursor: pointer
}

button:disabled {
    cursor: wait;
    opacity: .55
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid #d6a053;
    outline-offset: 2px
}

button,
select,
input,
textarea {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .64rem .85rem;
    background: var(--paper);
    color: var(--ink)
}

button:hover:not(:disabled) {
    border-color: #779382;
    background: #ecf1e9
}

a {
    color: inherit
}

header {
    height: 70px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
    display: flex;
    align-items: center;
    padding: 0 clamp(18px, 4vw, 70px);
    gap: 32px
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
    font: 600 23px Georgia, serif;
    letter-spacing: -1px
}

.brand img {
    width: 36px;
    height: 36px
}

.nav {
    height: 100%;
    display: flex;
    align-items: stretch;
    gap: 25px
}

.nav a {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: 13px;
    color: var(--muted);
    border-bottom: 2px solid transparent
}

.nav .current {
    border-color: var(--green);
    color: var(--green);
    font-weight: 700
}

.header-note {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px
}

.chat-shell {
    max-width: 880px;
    margin: auto;
    padding: 24px 26px 45px
}

.toolbar,
.row,
.tools,
.pills,
.card-title,
.session-line {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap
}

.toolbar {
    justify-content: space-between
}

.modes {
    display: flex;
    padding: 3px;
    border: 1px solid var(--line);
    background: #e8ece4;
    border-radius: 12px
}

.modes button {
    font-size: 13px;
    border: 0;
    background: transparent;
    border-radius: 9px;
    padding: .5rem .8rem
}

.modes .selected {
    background: var(--paper);
    box-shadow: 0 1px 3px #172e232b;
    font-weight: 650
}

.quiet {
    font-size: 13px;
    background: transparent
}

.hero {
    padding: clamp(38px, 7vh, 85px) 0 30px
}

.hero img {
    width: 53px;
    height: 53px
}

.hero h1,
.monitor h1,
.login h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
    letter-spacing: -.045em;
    color: var(--ink);
    margin: 15px 0 10px;
    line-height: 1.06
}

.hero h1 {
    font-size: clamp(40px, 7vw, 66px)
}

.hero p,
.monitor .sub,
.login p {
    max-width: 600px;
    color: var(--muted);
    line-height: 1.55;
    margin: 0
}

.conversation {
    display: grid;
    gap: 16px;
    margin: 20px 0
}

.message {
    padding: 15px 19px;
    border: 1px solid var(--line);
    border-radius: 15px;
    max-width: 90%;
    white-space: pre-wrap;
    line-height: 1.55;
    background: var(--paper)
}

.message.user {
    justify-self: end;
    background: #e1eadd
}

.message > strong {
    font-size: 11px;
    letter-spacing: .03em;
    display: block;
    color: var(--muted);
    margin-bottom: 5px
}

.message p {
    margin: 0
}

.pills {
    gap: 7px
}

.pills button,
.tools button {
    font-size: 12px
}

.composer {
    background: var(--paper);
    border: 1px solid #8ba08c;
    border-radius: 14px;
    padding: 10px;
    margin-top: 14px;
    box-shadow: 0 6px 22px #1b3a2b08
}

.composer textarea {
    width: 100%;
    resize: vertical;
    border: 0;
    background: transparent;
    padding: 8px;
    min-height: 56px
}

.composer .row {
    justify-content: flex-end
}

.primary {
    background: var(--green);
    border-color: var(--green);
    color: white;
    font-weight: 650
}

.primary:hover:not(:disabled) {
    background: #10382a;
    color: white
}

.info {
    font-size: 13px;
    line-height: 1.55;
    color: var(--muted);
    min-height: 22px;
    margin: 9px 0
}

.error {
    color: #8d3428
}

.login {
    max-width: 430px;
    margin: 11vh auto;
    background: var(--paper);
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 15px
}

.login h1,
.monitor h1 {
    font-size: 40px
}

.login label {
    margin: 23px 0 15px;
    display: grid;
    gap: 8px;
    font-size: 13px
}

.login button {
    width: 100%
}

.monitor {
    max-width: 1450px;
    margin: auto;
    padding: 24px clamp(14px, 3vw, 50px) 45px
}

.monitor .intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 22px
}

.monitor h1 {
    margin: 0 0 6px
}

.session-line {
    margin-bottom: 14px
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px
}

.card,
.trace {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 17px 20px;
    min-width: 0
}

.card-title {
    justify-content: space-between
}

.card h2 {
    margin: 0 0 12px;
    color: var(--ink);
    font: 600 19px Georgia, serif
}

.card h3,
.small-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    margin: 13px 0 5px
}

.markdown {
    max-height: 245px;
    overflow: auto;
    line-height: 1.5;
    font-size: 13px
}

.markdown p,
.markdown h4,
.markdown h3 {
    margin: 5px 0
}

.card textarea {
    width: 100%;
    resize: vertical;
    margin: 12px 0 6px
}

.tools {
    gap: 6px
}

.wide {
    grid-column: 1/-1
}

.tags,
.meta {
    font-size: 12px;
    color: var(--muted)
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 12px
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 6px;
    overflow-wrap: anywhere
}

th {
    color: var(--muted)
}

pre {
    font: 12px/1.48 ui-monospace, Menlo, monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin: 7px 0
}

.model-runs,
.traces {
    display: grid;
    gap: 9px;
    max-height: 370px;
    overflow: auto
}

.traces {
    margin-top: 12px;
    max-height: 640px
}

.trace {
    padding: 12px;
    background: #fbfbf7
}

.cols {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 9px;
    margin-top: 9px
}

.cols section {
    padding: 10px;
    border-radius: 7px;
    background: #efeee8;
    min-width: 0
}

.cols section:nth-child(2) {
    background: #faeae5
}

.cols section:nth-child(3) {
    background: #e6f1e7
}

.cols pre {
    max-height: 218px;
    overflow: auto
}

.pill {
    display: inline-flex;
    align-items: center;
    font-weight: 650;
    font-size: 11px;
    border-radius: 16px;
    padding: 4px 8px;
    background: #e0ece1;
    color: #244934
}

.pill.pending {
    background: #faeac9;
    color: #78531f
}

.pill.blocked {
    background: #f8e0db;
    color: #873f30
}

.danger {
    color: #873f30;
    border-color: #d3a59d
}

.run {
    padding: 8px;
    border-bottom: 1px solid var(--line)
}

.run summary {
    font-size: 12px;
    cursor: pointer
}

.run pre {
    max-height: 150px;
    overflow: auto
}

.action-label {
    font-weight: 650;
    font-size: 12px;
    color: var(--ink);
    display: block;
    margin: 0 0 7px
}

select {
    max-width: 100%
}

[hidden] {
    display: none !important
}

@media(max-width:740px) {
    header {
        height: auto;
        min-height: 59px;
        gap: 14px;
        flex-wrap: wrap;
        padding: 8px 14px
    }

    .nav {
        gap: 12px
    }

    .nav a {
        padding: 9px 0
    }

    .header-note {
        display: none
    }

    .chat-shell {
        padding: 16px
    }

    .hero {
        padding-top: 35px
    }

    .grid,
    .cols {
        grid-template-columns: 1fr
    }

    .monitor .intro {
        align-items: flex-start;
        flex-direction: column
    }

    .login {
        margin: 8vh 16px
    }

    .session-line select {
        max-width: 78vw
    }

    .message {
        max-width: 100%
    }
}
.contact-panel, .office-inbox {
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f0f4ec;
    font-size: 13px;
    line-height: 1.5;
}
.contact-panel p, .office-entries p { margin: 5px 0; }
.office-entries { max-height: 150px; overflow: auto; margin: 8px 0; }
.message.firm { border-color: #71947c; background: #edf5ea; }

.language-picker {
    display: flex;
    align-items: center;
    gap: .45rem;
    color: var(--muted);
    font-size: 12px;
}

.language-picker select {
    font-size: 13px;
    padding: .42rem .52rem;
    max-width: 10rem;
}

.dataset-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    flex-wrap: wrap;
    margin: 0 0 12px;
}

.dataset-toolbar p {
    margin: 0;
}

.dataset-state {
    font-size: 12px;
    font-weight: 650;
    color: var(--muted);
}

.dataset-state[data-phase="scanning"] {
    color: var(--orange);
}

.dataset-state[data-phase="selected"] {
    color: #16592f;
}

.dataset-scroll {
    overflow-x: auto;
}

.dataset-table {
    min-width: 560px;
}

.dataset-table th,
.dataset-table td {
    padding: 11px 9px;
    vertical-align: top;
}

.dataset-table thead {
    background: #f2f4ee;
}

.dataset-table .case-row>th {
    width: 30%;
    font-weight: 500;
}

.dataset-table .case-row>td:nth-child(3) {
    width: 40%;
}

.case-row small {
    display: block;
    color: var(--muted);
    margin-top: .25rem;
}

.record-toggle {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 14px;
    font-weight: 650;
    text-align: left;
}

.record-toggle::before {
    content: "▸";
    margin-right: 6px;
}

.record-toggle[aria-expanded="true"]::before {
    content: "▾";
}

.statute-preview {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.case-row.research-selected>* {
    background: #d6f0d9;
    color: #153c25;
}

.case-row.research-selected>th {
    box-shadow: inset 4px 0 #287647;
}

.research-selected .record-state {
    color: #16592f;
    font-weight: 750;
}

.dataset-detail>td {
    background: #f8f9f4;
}

.record-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
    gap: .9rem 1.45rem;
    margin: .3rem .6rem;
}

.record-fields dt {
    font-weight: 700;
    color: var(--muted);
    margin-bottom: .3rem;
}

.record-fields dd {
    white-space: pre-line;
    line-height: 1.5;
    margin: 0;
}

@media(max-width:740px) {
    .language-picker {
        margin-left: auto;
    }

    .language-picker span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }
}
