:root {
    --wine: #9f1038;
    --wine-dark: #65091f;
    --pink: #fff1f5;
    --pink-strong: #ffdce7;
    --ink: #2b0713;
    --muted: #7b4a5a;
    --line: #efb9c8;
    --surface: #ffffff;
    --shadow: 0 24px 70px rgba(116, 10, 42, 0.15);
    --radius: 22px;
}

@keyframes miaubyPanelIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes miaubyGlow {
    0%, 100% {
        box-shadow: 0 24px 70px rgba(116, 10, 42, 0.15);
    }

    50% {
        box-shadow: 0 28px 82px rgba(116, 10, 42, 0.22);
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255, 196, 214, 0.46), transparent 34rem),
        linear-gradient(180deg, #fff7fa 0%, #fff 45%, #fff5f8 100%);
    letter-spacing: 0;
}

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

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px clamp(18px, 4vw, 64px);
    background: linear-gradient(90deg, var(--wine-dark), #bb1d51);
    color: #fff;
}

.topbar-brand,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-brand img {
    width: 54px;
    height: auto;
    filter: brightness(0) invert(1);
}

.topbar-brand strong {
    font-size: 1.05rem;
}

.topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar-actions a {
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 999px;
    padding: 9px 14px;
    font-weight: 800;
    font-size: 0.88rem;
    background: rgba(255, 255, 255, 0.11);
}

.topbar-actions a:hover,
.topbar-actions .soft {
    background: #fff;
    color: var(--wine);
}

.miauw-shell {
    width: min(1480px, calc(100% - clamp(20px, 5vw, 86px)));
    margin: clamp(22px, 4vw, 58px) auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    gap: clamp(18px, 2.4vw, 34px);
    align-items: stretch;
}

.chat-panel,
.side-panel > div,
.miauw-login-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow);
    animation: miaubyPanelIn 0.28s ease both;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.chat-panel:hover,
.side-panel > div:hover {
    border-color: rgba(159, 16, 56, 0.42);
    transform: translateY(-1px);
}

