.acla-app {
    --acla-ink: #1f2933;
    --acla-muted: #5f6b76;
    --acla-line: #d8dee4;
    --acla-soft: #f5f7f8;
    --acla-accent: #176b5b;
    color: var(--acla-ink);
    margin: 1.5rem 0;
}
.acla-grid { display: block; }
.acla-panel, .acla-summary { border: 1px solid var(--acla-line); border-radius: 10px; padding: 1.2rem; background: #fff; }
.acla-panel h2, .acla-summary h2 { font-size: 1.25rem; margin: 0 0 .75rem; }
.acla-muted { color: var(--acla-muted); font-size: .95rem; }
.acla-field input, .acla-field select { width: 100%; }
.acla-field { margin-bottom: .8rem; }
.acla-field label { display: block; font-weight: 600; margin-bottom: .25rem; }
.acla-material-details { margin-top: .45rem; }
.acla-material-details summary { cursor: pointer; color: var(--acla-accent); font-weight: 600; }
.acla-material-details p { margin: .45rem 0 0; }
.acla-field option:disabled { color: #87919a; }
.acla-dimensions { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.acla-live-price { border: 1px solid var(--acla-line); border-radius: 8px; background: var(--acla-soft); margin: 1rem 0 .75rem; padding: .85rem 1rem; }
.acla-live-price-status { color: var(--acla-muted); margin: 0; }
.acla-live-price.is-loading .acla-live-price-status::before { content: ""; display: inline-block; width: .65rem; height: .65rem; border: 2px solid var(--acla-line); border-top-color: var(--acla-accent); border-radius: 50%; margin-right: .45rem; animation: acla-spin .8s linear infinite; }
.acla-live-price.is-error { border-color: #d8aaaa; background: #fff7f7; }
.acla-live-price.is-error .acla-live-price-status { color: #8a2424; }
.acla-live-price-total { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.acla-live-price-total strong { font-size: 1.35rem; }
.acla-live-price-details { display: grid; grid-template-columns: minmax(145px, 1fr) auto; gap: .2rem 1rem; border-top: 1px solid var(--acla-line); margin: .65rem 0 0; padding-top: .65rem; font-size: .9rem; }
.acla-live-price-details dt { color: var(--acla-muted); }
.acla-live-price-details dd { margin: 0; font-weight: 600; text-align: right; }
.acla-summary { margin-top: 1rem; }
.acla-summary dl { display: grid; grid-template-columns: minmax(110px, .5fr) 1fr; gap: .35rem 1rem; margin: 0; }
.acla-summary dt { color: var(--acla-muted); }
.acla-summary dd { margin: 0; font-weight: 600; }
.acla-errors { color: #8a2424; margin-top: .8rem; }
.acla-errors ul { margin: 0; padding-left: 1.2rem; }
.acla-cart-success { color: #155b3d; background: #eaf8f0; border: 1px solid #aad8bd; border-radius: 7px; padding: .75rem; }
.acla-error .button { margin-left: .5rem; }

.acla-chat-widget {
    --acla-chat-ink: #141413;
    --acla-chat-surface: #faf9f6;
    --acla-chat-paper: #fffdf8;
    --acla-chat-muted: #5f5a52;
    --acla-chat-line: #d8d2c8;
    --acla-chat-clay: #a94f2c;
    --acla-chat-success: #17643a;
    --acla-chat-danger: #a12d2d;
    color: var(--acla-chat-ink);
    font: inherit;
}
.acla-chat-widget,
.acla-chat-widget * { box-sizing: border-box; }
.acla-chat-widget [hidden] { display: none !important; }
.acla-chat-launcher {
    position: fixed;
    right: max(24px, env(safe-area-inset-right));
    bottom: max(24px, env(safe-area-inset-bottom));
    z-index: 9998;
    display: inline-flex;
    min-height: 52px;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    border: 1px solid var(--acla-chat-ink);
    border-radius: 0 0 16px 16px;
    background: var(--acla-chat-ink);
    box-shadow: none;
    color: var(--acla-chat-surface);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}
.acla-chat-launcher:hover { background: #2b2b29; color: var(--acla-chat-surface); text-decoration: underline; text-underline-offset: 3px; }
.acla-chat-launcher:focus-visible,
.acla-chat-close:focus-visible,
.acla-chat-form textarea:focus-visible,
.acla-chat-send:focus-visible,
.acla-chat-cart-success a:focus-visible { outline: 3px solid var(--acla-chat-clay); outline-offset: 2px; }
.acla-chat-launcher:disabled { cursor: default; opacity: .55; }
.acla-chat-launcher-icon { width: 22px; height: 22px; flex: 0 0 auto; }
.acla-chat-launcher.is-working .acla-chat-launcher-icon { opacity: .3; }
.acla-chat-launcher.is-working::before {
    position: absolute;
    left: 19px;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(250, 249, 246, .35);
    border-top-color: var(--acla-chat-surface);
    border-radius: 50%;
    content: "";
    animation: acla-spin .8s linear infinite;
}
.acla-chat-unread { width: 9px; height: 9px; border: 2px solid var(--acla-chat-ink); border-radius: 50%; background: var(--acla-chat-clay); }
.acla-chat-panel {
    position: fixed;
    right: max(24px, env(safe-area-inset-right));
    bottom: calc(88px + env(safe-area-inset-bottom));
    z-index: 9997;
    display: flex;
    width: min(400px, calc(100vw - 32px));
    max-height: calc(100vh - 104px);
    max-height: calc(100dvh - 104px);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--acla-chat-ink);
    border-radius: 0;
    background: var(--acla-chat-surface);
    box-shadow: none;
}
.acla-chat-header { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px 12px 20px; background: var(--acla-chat-ink); color: var(--acla-chat-surface); }
.acla-chat-header h2 { margin: 0; color: inherit; font: inherit; font-size: 18px; font-weight: 700; line-height: 1.2; }
.acla-chat-presence { display: flex; align-items: center; gap: 7px; margin: 5px 0 0; color: #d8d5ce; font-size: 12px; line-height: 1; }
.acla-chat-presence span { width: 7px; height: 7px; border-radius: 50%; background: #72a989; }
.acla-chat-presence.is-working span { background: #d79a78; }
.acla-chat-close { display: inline-grid; width: 44px; height: 44px; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid #4a4946; border-radius: 0; background: transparent; color: var(--acla-chat-surface); cursor: pointer; }
.acla-chat-close:hover { border-color: var(--acla-chat-surface); background: #2b2b29; color: var(--acla-chat-surface); }
.acla-chat-close svg { width: 22px; height: 22px; }
.acla-chat-configuration { padding: 12px 16px; border-bottom: 1px solid var(--acla-chat-line); background: var(--acla-chat-paper); }
.acla-chat-configuration-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.acla-chat-configuration-heading h3 { margin: 0; color: inherit; font: inherit; font-size: 14px; font-weight: 700; }
#acla-chat-configuration-state { color: var(--acla-chat-muted); font-size: 12px; font-weight: 600; text-align: right; }
#acla-chat-configuration-state.is-loading,
#acla-chat-configuration-state.is-valid { color: var(--acla-chat-clay); }
#acla-chat-configuration-state.is-success { color: var(--acla-chat-success); }
#acla-chat-configuration-state.is-error { color: var(--acla-chat-danger); }
#acla-chat-configuration-content > p { margin: 0; color: var(--acla-chat-muted); font-size: 13px; line-height: 1.4; }
#acla-chat-configuration-content dl { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 3px 10px; margin: 0; font-size: 13px; line-height: 1.35; }
#acla-chat-configuration-content dt { color: var(--acla-chat-muted); }
#acla-chat-configuration-content dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-weight: 600; }
.acla-chat-configuration-missing,
.acla-chat-configuration-error { margin-top: 8px !important; padding-top: 8px; border-top: 1px solid var(--acla-chat-line); }
.acla-chat-configuration-error { color: var(--acla-chat-danger) !important; }
.acla-chat-configuration-price { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--acla-chat-line); font-size: 13px; }
.acla-chat-configuration-price strong { color: var(--acla-chat-clay); font-size: 18px; line-height: 1; }
.acla-chat-configuration-price small { grid-column: 1 / -1; color: var(--acla-chat-muted); font-size: 12px; }
.acla-chat-cart-status:empty,
.acla-chat-status:empty { display: none; }
.acla-chat-cart-success { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--acla-chat-line); color: var(--acla-chat-success); font-size: 13px; }
.acla-chat-cart-success a { color: var(--acla-chat-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.acla-chat-log { display: flex; min-height: 160px; flex: 1 1 auto; flex-direction: column; gap: 12px; overflow-y: auto; overscroll-behavior: contain; padding: 16px; }
.acla-message { max-width: 86%; padding: 10px 12px; border: 1px solid var(--acla-chat-line); border-radius: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.acla-message-user { align-self: flex-end; border-color: var(--acla-chat-ink); background: var(--acla-chat-ink); color: var(--acla-chat-surface); }
.acla-message-assistant { align-self: flex-start; background: var(--acla-chat-paper); color: var(--acla-chat-ink); }
.acla-working { margin: 0; padding: 0 16px 10px; color: var(--acla-chat-muted); font-size: 13px; }
.acla-working::before { display: inline-block; width: 10px; height: 10px; margin-right: 7px; border: 2px solid var(--acla-chat-line); border-top-color: var(--acla-chat-clay); border-radius: 50%; content: ""; animation: acla-spin .8s linear infinite; }
.acla-chat-status { padding: 0 16px 10px; }
.acla-chat-error { padding: 9px 10px; border: 1px solid #d5aaa0; background: #fff7f4; color: var(--acla-chat-danger); font-size: 13px; line-height: 1.4; }
.acla-chat-form { display: grid; flex: 0 0 auto; grid-template-columns: minmax(0, 1fr) 94px; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--acla-chat-line); background: var(--acla-chat-surface); }
.acla-chat-form textarea { width: 100%; min-height: 72px; max-height: 150px; resize: vertical; border: 1px solid #8c867e; border-radius: 0; background: var(--acla-chat-paper); color: var(--acla-chat-ink); font: inherit; font-size: 14px; line-height: 1.4; }
.acla-chat-form textarea::placeholder { color: #6c665e; opacity: 1; }
.acla-chat-form textarea:disabled { background: #eeeae2; color: var(--acla-chat-muted); }
.acla-chat-send { min-height: 44px; align-self: stretch; padding: 8px 14px; border: 1px solid var(--acla-chat-ink); border-radius: 0 0 12px 12px; background: var(--acla-chat-ink); color: var(--acla-chat-surface); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.acla-chat-send:hover { background: #2b2b29; color: var(--acla-chat-surface); text-decoration: underline; text-underline-offset: 3px; }
.acla-chat-send:disabled { cursor: wait; opacity: .55; }
@keyframes acla-spin { to { transform: rotate(360deg); } }
@media (max-width: 760px) { .acla-dimensions { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
    .acla-chat-launcher { right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); }
    .acla-chat-panel { top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); bottom: calc(80px + env(safe-area-inset-bottom)); left: max(12px, env(safe-area-inset-left)); width: auto; max-height: none; }
    body.admin-bar .acla-chat-panel { top: calc(58px + env(safe-area-inset-top)); }
    .acla-chat-configuration { padding: 10px 14px; }
    .acla-chat-log { min-height: 0; padding: 14px; }
    .acla-chat-form { grid-template-columns: 1fr; padding: 10px 14px 14px; }
    .acla-chat-send { min-height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
    .acla-chat-launcher.is-working::before,
    .acla-working::before { animation: none; }
}
@media (forced-colors: active) {
    .acla-chat-launcher,
    .acla-chat-panel,
    .acla-chat-close,
    .acla-chat-form textarea,
    .acla-chat-send { border: 1px solid CanvasText; }
}
