:root {
    --bg: #f4f7fa;
    --panel: #ffffff;
    --text: #18212f;
    --muted: #657184;
    --line: #dce2ea;
    --accent: #12715b;
    --accent-dark: #0c5544;
    --ink: #101827;
    --warm: #c28732;
    --danger: #a83232;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--accent); text-decoration: none; }

button, textarea, input {
    font: inherit;
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
}

.site-nav {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    color: var(--text);
    font-weight: 800;
    font-size: 1.25rem;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--muted);
}

.nav-actions form { margin: 0; }
.nav-actions button, .nav-button, .auth-card button, .composer button, .cookie-banner button, .new-chat, .secondary-button, .danger-button {
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    padding: 10px 14px;
    cursor: pointer;
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
}

.danger-button {
    background: var(--danger);
}

.nav-actions button { background: #273244; }

.landing-shell {
    width: min(1240px, calc(100% - 28px));
    margin: 28px auto 44px;
}

.home-hero {
    min-height: 650px;
    display: grid;
    grid-template-columns: minmax(0, .92fr) minmax(420px, 1.08fr);
    align-items: center;
    gap: 34px;
    padding: 54px;
    overflow: hidden;
    position: relative;
    border: 1px solid #cad8e5;
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(16, 24, 39, .96), rgba(20, 48, 69, .92)),
        #101827;
    color: #fff;
}

.intro-panel {
    display: grid;
    gap: 14px;
    margin-bottom: 22px;
    position: relative;
    z-index: 1;
}

.eyebrow {
    margin: 0;
    color: #94f0d0;
    font-weight: 800;
    text-transform: uppercase;
    font-size: .78rem;
    letter-spacing: 0;
}

.intro-panel h1 {
    max-width: 760px;
    margin: 0;
    font-size: clamp(2.4rem, 5vw, 4.9rem);
    line-height: 1.03;
}

.intro-panel p {
    max-width: 760px;
    margin: 0;
    color: #d4dee9;
    font-size: 1.1rem;
    line-height: 1.65;
}

.landing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.home-hero .nav-button {
    background: #23a780;
    color: #fff;
    box-shadow: 0 14px 30px rgba(35, 167, 128, .28);
}

.home-hero .secondary-button {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .22);
    color: #fff;
}