.chat-panel {
    min-height: min(760px, calc(100vh - 150px));
    display: grid;
    grid-template-rows: auto minmax(320px, 1fr) auto;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: clamp(18px, 2vw, 26px);
    border-bottom: 1px solid var(--line);
    background: linear-gradient(90deg, #fff, #fff1f5);
}

.agent {
    display: flex;
    align-items: center;
    gap: 15px;
}

.agent img,
.miauw-face {
    width: 68px;
    height: 68px;
    border-radius: 20px;
    object-fit: cover;
    background: var(--pink);
    border: 2px solid #fff;
    box-shadow: 0 12px 24px rgba(159, 16, 56, 0.16);
    animation: miaubyGlow 3.8s ease-in-out infinite;
}

.agent h1 {
    margin: 0;
    color: var(--wine);
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 0.95;
}

.agent p {
    margin: 7px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.btn,
.audio-button,
.audio-cancel-button,
.send-button,
.quick-card button {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 12px 18px;
    color: var(--wine);
    background: #fff;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn:hover,
.audio-button:hover,
.audio-cancel-button:hover,
.send-button:hover,
.quick-card button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(159, 16, 56, 0.16);
}

.btn.primary,
.audio-button.is-active,
.send-button {
    border-color: var(--wine);
    background: var(--wine);
    color: #fff;
}

.btn.ghost {
    background: #fff8fa;
}

.chat-feed {
    padding: clamp(18px, 2vw, 28px);
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    max-width: 84%;
}

.message.assistant {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
}

.message > img {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    object-fit: cover;
    flex: 0 0 auto;
}

.bubble {
    border: 1px solid var(--line);
    border-radius: 18px 18px 18px 6px;
    padding: 14px 16px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(159, 16, 56, 0.08);
}

.message.user .bubble {
    border-color: #b31343;
    border-radius: 18px 18px 6px 18px;
    background: linear-gradient(135deg, #9f1038, #c5285d);
    color: #fff;
}

.bubble p {
    margin: 0;
    line-height: 1.55;
    font-size: 1rem;
}

.bubble strong {
    color: var(--wine);
    font-weight: 950;
}

.message.user .bubble strong {
    color: #fff;
}

.bubble code {
    border-radius: 7px;
    padding: 2px 5px;
    background: #fff1f5;
    color: var(--wine-dark);
    font-family: "Segoe UI Mono", Consolas, monospace;
    font-size: 0.92em;
}

.bubble time {
    display: block;
    margin-top: 9px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.message.user .bubble time {
    color: rgba(255, 255, 255, 0.78);
}

.audio-message .audio-bubble {
    width: min(420px, 72vw);
}

.chat-audio-main {
    display: grid;
    gap: 9px;
    min-width: 0;
}

.chat-audio-state {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--wine);
    font-weight: 950;
    font-size: 0.86rem;
}

.message.user .chat-audio-state {
    color: #fff;
}

.chat-audio-state::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #13b979;
    box-shadow: 0 0 0 5px rgba(19, 185, 121, 0.14);
}

.chat-audio-state small {
    border-radius: 999px;
    padding: 3px 7px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--muted);
    font-size: 0.78rem;
}

.message.user .chat-audio-state small {
    color: rgba(255, 255, 255, 0.86);
    background: rgba(255, 255, 255, 0.14);
}

.chat-audio-player {
    display: grid;
    grid-template-columns: minmax(190px, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-width: 0;
}

.chat-audio-player audio {
    width: 100%;
    min-width: 0;
    height: 34px;
}

.chat-audio-bars {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 30px;
}

.chat-audio-bars i {
    width: 5px;
    border-radius: 999px;
    background: linear-gradient(180deg, #c51f59, #f8a8bf);
}

.message.user .chat-audio-bars i {
    background: rgba(255, 255, 255, 0.82);
}

.chat-audio-bars i:nth-child(1) { height: 10px; }
.chat-audio-bars i:nth-child(2) { height: 22px; }
.chat-audio-bars i:nth-child(3) { height: 15px; }
.chat-audio-bars i:nth-child(4) { height: 28px; }
.chat-audio-bars i:nth-child(5) { height: 19px; }
.chat-audio-bars i:nth-child(6) { height: 25px; }
.chat-audio-bars i:nth-child(7) { height: 13px; }

.chat-audio-transcript {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.86rem;
}

.chat-audio-transcript button {
    cursor: pointer;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--wine);
    font-weight: 850;
}

.chat-audio-transcript p {
    margin-top: 7px;
}

.chat-audio-transcript p[hidden] {
    display: none;
}

.miauw-confirmation-card {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    border: 1px solid rgba(13, 148, 136, .35);
    border-radius: 13px;
    padding: 10px;
    background: #f5fffc;
}

.miauw-confirmation-card strong {
    color: #0f766e;
    font-size: 12px;
}

.miauw-confirmation-card span {
    color: var(--ink);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.32;
}

.miauw-confirmation-card nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.miauw-confirmation-card button {
    min-height: 31px;
    border: 1px solid #99f6e4;
    border-radius: 999px;
    padding: 0 11px;
    background: #0f766e;
    color: #fff;
    font-size: 12px;
    font-weight: 950;
    cursor: pointer;
}

.miauw-confirmation-card button:last-child {
    border-color: var(--line);
    background: #fff;
    color: var(--wine);
}

.miauw-confirmation-card button:disabled {
    opacity: .62;
    cursor: wait;
}

.training-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 11px;
    padding-top: 9px;
    border-top: 1px solid rgba(239, 185, 200, 0.68);
}

.training-actions button {
    min-height: 30px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 10px;
    background: #fff8fa;
    color: var(--wine);
    font-size: 0.76rem;
    font-weight: 950;
    cursor: pointer;
}

.training-actions button:hover {
    border-color: var(--wine);
    box-shadow: 0 8px 18px rgba(159, 16, 56, 0.12);
}

.training-actions button:disabled {
    opacity: .58;
    cursor: wait;
}

.training-actions span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
}

.training-actions span[data-mode="ok"] {
    color: #0f766e;
}

.training-actions span[data-mode="error"] {
    color: #b31343;
}

.miauw-training-modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(43, 7, 19, 0.34);
}

.miauw-training-box {
    width: min(620px, 100%);
    display: grid;
    gap: 13px;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: clamp(18px, 3vw, 28px);
    background: #fff;
    box-shadow: 0 28px 74px rgba(43, 7, 19, 0.24);
}

.miauw-training-box h2 {
    margin: 4px 0 0;
    color: var(--wine);
    font-size: 1.5rem;
}

