:root {
    color-scheme: dark;
    --bg: #080808;
    --surface: #111;
    --surface-raised: #181818;
    --border: #2b2b2b;
    --text: #f2f2f2;
    --muted: #8f8f8f;
    --soft: #c5c5c5;
    --blob-border-alpha: 0.22;
    --blob-glow-alpha: 0.12;
    --blob-glow-size: 34px;
    --blob-scale: 1;
    --ring-alpha: 0.32;
    --ring-outer-alpha: 0.12;
    --ring-scale: 1;
    --blob-skew: 0deg;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 50% -20%, #292929 0, #111 28%, var(--bg) 58%),
        var(--bg);
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

.eyebrow {
    margin: 0 0 0.65rem;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.muted {
    color: var(--muted);
}

.login-page {
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.login-shell {
    width: min(100%, 420px);
}

.login-card {
    padding: clamp(2rem, 7vw, 3rem);
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(17, 17, 17, 0.9);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(18px);
}

.login-logos {
    display: flex;
    height: 60px;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.dost-logo {
    width: 52px;
    height: 52px;
    filter: drop-shadow(0 0 10px rgba(0, 172, 236, 0.2));
}

.sinag-logo {
    width: 170px;
    max-height: 58px;
    object-fit: contain;
    object-position: left center;
}

.login-card h1 {
    margin: 0;
    font-size: clamp(1.8rem, 7vw, 2.5rem);
    letter-spacing: -0.045em;
}

.login-card > .muted {
    margin: 0.8rem 0 2rem;
    line-height: 1.6;
}

.login-form {
    display: grid;
    gap: 0.7rem;
}

.login-form label {
    margin-top: 0.55rem;
    color: var(--soft);
    font-size: 0.8rem;
    font-weight: 600;
}

.login-form input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid #363636;
    border-radius: 10px;
    outline: none;
    color: var(--text);
    background: #0d0d0d;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.login-form input:focus {
    border-color: #8b8b8b;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.primary-button {
    margin-top: 1.1rem;
    padding: 0.9rem 1rem;
    border: 0;
    border-radius: 10px;
    color: #090909;
    background: #ededed;
    font-weight: 750;
    cursor: pointer;
    transition: background 160ms ease, transform 160ms ease;
}

.primary-button:hover {
    background: #fff;
}

.primary-button:active {
    transform: translateY(1px);
}

.form-error {
    padding: 0.75rem 0.9rem;
    border: 1px solid #4b4b4b;
    border-radius: 10px;
    color: #ddd;
    background: #202020;
    font-size: 0.85rem;
}

.agent-page {
    --insight-panel-width: min(430px, 100vw);
    transition: padding-right 260ms cubic-bezier(.2, .8, .2, 1);
}

.agent-page.insight-open {
    padding-right: var(--insight-panel-width);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(100% - 2rem, 1120px);
    height: 76px;
    margin-inline: auto;
    border-bottom: 1px solid var(--border);
    transition: width 260ms cubic-bezier(.2, .8, .2, 1);
}

.wordmark {
    display: inline-flex;
    gap: 0.65rem;
    align-items: center;
    color: var(--text);
    font-size: 1rem;
    font-weight: 750;
    text-decoration: none;
}

.topbar-dost-logo {
    width: 28px;
    height: 29px;
}

.topbar-sinag-logo {
    width: 83px;
    height: 36px;
    object-fit: contain;
}

.wordmark-divider {
    width: 1px;
    height: 28px;
    background: #34475e;
}

.wordmark-name {
    color: #dceafa;
    font-size: 0.9rem;
    letter-spacing: -0.02em;
}

.text-button {
    padding: 0.55rem 0.8rem;
    border: 0;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
}

.text-button:hover {
    color: var(--text);
}

.agent-shell {
    width: min(100% - 2rem, 900px);
    margin: 0 auto;
    padding: clamp(3rem, 7vw, 5.5rem) 0 5rem;
}

.voice-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.voice-stage h1 {
    margin: 0;
    font-size: clamp(2rem, 6vw, 3.4rem);
    letter-spacing: -0.055em;
}

.status {
    min-height: 1.4em;
    margin: 0.8rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.blob-wrap {
    display: grid;
    width: clamp(210px, 38vw, 310px);
    aspect-ratio: 1;
    margin: clamp(2.2rem, 6vw, 4rem) 0;
    place-items: center;
}

.voice-blob {
    position: relative;
    display: grid;
    width: 70%;
    aspect-ratio: 1;
    place-items: center;
    overflow: visible;
    border: 1px solid rgba(114, 151, 198, var(--blob-border-alpha));
    border-radius: 44% 56% 47% 53% / 55% 43% 57% 45%;
    background:
        radial-gradient(circle at 32% 27%, #667588 0%, #45515f 19%, #263040 43%, #15191f 70%, #0d0e10 100%);
    box-shadow:
        0 0 var(--blob-glow-size) rgba(64, 113, 174, var(--blob-glow-alpha)),
        inset -24px -24px 40px rgba(2, 6, 12, 0.7),
        inset 12px 10px 28px rgba(155, 182, 213, 0.12);
    transform: scale(var(--blob-scale)) rotate(var(--blob-skew));
    animation: blob-idle 10s cubic-bezier(.45, .05, .55, .95) infinite;
    transition: box-shadow 80ms linear, transform 80ms linear, border-radius 120ms ease-out;
}

.voice-blob::before,
.voice-blob::after {
    position: absolute;
    content: "";
    border: 1px solid rgba(108, 146, 192, 0.12);
    border-radius: 53% 47% 54% 46% / 48% 56% 44% 52%;
    inset: -17%;
    opacity: var(--ring-alpha);
    transform: scale(var(--ring-scale));
}

.voice-blob::after {
    inset: -34%;
    opacity: var(--ring-outer-alpha);
}

.blob-core {
    width: 28%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: rgba(141, 172, 210, 0.25);
    filter: blur(19px);
}

.voice-blob.is-speaking {
    animation-duration: 2.2s;
}

@keyframes blob-idle {
    0%, 100% { border-radius: 44% 56% 47% 53% / 55% 43% 57% 45%; }
    20% { border-radius: 58% 42% 60% 40% / 45% 60% 40% 55%; }
    48% { border-radius: 40% 60% 42% 58% / 59% 41% 59% 41%; }
    74% { border-radius: 55% 45% 51% 49% / 41% 58% 42% 59%; }
}

.talk-button {
    display: inline-flex;
    min-width: 180px;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem;
    border: 1px solid #4a4a4a;
    border-radius: 999px;
    color: var(--text);
    background: #181818;
    font-weight: 700;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.talk-button:hover:not(:disabled) {
    border-color: #797979;
    background: #202020;
}

.talk-button.is-listening {
    color: #080808;
    background: #ededed;
    border-color: #ededed;
    transform: scale(0.97);
}

.talk-button:disabled {
    cursor: wait;
    opacity: 0.52;
}

.mic-icon {
    position: relative;
    width: 12px;
    height: 17px;
    border: 2px solid currentColor;
    border-radius: 8px;
}

.mic-icon::before {
    position: absolute;
    width: 18px;
    height: 11px;
    border: 2px solid currentColor;
    border-top: 0;
    border-radius: 0 0 10px 10px;
    content: "";
    left: 50%;
    top: 7px;
    transform: translateX(-50%);
}

.talk-help {
    margin: 0.8rem 0 0;
    color: #696969;
    font-size: 0.75rem;
}

.transcript-panel {
    margin-top: clamp(4rem, 10vw, 7rem);
    padding-top: 1.6rem;
    border-top: 1px solid var(--border);
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: -0.025em;
}

.connection-badge {
    padding: 0.35rem 0.6rem;
    border: 1px solid #343434;
    border-radius: 999px;
    color: #777;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.connection-badge.is-online {
    color: #d3d3d3;
    border-color: #595959;
}

.transcript {
    display: flex;
    max-height: 440px;
    min-height: 150px;
    margin-top: 1.5rem;
    padding-right: 0.35rem;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

.empty-state {
    display: grid;
    min-height: 140px;
    place-items: center;
    border: 1px dashed #292929;
    border-radius: 14px;
    color: #616161;
    font-size: 0.85rem;
}

.message {
    max-width: 78%;
}

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

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

.message-speaker {
    display: block;
    margin-bottom: 0.45rem;
    color: #6e6e6e;
    font-size: 0.65rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.message-body {
    margin: 0;
    padding: 0.85rem 1rem;
    border: 1px solid #292929;
    border-radius: 14px;
    color: #c8c8c8;
    background: #111;
    line-height: 1.55;
}

.message.user .message-body {
    color: #111;
    background: #d5d5d5;
    border-color: #d5d5d5;
}

.insight-toggle {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 40;
    padding: 0.7rem 1rem;
    border: 1px solid #41536b;
    border-radius: 999px;
    color: #dce9fa;
    background: #17202d;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.38);
    cursor: pointer;
    transition: right 260ms cubic-bezier(.2, .8, .2, 1);
}

.agent-page.insight-open .insight-toggle {
    right: calc(var(--insight-panel-width) + 1rem);
}

.insight-sidebar {
    position: fixed;
    z-index: 30;
    top: 0;
    right: 0;
    display: flex;
    width: var(--insight-panel-width, min(430px, 100vw));
    height: 100dvh;
    padding: 1.25rem;
    border-left: 1px solid #29394e;
    flex-direction: column;
    background:
        radial-gradient(circle at 100% 0, rgba(37, 72, 111, 0.3), transparent 36%),
        #0c1016;
    transform: translateX(100%);
    transition: transform 260ms cubic-bezier(.2, .8, .2, 1);
    pointer-events: none;
}

.insight-sidebar.is-open {
    transform: translateX(0);
    pointer-events: auto;
}

.insight-sidebar__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.35rem 0 1.25rem;
    border-bottom: 1px solid #243243;
}

.insight-sidebar__header h2 {
    margin: 0;
    font-size: 1.3rem;
    letter-spacing: -0.03em;
}

.icon-button {
    display: grid;
    width: 34px;
    height: 34px;
    border: 1px solid #32445c;
    border-radius: 50%;
    place-items: center;
    color: #a9bed8;
    background: #121b27;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
}

.insight-content {
    padding: 1.4rem 0 2rem;
    overflow-y: auto;
}

.insight-card,
.forecast-day {
    border: 1px solid #29394e;
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(27, 39, 55, 0.92), rgba(14, 19, 27, 0.98));
    box-shadow: inset 0 1px 0 rgba(181, 208, 241, 0.05);
}

.insight-card {
    padding: 1.35rem;
}

.insight-kicker {
    margin: 0 0 0.5rem;
    color: #87a5c7;
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.insight-card__title {
    margin: 0;
    color: #e6edf7;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}

.weather-condition {
    margin: 0.55rem 0 0;
    color: #adc2da;
    text-transform: capitalize;
}

.weather-temperature {
    margin: 1.15rem 0;
    color: #f1f6ff;
    font-size: 4.25rem;
    font-weight: 680;
    letter-spacing: -0.1em;
    line-height: 0.9;
}

.weather-temperature span {
    margin-left: 0.22rem;
    color: #91abc8;
    font-size: 1.25rem;
    letter-spacing: 0;
}

.weather-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
}

.weather-metric {
    padding: 0.7rem;
    border: 1px solid rgba(101, 134, 171, 0.23);
    border-radius: 10px;
    background: rgba(5, 11, 18, 0.35);
}

.weather-metric__label,
.weather-metric__value {
    display: block;
}

.weather-metric__label {
    color: #8097b1;
    font-size: 0.68rem;
}

.weather-metric__value {
    margin-top: 0.25rem;
    color: #dbe8f8;
    font-size: 0.9rem;
}

.insight-footnote,
.advisory-disclaimer {
    margin: 1rem 0 0;
    color: #7f93aa;
    font-size: 0.72rem;
    line-height: 1.5;
}

.forecast-insight {
    display: grid;
    gap: 0.55rem;
}

.forecast-days {
    display: grid;
    gap: 0.7rem;
    margin-top: 0.7rem;
}

.forecast-day {
    padding: 0.95rem 1rem;
}

.forecast-day__label {
    color: #d9e7f8;
    font-size: 0.9rem;
}

.forecast-day__condition,
.forecast-day__detail {
    margin: 0.35rem 0 0;
    color: #839ab5;
    font-size: 0.78rem;
    text-transform: capitalize;
}

.forecast-day__temperature {
    margin: 0.55rem 0 0;
    color: #edf5ff;
    font-size: 1.1rem;
    font-weight: 700;
}

.hourly-insight {
    display: grid;
    gap: 0.55rem;
}

.hourly-peak {
    margin: 0.35rem 0 0;
    color: #9ec0e4;
    font-size: 0.82rem;
}

.hourly-hours {
    display: grid;
    gap: 0.7rem;
    margin-top: 0.7rem;
}

.hourly-hour {
    padding: 0.95rem 1rem;
    border: 1px solid #29394e;
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(27, 39, 55, 0.92), rgba(14, 19, 27, 0.98));
}

.hourly-hour.is-peak {
    border-color: #4f7eac;
    box-shadow: inset 0 0 0 1px rgba(111, 160, 214, 0.25);
}

.hourly-hour__label {
    color: #d9e7f8;
    font-size: 0.9rem;
}

.hourly-hour__condition,
.hourly-hour__detail {
    margin: 0.35rem 0 0;
    color: #839ab5;
    font-size: 0.78rem;
    text-transform: capitalize;
}

.hourly-hour__temperature {
    margin: 0.55rem 0 0;
    color: #edf5ff;
    font-size: 1.1rem;
    font-weight: 700;
}

.advisory-context {
    margin: 0.7rem 0 0;
    color: #93b1d1;
    font-size: 0.82rem;
}

.advisory-sections {
    display: grid;
    gap: 0.9rem;
    margin-top: 1.3rem;
}

.advisory-section {
    padding: 0.9rem;
    border-left: 2px solid #3a638d;
    background: rgba(14, 26, 40, 0.54);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 320ms ease, transform 320ms ease;
}

.advisory-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.advisory-section__heading {
    margin: 0;
    color: #dceafa;
    font-size: 0.82rem;
}

.advisory-section__list {
    display: grid;
    gap: 0.45rem;
    margin: 0.65rem 0 0;
    padding-left: 1.1rem;
    color: #a8bad0;
    font-size: 0.83rem;
    line-height: 1.5;
}

#agent-audio {
    position: fixed;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 600px) {
    .topbar,
    .agent-shell {
        width: min(100% - 1.4rem, 900px);
    }

    .topbar {
        height: 66px;
    }

    .agent-shell {
        padding-top: 2.5rem;
    }

    .message {
        max-width: 90%;
    }

    .agent-page {
        --insight-panel-width: min(360px, 92vw);
    }

    .insight-sidebar {
        border-left: 1px solid #29394e;
    }

    .insight-toggle {
        right: 0.75rem;
        bottom: 0.75rem;
    }
}

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