.hero-proof {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.hero-proof span {
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    color: #dce8f2;
    background: rgba(255, 255, 255, .07);
    padding: 7px 11px;
    font-size: .9rem;
    font-weight: 700;
}

.hero-product {
    position: relative;
    min-height: 450px;
    display: grid;
    align-items: center;
}

.product-window {
    transform: rotate(-1deg);
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(0, 0, 0, .28);
    overflow: hidden;
}

.window-bar {
    display: flex;
    gap: 6px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    background: #f7fbfa;
}

.window-bar span {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #c8d4dd;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 18px;
}

.product-card,
.product-row,
.product-log {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 14px;
}

.product-card.primary {
    background: #e8f7f2;
    border-color: var(--accent);
}

.product-card small,
.product-row span,
.product-log span {
    display: block;
    color: var(--muted);
    font-size: .88rem;
}

.product-card strong {
    display: block;
    margin-top: 4px;
    font-size: 2rem;
}

.product-row,
.product-log {
    grid-column: 1 / -1;
}

.product-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.product-log {
    display: flex;
    justify-content: space-between;
    background: #f7fbfa;
}

.ad-slot {
    margin: 18px 0 0;
    min-height: 118px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: #fff;
    display: grid;
    gap: 10px;
    align-items: stretch;
    padding: 10px;
}

.ad-label {
    color: var(--muted);
    font-size: .78rem;
    text-transform: uppercase;
    font-weight: 800;
}

.ad-slot ins {
    min-height: 90px;
}

.ad-placeholder {
    min-height: 84px;
    display: grid;
    place-items: center;
    gap: 4px;
    text-align: center;
    color: var(--muted);
    background: #f7fbfa;
    border-radius: 8px;
}

.ad-placeholder strong {
    color: var(--text);
}

.ad-placeholder code {
    color: var(--accent-dark);
}

.home-features article {
    min-height: 190px;
    border-color: #cfe3dc;
    background:
        linear-gradient(180deg, #fff, #f7fbfa);
}

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

.feature-grid article,
.direction-panel,
.job-action-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.feature-grid span {
    color: var(--accent);
    font-weight: 800;
}

.feature-grid h2,
.feature-grid h3,
.direction-panel h2 {
    margin: 8px 0;
    font-size: 1.25rem;
}

.feature-grid p,
.direction-panel p,
.job-action-panel p {
    color: var(--muted);
    margin: 0;
    line-height: 1.55;
}

.landing-section {
    margin-top: 58px;
}

.section-heading {
    width: min(760px, 100%);
    margin-bottom: 22px;
}

.section-heading span,
.trust-section > div > span,
.landing-cta span,
.landing-footer span {
    display: block;
    color: var(--accent);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.section-heading h2,
.trust-section h2,
.landing-cta h2 {
    margin: 8px 0 0;
    color: var(--text);
    font-size: clamp(1.75rem, 3vw, 2.55rem);
    line-height: 1.12;
}

.section-heading p,
.trust-section p {
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.65;
}

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

.steps-grid article {
    position: relative;
    min-height: 220px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 22px;
}

.steps-grid strong {
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 8px;
    background: #edf7f4;
    color: var(--accent-dark);
    font-size: 1rem;
}

.steps-grid h3 {
    margin: 18px 0 8px;
    font-size: 1.2rem;
}

.steps-grid p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.trust-section {
    display: grid;
    grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr);
    gap: 24px;
    margin-top: 58px;
    border: 1px solid #cbd8e5;
    border-radius: 8px;
    background:
        linear-gradient(135deg, #fff, #f6faf9);
    padding: 30px;
}

.trust-list {
    display: grid;
    gap: 12px;
}

.trust-list article {
    border-left: 3px solid var(--warm);
    border-radius: 8px;
    background: #fff;
    padding: 16px 18px;
    box-shadow: 0 10px 28px rgba(24, 33, 47, .06);
}

.trust-list h3 {
    margin: 0 0 6px;
    font-size: 1rem;
}

.trust-list p {
    margin: 0;
}

.faq-list {
    display: grid;
    gap: 10px;
}

.faq-list details {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 16px 18px;
}

.faq-list summary {
    cursor: pointer;
    color: var(--text);
    font-weight: 800;
}

.faq-list p {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.landing-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 58px;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    padding: 28px;
}

.landing-cta h2 {
    color: #fff;
    max-width: 760px;
}

.landing-cta span {
    color: #94f0d0;
}

.landing-cta .nav-button {
    flex: 0 0 auto;
    background: #23a780;
}

.landing-footer {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(180px, .6fr) minmax(180px, .6fr);
    gap: 24px;
    margin-top: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 22px;
}

.landing-footer strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.landing-footer p {
    max-width: 560px;
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.landing-footer a {
    display: block;
    margin-top: 8px;
    color: var(--text);
}

.landing-shell {
    width: 100%;
    margin: 0;
    overflow: hidden;
}

.home-hero {
    min-height: calc(100vh - 64px);
    display: grid;
    grid-template-columns: minmax(360px, .78fr) minmax(460px, 1.22fr);
    align-items: center;
    gap: clamp(28px, 4vw, 70px);
    width: 100%;
    padding: clamp(36px, 5.5vw, 74px) clamp(18px, 6vw, 86px);
    overflow: hidden;
    position: relative;
    border: 0;
    border-radius: 0;
    background:
        radial-gradient(circle at 75% 16%, rgba(123, 216, 255, .18), transparent 32%),
        linear-gradient(132deg, #0e1828 0%, #133a3b 46%, #101827 100%);
    color: #fff;
}

.home-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(90deg, #000, rgba(0, 0, 0, .35), transparent);
    pointer-events: none;
}

.hero-copy {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 16px;
    max-width: 650px;
}

.hero-copy h1 {
    margin: 0;
    max-width: 640px;
    font-size: clamp(2.45rem, 4.5vw, 4.95rem);
    line-height: 1.04;
}

.hero-copy p:not(.eyebrow) {
    max-width: 650px;
    margin: 0;
    color: #d9e5ea;
    font-size: clamp(1rem, 1.35vw, 1.22rem);
    line-height: 1.65;
}

.hero-visual {
    position: relative;
    z-index: 1;
    min-height: 500px;
    display: grid;
    align-items: center;
}

.flow-svg {
    width: min(100%, 920px);
    min-height: 420px;
    filter: drop-shadow(0 28px 80px rgba(0, 0, 0, .22));
}

.flow-line {
    fill: none;
    stroke: rgba(255, 255, 255, .42);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 10 15;
    animation: flow-dash 7s linear infinite;
}

.line-two {
    animation-duration: 8.8s;
    animation-direction: reverse;
    opacity: .85;
}

.line-three {
    animation-duration: 6.5s;
    opacity: .72;
}

.flow-dot {
    fill: url(#flow-accent);
    filter: drop-shadow(0 0 14px rgba(123, 216, 255, .72));
}

.dot-one {
    offset-path: path("M120 168 C260 72 380 132 462 242 C540 346 664 374 800 286");
    animation: flow-move 5.8s ease-in-out infinite;
}

.dot-two {
    offset-path: path("M104 408 C248 504 360 456 454 344 C556 220 668 190 806 112");
    animation: flow-move 6.7s ease-in-out infinite reverse;
}

.dot-three {
    offset-path: path("M132 292 C282 292 310 318 430 318 C560 318 620 438 790 436");
    animation: flow-move 4.9s ease-in-out infinite;
    animation-delay: -1.4s;
}

.node {
    animation: node-float 5.8s ease-in-out infinite;
}

.target-node {
    animation-delay: -.9s;
}

.status-node {
    animation-delay: -1.7s;
}

.node text {
    fill: #657184;
    font: 800 18px Inter, ui-sans-serif, system-ui, sans-serif;
}

.node .node-big {
    fill: #101827;
    font-size: 25px;
}

.node .node-small {
    fill: #12715b;
    font-size: 16px;
}

.node .node-invert {
    fill: #fff;
}

.queue-bar {
    fill: url(#flow-accent);
    animation: queue-pulse 1.9s ease-in-out infinite;
}

.bar-two {
    animation-delay: -.7s;
}

.solution-band,
.process-section,
.faq-section {
    width: min(1180px, calc(100% - 32px));
    margin: 76px auto 0;
}

.home-features {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.home-features article {
    min-height: 220px;
    background: #fff;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.home-features article:hover {
    transform: translateY(-6px);
    border-color: #8fd8c3;
    box-shadow: 0 18px 46px rgba(24, 33, 47, .09);
}

.timeline-flow {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.timeline-flow article {
    min-height: 240px;
    padding: 26px;
    position: relative;
    border-right: 1px solid var(--line);
}

.timeline-flow article:last-child {
    border-right: 0;
}

.timeline-flow strong {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 999px;
    background: #e8f7f2;
    color: var(--accent-dark);
}

.timeline-flow h3 {
    margin: 28px 0 10px;
    font-size: 1.35rem;
}

.timeline-flow p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.trust-section {
    width: 100%;
    grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr);
    margin-top: 76px;
    border-width: 1px 0;
    border-radius: 0;
    padding: clamp(34px, 6vw, 74px) clamp(18px, 7vw, 96px);
    background:
        linear-gradient(120deg, #ffffff 0%, #f2f8f6 100%);
}

.landing-cta {
    width: min(1180px, calc(100% - 32px));
    margin: 76px auto 0;
    padding: clamp(26px, 4vw, 46px);
}

.landing-footer,
.donation-panel {
    width: min(1180px, calc(100% - 32px));
    margin-left: auto;
    margin-right: auto;
}

.ad-slot {
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto 0;
}

@keyframes flow-dash {
    to {
        stroke-dashoffset: -240;
    }
}

@keyframes flow-move {
    0%, 100% {
        offset-distance: 0%;
        opacity: .2;
    }
    12%, 88% {
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        offset-distance: 100%;
    }
}

@keyframes node-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes queue-pulse {
    0%, 100% {
        opacity: .58;
        transform: scaleX(.72);
    }
    50% {
        opacity: 1;
        transform: scaleX(1);
    }
}

@media (max-width: 1180px) {
    .home-hero {
        grid-template-columns: minmax(320px, .86fr) minmax(400px, 1.14fr);
        padding-inline: 36px;
    }

    .hero-copy h1 {
        font-size: clamp(2.35rem, 5.3vw, 4rem);
    }

    .hero-visual {
        min-height: 430px;
    }
}

.direction-panel {
    margin-bottom: 18px;
}

.job-action-panel {
    display: grid;
    gap: 12px;
    align-content: start;
    justify-items: start;
}

.donation {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    color: #344256;
}

.donation-panel {
    justify-content: space-between;
    border: 1px solid #f0c36c;
    border-radius: 8px;
    background: #fff7df;
    padding: 14px;
}

.donation-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    border: 1px solid #f0c36c;
    border-radius: 8px;
    background: #fff7df;
    color: #5b3b00;
    padding: 9px 12px;
    font-weight: 800;
}

.hero-donation {
    background: #fff7df;
}

.donation-link:hover {
    background: #ffe9a8;
    color: #3b2800;
}

.donation-icon {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: #ffdd72;
    font-size: 1rem;
}

.public-queue-status {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 12px;
    width: fit-content;
    max-width: 100%;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
}

.public-queue-status span {
    color: var(--text);
    font-weight: 700;
}

.public-queue-status strong {
    color: var(--accent);
    font-size: 1.35rem;
}

.public-queue-status small {
    color: var(--muted);
}

.chat-layout {
    display: grid;
    gap: 16px;
}

.chat-layout.authenticated {
    grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
}

.chat-layout.public {
    grid-template-columns: minmax(0, 1fr);
}

.chat-layout.public .chat-panel {
    width: min(960px, 100%);
    margin: 0 auto;
}

.conversation-list {
    background: #edf1f5;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    height: 720px;
    overflow: auto;
}

.conversation-item {
    width: 100%;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    display: block;
    padding: 10px;
    margin-top: 6px;
    text-align: left;
    cursor: pointer;
}

.conversation-item.active, .conversation-item:hover {
    background: #fff;
}

.chat-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    min-height: 720px;
    display: grid;
    grid-template-rows: 1fr auto auto;
}

.messages {
    min-height: 0;
    max-height: 600px;
    overflow-y: auto;
    padding: 26px;
}

.empty-chat {
    min-height: 420px;
    display: grid;
    place-content: center;
    justify-items: center;
    color: var(--muted);
    text-align: center;
    gap: 8px;
}

.message {
    display: flex;
    margin: 12px 0;
}

.message.user { justify-content: flex-end; }
.message.assistant { justify-content: flex-start; }

.bubble {
    max-width: min(760px, 88%);
    border-radius: 8px;
    padding: 14px 16px;
    background: #eef3f8;
}

.message.user .bubble {
    background: #dff3ec;
}

.role {
    display: block;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.bubble p {
    margin: 0;
    white-space: pre-wrap;
}

.bubble.typing p::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 1em;
    margin-left: 3px;
    vertical-align: -2px;
    background: currentColor;
    animation: typing-caret 0.9s steps(2, start) infinite;
}

.bubble.loading p::after {
    content: "...";
    display: inline-block;
    min-width: 22px;
    animation: loading-dots 1.2s steps(4, end) infinite;
}

@keyframes typing-caret {
    50% {
        opacity: 0;
    }
}

@keyframes loading-dots {
    0% {
        content: "";
    }
    25% {
        content: ".";
    }
    50% {
        content: "..";
    }
    75%, 100% {
        content: "...";
    }
}

.bubble small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}

.composer {
    border-top: 1px solid var(--line);
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    background: #fbfcfd;
}

.composer textarea {
    resize: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px 14px;
    min-height: 54px;
}

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

.save-hint {
    margin: 0;
    padding: 0 16px 14px;
    color: var(--muted);
    font-size: .92rem;
}

.cookie-banner {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: min(760px, calc(100% - 28px));
    background: #172033;
    color: #fff;
    border-radius: 8px;
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    z-index: 20;
}

.cookie-banner a { color: #9ce0cb; }
.cookie-banner button { background: #fff; color: #172033; }

.site-footer {
    border-top: 1px solid var(--line);
    padding: 24px 0;
    color: var(--muted);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.auth-page, .legal-page, .admin-page {
    padding: 42px 0;
}

.auth-card {
    width: min(440px, 100%);
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    display: grid;
    gap: 10px;
}

.auth-card input {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.validation { color: var(--danger); font-size: .9rem; }

.legal-page {
    max-width: 860px;
    line-height: 1.7;
}

.legal-page h1, .admin-header h1 { margin-top: 0; }
.legal-page h2 { margin-top: 28px; font-size: 1.2rem; }

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}

.admin-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
}

.panel-menu {
    position: sticky;
    top: 64px;
    z-index: 8;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(12px);
}

.panel-menu button {
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    padding: 9px 12px;
    cursor: pointer;
}

.panel-menu button:hover,
.panel-menu button.active {
    background: #eef3f8;
}

.panel-menu button.active {
    color: var(--accent-dark);
    font-weight: 800;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.metrics-grid div, .admin-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.metrics-grid .queue-main {
    border-color: var(--accent);
    background: #eaf7f2;
}

.metrics-grid span {
    display: block;
    color: var(--muted);
}

.metrics-grid strong {
    display: block;
    font-size: 1.5rem;
}

.admin-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.admin-columns.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace-panel {
    margin-top: 24px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

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

.panel-heading h2 {
    margin: 0;
}

.panel-heading > span {
    color: var(--muted);
    font-size: .92rem;
}

.table-wrap {
    overflow-x: auto;
}

.jobs-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
    font-size: .95rem;
}

.jobs-table th {
    color: var(--muted);
    font-size: .78rem;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
}

.jobs-table td {
    vertical-align: top;
    padding: 16px 8px;
    border-bottom: 1px solid var(--line);
}

.jobs-table td:first-child {
    width: 22%;
}

.jobs-table td:first-child span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: .88rem;
}

.truncate {
    display: inline-block;
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    background: #eef3f8;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 800;
}

.status-pill.success { background: #dff3ec; color: var(--accent-dark); }
.status-pill.danger { background: #ffe8e8; color: var(--danger); }
.status-pill.warning { background: #fff7df; color: #765200; }
.status-pill.muted, .status-pill.neutral { background: #eef3f8; color: var(--muted); }

.action-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
}

.action-stack form {
    margin: 0;
}

.edit-details {
    position: relative;
}

.edit-details summary {
    list-style: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 8px 10px;
    cursor: pointer;
}

.edit-details summary::-webkit-details-marker {
    display: none;
}

.edit-details[open] .inline-edit {
    position: absolute;
    right: 0;
    top: 42px;
    z-index: 5;
    width: min(520px, calc(100vw - 48px));
    max-height: 72vh;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 40px rgba(24, 33, 47, .14);
    padding: 16px;
}

.tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f9fb;
}

.tab-button {
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    padding: 8px 10px;
    cursor: pointer;
}

.tab-button.active {
    background: #fff;
    color: var(--text);
    box-shadow: 0 1px 4px rgba(24, 33, 47, .08);
}

.empty-state {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 18px;
    color: var(--muted);
}

.empty-state strong {
    color: var(--text);
}

.empty-state p {
    margin: 6px 0 0;
}

.activity-list {
    display: grid;
    gap: 8px;
}

.activity-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.activity-item:last-child {
    border-bottom: 0;
}

.activity-item p {
    margin: 4px 0 0;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-item time {
    color: var(--muted);
    font-size: .84rem;
    white-space: nowrap;
}

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

.chart-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.chart-summary article {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 16px;
}

.chart-summary span {
    display: block;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 800;
    text-transform: uppercase;
}

.chart-summary strong {
    display: block;
    margin-top: 8px;
    color: var(--ink);
    font-size: 2rem;
    line-height: 1;
}

.chart-summary small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}

.chart-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(24, 33, 47, .05);
}

.chart-card h3 {
    margin: 0 0 14px;
    font-size: 1rem;
}

.chart-row {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.chart-row div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    align-items: baseline;
}

.chart-row strong {
    color: var(--text);
}

.chart-row small {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
}

.chart-track {
    height: 9px;
    border-radius: 999px;
    background: #edf2f6;
    overflow: hidden;
}

.chart-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0c5544, #23a780);
}

.chart-fill.danger { background: var(--danger); }
.chart-fill.warning { background: #d69c15; }
.chart-fill.neutral { background: #8b98a8; }

.big-number {
    font-size: 3rem;
    font-weight: 800;
    color: var(--accent-dark);
    line-height: 1;
}

.chart-card p {
    margin: 4px 0 0;
    color: var(--muted);
}

.ai-config-panel {
    margin-top: 24px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    gap: 22px;
}

.ai-config-panel h2 {
    margin: 0 0 8px;
}

.ai-config-panel p {
    color: var(--muted);
}

.ai-config-form {
    display: grid;
    gap: 9px;
}

.inline-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 160px);
    gap: 8px;
}

.ai-config-form input,
.ai-config-form select,
.ai-config-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
}

.ai-config-form button {
    justify-self: start;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    padding: 10px 14px;
    cursor: pointer;
}

.form-hint {
    margin: 0;
    color: var(--muted);
    font-size: .92rem;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.test-result {
    display: grid;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f9fb;
    padding: 12px;
    color: var(--muted);
}

.test-result strong {
    color: var(--text);
}

.test-result.success {
    border-color: #b9dfd2;
    background: #eef9f5;
}

.test-result.error {
    border-color: #ffc9c9;
    background: #fff4f4;
}

.test-result code {
    overflow-wrap: anywhere;
    color: var(--accent-dark);
}

.check-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-line input {
    width: auto;
}

.admin-alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin: 16px 0 0;
}

.admin-alert.success {
    background: #dff3ec;
}

.admin-alert.error {
    background: #ffe8e8;
    color: var(--danger);
}

.admin-row {
    margin-bottom: 10px;
}

.admin-row span {
    display: block;
    color: var(--muted);
    font-size: .88rem;
}

.admin-row p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-row .webhook-url {
    color: var(--accent-dark);
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: .9rem;
}

.admin-row.error strong { color: var(--danger); }

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.row-actions form {
    margin: 0;
}

.row-actions button {
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    padding: 8px 10px;
    cursor: pointer;
}

.row-actions .secondary-button {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
}

.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: .86rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.action-button-primary {
    background: #e8f7f2;
    border-color: #b9dfd2;
    color: var(--accent-dark);
}

.action-button-secondary {
    background: #f5f7fa;
    border-color: var(--line);
    color: #334155;
}

.action-button-danger {
    background: #fff1f1;
    border-color: #ffc9c9;
    color: var(--danger);
}

.action-button-public {
    background: #101827;
    border-color: #101827;
    color: #fff;
}

.action-button:hover {
    filter: brightness(.97);
}

.public-status-hint {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: var(--muted);
    padding: 7px 10px;
    font-size: .82rem;
    font-weight: 800;
    white-space: nowrap;
}

.history-row td {
    padding: 0 8px 16px;
    background: #fbfcfd;
}

.history-details {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.history-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
    color: var(--text);
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 800;
}

.history-details summary small {
    color: var(--muted);
    font-weight: 700;
}

.run-history {
    display: grid;
    gap: 10px;
    padding: 12px;
}

.run-history article {
    display: grid;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
    padding: 12px;
}

.run-history article > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.run-history p {
    margin: 0;
    color: var(--muted);
}

.run-history code,
.run-history pre {
    max-width: 100%;
    overflow: auto;
    border-radius: 8px;
    background: #eef3f8;
    color: #334155;
    padding: 8px;
    white-space: pre-wrap;
}

.empty-state.compact {
    margin: 12px;
    padding: 14px;
}

.inline-edit {
    margin-top: 0;
}

@media (max-width: 820px) {
    .site-nav, .nav-actions, .cookie-banner, .admin-header {
        align-items: flex-start;
        flex-direction: column;
        height: auto;
        padding: 12px 0;
    }

    .chat-layout, .metrics-grid, .admin-columns, .admin-columns.two, .ai-config-panel, .feature-grid, .home-hero, .steps-grid, .trust-section, .landing-footer {
        grid-template-columns: 1fr;
    }

    .home-hero {
        min-height: auto;
        padding: 22px;
    }

    .hero-product {
        min-height: 320px;
    }

    .product-window {
        transform: none;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }

    .intro-panel h1 {
        font-size: clamp(2.1rem, 12vw, 3.1rem);
    }

    .landing-cta {
        align-items: flex-start;
        flex-direction: column;
    }

    .panel-menu {
        position: static;
    }

    .panel-heading, .activity-item {
        grid-template-columns: 1fr;
    }

    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .activity-item time {
        white-space: normal;
    }

    .charts-grid, .chart-summary {
        grid-template-columns: 1fr;
    }

    .conversation-list {
        height: auto;
        max-height: 220px;
    }

    .composer {
        grid-template-columns: 1fr;
    }
}
