/* Patron web (arturo#283): one column, phone first. */

:root {
    --pw-bg: #f7f5f1;
    --pw-surface: #ffffff;
    --pw-text: #1f1d1a;
    --pw-muted: #5f5a52;
    --pw-line: #d9d4ca;
    --pw-accent: #8a4b12;
    --pw-accent-text: #ffffff;
    --pw-client: #efe3d3;
    --pw-spyder: #eceae6;
}

@media (prefers-color-scheme: dark) {
    :root {
        --pw-bg: #161412;
        --pw-surface: #201d1a;
        --pw-text: #f1ede6;
        --pw-muted: #b3ab9f;
        --pw-line: #3a352f;
        --pw-accent: #d98a3d;
        --pw-accent-text: #161412;
        --pw-client: #3b2c1c;
        --pw-spyder: #2a2724;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--pw-bg);
    color: var(--pw-text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.pw {
    max-width: 44rem;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pw-unbound,
.pw-phase,
.pw-status,
.pw-notice,
.pw-waiting {
    margin: 0;
    color: var(--pw-muted);
}

.pw-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.pw-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pw-title {
    margin: 0;
    font-size: 1.5rem;
    overflow-wrap: anywhere;
}

/* Their own site, one tap away — a new tab, so the conversation is kept. */
.pw-site {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    color: var(--pw-accent);
    font-weight: 600;
    text-decoration: underline;
}

.pw-site:focus-visible {
    outline: 3px solid var(--pw-accent);
    outline-offset: 2px;
}

.pw-draft,
.pw-chat {
    background: var(--pw-surface);
    border: 1px solid var(--pw-line);
    border-radius: 12px;
    padding: 12px 16px;
}

.pw-eyebrow {
    margin: 0 0 8px;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pw-muted);
}

.pw-fields {
    margin: 8px 0;
}

.pw-fields dt {
    font-size: 0.8rem;
    color: var(--pw-muted);
}

.pw-fields dd {
    margin: 0 0 8px;
    overflow-wrap: anywhere;
}

.pw-criteria {
    margin: 0;
    padding-left: 1.25rem;
}

.pw-log {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pw-line {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 14px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.pw-line-client {
    align-self: flex-end;
    background: var(--pw-client);
}

.pw-line-spyder {
    align-self: flex-start;
    background: var(--pw-spyder);
}

/* The team's answer to a held request: Spyder's side, marked as the team's. */
.pw-line-team {
    align-self: flex-start;
    background: var(--pw-spyder);
    border-left: 3px solid var(--pw-accent);
}

.pw-line-notice {
    align-self: flex-start;
    max-width: 100%;
    padding: 0;
    font-size: 0.9rem;
    color: var(--pw-muted);
}

/* Where the current request stands: one line under the conversation, and the
   hidden sources the server declared it and the connection notices in
   (arturo#340). */
.pw-standings-source,
.pw-notices-source {
    margin: 0;
    padding: 0;
    list-style: none;
}

.pw-standing {
    margin: 8px 0 0;
    font-size: 0.9rem;
    color: var(--pw-muted);
}

.pw-composer {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pw-label {
    font-weight: 600;
}

.pw-row {
    display: flex;
    gap: 8px;
}

/* Examples to start from: they fill the box, they never send. */
.pw-chips {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 2px 0 0;
    padding: 0;
}

.pw-chip {
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid var(--pw-line);
    border-radius: 999px;
    background: var(--pw-surface);
    color: var(--pw-text);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.pw-chip:focus-visible {
    outline: 3px solid var(--pw-accent);
    outline-offset: 2px;
}

/* The scripted answers, on a button: unlike the examples above they SEND, and
   they sit under the line that asked for them (arturo#339). */
.pw-replies-source {
    margin: 0;
    padding: 0;
    list-style: none;
}

.pw-replies {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 0;
    padding: 0;
    white-space: normal;
}

.pw-reply {
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid var(--pw-accent);
    border-radius: 999px;
    background: var(--pw-surface);
    color: var(--pw-accent);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.pw-reply:focus-visible {
    outline: 3px solid var(--pw-accent);
    outline-offset: 2px;
}

/* Pearl's card: her options on those same buttons, and the server's line
   saying the message box is still a way out (arturo#347). */
.pw-card {
    margin: 8px 0 0;
    white-space: normal;
}

.pw-card .pw-replies {
    margin: 0;
}

.pw-card-free-text {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: var(--pw-muted);
}

.pw-input {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--pw-line);
    border-radius: 10px;
    background: var(--pw-surface);
    color: var(--pw-text);
    font: inherit;
}

.pw-send,
.pw-reconnect {
    min-height: 44px;
    padding: 8px 16px;
    border: 0;
    border-radius: 10px;
    background: var(--pw-accent);
    color: var(--pw-accent-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.pw-send:disabled,
.pw-input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.pw-reconnect {
    align-self: flex-start;
}

.pw-input:focus-visible,
.pw-send:focus-visible,
.pw-reconnect:focus-visible {
    outline: 3px solid var(--pw-accent);
    outline-offset: 2px;
}

.pw-account {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.pw-signout {
    margin: 0;
}

.pw-account-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: none;
    color: var(--pw-accent);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.pw-account-link:focus-visible {
    outline: 3px solid var(--pw-accent);
    outline-offset: 2px;
}

/* The password change, the sign-in page a client is handed (engine/core#337)
   and the four password-reset pages (arturo#335, piece 8): one column, the
   same fields. */
.pw-password,
.pw-signin,
.pw-reset {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pw-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pw-field input {
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--pw-line);
    border-radius: 10px;
    background: var(--pw-surface);
    color: var(--pw-text);
    font: inherit;
}

.pw-errors {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--pw-accent);
}

.pw-help {
    margin: 0;
    color: var(--pw-muted);
    font-size: 0.9rem;
}

.pw-password .pw-send,
.pw-signin .pw-send,
.pw-reset .pw-send {
    align-self: flex-start;
}

[hidden] {
    display: none !important;
}
