:root {
    --paper: #f5f5f0;
    --surface: #fff;
    --ink: #20271f;
    --muted: #626b60;
    --line: #dce0d7;
    --accent: #d4ec93;
    --green: #365d28;
    --mono: ui-monospace, SFMono-Regular, Consolas, monospace
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: var(--paper) !important;
    color: var(--ink) !important;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
    font-size: 14px
}

a {
    color: inherit
}

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

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

button {
    cursor: pointer
}

button:disabled {
    cursor: not-allowed;
    opacity: .5
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--green) !important;
    outline-offset: 3px
}

h1,
h2,
h3,
p {
    margin-top: 0
}

h1 {
    letter-spacing: -.045em
}

h2 {
    letter-spacing: -.02em
}

input:not([type=checkbox]):not([type=range]),
select,
textarea {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 9px 11px;
    background: #fff;
    color: var(--ink);
    max-width: 100%
}

input[type=checkbox] {
    accent-color: var(--green);
    width: 17px;
    height: 17px
}

input[type=range] {
    accent-color: var(--green);
    width: 100%
}

label {
    font-size: 12px;
    color: var(--muted)
}

button {
    min-height: 36px
}

body .shadow-sm {
    box-shadow: none
}

body .rounded-lg {
    border-radius: 6px
}

body .border-gray-200,
body .border-gray-300 {
    border-color: var(--line)
}

body .bg-gray-900,
body .bg-blue-600 {
    background: var(--ink)
}

body .text-blue-600,
body .text-blue-700 {
    color: var(--green)
}

body .bg-green-600 {
    background: var(--green)
}

body .bg-red-600 {
    background: #8e3e34
}

body .text-gray-500,
body .text-gray-600 {
    color: var(--muted)
}

body .max-w-6xl {
    max-width: 1160px
}

body main.min-h-screen {
    min-height: calc(100vh - 150px)
}

.app-header {
    border-bottom: 1px solid var(--line);
    background: var(--paper)
}

.header-inner {
    max-width: 1160px;
    margin: auto;
    display: flex;
    align-items: center;
    gap: 36px;
    padding: 18px 24px
}

.wordmark {
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -1.1px;
    text-decoration: none;
    white-space: nowrap
}

.wordmark span {
    color: var(--green)
}

.app-nav {
    display: flex;
    gap: 5px;
    flex: 1
}

.app-nav a {
    padding: 7px 12px;
    text-decoration: none;
    font-size: 13px;
    color: var(--muted);
    border-radius: 4px
}

.app-nav a[aria-current=page] {
    background: #e6e9df;
    color: var(--ink);
    font-weight: 600
}

.app-nav a:hover {
    background: #e6e9df
}

.header-aside {
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 12px;
    color: var(--muted)
}

.app-footer {
    max-width: 1160px;
    margin: 32px auto 0;
    padding: 20px 24px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted)
}

.skip-link {
    position: absolute;
    top: -60px;
    background: var(--ink);
    color: #fff;
    padding: 10px;
    z-index: 100
}

.skip-link:focus {
    top: 0
}

.eyebrow {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--muted);
    margin-bottom: 12px
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 28px
}

.page-heading h1 {
    font-size: 32px;
    line-height: 1.2;
    margin-bottom: 8px;
    font-weight: 600
}

.page-heading p {
    color: var(--muted);
    max-width: 600px
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 22px;
    margin-bottom: 20px
}

.panel h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px
}

.panel-head h2 {
    margin: 0
}

.btn {
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    padding: 8px 14px;
    font-weight: 500;
    color: var(--ink);
    text-decoration: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    font-size: 13px
}

.btn:hover {
    background: #eef0e8
}

.btn-primary {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink)
}

.btn-primary:hover {
    background: #394333
}

.btn-accent {
    background: var(--accent);
    border-color: var(--accent)
}

.btn-danger {
    color: #8e3e34
}

.quiet {
    color: var(--muted);
    font-size: 13px
}

.mono,
.timer-display {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.03em
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px
}

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

.action-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 16px
}

.work-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    margin: 16px 0
}

.metric {
    padding: 14px 10px;
    border-right: 1px solid var(--line)
}

.metric:last-child {
    border: 0
}

.metric dt {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 5px
}

.metric dd {
    font-family: var(--mono);
    font-size: 20px;
    margin: 0
}

.badge {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: .03em;
    padding: 4px 7px;
    border: 1px solid var(--line);
    border-radius: 3px;
    white-space: nowrap
}

.badge.active {
    background: #edf4de;
    color: var(--green);
    border-color: #d6e4bd
}

.work-card {
    scroll-margin-top: 20px
}

.work-card h3 {
    font-weight: 600;
    font-size: 17px;
    margin: 5px 0
}

.work-card summary {
    cursor: pointer;
    font-size: 12px;
    margin-top: 16px
}

.receipt-events {
    list-style: none;
    padding: 0;
    margin: 12px 0
}

.receipt-events li {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere
}

.receipt-events time {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted)
}

.receipt-events a {
    color: var(--green);
    text-decoration: underline
}

.notice {
    padding: 10px 12px;
    border-left: 3px solid #9b782e;
    background: #fbf6e9;
    font-size: 12px;
    margin: 12px 0
}

.error {
    background: #fcf0eb;
    border-color: #983b2d;
    color: #833628
}

.status-message:empty {
    display: none
}

.status-message {
    margin-bottom: 18px
}

.empty-state {
    padding: 35px 18px;
    text-align: center;
    color: var(--muted)
}

.draft-row {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 10px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line)
}

.draft-row .form-grid {
    margin-top: 8px
}

.token-output {
    word-break: break-all;
    background: var(--paper);
    padding: 12px;
    display: block;
    font-family: var(--mono);
    margin-top: 12px
}