.miauw-training-box span,
.miauw-training-box label {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.miauw-training-box label {
    display: grid;
    gap: 7px;
}

.miauw-training-box input,
.miauw-training-box select,
.miauw-training-box textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 13px;
    outline: none;
    color: var(--ink);
    background: #fff8fa;
    letter-spacing: 0;
    text-transform: none;
}

.miauw-training-box textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.42;
}

.miauw-training-box input:focus,
.miauw-training-box select:focus,
.miauw-training-box textarea:focus {
    border-color: var(--wine);
    box-shadow: 0 0 0 4px rgba(159, 16, 56, 0.09);
}

.miauw-training-box nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.message.typing {
    opacity: 0.96;
}

.message.typing .bubble {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 48px;
}

.typing-text {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.typing-dots i {
    width: 7px;
    height: 7px;
    border-radius: 99px;
    background: var(--wine);
    opacity: 0.35;
    animation: miauwTyping 0.95s infinite ease-in-out;
}

.typing-dots i:nth-child(2) {
    animation-delay: 0.14s;
}

.typing-dots i:nth-child(3) {
    animation-delay: 0.28s;
}

@keyframes miauwTyping {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.32;
    }

    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    gap: 12px;
    padding: clamp(16px, 2vw, 24px);
    border-top: 1px solid var(--line);
    background: rgba(255, 246, 249, 0.88);
}

.audio-draft {
    grid-column: 1 / -1;
    display: grid;
    gap: 10px;
    border: 1px solid rgba(159, 16, 56, 0.28);
    border-radius: 18px;
    padding: 12px;
    background: linear-gradient(135deg, #fff, #fff1f5);
    box-shadow: 0 14px 34px rgba(159, 16, 56, 0.11);
}

.audio-draft[hidden] {
    display: none;
}

.audio-draft-main {
    display: grid;
    grid-template-columns: minmax(160px, auto) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.audio-draft-head {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--wine);
    font-size: 0.88rem;
    font-weight: 950;
}

.audio-draft-head small {
    border-radius: 999px;
    padding: 4px 8px;
    background: #fff;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
}

.audio-draft-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #10a56a;
    box-shadow: 0 0 0 5px rgba(16, 165, 106, 0.13);
}

.audio-draft-player {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(190px, 280px) minmax(80px, 1fr);
    gap: 12px;
    align-items: center;
}

.audio-draft-player audio {
    width: 100%;
    min-width: 0;
    height: 36px;
    accent-color: var(--wine);
}

.audio-draft-bars {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    overflow: hidden;
}

.audio-draft-bars i {
    width: 5px;
    border-radius: 999px;
    background: linear-gradient(180deg, #c51f59, #f8a8bf);
}

.audio-draft-bars i:nth-child(1) { height: 10px; }
.audio-draft-bars i:nth-child(2) { height: 20px; }
.audio-draft-bars i:nth-child(3) { height: 14px; }
.audio-draft-bars i:nth-child(4) { height: 26px; }
.audio-draft-bars i:nth-child(5) { height: 18px; }
.audio-draft-bars i:nth-child(6) { height: 24px; }
.audio-draft-bars i:nth-child(7) { height: 12px; }

.audio-draft p {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 750;
    line-height: 1.42;
}

.audio-draft p strong {
    color: var(--wine);
    font-weight: 950;
}

.composer textarea {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    max-height: 150px;
    resize: none;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 15px 16px;
    outline: none;
    background: #fff;
    color: var(--ink);
    line-height: 1.4;
}

.composer textarea:focus {
    border-color: var(--wine);
    box-shadow: 0 0 0 4px rgba(159, 16, 56, 0.09);
}

.send-button,
.audio-cancel-button {
    min-width: 112px;
    align-self: end;
}

.audio-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-width: 98px;
    align-self: end;
    background: #fff;
}

.audio-button-dot {
    width: 10px;
    height: 10px;
    border-radius: 99px;
    background: currentColor;
    box-shadow: 0 0 0 5px rgba(159, 16, 56, 0.1);
}

.audio-button.is-active .audio-button-dot {
    color: #fff;
    animation: miauwAudioPulse 1.05s infinite ease-in-out;
    box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.24);
}

.audio-button.is-draft {
    border-color: #10a56a;
    color: #0d8a59;
}

.audio-button.is-starting {
    cursor: wait;
    opacity: 0.82;
}

