.ifm-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    border-bottom: 1px solid rgba(23, 43, 77, .12);
    background: rgba(247, 243, 235, .92);
    box-shadow: 0 8px 28px rgba(23, 43, 77, .06);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.ifm-nav, .ifm-nav * { box-sizing: border-box; }
.ifm-nav [hidden] { display: none !important; }
.ifm-nav button, .ifm-nav a { font: inherit; -webkit-tap-highlight-color: transparent; }

.ifm-nav__inner {
    width: min(calc(100% - 32px), 1120px);
    min-height: 68px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 22px;
}

.ifm-nav__brand {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: #172b4d;
    text-decoration: none;
}

.ifm-nav__logo-frame {
    width: 76px;
    height: 48px;
    overflow: hidden;
    display: block;
    border-radius: 8px;
    background: #fff;
}

.ifm-nav__logo-frame img {
    width: 76px;
    height: 76px;
    display: block;
    object-fit: cover;
    transform: translateY(-14px);
}

.ifm-nav__brand-copy { display: grid; gap: 1px; }
.ifm-nav__brand-copy strong {
    font: 700 16px/1 "DM Sans", system-ui, sans-serif;
    letter-spacing: .08em;
}
.ifm-nav__brand-copy small {
    color: #706a62;
    font: 700 8px/1.2 "DM Sans", system-ui, sans-serif;
    letter-spacing: .09em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ifm-nav__links {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 3px;
}

.ifm-nav__modules {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(23, 43, 77, .1);
    border-radius: 999px;
    background: rgba(255, 255, 255, .48);
    padding: 3px;
}
.ifm-nav__modules a {
    min-height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 17px;
    color: #706a62;
    font-size: 10px;
    font-weight: 850;
    text-decoration: none;
    white-space: nowrap;
}
.ifm-nav__modules a:hover { color: #172b4d; }
.ifm-nav__modules a.is-active { background: #172b4d; box-shadow: 0 5px 12px rgba(23,43,77,.16); color: #fff; }

.ifm-nav__operations {
    width: min(calc(100% - 32px), 1120px);
    min-height: 44px;
    margin: 0 auto;
    border-top: 1px solid rgba(23, 43, 77, .08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.ifm-nav__operations .ifm-nav__links { overflow-x: auto; scrollbar-width: none; }
.ifm-nav__operations .ifm-nav__links::-webkit-scrollbar { display: none; }
.ifm-nav__context {
    width: min(calc(100% - 32px), 1120px);
    min-height: 40px;
    margin: 0 auto;
    border-top: 1px solid rgba(23, 43, 77, .08);
    display: flex;
    align-items: center;
}
.ifm-nav__context .ifm-nav__subnav {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 3px;
    background: transparent;
    padding: 3px 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.ifm-nav__context .ifm-nav__subnav::-webkit-scrollbar { display: none; }
.ifm-nav__context .ifm-nav__subnav a {
    min-height: 31px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 13px;
    color: #706a62;
    font-size: 9px;
    font-weight: 850;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}
.ifm-nav__context .ifm-nav__subnav a:hover { background: rgba(255,255,255,.7); color: #172b4d; }
.ifm-nav__context .ifm-nav__subnav a.is-active {
    background: #172b4d;
    box-shadow: 0 4px 10px rgba(23,43,77,.14);
    color: #fff;
}
.ifm-nav__context--detail {
    min-height: 38px;
    background: rgba(255, 255, 255, .34);
}
.ifm-nav__context--detail .ifm-nav__subnav { padding-block: 2px 4px; }
.ifm-nav__context--detail .ifm-nav__subnav::before {
    content: "DOSYA";
    flex: 0 0 auto;
    margin-right: 6px;
    color: #9a554b;
    font-size: 7px;
    font-weight: 900;
    letter-spacing: .12em;
}
.ifm-nav__context--job .ifm-nav__subnav::before { content: "İŞ"; }
.ifm-nav__links .ifm-nav__create { background: rgba(214, 91, 74, .1); color: #963d31; }
.ifm-nav__links .ifm-nav__create:hover { background: rgba(214, 91, 74, .17); color: #8a352b; }
.ifm-nav__links .ifm-nav__calendar-link { display: inline-flex; align-items: center; gap: 6px; }
.ifm-nav__calendar-link svg { width: 14px; height: 14px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ifm-nav__section-label { flex: 0 0 auto; color: #8b857d; font-size: 8px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }

.ifm-nav__links a,
.ifm-nav__links button,
.ifm-nav__refresh,
.ifm-nav__account > form button {
    min-height: 36px;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    padding: 8px 12px;
    color: #5f5a53;
    cursor: pointer;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.ifm-nav__links a:hover,
.ifm-nav__links button:hover,
.ifm-nav__links .is-active {
    background: rgba(255, 255, 255, .82);
    color: #172b4d;
}

.ifm-nav__links .is-active { box-shadow: inset 0 0 0 1px rgba(23, 43, 77, .1); }
.ifm-nav__links .ifm-nav__context { color: #2867a6; }
.ifm-nav__links .ifm-nav__install { color: #2867a6; }

.ifm-nav__account {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 5px;
}
.ifm-nav__admin { width:36px; height:36px; flex:0 0 36px; border-radius:50%; display:grid; place-items:center; color:#706a62; text-decoration:none; }
.ifm-nav__admin:hover, .ifm-nav__admin.is-active { background:rgba(23,43,77,.07); color:#172b4d; }
.ifm-nav__admin svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

.ifm-nav__account form { margin: 0; }
.ifm-nav__mobile-account { position: relative; display: none; }
.ifm-nav__mobile-account-trigger {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #706a62;
    cursor: pointer;
    font: 900 13px/1 "DM Sans", system-ui, sans-serif;
    letter-spacing: .08em;
}
.ifm-nav__mobile-account-trigger:hover,
.ifm-nav__mobile-account.is-open .ifm-nav__mobile-account-trigger { background: rgba(23,43,77,.06); color: #172b4d; }
.ifm-nav__mobile-account-panel {
    position: absolute;
    top: calc(100% + 9px);
    right: 0;
    z-index: 1120;
    width: 190px;
    border: 1px solid rgba(23,43,77,.13);
    border-radius: 15px;
    display: grid;
    gap: 3px;
    background: #fffdf9;
    box-shadow: 0 18px 48px rgba(23,43,77,.2);
    padding: 12px;
    color: #172b4d;
}
.ifm-nav__mobile-account-panel > span { overflow: hidden; font-size: 10px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.ifm-nav__mobile-account-panel > small { color: #817970; font-size: 8px; }
.ifm-nav__mobile-account-panel > a {
    min-height: 34px;
    margin-top: 7px;
    border-top: 1px solid rgba(23,43,77,.08);
    display: flex;
    align-items: center;
    color: #365276;
    font-size: 9px;
    font-weight: 800;
    text-decoration: none;
    padding: 8px 10px 0;
}
.ifm-nav__mobile-account-panel > a:hover { color: #172b4d; }
.ifm-nav__mobile-account-panel form { margin-top: 7px; border-top: 1px solid rgba(23,43,77,.08); padding-top: 7px; }
.ifm-nav__mobile-account-panel form button {
    width: 100%;
    min-height: 34px;
    border: 0;
    border-radius: 9px;
    background: rgba(185,77,63,.07);
    color: #914137;
    cursor: pointer;
    font-size: 9px;
    font-weight: 800;
    text-align: left;
    padding: 8px 10px;
}
.ifm-nav__mobile-account-panel form button:hover { background: rgba(185,77,63,.13); }
.ifm-nav__notifications { position: relative; flex: 0 0 auto; }
.ifm-nav__notification-trigger {
    position: relative;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: transparent;
    color: #706a62;
    cursor: pointer;
}
.ifm-nav__notification-trigger:hover,
.ifm-nav__notifications.is-open .ifm-nav__notification-trigger { background: rgba(23,43,77,.06); color: #172b4d; }
.ifm-nav__notification-trigger svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ifm-nav__notification-count { position: absolute; top: 1px; right: 0; min-width: 15px; height: 15px; border: 2px solid #f7f3eb; border-radius: 999px; display: grid; place-items: center; background: #d64f43; padding: 0 3px; color: #fff; font-size: 7px; font-weight: 900; line-height: 1; }
.ifm-nav__notification-panel { position: absolute; top: calc(100% + 10px); right: -8px; z-index: 1100; width: min(370px,calc(100vw - 24px)); overflow: hidden; border: 1px solid rgba(23,43,77,.13); border-radius: 19px; background: #fffdf9; box-shadow: 0 22px 60px rgba(23,43,77,.2); color: #211f1c; }
.ifm-nav__notification-panel > header { min-height: 55px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(23,43,77,.1); padding: 12px 14px; }
.ifm-nav__notification-panel > header > div { display: grid; gap: 2px; }
.ifm-nav__notification-panel > header span { color: #172b4d; font-size: 12px; font-weight: 900; }
.ifm-nav__notification-panel > header strong { color: #d64f43; font-size: 8px; font-weight: 850; text-transform: uppercase; }
.ifm-nav__notification-panel > header button { border: 0; border-radius: 999px; background: rgba(23,43,77,.055); padding: 7px 9px; color: #5f5a53; cursor: pointer; font-size: 8px; font-weight: 800; }
.ifm-nav__notification-panel > header button:hover { background: rgba(23,43,77,.1); color: #172b4d; }
.ifm-nav__notification-list { max-height: min(430px,calc(100vh - 150px)); overflow-y: auto; }
.ifm-nav__notification-item { position: relative; display: grid; grid-template-columns: 34px minmax(0,1fr) 7px; gap: 10px; align-items: start; border-bottom: 1px solid rgba(23,43,77,.07); padding: 12px 13px; color: inherit; text-decoration: none; }
.ifm-nav__notification-item:last-child { border-bottom: 0; }
.ifm-nav__notification-item:hover { background: rgba(40,103,166,.045); }
.ifm-nav__notification-item.is-unread { background: rgba(214,79,67,.045); }
.ifm-nav__notification-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: rgba(40,103,166,.09); color: #2867a6; }
.ifm-nav__notification-item.is-unread .ifm-nav__notification-icon { background: rgba(214,79,67,.11); color: #b34035; }
.ifm-nav__notification-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ifm-nav__notification-copy { min-width: 0; display: grid; gap: 3px; }
.ifm-nav__notification-copy strong { color: #172b4d; font-size: 10px; font-weight: 900; }
.ifm-nav__notification-copy small { display: -webkit-box; overflow: hidden; color: #625d56; font-size: 9px; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.ifm-nav__notification-copy time { color: #8b857d; font-size: 7.5px; font-weight: 750; }
.ifm-nav__notification-item > i { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: #d64f43; box-shadow: 0 0 0 4px rgba(214,79,67,.09); }
.ifm-nav__notification-empty { display: grid; gap: 5px; padding: 28px 18px; text-align: center; }
.ifm-nav__notification-empty strong { color: #172b4d; font-size: 11px; }
.ifm-nav__notification-empty span { color: #8b857d; font-size: 9px; }
.ifm-nav__refresh,
.ifm-nav__account > form button { color: #706a62; }
.ifm-nav__refresh:hover,
.ifm-nav__account > form button:hover { background: rgba(23, 43, 77, .05); color: #172b4d; }
.ifm-nav__refresh svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}
.ifm-nav__refresh span { margin-left: 5px; }
.ifm-nav__user {
    max-width: 130px;
    overflow: hidden;
    color: #706a62;
    font-size: 9px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ifm-nav__language {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 1px solid rgba(23, 43, 77, .12);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #172b4d;
    font: 800 9px/1 "DM Sans", system-ui, sans-serif;
}

.ifm-nav__links--guest { margin-left: auto; }
.ifm-nav + .login-shell { min-height: calc(100dvh - 68px); }

.ifm-confirm {
    width: min(calc(100% - 32px), 470px);
    max-width: none;
    overflow: visible;
    border: 1px solid rgba(23, 43, 77, .13);
    border-radius: 26px;
    background: #f7f3eb;
    box-shadow: 0 28px 80px rgba(23, 43, 77, .25);
    padding: 0;
    color: #24211e;
    font-family: "DM Sans", system-ui, sans-serif;
}
.ifm-confirm[open] { animation: ifm-confirm-enter .18s ease-out; }
.ifm-confirm::backdrop {
    background: rgba(15, 27, 47, .52);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.ifm-confirm__shell { display: grid; grid-template-columns: 48px 1fr; gap: 16px; padding: 26px; }
.ifm-confirm__icon {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    background: rgba(214, 91, 74, .13);
    box-shadow: inset 0 0 0 1px rgba(214, 91, 74, .22);
    color: #a43f33;
    font: 700 25px/1 "Fraunces", Georgia, serif;
}
.ifm-confirm__copy { min-width: 0; }
.ifm-confirm__eyebrow { color: #a43f33; font-size: 8px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.ifm-confirm__copy h2 { margin: 5px 0 0; color: #172b4d; font: 600 25px/1.12 "Fraunces", Georgia, serif; letter-spacing: -.02em; }
.ifm-confirm__copy p { margin: 10px 0 0; color: #706a62; font-size: 11px; line-height: 1.6; }
.ifm-confirm__actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 9px; margin-top: 5px; }
.ifm-confirm__actions button { min-height: 42px; border-radius: 999px; padding: 10px 17px; cursor: pointer; font: 800 10px/1 "DM Sans", system-ui, sans-serif; }
.ifm-confirm__cancel { border: 1px solid rgba(23, 43, 77, .13); background: rgba(255, 255, 255, .62); color: #172b4d; }
.ifm-confirm__approve { border: 1px solid #bd4e40; background: #c85547; box-shadow: 0 8px 18px rgba(200, 85, 71, .2); color: #fff; }
.ifm-confirm__cancel:hover { background: #fff; }
.ifm-confirm__approve:hover { background: #ad4539; }
.ifm-confirm__actions button:focus-visible { outline: 3px solid rgba(40, 103, 166, .25); outline-offset: 2px; }
.ifm-confirm[data-tone="info"] .ifm-confirm__icon { background: rgba(40,103,166,.11); box-shadow: inset 0 0 0 1px rgba(40,103,166,.18); color:#2867a6; }
.ifm-confirm[data-tone="info"] .ifm-confirm__eyebrow { color:#2867a6; }
.ifm-confirm[data-tone="info"] .ifm-confirm__approve { border-color:#172b4d; background:#172b4d; box-shadow:0 8px 18px rgba(23,43,77,.2); }
.ifm-confirm[data-tone="info"] .ifm-confirm__approve:hover { background:#233f6c; }
.ifm-confirm__cancel[hidden] { display:none; }

@keyframes ifm-confirm-enter {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
    .ifm-nav__workspace-rehber { display: none !important; }
    .ifm-nav__inner {
        width: 100%;
        min-height: 56px;
        flex-wrap: nowrap;
        gap: 4px;
        padding: 6px 8px;
    }
    .ifm-nav__brand { flex: 0 0 42px; display: inline-flex; }
    .ifm-nav__logo-frame { width: 42px; height: 36px; }
    .ifm-nav__logo-frame img { width: 58px; height: 58px; transform: translate(-8px, -11px); }
    .ifm-nav__brand-copy { display: none; }
    .ifm-nav__workspace-switcher {
        order: 1;
        width: auto;
        min-width: 0;
        flex: 1 1 auto;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2px;
        padding: 2px;
    }
    .ifm-nav__workspace-switcher a { min-width: 0; min-height: 34px; padding-inline: 6px; font-size: 9px; }
    .ifm-nav__links { overflow-x: auto; gap: 0; scrollbar-width: none; }
    .ifm-nav__links::-webkit-scrollbar { display: none; }
    .ifm-nav__links a, .ifm-nav__links button { min-height: 34px; padding-inline: 9px; font-size: 9px; }
    .ifm-nav__account { order: 2; flex: 0 0 auto; margin-left: 0; gap: 0; }
    .ifm-nav__user { display: none; }
    .ifm-nav__desktop-logout, .ifm-nav__language { display: none; }
    .ifm-nav__mobile-account { display: block; }
    .ifm-nav__admin { display: none; }
    .ifm-nav__refresh { min-height: 34px; padding-inline: 7px; font-size: 9px; }
    .ifm-nav__refresh span { display: none; }
    .ifm-nav__refresh svg { width: 16px; height: 16px; }
    .ifm-nav__language { width: 30px; height: 30px; flex-basis: 30px; font-size: 8px; }
    .ifm-nav__notification-trigger { width: 32px; height: 32px; }
    .ifm-nav__notification-panel { position: fixed; top: 56px; right: 8px; width: calc(100vw - 16px); border-radius: 17px; }
    .ifm-nav__operations { width: 100%; min-height: 42px; padding: 4px 12px; }
    .ifm-nav__context { padding: 4px 12px; }
    .ifm-nav__section-label { display: none; }
    .ifm-nav + .login-shell { min-height: calc(100dvh - 56px); }
}

@media (max-width: 430px) {
    .ifm-nav__inner { padding-inline: 6px; }
    .ifm-nav__links a, .ifm-nav__links button { padding-inline: 7px; }
    .ifm-nav__workspace-switcher a { padding-inline: 5px; font-size: 8.5px; }
    .ifm-confirm__shell { grid-template-columns: 40px 1fr; gap: 13px; padding: 21px; }
    .ifm-confirm__icon { width: 40px; height: 40px; border-radius: 13px; font-size: 21px; }
    .ifm-confirm__copy h2 { font-size: 22px; }
    .ifm-confirm__actions { display: grid; grid-template-columns: 1fr 1fr; }
    .ifm-confirm__actions button { width: 100%; padding-inline: 12px; }
}

@media (prefers-reduced-transparency: reduce) {
    .ifm-nav { background: #f7f3eb; backdrop-filter: none; -webkit-backdrop-filter: none; }
}

@media (prefers-reduced-motion: reduce) {
    .ifm-confirm[open] { animation: none; }
}
/* Kentsel IFM AI — scoped floating, read-only data assistant. */
.ifm-ai {
    --ai-navy: #172b4d;
    --ai-navy-lift: #24406b;
    --ai-ink: #24211e;
    --ai-body: #3a3630;
    --ai-muted: #766f66;
    --ai-paper: #f7f3eb;
    --ai-surface: #fffdf9;
    --ai-line: rgba(23, 43, 77, .13);
    --ai-hair: rgba(23, 43, 77, .07);
    --ai-slate: #3d5c85;
    --ai-amber: #f0b86a;
    --ai-green: #3f7a56;
    --ai-red: #b04a3c;
    --ai-pad: 18px;
    --ai-panel-w: min(430px, calc(100vw - 30px));
    --ai-panel-h: min(660px, calc(100dvh - 36px));
    --ai-rail-w: 264px;
    position: fixed;
    right: 22px;
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 1200;
    font-family: "DM Sans", system-ui, sans-serif;
}
.ifm-ai, .ifm-ai * { box-sizing: border-box; }
.ifm-ai [hidden] { display: none !important; }
.ifm-ai button, .ifm-ai a { -webkit-tap-highlight-color: transparent; }

/* Launcher — the single persistent entry point. */
.ifm-ai__launcher {
    min-height: 52px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px 8px 8px;
    background: linear-gradient(140deg, #26426c 0%, #172b4d 62%);
    box-shadow: 0 16px 38px rgba(23, 43, 77, .3), inset 0 1px 0 rgba(255, 255, 255, .09);
    color: #fff;
    cursor: pointer;
    font: 800 13px/1 "DM Sans", system-ui, sans-serif;
    letter-spacing: .01em;
    transition: transform .18s ease, box-shadow .18s ease;
}
.ifm-ai__launcher > span:first-child {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 34% 28%, #ffdca6, #f0b86a 72%);
    box-shadow: 0 4px 12px rgba(240, 184, 106, .38);
    color: #172b4d;
    font-size: 17px;
}
.ifm-ai__launcher:hover { transform: translateY(-2px); box-shadow: 0 22px 46px rgba(23, 43, 77, .34); }
.ifm-ai.is-open .ifm-ai__launcher { visibility: hidden; }

/* Panel shell — explicit 4-row grid so the history rail can overlay or dock. */
.ifm-ai__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: var(--ai-panel-w);
    height: var(--ai-panel-h);
    border: 1px solid rgba(23, 43, 77, .16);
    border-radius: 26px;
    overflow: hidden;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    background: var(--ai-paper);
    box-shadow: 0 34px 92px rgba(15, 27, 47, .3), 0 6px 18px rgba(15, 27, 47, .1);
    color: var(--ai-ink);
}
.ifm-ai__panel:not([hidden]) { display: grid; animation: ifm-ai-enter .2s cubic-bezier(.2, .8, .3, 1); }

/* 1 — Identity bar: who is answering, and which conversation. */
.ifm-ai__header {
    grid-area: 1 / 1;
    min-height: 74px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: linear-gradient(135deg, #21395f 0%, #172b4d 58%, #132340 100%);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .07);
    color: #fff;
}
.ifm-ai__identity { min-width: 0; flex: 1; display: grid; gap: 4px; }
.ifm-ai__identity span { color: var(--ai-amber); font-size: 10px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.ifm-ai__identity strong { overflow: hidden; color: #fff; font: 600 18px/1.15 "Fraunces", Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }
.ifm-ai__header-actions { display: flex; gap: 7px; }
.ifm-ai__header-button {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    background: rgba(255, 255, 255, .09);
    color: #fff;
    cursor: pointer;
    font: 400 20px/1 system-ui, sans-serif;
    transition: background .16s ease, border-color .16s ease;
}
.ifm-ai__header-button:hover { border-color: rgba(255, 255, 255, .32); background: rgba(255, 255, 255, .19); }

/* Conversation history — overlay on narrow screens, docked rail on wide ones. */
.ifm-ai__history {
    grid-area: 2 / 1 / 5 / 2;
    z-index: 4;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    background: rgba(247, 243, 235, .985);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.ifm-ai__history-head {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px 12px var(--ai-pad);
    border-bottom: 1px solid var(--ai-hair);
}
.ifm-ai__history-head strong { color: var(--ai-navy); font: 600 20px/1 "Fraunces", Georgia, serif; }
.ifm-ai__history-close {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 50%;
    background: rgba(23, 43, 77, .07);
    color: var(--ai-navy);
    cursor: pointer;
    font-size: 21px;
    transition: background .16s ease;
}
.ifm-ai__history-close:hover { background: rgba(23, 43, 77, .13); }
.ifm-ai__history-list { min-height: 0; display: grid; align-content: start; gap: 6px; overflow-y: auto; padding: 12px; }
.ifm-ai__history-list > p { margin: 40px 16px; color: var(--ai-muted); font-size: 12.5px; line-height: 1.5; text-align: center; }
.ifm-ai__history-item {
    position: relative;
    display: grid;
    gap: 5px;
    width: 100%;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 12px 14px;
    background: transparent;
    color: var(--ai-ink);
    cursor: pointer;
    text-align: left;
    transition: border-color .16s ease, background .16s ease;
}
.ifm-ai__history-item:hover { border-color: var(--ai-hair); background: rgba(255, 255, 255, .8); }
.ifm-ai__history-item.is-active { border-color: rgba(61, 92, 133, .22); background: #e9eff6; }
.ifm-ai__history-item.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--ai-slate);
}
.ifm-ai__history-item strong { overflow: hidden; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.ifm-ai__history-item small { color: var(--ai-muted); font-size: 11px; }

/* 2 — Scope ribbon: the permission promise, stated once and always visible. */
.ifm-ai__scope {
    grid-area: 2 / 1;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px var(--ai-pad);
    border-bottom: 1px solid var(--ai-hair);
    background: linear-gradient(90deg, rgba(63, 122, 86, .12), rgba(63, 122, 86, .03) 46%, rgba(255, 255, 255, 0));
    color: #2f5f43;
}
.ifm-ai__scope i { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--ai-green); box-shadow: 0 0 0 4px rgba(63, 122, 86, .15); }
.ifm-ai__scope span { font-size: 10.5px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.ifm-ai__scope small {
    margin-left: auto;
    border: 1px solid var(--ai-hair);
    border-radius: 999px;
    padding: 4px 11px;
    background: rgba(255, 255, 255, .74);
    color: var(--ai-muted);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

/* 3 — Conversation stream. */
.ifm-ai__messages {
    grid-area: 3 / 1;
    min-height: 0;
    display: grid;
    align-content: start;
    gap: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px var(--ai-pad) 18px;
    box-shadow: inset 0 9px 10px -11px rgba(23, 43, 77, .3);
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(23, 43, 77, .18) transparent;
}
.ifm-ai__messages::-webkit-scrollbar, .ifm-ai__history-list::-webkit-scrollbar { width: 10px; }
.ifm-ai__messages::-webkit-scrollbar-thumb, .ifm-ai__history-list::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background-clip: content-box;
    background-color: rgba(23, 43, 77, .18);
}
/* Nothing asked yet: centre the opening pair so a tall panel never feels empty. */
.ifm-ai__messages:has(> .ifm-ai__suggestions:nth-child(2):last-child) { align-content: center; padding-bottom: 58px; }
.ifm-ai__message { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: start; }
.ifm-ai__message > span {
    width: 32px;
    height: 32px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: linear-gradient(150deg, var(--ai-navy-lift), var(--ai-navy));
    box-shadow: 0 4px 12px rgba(23, 43, 77, .18);
    color: var(--ai-amber);
    font-size: 9.5px;
    font-weight: 900;
    letter-spacing: .03em;
}
.ifm-ai__message > div {
    min-width: 0;
    /* font-size anchors the ch measure below — answers stay inside a readable column. */
    font-size: 14px;
    max-width: min(100%, 66ch);
    justify-self: start;
    border: 1px solid var(--ai-hair);
    border-radius: 6px 18px 18px 18px;
    padding: 14px 16px;
    background: var(--ai-surface);
    box-shadow: 0 6px 20px rgba(23, 43, 77, .06);
}
.ifm-ai__message p { margin: 0; color: var(--ai-body); font-size: 14px; line-height: 1.62; white-space: pre-wrap; }
.ifm-ai__message > div > small {
    display: block;
    margin-top: 11px;
    padding-top: 10px;
    border-top: 1px dashed var(--ai-line);
    color: var(--ai-muted);
    font-size: 12px;
    line-height: 1.5;
}
/* The opening message is the first thing a newcomer reads — give it presence. */
.ifm-ai__messages > .ifm-ai__message:first-child:has(+ .ifm-ai__suggestions) > div {
    border-color: rgba(23, 43, 77, .11);
    background: linear-gradient(155deg, #fff 0%, #fdfaf2 100%);
    box-shadow: 0 12px 32px rgba(23, 43, 77, .09);
}
.ifm-ai__messages > .ifm-ai__message:first-child:has(+ .ifm-ai__suggestions) p { color: #2f2b26; font-size: 15px; }
.ifm-ai__message.is-user { grid-template-columns: minmax(0, 1fr) 32px; }
.ifm-ai__message.is-user > span { grid-column: 2; grid-row: 1; background: linear-gradient(150deg, #efe4d2, #ded0b6); box-shadow: 0 4px 12px rgba(73, 63, 51, .14); color: #4a4033; }
.ifm-ai__message.is-user > div {
    grid-column: 1;
    grid-row: 1;
    max-width: min(100%, 46ch);
    justify-self: end;
    border-color: rgba(120, 98, 64, .2);
    border-radius: 18px 6px 18px 18px;
    background: linear-gradient(150deg, #f2e8d8, #e8dcc6);
    box-shadow: 0 6px 18px rgba(73, 63, 51, .09);
}
.ifm-ai__message.is-user p { color: #3d3529; font-weight: 500; }

/* Starter prompts — the strongest call to action before the first question. */
.ifm-ai__suggestions { display: grid; gap: 8px; margin-top: 2px; padding-left: 42px; }
.ifm-ai__suggestions button {
    position: relative;
    min-height: 48px;
    display: flex;
    align-items: center;
    border: 1px solid var(--ai-line);
    border-radius: 14px;
    padding: 11px 36px 11px 14px;
    background: var(--ai-surface);
    box-shadow: 0 3px 10px rgba(23, 43, 77, .05);
    color: var(--ai-navy);
    cursor: pointer;
    text-align: left;
    font: 700 13px/1.4 "DM Sans", system-ui, sans-serif;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.ifm-ai__suggestions button::after {
    content: "→";
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ai-slate);
    font-size: 13px;
    opacity: .42;
    transition: opacity .16s ease, transform .16s ease;
}
.ifm-ai__suggestions button:hover {
    transform: translateY(-1px);
    border-color: rgba(61, 92, 133, .34);
    box-shadow: 0 11px 26px rgba(23, 43, 77, .1);
}
.ifm-ai__suggestions button:hover::after { opacity: 1; transform: translateY(-50%) translateX(3px); }

/* Answer body. */
.ifm-ai__answer { display: grid; gap: 11px; }
.ifm-ai__answer h3 {
    position: relative;
    margin: 2px 0 0;
    padding-bottom: 9px;
    color: var(--ai-navy);
    font: 600 19px/1.24 "Fraunces", Georgia, serif;
    letter-spacing: -.012em;
}
.ifm-ai__answer h3::after { content: ""; position: absolute; left: 0; bottom: 0; width: 28px; height: 2px; border-radius: 2px; background: var(--ai-amber); }
.ifm-ai__answer h4 { margin: 4px 0 0; color: var(--ai-slate); font-size: 11px; font-weight: 850; line-height: 1.3; text-transform: uppercase; letter-spacing: .1em; }
.ifm-ai__answer p { margin: 0; }
.ifm-ai__answer ul, .ifm-ai__answer ol { display: grid; gap: 8px; margin: 0; padding-left: 20px; color: var(--ai-body); }
.ifm-ai__answer li { padding-left: 3px; font-size: 13.5px; line-height: 1.6; }
.ifm-ai__answer li::marker { color: #93a0b3; font-weight: 700; }
.ifm-ai__answer ol > li::marker { color: var(--ai-slate); }
.ifm-ai__answer li > ul, .ifm-ai__answer li > ol { gap: 6px; margin-top: 7px; padding-left: 17px; }
.ifm-ai__answer li > ul > li, .ifm-ai__answer li > ol > li { color: #544e46; font-size: 13px; font-weight: 500; }
.ifm-ai__answer strong { color: var(--ai-navy); font-weight: 800; }

/* Evidence trail, then the follow-up action. */
.ifm-ai__sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--ai-hair); }
.ifm-ai__sources small { width: 100%; margin: 0 0 2px; color: var(--ai-muted); font-size: 10px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.ifm-ai__sources a {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(61, 92, 133, .16);
    border-radius: 999px;
    padding: 6px 11px;
    background: #edf2f8;
    color: #31537d;
    font-size: 11px;
    font-weight: 750;
    text-decoration: none;
    transition: border-color .16s ease, background .16s ease;
}
.ifm-ai__sources a:hover { border-color: rgba(61, 92, 133, .32); background: #dfe8f4; }
.ifm-ai__answer-actions { display: flex; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--ai-hair); }
.ifm-ai__answer-actions button {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--ai-line);
    border-radius: 999px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, .85);
    color: var(--ai-slate);
    cursor: pointer;
    font: 800 11px/1 "DM Sans", system-ui, sans-serif;
    letter-spacing: .03em;
    transition: border-color .16s ease, background .16s ease;
}
.ifm-ai__answer-actions button:hover { border-color: rgba(61, 92, 133, .3); background: #fff; }
.ifm-ai__answer-actions button::before { content: "◖"; margin-right: 7px; font-size: 12px; }
.ifm-ai__answer-actions button.is-speaking { border-color: rgba(176, 74, 60, .28); background: #fff1ee; color: #a24438; }

/* Waiting state — narrates progress instead of stalling silently. */
.ifm-ai__message.is-loading > div { min-height: 64px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; }
.ifm-ai__message.is-loading > div > strong { color: var(--ai-navy); font-size: 13px; }
.ifm-ai__message.is-loading > div > small { grid-column: 1; margin: 0; padding: 0; border: 0; color: var(--ai-muted); font-size: 11.5px; }
.ifm-ai__thinking-dots { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 5px; }
.ifm-ai__thinking-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ai-slate); animation: ifm-ai-dot 1s infinite ease-in-out; }
.ifm-ai__thinking-dots i:nth-child(2) { animation-delay: .14s; }
.ifm-ai__thinking-dots i:nth-child(3) { animation-delay: .28s; }
.ifm-ai__message.is-voice > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; }
.ifm-ai__message.is-voice > div > strong { color: #4a4033; font-size: 12.5px; }
.ifm-ai__message.is-voice audio { width: 100%; height: 36px; }
.ifm-ai__message.is-voice small.is-error { color: #a24438; }

/* 4 — Composer: input states stack directly above the field that owns them. */
.ifm-ai__form { grid-area: 4 / 1; border-top: 1px solid var(--ai-line); padding: 14px var(--ai-pad) 16px; background: linear-gradient(180deg, rgba(255, 255, 255, .45), var(--ai-surface)); }
.ifm-ai__form > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ifm-ai__composer {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 8px;
    align-items: end;
    border: 1px solid var(--ai-line);
    border-radius: 18px;
    padding: 6px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(23, 43, 77, .05);
    transition: border-color .16s ease, box-shadow .16s ease;
}
.ifm-ai__composer:focus-within { border-color: #4c709e; box-shadow: 0 0 0 3px rgba(76, 112, 158, .13); }
.ifm-ai__form textarea {
    width: 100%;
    min-height: 42px;
    max-height: 110px;
    resize: none;
    border: 0;
    padding: 11px 4px;
    background: transparent;
    color: var(--ai-ink);
    outline: none;
    font: 500 14px/1.5 "DM Sans", system-ui, sans-serif;
}
.ifm-ai__form textarea::placeholder { color: #9d968c; }
.ifm-ai__form button { border: 0; cursor: pointer; font-family: "DM Sans", system-ui, sans-serif; }
.ifm-ai__mic, .ifm-ai__send { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--ai-navy); color: #fff; font: 800 19px/1 system-ui, sans-serif; }
.ifm-ai__send { background: linear-gradient(150deg, var(--ai-navy-lift), var(--ai-navy)); box-shadow: 0 6px 16px rgba(23, 43, 77, .22); transition: transform .16s ease, box-shadow .16s ease; }
.ifm-ai__send:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(23, 43, 77, .28); }
.ifm-ai__form .ifm-ai__mic { border: 1px solid rgba(176, 74, 60, .22); background: #fff6f4; color: #a54b3f; font-size: 15px; transition: background .16s ease; }
.ifm-ai__form .ifm-ai__mic:hover { background: #ffeae5; }
.ifm-ai__form .ifm-ai__mic.is-recording { border-color: transparent; background: var(--ai-red); color: #fff; animation: ifm-ai-record-pulse 1.35s infinite; }
.ifm-ai__form button:disabled { opacity: .45; cursor: wait; }
.ifm-ai__form button:disabled:hover { transform: none; }
.ifm-ai__disclaimer { display: block; margin: 11px 4px 0; color: var(--ai-muted); font-size: 11px; line-height: 1.45; }
.ifm-ai__recording {
    min-height: 48px;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    border: 1px solid rgba(176, 74, 60, .24);
    border-radius: 16px;
    padding: 9px 10px 9px 14px;
    background: linear-gradient(90deg, #fff0ec, #fff8f6);
}
.ifm-ai__recording:not([hidden]) { display: grid; }
.ifm-ai__recording > i { width: 9px; height: 9px; border-radius: 50%; background: var(--ai-red); box-shadow: 0 0 0 5px rgba(176, 74, 60, .13); animation: ifm-ai-record-pulse 1.35s infinite; }
.ifm-ai__recording strong { color: #7d382f; font-size: 12px; }
.ifm-ai__recording time { color: #7d382f; font-size: 12px; font-weight: 850; font-variant-numeric: tabular-nums; }
.ifm-ai__recording button { min-height: 32px; border-radius: 10px; padding: 8px 12px; background: var(--ai-red); color: #fff; font-size: 10.5px; font-weight: 850; }
.ifm-ai__voice-preview {
    grid-template-columns: 36px minmax(72px, 1fr) 30px;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    border: 1px solid rgba(61, 92, 133, .16);
    border-radius: 16px;
    padding: 10px;
    background: linear-gradient(90deg, #edf2f8, #f7fafd);
}
.ifm-ai__voice-preview:not([hidden]) { display: grid; }
.ifm-ai__voice-preview > div { display: grid; gap: 3px; }
.ifm-ai__voice-preview strong { color: #274666; font-size: 12px; }
.ifm-ai__voice-preview small { color: #6c7d8e; font-size: 11px; font-variant-numeric: tabular-nums; }
.ifm-ai__voice-preview > button { width: 30px; height: 30px; border-radius: 50%; background: rgba(23, 43, 77, .08); color: #56697e; font-size: 18px; }
.ifm-ai__voice-player { grid-column: 1 / -1; min-width: 0; }
.ifm-ai__voice-player .ifm-audio { width: 100%; background: rgba(255, 255, 255, .8); }
.ifm-ai__voice-bars { height: 28px; display: flex; align-items: center; justify-content: center; gap: 2px; }
.ifm-ai__voice-bars i { width: 3px; border-radius: 99px; background: #4d7096; }
.ifm-ai__voice-bars i:nth-child(1), .ifm-ai__voice-bars i:nth-child(5) { height: 9px; }
.ifm-ai__voice-bars i:nth-child(2), .ifm-ai__voice-bars i:nth-child(4) { height: 18px; }
.ifm-ai__voice-bars i:nth-child(3) { height: 26px; }

@keyframes ifm-ai-enter { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes ifm-ai-dot { 0%, 70%, 100% { opacity: .35; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-2px); } }
@keyframes ifm-ai-record-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(176, 74, 60, .12); } 50% { box-shadow: 0 0 0 6px rgba(176, 74, 60, .08); } }

/* Tablet — a wider card, same single-column reading order. */
@media (min-width: 641px) and (max-width: 1023px) {
    .ifm-ai { --ai-pad: 20px; --ai-panel-w: min(486px, calc(100vw - 36px)); --ai-panel-h: min(710px, calc(100dvh - 40px)); }
}

/* Desktop — the canvas earns a wider panel and a dockable history rail. */
@media (min-width: 1024px) {
    .ifm-ai { --ai-pad: 22px; --ai-panel-w: min(660px, calc(100vw - 44px)); --ai-panel-h: min(768px, calc(100dvh - 48px)); }
    .ifm-ai__suggestions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ifm-ai__messages { gap: 18px; padding-top: 24px; }
}
@media (min-width: 1400px) {
    .ifm-ai { --ai-panel-w: min(720px, calc(100vw - 52px)); --ai-panel-h: min(824px, calc(100dvh - 56px)); --ai-rail-w: 292px; }
}
@supports selector(:has(*)) {
    @media (min-width: 1024px) {
        .ifm-ai__panel { transition: width .24s cubic-bezier(.4, 0, .2, 1); }
        .ifm-ai__panel:has(> .ifm-ai__history:not([hidden])) {
            width: min(calc(var(--ai-panel-w) + var(--ai-rail-w)), calc(100vw - 44px));
            grid-template-columns: var(--ai-rail-w) minmax(0, 1fr);
        }
        .ifm-ai__panel:has(> .ifm-ai__history:not([hidden])) > .ifm-ai__header { grid-area: 1 / 2; }
        .ifm-ai__panel:has(> .ifm-ai__history:not([hidden])) > .ifm-ai__scope { grid-area: 2 / 2; }
        .ifm-ai__panel:has(> .ifm-ai__history:not([hidden])) > .ifm-ai__messages { grid-area: 3 / 2; }
        .ifm-ai__panel:has(> .ifm-ai__history:not([hidden])) > .ifm-ai__form { grid-area: 4 / 2; }
        .ifm-ai__panel:has(> .ifm-ai__history:not([hidden])) > .ifm-ai__history {
            grid-area: 1 / 1 / 5 / 2;
            border-right: 1px solid var(--ai-line);
            background: linear-gradient(180deg, #f1ece1, var(--ai-paper) 140px);
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
        }
        .ifm-ai__panel:has(> .ifm-ai__history:not([hidden])) > .ifm-ai__history .ifm-ai__history-head { min-height: 74px; }
    }
}

/* Phone — full-height sheet: every pixel goes to reading and answering. */
@media (max-width: 640px) {
    .ifm-ai { --ai-pad: 15px; right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }
    .ifm-ai__launcher { min-height: 48px; padding: 7px 17px 7px 7px; font-size: 12.5px; }
    .ifm-ai__launcher > span:first-child { width: 32px; height: 32px; font-size: 16px; }
    .ifm-ai__panel {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100dvh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
    .ifm-ai__header { min-height: 0; padding: calc(13px + env(safe-area-inset-top)) 13px 13px; }
    .ifm-ai__identity strong { font-size: 17px; }
    .ifm-ai__message { grid-template-columns: 30px minmax(0, 1fr); gap: 9px; }
    .ifm-ai__message.is-user { grid-template-columns: minmax(0, 1fr) 30px; }
    .ifm-ai__message > span { width: 30px; height: 30px; border-radius: 10px; }
    .ifm-ai__message > div { padding: 13px 14px; }
    .ifm-ai__message.is-user > div { max-width: min(100%, 40ch); }
    .ifm-ai__suggestions { padding-left: 0; }
    .ifm-ai__scope small { font-size: 10.5px; padding-inline: 9px; }
    .ifm-ai__form { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
    .ifm-ai__form textarea { font-size: 16px; }
    .ifm-ai__answer h3 { font-size: 18px; }
}

/* Small phones — reclaim gutter so the composer hint still fits on one line. */
@media (max-width: 400px) {
    .ifm-ai { --ai-pad: 12px; }
    .ifm-ai__composer { grid-template-columns: 39px minmax(0, 1fr) 39px; gap: 6px; padding: 5px; }
    .ifm-ai__mic, .ifm-ai__send { width: 39px; height: 39px; }
    .ifm-ai__form textarea { padding-inline: 2px; }
    .ifm-ai__form textarea::placeholder { letter-spacing: -.02em; }
    .ifm-ai__scope { gap: 7px; padding-inline: var(--ai-pad); }
    .ifm-ai__header { padding-inline: 11px; }
}

@media (prefers-reduced-motion: reduce) {
    .ifm-ai__launcher:hover, .ifm-ai__send:hover, .ifm-ai__suggestions button:hover { transform: none; }
    .ifm-ai__panel { transition: none; }
    .ifm-ai__panel:not([hidden]), .ifm-ai__thinking-dots i, .ifm-ai__form .ifm-ai__mic.is-recording, .ifm-ai__recording > i { animation: none; }
}