.token-row {
    border-top: 1px solid var(--line);
    padding: 12px 0;
    display: flex;
    justify-content: space-between;
    gap: 8px
}

.section-divider {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 24px 0
}

.public-wrap {
    max-width: 1080px;
    margin: auto;
    padding: 0 24px
}

.public-hero {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 70px;
    padding: 90px 0 70px;
    align-items: center
}

.public-hero h1 {
    font-size: clamp(38px, 5vw, 64px);
    line-height: 1.06;
    font-weight: 550;
    margin: 0 0 24px
}

.public-hero p {
    font-size: 16px;
    color: var(--muted);
    max-width: 460px
}

.public-hero .panel {
    margin: 0
}

.public-section {
    padding: 48px 0;
    border-top: 1px solid var(--line)
}

.public-section h2 {
    font-size: 28px;
    font-weight: 550
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px
}

.feature-grid h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 12px 0
}

.feature-grid p {
    color: var(--muted)
}

.article {
    max-width: 740px;
    margin: 60px auto;
    padding: 0 24px
}

.article h1 {
    font-size: 40px;
    line-height: 1.12;
    margin-bottom: 20px
}

.article h2 {
    font-size: 22px;
    font-weight: 600;
    margin-top: 36px;
    margin-bottom: 14px
}

.article p,
.article li {
    font-size: 15px;
    line-height: 1.8
}

.article ul,
.article ol {
    padding-left: 23px;
    list-style: revert
}

.article a {
    text-decoration: underline;
    color: var(--green)
}

pre {
    padding: 18px;
    border: 1px solid var(--line);
    background: #eceee6;
    border-radius: 4px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.6
}

code {
    font-family: var(--mono)
}

.timeline {
    display: grid;
    gap: 9px;
    margin: 20px 0
}

.timeline-row {
    display: grid;
    grid-template-columns: 70px 1fr;
    align-items: center;
    font-size: 11px;
    gap: 8px
}

.track {
    height: 20px;
    background: #eef0e8;
    position: relative;
    border-radius: 2px;
    overflow: hidden
}

.bar {
    height: 100%;
    background: var(--green);
    position: absolute
}

.bar.agent {
    background: #a1b88c
}

.bar.waiting {
    background: #cec6aa
}

.legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--muted)
}

.timer-card:has([data-running=true]) {
    border-left: 3px solid var(--green);
    background: #fcfef7
}

.timer-card .timer-display {
    font-size: 36px;
    font-weight: 450
}

.timer-card .timer-notes {
    width: min(100%, 600px)
}

body .timer-card {
    padding: 22px 24px
}

#timer-cards {
    display: grid;
    gap: 12px
}

#timer-cards>* {
    margin-top: 0
}

.timer-status span {
    font-family: var(--mono);
    font-size: 11px
}

.timer-button {
    min-width: 110px
}

.public-nav {
    display: flex;
    gap: 18px;
    align-items: center
}

.public-nav a {
    font-size: 13px;
    text-decoration: none
}

.calculator-fields {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px
}

.calculator-fields label {
    display: flex;
    flex-direction: column;
    gap: 10px
}

.calculator-result {
    padding: 20px 0;
    font-family: var(--mono);
    font-size: 15px
}

.hidden {
    display: none
}

@media(max-width:900px) {
    .work-layout {
        grid-template-columns: 1fr
    }

    .public-hero {
        gap: 30px
    }

    .header-inner {
        gap: 16px;
        flex-wrap: wrap
    }

    .header-aside {
        margin-left: auto
    }

    .app-nav {
        order: 3;
        flex-basis: 100%;
        overflow-x: auto
    }

    .app-nav a {
        white-space: nowrap
    }

    .metrics {
        grid-template-columns: repeat(2, 1fr)
    }

    .metric:nth-child(2) {
        border-right: 0
    }

    .metric:nth-child(-n+2) {
        border-bottom: 1px solid var(--line)
    }
}

@media(max-width:600px) {
    .header-inner {
        padding: 14px 16px;
        gap: 8px
    }

    .app-nav {
        gap: 0
    }

    .app-nav a {
        padding: 8px 10px
    }

    .public-wrap {
        padding: 0 18px
    }

    .public-hero {
        grid-template-columns: 1fr;
        padding: 45px 0;
        gap: 30px
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 20px
    }

    .public-nav {
        gap: 12px
    }

    .public-nav .nav-secondary {
        display: none
    }

    .form-grid,
    .calculator-fields {
        grid-template-columns: 1fr
    }

    .form-wide {
        grid-column: auto
    }

    .panel {
        padding: 16px
    }

    .page-heading {
        display: block
    }

    .page-heading h1 {
        font-size: 28px
    }

    .public-section {
        padding: 32px 0
    }

    .article {
        margin-top: 36px
    }

    .article h1 {
        font-size: 32px
    }

    .app-footer {
        gap: 16px;
        flex-wrap: wrap
    }

    .timer-card .timer-display {
        font-size: 32px
    }

    .header-aside .account-label {
        display: none
    }
}

@media(prefers-reduced-motion:reduce) {
    * {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important
    }
}

dialog::backdrop {
    background: rgb(32 39 31 / 30%);
}

.account-label {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .app-nav a {
        padding: 8px 9px;
        font-size: 12px;
    }
}

.agent-setup-banner {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
    padding: 13px 16px;
    border: 1px solid #d6e4bd;
    border-radius: 4px;
    background: #edf4de;
    color: var(--green);
    text-align: left;
}
.agent-setup-banner:hover { background: #e3edce; }
.agent-setup-banner .mono { font-size: 12px; text-align: right; }
#setup-copy-fallback { margin-top: 12px; }
#setup-prompt-text { display: block; width: 100%; margin-top: 8px; font-family: var(--mono); font-size: 12px; }