.audio-cancel-button {
    border-color: var(--line);
    background: linear-gradient(135deg, #fff, #fff1f5);
    color: var(--wine);
    box-shadow: 0 10px 22px rgba(159, 16, 56, 0.08);
}

.audio-cancel-button[hidden] {
    display: none;
}

.audio-cancel-button:hover {
    border-color: var(--wine);
    background: #fff;
}

.audio-button:disabled,
.audio-cancel-button:disabled,
.send-button:disabled {
    opacity: 0.7;
    cursor: wait;
}

@keyframes miauwAudioPulse {
    0%, 100% {
        transform: scale(0.88);
        opacity: 0.72;
    }

    50% {
        transform: scale(1.18);
        opacity: 1;
    }
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.side-panel > div {
    padding: 20px;
}

.status-card {
    display: flex;
    gap: 13px;
    align-items: flex-start;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 99px;
    margin-top: 5px;
    background: #10a56a;
    box-shadow: 0 0 0 6px rgba(16, 165, 106, 0.12);
}

.status-card strong,
.quick-card h2,
.rules-card h2 {
    color: var(--wine);
    margin: 0 0 8px;
}

.status-card p,
.rules-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.guardian-card {
    display: grid;
    gap: 14px;
}

.trainer-card {
    display: grid;
    gap: 13px;
}

.trainer-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    border: 1px solid var(--wine);
    border-radius: 999px;
    padding: 10px 14px;
    background: var(--wine);
    color: #fff;
    font-size: 0.84rem;
    font-weight: 950;
}

.trainer-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(159, 16, 56, 0.16);
}

.guardian-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.guardian-head span,
.pattern-list > span {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.guardian-head strong {
    display: block;
    margin-top: 3px;
    color: var(--wine);
    font-size: 1.35rem;
}

.guardian-head i {
    width: 15px;
    height: 15px;
    border-radius: 99px;
    background: #10a56a;
    box-shadow: 0 0 0 7px rgba(16, 165, 106, 0.12);
}

.guardian-card.has-alerts .guardian-head i {
    background: #e11d48;
    box-shadow: 0 0 0 7px rgba(225, 29, 72, 0.12);
}

.alert-list,
.pattern-list {
    display: grid;
    gap: 9px;
}

.alert-pill {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
    border: 1px solid var(--line);
    border-left-width: 5px;
    border-radius: 14px;
    padding: 10px 11px;
    background: #fff9fb;
}

.alert-pill-main {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.alert-pill strong {
    color: var(--wine);
    font-size: 0.9rem;
}

.alert-pill span,
.alert-pill em,
.guardian-empty,
.pattern-list small {
    color: var(--muted);
    font-size: 0.83rem;
    line-height: 1.36;
}

.alert-pill em {
    font-style: normal;
    font-weight: 800;
}

.alert-dismiss {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 9px;
    background: #fff;
    color: var(--wine);
    font-size: 0.72rem;
    font-weight: 900;
    cursor: pointer;
}

.alert-dismiss:hover {
    border-color: var(--wine);
    box-shadow: 0 8px 18px rgba(159, 16, 56, 0.12);
}

.alert-dismiss:disabled {
    opacity: .55;
    cursor: wait;
}

.alert-pill.severity-alta,
.alert-pill.severity-critica {
    border-left-color: #dc2626;
}

.alert-pill.severity-media {
    border-left-color: #f59e0b;
}

.alert-pill.severity-baixa {
    border-left-color: #2563eb;
}

.guardian-empty {
    margin: 0;
}

.pattern-list {
    padding-top: 2px;
}

.pattern-list small {
    display: block;
    border-radius: 10px;
    padding: 8px 9px;
    background: #fff4f8;
}

.quick-card {
    display: grid;
    gap: 10px;
}

.quick-card button {
    width: 100%;
    text-align: left;
    border-radius: 14px;
    background: #fff8fa;
}

.miauw-login-body {
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    padding: 28px;
    overflow: hidden;
}

.miauw-login-body::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    opacity: .32;
    background-image:
        linear-gradient(90deg, rgba(97, 5, 29, .08) 1px, transparent 1px),
        linear-gradient(180deg, rgba(13, 148, 136, .08) 1px, transparent 1px),
        linear-gradient(135deg, transparent 0 47%, rgba(97, 5, 29, .08) 47% 48%, transparent 48% 100%);
    background-size: 52px 52px, 52px 52px, 104px 104px;
    animation: miaubyLoginGrid 26s linear infinite;
}

.miauw-login-card {
    width: min(520px, 100%);
    padding: clamp(26px, 4vw, 42px);
    box-shadow: 0 30px 76px rgba(97, 5, 29, .14);
}

@keyframes miaubyLoginGrid {
    from {
        background-position: 0 0, 0 0, 0 0;
    }

    to {
        background-position: 52px 52px, -52px 52px, 104px 104px;
    }
}

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

.brand-logo {
    width: min(230px, 58%);
    height: auto;
}

.kicker {
    display: inline-block;
    color: var(--wine);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.miauw-login-card h1 {
    margin: 12px 0 8px;
    color: var(--wine);
    font-size: clamp(2.1rem, 6vw, 3.8rem);
    line-height: 0.98;
}

.miauw-login-card p {
    color: var(--muted);
    margin: 0 0 22px;
}

.miauw-login-card form,
.miauw-login-card label {
    display: grid;
    gap: 9px;
}

.miauw-login-card form {
    gap: 15px;
}

.miauw-login-card label {
    color: var(--wine-dark);
    font-weight: 900;
}

.miauw-login-card input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 13px 14px;
    outline: none;
}

.miauw-login-card input:focus {
    border-color: var(--wine);
    box-shadow: 0 0 0 4px rgba(159, 16, 56, 0.09);
}

.notice {
    border-radius: 14px;
    padding: 12px 14px;
    margin: 0 0 16px;
    font-weight: 800;
}

.notice.error {
    border: 1px solid #f0a0b5;
    background: #fff0f3;
    color: var(--wine-dark);
}

.diagnostic-shell {
    width: min(1360px, calc(100% - clamp(20px, 5vw, 86px)));
    margin: clamp(20px, 3.5vw, 46px) auto;
    display: grid;
    gap: 18px;
}

.diagnostic-hero,
.diag-card,
.diag-panel,
.diag-notice {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 18px 46px rgba(116, 10, 42, 0.1);
}

.diagnostic-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: clamp(18px, 2.4vw, 30px);
}

.diagnostic-agent h1 {
    margin: 4px 0 6px;
    color: var(--wine);
    font-size: clamp(2rem, 4.5vw, 4.2rem);
    line-height: 0.95;
}

.diag-kicker,
.diag-card span,
.diag-panel-head span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 950;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.diag-version {
    display: grid;
    gap: 5px;
    justify-items: end;
    color: var(--muted);
    font-weight: 850;
}

.diag-version strong {
    color: var(--wine);
    font-size: 1.4rem;
}

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

.diag-card {
    padding: 18px;
    min-height: 145px;
}

.diag-card strong {
    display: block;
    margin: 10px 0 8px;
    color: var(--wine);
    font-size: clamp(1.25rem, 2.2vw, 2.05rem);
    line-height: 1;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.diag-card p,
.diag-panel-head p,
.diag-empty,
.diag-list span,
.diag-row p,
.diag-row small {
    color: var(--muted);
    line-height: 1.45;
}

.diag-card p,
.diag-empty {
    margin: 0;
}

.diag-two {
    display: grid;
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
    gap: 18px;
}

.diag-panel {
    padding: 18px;
}

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

.diag-panel-head h2 {
    margin: 4px 0 0;
    color: var(--wine);
    font-size: 1.45rem;
}

.diag-panel-head p {
    margin: 3px 0 0;
    text-align: right;
    font-weight: 800;
}

.diag-list,
.diag-table,
.diag-tags {
    display: grid;
    gap: 10px;
}

.diag-list p {
    display: grid;
    gap: 5px;
    margin: 0;
    border: 1px solid rgba(239, 185, 200, 0.78);
    border-radius: 14px;
    padding: 11px 12px;
    background: #fff8fa;
}

.diag-list.compact p {
    grid-template-columns: 90px minmax(0, 1fr);
    align-items: center;
}

.diag-list strong,
.diag-row strong {
    color: var(--wine-dark);
}

.diag-tags {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.diag-tags span,
.diag-tags b {
    border: 1px solid rgba(239, 185, 200, 0.78);
    border-radius: 999px;
    padding: 9px 12px;
    background: #fff8fa;
    color: var(--wine);
    font-size: 0.84rem;
    font-weight: 900;
}

.diag-tags b {
    grid-column: 1 / -1;
    border-radius: 14px;
    color: #9f1239;
}

.diag-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid rgba(239, 185, 200, 0.78);
    border-left: 5px solid var(--wine);
    border-radius: 16px;
    padding: 13px;
    background: #fff;
}

.diag-row span {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 0.77rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.diag-row p {
    margin: 6px 0;
}

.diag-row small {
    display: block;
    font-weight: 800;
}

.diag-actions {
    display: flex;
    gap: 8px;
}

.diag-voice-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
    margin: 14px 0;
    border: 1px solid rgba(239, 185, 200, 0.78);
    border-radius: 14px;
    padding: 12px;
    background: #fff8fa;
}

.diag-voice-form label {
    display: grid;
    gap: 6px;
    min-width: min(100%, 420px);
    flex: 1 1 420px;
    color: var(--muted);
    font-weight: 900;
}

.diag-voice-form select {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0 12px;
    background: #fff;
    color: var(--text);
    font-weight: 850;
}

.diag-btn {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 9px 12px;
    background: #fff;
    color: var(--wine);
    font-size: 0.8rem;
    font-weight: 950;
    cursor: pointer;
}

.diag-btn.ok {
    border-color: #0f766e;
    color: #0f766e;
}

.diag-btn.warn {
    border-color: #f2a9b9;
    color: #b31343;
}

.diag-btn:hover {
    box-shadow: 0 10px 22px rgba(159, 16, 56, 0.12);
    transform: translateY(-1px);
}

.diag-notice {
    padding: 13px 15px;
    color: var(--wine);
    font-weight: 900;
}

.diag-notice.success {
    border-color: rgba(15, 118, 110, 0.38);
    background: #effefa;
    color: #0f766e;
}

.diag-notice.error {
    background: #fff0f3;
    color: var(--wine-dark);
}

.training-shell {
    width: min(1380px, calc(100% - clamp(20px, 5vw, 86px)));
    margin: clamp(20px, 3.5vw, 46px) auto;
    display: grid;
    gap: 18px;
}

.training-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.training-filters a {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 9px 13px;
    background: #fff;
    color: var(--wine);
    font-weight: 950;
    font-size: 0.84rem;
}

.training-filters a.is-active {
    border-color: var(--wine);
    background: var(--wine);
    color: #fff;
}

.training-list {
    display: grid;
    gap: 14px;
}

.training-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.86fr);
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 46px rgba(116, 10, 42, 0.08);
}

.training-copy {
    display: grid;
    gap: 11px;
}

.training-copy p {
    margin: 0;
    color: var(--ink);
    line-height: 1.5;
}

.training-copy small,
.training-meta {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 850;
}

.training-copy strong {
    color: var(--wine);
}

.training-form {
    display: grid;
    gap: 10px;
}

.training-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.training-form input,
.training-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 11px 12px;
    outline: none;
    background: #fff8fa;
    color: var(--ink);
    letter-spacing: 0;
    text-transform: none;
}

.training-form textarea {
    min-height: 116px;
    resize: vertical;
    line-height: 1.42;
}

.training-form input:focus,
.training-form textarea:focus {
    border-color: var(--wine);
    box-shadow: 0 0 0 4px rgba(159, 16, 56, 0.09);
}

.training-form nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.training-empty {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    background: #fff;
    color: var(--muted);
    font-weight: 850;
}

@media (max-width: 980px) {
    .miauw-shell {
        grid-template-columns: 1fr;
    }

    .diag-grid,
    .diag-two {
        grid-template-columns: 1fr;
    }

    .training-row {
        grid-template-columns: 1fr;
    }

    .chat-panel {
        min-height: 72vh;
    }

    .side-panel {
        order: -1;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (max-width: 680px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .chat-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .message {
        max-width: 100%;
    }

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

    .audio-draft-main,
    .audio-draft-player,
    .chat-audio-player {
        grid-template-columns: 1fr;
    }

    .chat-audio-bars {
        display: none;
    }

    .audio-button,
    .audio-cancel-button,
    .send-button {
        width: 100%;
    }

    .alert-pill {
        grid-template-columns: 1fr;
    }

    .alert-dismiss {
        width: max-content;
    }

    .diagnostic-hero,
    .diag-panel-head,
    .diag-row {
        grid-template-columns: 1fr;
    }

    .diagnostic-hero,
    .diag-panel-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .diag-version {
        justify-items: start;
    }

    .diag-panel-head p {
        text-align: left;
    }

    .diag-actions {
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
