/* Brand variables are inlined by the UI shell to avoid an extra blocking CSS fetch. */
/* Self-hosted IBM Plex faces keep the existing look without a blocking Google Fonts hop. */

/* cyrillic-ext */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F63fjptAgt5VM-kVkqdyU8n1iIq129k.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F63fjptAgt5VM-kVkqdyU8n1isq129k.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* vietnamese */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F63fjptAgt5VM-kVkqdyU8n1iAq129k.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F63fjptAgt5VM-kVkqdyU8n1iEq129k.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F63fjptAgt5VM-kVkqdyU8n1i8q1w.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cyrillic-ext */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3twJwl1FgtIU.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3twJwlRFgtIU.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* vietnamese */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3twJwl9FgtIU.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3twJwl5FgtIU.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3twJwlBFgg.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cyrillic-ext */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3vAOwl1FgtIU.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3vAOwlRFgtIU.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* vietnamese */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3vAOwl9FgtIU.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3vAOwl5FgtIU.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3vAOwlBFgg.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cyrillic-ext */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3pQPwl1FgtIU.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3pQPwlRFgtIU.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* vietnamese */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3pQPwl9FgtIU.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3pQPwl5FgtIU.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexmono/v20/-F6qfjptAgt5VM-kVkqdyU8n3pQPwlBFgg.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cyrillic-ext */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxTKYbABA.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxaKYbABA.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* greek */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxdKYbABA.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* vietnamese */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxRKYbABA.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxQKYbABA.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxeKYY.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cyrillic-ext */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxTKYbABA.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxaKYbABA.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* greek */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxdKYbABA.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* vietnamese */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxRKYbABA.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxQKYbABA.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxeKYY.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cyrillic-ext */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxTKYbABA.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxaKYbABA.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* greek */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxdKYbABA.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* vietnamese */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxRKYbABA.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxQKYbABA.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxeKYY.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cyrillic-ext */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxTKYbABA.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxaKYbABA.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* greek */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxdKYbABA.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* vietnamese */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxRKYbABA.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxQKYbABA.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('/ui/assets/fonts/ibmplexsans/v23/zYXzKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1syxeKYY.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Default: Dark theme (aligned with landing page) ── */
:root {
  color-scheme: dark;
  --bg: #000;
  --panel: rgba(10, 10, 10, 0.65);
  --ink: rgba(255, 255, 255, 0.9);
  --text: rgba(255, 255, 255, 0.9);
  --muted: #a1a1aa;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.12);
  --accent: var(--brand-primary);
  --accent-2: #3b82f6;
  --danger: #ef4444;
  --stop-grad-1: #9f3d3d;
  --stop-grad-2: #c35858;
  --stop-border: #bb6464;
  --stop-text: #fff5f5;
  --shadow: none;
  --bg-grad-a: #000;
  --bg-grad-b: #000;
  --bg-grad-c: #000;
  --orb-a-color: rgba(var(--brand-primary-rgb), 0.25);
  --orb-b-color: #4c0519;
  --panel-elevated: rgba(17, 17, 17, 0.65);
  --panel-soft: rgba(23, 23, 23, 0.5);
  --panel-muted: rgba(5, 5, 5, 0.5);
  --surface: #0a0a0a;
  --input-bg: rgba(10, 10, 10, 0.5);
  --reasoning-bg: #050505;
  --reasoning-line: rgba(var(--brand-primary-rgb), 0.3);
  --thinking-base: #1E1A2E;
  --thinking-shimmer: #2A2440;
  --thinking-accent: #9580FF;
  --thinking-complete: #4ade80;
  --thinking-pending: #555;
  --thinking-summary-bg: #1E1A2E;
  --thinking-scroll-shadow: rgba(0, 0, 0, 0.25);
  --bubble-user-bg: rgba(var(--brand-primary-rgb), 0.18);
  --bubble-user-line: rgba(var(--brand-primary-rgb), 0.35);
  --button-bg: #111111;
  --ink-soft: rgba(255, 255, 255, 0.6);
  --menu-bg: rgba(17, 17, 17, 0.65);
  --menu-shadow: 0 14px 28px rgba(0, 0, 0, 0.68);
  --button-hover-shadow: 0 0 15px rgba(var(--brand-primary-rgb), 0.25);
  --accent-border: var(--brand-primary);
  --accent-grad-1: var(--brand-primary);
  --accent-grad-2: var(--brand-primary);
  --accent-text: #fff;
  --badge-bg: #111111;
  --code-bg: #050505;
  --code-fg: #e4e4e7;
  --code-comment: #8f96a3;
  --code-keyword: #f59e0b;
  --code-string: #67e8f9;
  --code-number: #fda4af;
  --code-title: #93c5fd;
  --code-built-in: #86efac;
  --code-meta: #c4b5fd;
  --canvas-code-bg: #050505;
  --canvas-code-fg: #d6dfea;
  --canvas-code-border: rgba(255, 255, 255, 0.1);
  --tool-error-line: #7d3c3c;
  --tool-error-bg: #341e1e;
  --warn-border: #8f7b42;
  --warn-bg: #302815;
  --warn-fg: #c8b27e;
  --scrim: rgba(0, 0, 0, 0.68);
  --chat-log-pad-top: 16px;
  --chat-log-pad-bottom: 24px;
  --chat-header-h: 0px;
  --composer-h: 0px;
  --font-sans: 'IBM Plex Sans', 'Avenir Next', 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --font-display: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
}

/* ── Light theme (opt-in) — neutral cool gray ── */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f8;
  --panel: #ffffff;
  --ink: #1a1a1a;
  --text: #1a1a1a;
  --muted: #71717a;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --accent: var(--brand-primary);
  --accent-2: #c2410c;
  --danger: #dc2626;
  --stop-grad-1: #9e3434;
  --stop-grad-2: #c24a4a;
  --stop-border: #7f2a2a;
  --stop-text: #fff5f5;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
  --bg-grad-a: #f7f7f8;
  --bg-grad-b: #f4f4f5;
  --bg-grad-c: #fafafa;
  --orb-a-color: rgba(var(--brand-primary-rgb), 0.12);
  --orb-b-color: rgba(var(--brand-primary-rgb), 0.06);
  --panel-elevated: #ffffff;
  --panel-soft: rgba(0, 0, 0, 0.02);
  --panel-muted: #f4f4f5;
  --surface: #ffffff;
  --input-bg: #fafafa;
  --reasoning-bg: #f4f4f5;
  --reasoning-line: rgba(var(--brand-primary-rgb), 0.2);
  --thinking-base: #F0EEFF;
  --thinking-shimmer: #E0DBFF;
  --thinking-accent: #7C6BFF;
  --thinking-complete: #22c55e;
  --thinking-pending: #d4d4d8;
  --thinking-summary-bg: #F5F3FF;
  --thinking-scroll-shadow: rgba(0, 0, 0, 0.06);
  --bubble-user-bg: rgba(var(--brand-primary-rgb), 0.06);
  --bubble-user-line: rgba(var(--brand-primary-rgb), 0.2);
  --button-bg: #fafafa;
  --ink-soft: #71717a;
  --menu-bg: rgba(255, 255, 255, 0.82);
  --menu-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  --button-hover-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  --accent-border: var(--brand-primary);
  --accent-grad-1: var(--brand-primary);
  --accent-grad-2: var(--brand-primary);
  --accent-text: #fff;
  --badge-bg: #f4f4f5;
  --code-bg: #f4f4f5;
  --code-fg: #1a1a1a;
  --code-comment: #a1a1aa;
  --code-keyword: #c2410c;
  --code-string: #0d9488;
  --code-number: #b45309;
  --code-title: #2563eb;
  --code-built-in: #16a34a;
  --code-meta: #9333ea;
  --canvas-code-bg: #18181b;
  --canvas-code-fg: #e4e4e7;
  --canvas-code-border: #3f3f46;
  --tool-error-line: #e4a0a0;
  --tool-error-bg: #fef2f2;
  --warn-border: #a16207;
  --warn-bg: #fefce8;
  --warn-fg: #a16207;
  --scrim: rgba(0, 0, 0, 0.3);
}

/* Dark is now the default — apply dark overrides at root level */
body,
.app-shell {
  background: #000 !important;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.025;
}

/* Subtle grid overlay matching landing page aesthetic */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(var(--brand-primary-rgb), 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--brand-primary-rgb), 0.025) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 10%, transparent 70%);
}

.bg-orb {
  display: none;
}

/* Light theme: restore original body styling */
html[data-theme="light"] body,
html[data-theme="light"] .app-shell {
  background: radial-gradient(circle at 15% 20%, var(--bg-grad-a) 0%, var(--bg-grad-b) 45%, var(--bg-grad-c) 100%) !important;
}

html[data-theme="light"] body::before {
  display: none;
}

html[data-theme="light"] body::after {
  display: none;
}

html[data-theme="light"] .bg-orb {
  display: block;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

*:hover {
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
}

*:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
}

html[data-theme="light"] *:hover {
  scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
}

html[data-theme="light"] *:hover::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.25);
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'IBM Plex Sans', 'Avenir Next', 'Segoe UI', sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% 20%, var(--bg-grad-a) 0%, var(--bg-grad-b) 45%, var(--bg-grad-c) 100%);
  overflow: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(20px);
  opacity: 0.35;
  pointer-events: none;
}

.orb-a {
  width: 380px;
  height: 380px;
  background: var(--orb-a-color);
  top: -110px;
  right: -110px;
}

.orb-b {
  width: 340px;
  height: 340px;
  background: var(--orb-b-color);
  bottom: -120px;
  left: -110px;
}

.app-shell {
  position: relative;
  z-index: 2;
  display: flex;
  padding: 16px;
  min-height: 100vh;
  min-height: 100dvh;
  --push-drawer-width: clamp(168px, 32vw, 330px);
}

.app-shell.drawer-mode-push {
  display: grid;
  grid-template-columns: minmax(0, var(--push-drawer-width)) minmax(0, 1fr);
  gap: 12px;
  transition: grid-template-columns 190ms ease;
}

.app-shell.drawer-mode-push.drawer-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.app-shell.drawer-mode-push .sessions-drawer {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  top: auto;
  bottom: auto;
  left: auto;
  right: auto;
  width: auto;
  min-width: 0;
  transform: translateX(0);
  border-radius: 8px;
  border: 1px solid var(--line);
  z-index: 3;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  opacity: 1;
  transition: transform 190ms ease, opacity 150ms ease;
}

.app-shell.drawer-mode-push.drawer-collapsed .sessions-drawer {
  transform: translateX(-14px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-shell.drawer-mode-push .panel.chat {
  grid-column: 2;
  grid-row: 1;
  min-height: calc(100vh - 32px);
  min-height: calc(100dvh - 32px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.panel.chat {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: calc(100vh - 32px);
  min-height: calc(100dvh - 32px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.chat-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(10, 10, 10, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

html[data-theme="light"] .chat-header {
  background: rgba(247, 247, 248, 0.75);
}

.chat-header.header-menu-open {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.chat-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-family: 'IBM Plex Mono', var(--font-mono);
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.chat-title > * {
  max-width: 100%;
}

.chat-title-btn {
  display: block;
  max-width: 100%;
  margin: 0 auto;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  padding: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.chat-title-btn:hover {
  color: var(--accent);
}

.chat-title-input {
  width: min(560px, 100%);
  max-width: 100%;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 94%, white);
  color: var(--text);
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  padding: 6px 12px;
  text-align: center;
}

.chat-header-actions {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
}

.icon-btn .btn-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.header-icon-btn {
  border-radius: 999px;
}

.chat-header .header-icon-btn .btn-icon {
  width: 22px;
  height: 22px;
}

.header-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 340px;
  max-width: min(94vw, 460px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--menu-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--menu-shadow);
  padding: 10px;
  z-index: 70;
  overflow: hidden;
  display: grid;
  gap: 10px;
}

/* chat-header dark bg now in default .chat-header rule */

/* composer dark bg now in default .composer rule */

/* composer-task-plan dark bg now in default .composer-task-plan rule */

.header-menu[hidden] {
  display: none;
}

.header-menu-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  font-family: 'IBM Plex Mono', var(--font-mono);
}

.header-menu-section {
  display: grid;
  gap: 8px;
}

.toolbar-row.header-menu-toolbar-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.toolbar-row.header-menu-toolbar-row>label {
  font-size: 12px;
  color: var(--muted);
}

.toolbar-row.header-menu-model-row {
  grid-template-columns: 88px minmax(0, 1fr) auto;
}

.header-menu #modelSelect,
.header-menu #reasoningEffortSelect,
.header-menu #reasoningSummarySelect {
  width: 100%;
  min-width: 0;
}

.header-menu-model-row .model-capability-badge {
  justify-self: start;
}

.switch.header-menu-switch-row {
  width: 100%;
  justify-content: space-between;
  min-height: 34px;
  gap: 10px;
}

.switch.header-menu-switch-row span {
  font-size: 12px;
  color: var(--muted);
}

.switch.header-menu-switch-row input[type='checkbox'] {
  margin: 0;
}

.header-menu-tools-section {
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

.tools-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 4px 2px;
  cursor: pointer;
}

.tools-section-header:hover {
  color: var(--ink);
}

.tools-section-chevron {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  transition: transform 150ms ease;
}

.tools-section-header[aria-expanded='false'] .tools-section-chevron {
  transform: rotate(-90deg);
}

.tools-checklist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
  padding: 2px 0;
}

.tools-checklist[hidden] {
  display: none;
}

.tools-checklist-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
}

.tools-checklist-item:hover {
  background: var(--panel-soft);
}

.tools-checklist-item input[type='checkbox'] {
  margin: 0;
  flex: 0 0 auto;
}

.tools-checklist-item .tools-item-name {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tools-checklist-item-disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.68;
}

.tools-checklist-item-disabled:hover {
  background: transparent;
}

.tools-item-reason {
  flex: 0 0 auto;
  max-width: 45%;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tools-checklist-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tools-checklist-group-item {
  font-weight: 600;
}

.tools-group-name {
  letter-spacing: 0.01em;
}

.tools-checklist-group-children {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 14px;
  padding-left: 6px;
  border-left: 1px solid var(--line);
}

.tools-checklist-child-item {
  padding-left: 2px;
}

.tools-checklist-empty {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 4px;
  font-style: italic;
}

.header-menu-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 8px 9px;
  font-size: 13px;
  cursor: pointer;
}

.header-menu-item:hover {
  background: var(--panel-soft);
}

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  border: 0;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.drawer-scrim[hidden] {
  display: none;
}

.drawer-scrim.visible {
  opacity: 1;
  pointer-events: auto;
}

body.overlay-open {
  overflow: hidden;
}

body.automation-modal-open {
  overflow: hidden;
}

body.settings-modal-open {
  overflow: hidden;
}

.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 60;
  border-radius: 0;
  transition: transform 170ms ease;
}

.sessions-drawer {
  left: 0;
  width: min(340px, 92vw);
  transform: translateX(-100%);
  border-left: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.sessions-drawer.open {
  transform: translateX(0);
}

/* ── Settings Modal ──────────────────────────────────────────────── */
.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 200ms ease, visibility 200ms ease;
}

.settings-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.settings-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: var(--scrim);
  cursor: pointer;
}

.settings-modal-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  width: min(860px, 100%);
  height: min(80vh, 720px);
  max-height: min(80vh, 720px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  animation: settingsModalSlideIn 220ms ease;
}

html[data-theme="dark"] .settings-modal-card {
  background: rgba(10, 10, 10, 0.82);
}

@keyframes settingsModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }

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

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 20px 12px;
  border-right: 1px solid var(--line);
  background: var(--panel-muted);
  overflow-y: auto;
}

.settings-nav-title {
  margin: 0 0 16px 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-family: var(--font-display);
  color: var(--ink);
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-display);
  text-align: left;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 120ms ease;
}

.settings-nav-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.settings-nav-item:hover {
  background: color-mix(in srgb, var(--panel-soft) 80%, transparent);
  color: var(--ink);
}

.settings-nav-item.is-active {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.settings-nav-item.is-active .settings-nav-icon {
  stroke: var(--accent);
}

.settings-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.settings-body-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.settings-body-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.03em;
  font-family: 'IBM Plex Mono', var(--font-mono);
}

.settings-close-btn {
  border-radius: 6px;
  width: 44px;
  min-width: 44px;
  height: 44px;
}

.settings-close-btn .btn-icon {
  width: 20px;
  height: 20px;
}

.settings-body-content {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}

.sessions-drawer .panel-head {
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 10px;
}

.sessions-actions {
  padding: 0 14px 8px;
}

.sessions-actions .btn {
  width: 100%;
}

.drawer-nav-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.drawer-footer-actions {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding: 8px 14px 10px;
}

.drawer-nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.01em;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.drawer-nav-item-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.drawer-nav-item:hover {
  background: color-mix(in srgb, var(--panel-soft) 72%, transparent);
}

.drawer-nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.drawer-nav-item.is-active {
  color: var(--accent);
  background: color-mix(in srgb, var(--panel-soft) 90%, transparent);
}

.drawer-section-label {
  margin: 0;
  padding: 4px 14px 8px 24px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: 'IBM Plex Mono', var(--font-mono);
}

.drawer-collections-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 14px 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-soft) 88%, transparent);
  width: max-content;
  max-width: calc(100% - 28px);
}

.drawer-collections-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.drawer-collections-tab:hover {
  color: var(--ink);
}

.drawer-collections-tab.is-active {
  background: var(--panel-elevated);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.drawer-pane {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 8px;
}

.panel-head h1,
.panel-head h2 {
  margin: 0;
  letter-spacing: 0.04em;
  font-family: 'IBM Plex Mono', var(--font-mono);
}

.panel-head h1 {
  font-size: 20px;
}

.panel-head h2 {
  font-size: 18px;
}

.panel-head-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-head-brand h2 {
  font-family: 'IBM Plex Mono', var(--font-mono);
  letter-spacing: 0.04em;
  font-weight: 500;
}

.panel-head-logo {
  border-radius: 7px;
  flex-shrink: 0;
}

.drawer-close-btn {
  width: 44px;
  min-width: 44px;
  height: 44px;
}

.muted {
  margin: 0;
  padding: 0 16px 10px;
  color: var(--muted);
  font-size: 13px;
}

.sessions-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  padding: 4px 10px 12px;
  overflow: auto;
  overscroll-behavior-y: contain;
  min-height: 0;
}

.sessions-pull-hint {
  margin: 0 14px;
  height: 0;
  overflow: hidden;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  transition: height 140ms ease, opacity 140ms ease, color 140ms ease;
}

.sessions-pull-hint.is-visible {
  opacity: 0.82;
}

.sessions-pull-hint.is-ready,
.sessions-pull-hint.is-refreshing {
  color: var(--accent);
  opacity: 1;
}

#sessionsList {
  scrollbar-width: none;
  -ms-overflow-style: none;
  transition: transform 120ms ease;
}

#sessionsList::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.session-list-hint {
  margin: 2px 4px 0;
  padding: 9px 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.session-list-hint.loading {
  color: var(--accent);
  border-style: solid;
}

.session-list-hint.end {
  opacity: 0.78;
}

.drawer-boards-empty-state,
.drawer-explore-empty-state {
  margin: 8px 6px 0;
  padding: 18px 14px 16px;
  border: 1px solid color-mix(in srgb, var(--line) 90%, transparent);
  border-radius: 16px;
  background:
    radial-gradient(circle at top, color-mix(in srgb, var(--panel-soft) 82%, transparent), transparent 68%),
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 94%, transparent), color-mix(in srgb, var(--panel-soft) 72%, transparent));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  color: var(--muted);
}

.drawer-boards-empty-figure,
.drawer-explore-empty-figure {
  width: min(188px, 100%);
  display: flex;
  justify-content: center;
  opacity: 0.9;
}

.drawer-boards-empty-svg,
.drawer-explore-empty-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.drawer-boards-empty-card {
  stroke-width: 1.5;
}

.drawer-explore-empty-bubble {
  stroke-width: 1.5;
}

.drawer-boards-empty-card-back {
  fill: color-mix(in srgb, var(--panel-soft) 72%, transparent);
  stroke: color-mix(in srgb, var(--line) 86%, transparent);
}

.drawer-boards-empty-card-mid {
  fill: color-mix(in srgb, var(--panel-elevated) 68%, transparent);
  stroke: color-mix(in srgb, var(--line) 90%, transparent);
}

.drawer-boards-empty-card-front {
  fill: color-mix(in srgb, var(--panel-elevated) 92%, transparent);
  stroke: color-mix(in srgb, var(--line) 94%, transparent);
}

.drawer-explore-empty-bubble-back {
  fill: color-mix(in srgb, var(--panel-soft) 70%, transparent);
  stroke: color-mix(in srgb, var(--line) 84%, transparent);
}

.drawer-explore-empty-bubble-front {
  fill: color-mix(in srgb, var(--panel-elevated) 92%, transparent);
  stroke: color-mix(in srgb, var(--line) 94%, transparent);
}

.drawer-boards-empty-card-accent,
.drawer-explore-empty-accent {
  fill: color-mix(in srgb, var(--accent) 14%, transparent);
  stroke: color-mix(in srgb, var(--accent) 30%, transparent);
  stroke-width: 1.2;
}

.drawer-boards-empty-line,
.drawer-explore-empty-line {
  fill: color-mix(in srgb, var(--muted) 18%, transparent);
}

.drawer-boards-empty-line-short,
.drawer-explore-empty-line-short {
  fill: color-mix(in srgb, var(--muted) 14%, transparent);
}

.drawer-boards-empty-pin {
  stroke: color-mix(in srgb, var(--accent) 48%, var(--muted));
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.82;
}

.drawer-explore-empty-glow {
  fill: color-mix(in srgb, var(--accent) 8%, transparent);
}

.drawer-explore-empty-needle {
  fill: color-mix(in srgb, var(--accent) 14%, transparent);
  stroke: color-mix(in srgb, var(--accent) 46%, var(--muted));
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.drawer-boards-empty-orbit {
  fill: color-mix(in srgb, var(--accent) 18%, transparent);
  stroke: color-mix(in srgb, var(--accent) 36%, transparent);
  stroke-width: 1.2;
}

.drawer-boards-empty-orbit-small {
  opacity: 0.72;
}

.drawer-explore-empty-star {
  fill: color-mix(in srgb, var(--accent) 20%, transparent);
  stroke: color-mix(in srgb, var(--accent) 42%, transparent);
  stroke-width: 1.2;
}

.drawer-explore-empty-star-small {
  opacity: 0.72;
}

.drawer-boards-empty-copy,
.drawer-explore-empty-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 210px;
}

.drawer-boards-empty-title,
.drawer-explore-empty-title {
  color: color-mix(in srgb, var(--ink) 82%, var(--muted));
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.drawer-boards-empty-text,
.drawer-explore-empty-text {
  font-size: 12px;
  line-height: 1.5;
  color: color-mix(in srgb, var(--muted) 92%, transparent);
}

.drawer-boards-empty-chip,
.drawer-explore-empty-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  background: color-mix(in srgb, var(--panel-soft) 88%, transparent);
  color: color-mix(in srgb, var(--muted) 96%, var(--ink));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: 'IBM Plex Mono', var(--font-mono);
}

.session-item {
  border: 1px solid var(--line);
  background: linear-gradient(168deg, color-mix(in srgb, var(--panel-elevated) 88%, var(--surface) 12%), var(--panel-elevated));
  border-radius: 6px;
  padding: 8px;
  transition: transform 120ms ease, border-color 120ms ease;
}

.session-item:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.session-item.deleting {
  opacity: 0.72;
}

.session-item.has-menu-open {
  z-index: 80;
  position: relative;
}

.session-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.session-main {
  flex: 1 1 auto;
  min-width: 0;
}

.session-select-btn {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 2px;
  border-radius: 8px;
  cursor: pointer;
}

.session-select-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.session-actions {
  position: relative;
  flex: 0 0 auto;
}

.session-more-btn {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--button-bg);
  color: var(--muted);
  padding: 0;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.session-item:hover .session-more-btn,
.session-item.has-menu-open .session-more-btn {
  opacity: 1;
  pointer-events: auto;
}

.session-more-btn:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.session-more-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.session-item-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--menu-bg);
  box-shadow: var(--menu-shadow);
  padding: 6px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-item-menu-btn {
  border: 1px solid transparent;
  background: var(--menu-bg);
  color: var(--ink);
  text-align: left;
  padding: 7px 8px;
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
}

.session-item-menu-btn:hover {
  background: var(--panel-soft);
}

.session-item-menu-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.session-item-menu-btn.danger {
  color: var(--danger);
}

.session-item-menu-btn.danger:hover {
  background: var(--tool-error-bg);
}

.session-rename-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1.3;
  background: var(--input-bg);
  color: var(--ink);
}

.session-item.active {
  border-color: var(--accent);
  background: var(--panel-soft);
}

.session-title {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.01em;
  line-height: 1.35;
  word-break: break-word;
}

.session-title.running {
  color: var(--accent);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .session-title.running {
    background-image: linear-gradient(100deg,
        var(--ink) 0%,
        var(--ink) 34%,
        var(--accent) 50%,
        var(--ink) 66%,
        var(--ink) 100%);
    background-size: 220% 100%;
    background-position: 180% 0;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: sessionTitleShimmer 1.6s linear infinite;
  }
}

.session-automation-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: var(--accent-text, #fff);
  background: var(--accent-grad-1, linear-gradient(135deg, #6366f1, #8b5cf6));
  border-radius: 6px;
  vertical-align: middle;
  white-space: nowrap;
  pointer-events: none;
}

.workspace-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.workspace-chat-pane {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.workspace-canvas-pane {
  flex: 1 1 auto;
  min-width: 320px;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-soft) 52%, var(--panel)), var(--panel));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: var(--chat-header-h);
}

.workspace-canvas-pane.is-embedded-board-preview,
.workspace-canvas-pane.is-pinned-board-mode {
  background: transparent;
}

.workspace-splitter {
  position: relative;
  flex: 0 0 10px;
  width: 10px;
  cursor: col-resize;
  background: color-mix(in srgb, var(--line) 35%, transparent);
  touch-action: none;
}

.workspace-splitter::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 42px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 38%, var(--line-strong));
}

.workspace-splitter:hover::after {
  background: color-mix(in srgb, var(--accent) 68%, var(--line-strong));
}

body.workspace-resizing,
body.workspace-resizing * {
  cursor: col-resize !important;
  user-select: none;
}

.dashboard-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dashboard-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.dashboard-panel-heading-wrap {
  min-width: 0;
  flex: 1 1 auto;
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
}

.dashboard-panel-heading {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dashboard-panel-heading .muted {
  padding: 0;
  font-size: 12px;
  word-break: break-word;
}

.dashboard-title {
  margin: 0;
  font-size: 16px;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
}

.dashboard-title-shell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dashboard-title-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
}

.dashboard-title-btn:hover {
  color: var(--accent);
}

.dashboard-title-input {
  width: min(560px, 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 94%, white);
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
}

.dashboard-panel.is-embedded-board-preview .dashboard-panel-head {
  align-items: center;
}

.dashboard-panel.is-embedded-board-preview .dashboard-panel-heading {
  gap: 0;
}

.dashboard-panel.is-embedded-board-preview .dashboard-title {
  display: flex;
  align-items: center;
  min-width: 0;
}

.dashboard-panel.is-pinned-board-mode .dashboard-panel-head {
  display: none;
}

.dashboard-panel.is-pinned-board-mode .dashboard-panel-heading-wrap {
  justify-content: flex-end;
}

.dashboard-panel.is-pinned-board-mode .dashboard-panel-heading {
  width: 100%;
  align-items: flex-end;
}

.dashboard-panel.is-pinned-board-mode .dashboard-title {
  width: 100%;
  display: flex;
  justify-content: flex-end;
}

.dashboard-head-icon-btn {
  border-radius: 6px;
}

.dashboard-panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  justify-content: flex-end;
}

.dashboard-view-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel-soft) 78%, var(--panel));
}

.dashboard-view-btn {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
}

.dashboard-view-btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.dashboard-view-btn.is-active {
  color: var(--accent-text);
  border-color: var(--accent-border);
  background: var(--accent-grad-1);
}

#mobileCanvasCloseBtn {
  background: color-mix(in srgb, var(--panel-soft) 70%, var(--warn-bg));
}

.dashboard-artifacts-view {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-elevated);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.dashboard-artifacts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-artifacts-filters {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.artifact-filter-btn {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
}

.artifact-filter-btn.is-active {
  color: var(--accent-text);
  border-color: var(--accent-border);
  background: var(--accent-grad-1);
}

.dashboard-artifacts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.artifact-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  padding: 9px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.artifact-row-main {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.artifact-row-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}

.artifact-row-meta {
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

.artifact-row-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.artifact-row-actions .btn {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.artifact-row-actions a.btn,
.artifact-row-actions a.btn:hover,
.artifact-row-actions a.btn:focus-visible {
  text-decoration: none;
}

/* View toggle (List / Gallery) */
.artifacts-view-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel-soft) 78%, var(--panel));
}

.artifacts-view-btn {
  min-height: 30px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.artifacts-view-btn svg {
  width: 16px;
  height: 16px;
}

.artifacts-view-btn.is-active {
  color: var(--accent-text);
  border-color: var(--accent-border);
  background: var(--accent-grad-1);
}

/* Gallery grid layout */
.dashboard-artifacts-list.is-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  align-content: start;
}

.artifacts-scroll-sentinel {
  padding: 12px 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.dashboard-artifacts-list.is-gallery .artifacts-scroll-sentinel {
  grid-column: 1 / -1;
}

/* Gallery card */
.artifact-gallery-card {
  position: relative;
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.artifact-gallery-card:hover {
  border-color: var(--accent-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.artifact-gallery-thumb {
  width: 100%;
  aspect-ratio: 8 / 5;
  background: var(--panel-soft);
  overflow: hidden;
  position: relative;
}

/* padding-bottom fallback for browsers without aspect-ratio */
@supports not (aspect-ratio: 8 / 5) {
  .artifact-gallery-thumb {
    aspect-ratio: auto;
    height: 0;
    padding-bottom: 62.5%;
  }
}

.artifact-gallery-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Fallback when thumbnail fails */
.artifact-gallery-thumb.is-fallback {
  background: linear-gradient(135deg, var(--panel-soft) 0%, var(--panel) 100%);
}

.artifact-gallery-thumb.is-fallback::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  opacity: 0.2;
  background: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cpath d='M3 9h18'/%3E%3Cpath d='M9 21V9'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cpath d='M3 9h18'/%3E%3Cpath d='M9 21V9'/%3E%3C/svg%3E");
  mask-size: contain;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
}

/* Bottom gradient overlay with text */
.artifact-gallery-overlay {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.5) 50%, transparent);
  padding: 48px 10px 10px;
}

.artifact-gallery-title {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-gallery-meta {
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

/* Hover overlay with action button */
.artifact-gallery-hover {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.artifact-gallery-card:hover .artifact-gallery-hover {
  opacity: 1;
}

.artifact-gallery-hover-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.92);
  color: #1f2937;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.artifact-gallery-hover-btn svg {
  width: 14px;
  height: 14px;
}

.artifact-gallery-pin-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(10, 15, 26, 0.55);
  color: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, color 120ms ease, opacity 120ms ease;
}

.artifact-gallery-pin-btn .btn-icon {
  width: 15px;
  height: 15px;
  fill: currentColor;
  stroke: none;
}

.artifact-gallery-pin-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(10, 15, 26, 0.72);
}

.artifact-gallery-pin-btn.is-active {
  background: rgba(var(--brand-primary-rgb), 0.92);
  border-color: rgba(var(--brand-primary-rgb), 0.96);
  color: #fff;
}

.artifact-gallery-pin-btn:disabled {
  opacity: 0.56;
  cursor: default;
  transform: none;
}

/* Image gallery card (generate_image outputs) */
.artifact-image-card .artifact-gallery-thumb {
  background: #0d0d0d;
}

.artifact-image-card .artifact-gallery-thumb img {
  object-fit: contain;
}

body.artifact-image-lightbox-open {
  overflow: hidden;
}

.artifact-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 7000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.artifact-image-lightbox-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(8, 12, 20, 0.72);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  cursor: pointer;
}

.artifact-image-lightbox-dialog {
  position: relative;
  width: min(1120px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(18, 24, 34, 0.84);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
}

.artifact-image-lightbox-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.artifact-image-lightbox-title-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.artifact-image-lightbox-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-image-lightbox-meta {
  font-size: 12px;
  color: var(--muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.artifact-image-lightbox-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.artifact-image-lightbox-media {
  min-height: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(6, 10, 16, 0.58);
  overflow: auto;
  padding: 10px;
}

.artifact-image-lightbox-media img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 190px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
}

@media (max-width: 720px) {
  .artifact-image-lightbox {
    padding: 12px;
  }

  .artifact-image-lightbox-dialog {
    width: min(100vw - 16px, 100%);
    max-height: calc(100vh - 16px);
    padding: 12px;
    border-radius: 18px;
  }

  .artifact-image-lightbox-header {
    flex-direction: column;
  }

  .artifact-image-lightbox-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .artifact-image-lightbox-media img {
    max-height: calc(100vh - 240px);
  }
}

.dashboard-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-elevated);
  padding: 18px 16px;
}

.dashboard-empty h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.dashboard-empty p {
  margin: 0;
}

.dashboard-timeline {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-elevated);
  padding: 10px;
  max-height: 24vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dashboard-timeline-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel-soft);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dashboard-timeline-item.is-info {
  border-left-color: var(--accent-border);
}

.dashboard-timeline-item.is-success {
  border-left-color: var(--accent);
}

.dashboard-timeline-item.is-error {
  border-left-color: var(--danger);
}

.dashboard-timeline-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.dashboard-timeline-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--badge-bg);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  line-height: 1.4;
}

.dashboard-timeline-title {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.dashboard-timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dashboard-timeline-meta-pill {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-elevated);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  padding: 2px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-timeline-body {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.dashboard-timeline-item.is-success .dashboard-timeline-badge {
  border-color: var(--accent-border);
  color: var(--accent);
}

.dashboard-timeline-item.is-error .dashboard-timeline-badge {
  border-color: var(--tool-error-line);
  background: var(--tool-error-bg);
  color: var(--danger);
}

.dashboard-preview {
  flex: 1 1 auto;
  width: 100%;
  min-height: 54vh;
  border: 1.5px solid transparent;
  border-radius: 8px;
  background: transparent;
  position: relative;
}

.dashboard-board-preview {
  overflow: auto;
  background: transparent;
}

.dashboard-panel.is-embedded-board-preview .dashboard-board-preview,
.dashboard-panel.is-pinned-board-mode .dashboard-board-preview {
  border-radius: 0;
}

.panel.chat.canvas-readonly-mode .dashboard-panel.is-embedded-board-preview.is-preview-mode,
.panel.chat.canvas-readonly-mode .dashboard-panel.is-pinned-board-mode.is-preview-mode {
  background: transparent;
}

.panel.chat.canvas-readonly-mode .dashboard-panel.is-embedded-board-preview.is-preview-mode .dashboard-board-preview,
.panel.chat.canvas-readonly-mode .dashboard-panel.is-pinned-board-mode.is-preview-mode .dashboard-board-preview {
  padding: 0;
}

.panel.chat.canvas-readonly-mode .dashboard-panel.is-embedded-board-preview.is-preview-mode .board-section:first-child,
.panel.chat.canvas-readonly-mode .dashboard-panel.is-pinned-board-mode.is-preview-mode .board-section:first-child {
  padding-top: 0;
}

.panel.chat.canvas-readonly-mode .dashboard-panel.is-embedded-board-preview.is-preview-mode .board-grid,
.panel.chat.canvas-readonly-mode .dashboard-panel.is-pinned-board-mode.is-preview-mode .board-grid {
  padding-top: 0;
}

body.board-standalone-mode .bg-orb,
body.board-standalone-mode .sessions-drawer,
body.board-standalone-mode .chat-header,
body.board-standalone-mode .workspace-chat-pane,
body.board-standalone-mode .workspace-splitter,
body.board-standalone-mode .composer,
body.board-standalone-mode .dashboard-panel-head,
body.board-standalone-mode .dashboard-artifacts-view,
body.board-standalone-mode .dashboard-editor-wrap,
body.board-standalone-mode .dashboard-timeline,
body.board-standalone-mode .dashboard-empty {
  display: none !important;
}

body.board-standalone-mode .app-shell {
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  /* Override grid layout to remove drawer column */
  display: flex;
}

body.board-standalone-mode .app-shell.drawer-mode-push {
  display: flex;
}

body.board-standalone-mode .app-shell.drawer-mode-push {
  grid-template-columns: 0 minmax(0, 1fr);
  gap: 0;
}

body.board-standalone-mode .panel.chat {
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.board-standalone-mode .workspace-body {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

body.board-standalone-mode .workspace-canvas-pane {
  min-width: 0;
  width: 100%;
  border-left: 0;
  padding-top: 0;
  background: transparent;
}

body.board-standalone-mode .dashboard-panel {
  padding: 0;
  background: transparent;
}

body.board-standalone-mode .dashboard-board-preview {
  min-height: 100vh;
  min-height: 100dvh;
  border: 0;
  border-radius: 0;
  background: transparent;
}

body.public-share-mode .bg-orb,
body.public-share-mode .sessions-drawer,
body.public-share-mode .chat-header,
body.public-share-mode .workspace-chat-pane,
body.public-share-mode .workspace-splitter,
body.public-share-mode .composer,
body.public-share-mode .pending-approval-bar,
body.public-share-mode .request-user-input-card,
body.public-share-mode .btn-jump-bottom,
body.public-share-mode .drawer-scrim,
body.public-share-mode .settings-modal,
body.public-share-mode .board-config-drawer,
body.public-share-mode .canvas-share-modal {
  display: none !important;
}

html.public-share-route body:not(.public-share-mode) .app-shell {
  visibility: hidden;
}

html.dashboard-direct-route body:not(.dashboard-route-ready) .app-shell {
  visibility: hidden;
}

.dashboard-route-loading-shell {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 4;
  padding: 24px;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

html.dashboard-direct-route body:not(.dashboard-route-ready) .dashboard-route-loading-shell {
  display: flex;
}

body.public-share-mode {
  overflow: auto;
}

body.public-share-mode .app-shell {
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
}

body.public-share-mode .app-shell.drawer-mode-push {
  display: flex;
  grid-template-columns: 0 minmax(0, 1fr);
  gap: 0;
}

body.public-share-mode .panel.chat {
  min-height: 100vh;
  min-height: 100dvh;
  max-height: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: visible;
}

body.public-share-mode .workspace-body {
  display: block;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

body.public-share-mode .workspace-canvas-pane {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  border-left: 0;
  padding-top: 0;
  background: transparent;
  overflow: visible;
}

body.public-share-mode .dashboard-panel {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  gap: 0;
  background: transparent;
  overflow: visible;
}

body.public-share-mode .dashboard-panel.is-canvas-selected.is-preview-mode {
  overflow: visible !important;
}

body.public-share-mode .dashboard-panel-head {
  position: sticky;
  top: 0;
  z-index: 6;
  margin: 0;
  padding: 18px 20px 14px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

body.public-share-mode .dashboard-artifacts-view,
body.public-share-mode .dashboard-editor-wrap,
body.public-share-mode .dashboard-timeline,
body.public-share-mode .dashboard-empty {
  display: none !important;
}

body.public-share-mode .dashboard-preview,
body.public-share-mode .dashboard-board-preview {
  flex: 1 1 auto;
  min-height: 0;
  min-height: calc(100vh - 88px);
  min-height: calc(100dvh - 88px);
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible !important;
}

body.public-share-mode .dashboard-board-preview {
  overflow: visible !important;
}

/* Flowing glow border while canvas is busy */
@property --glow-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.dashboard-panel.is-canvas-busy .dashboard-preview {
  border-color: transparent;
  background-clip: padding-box;
}

.dashboard-panel.is-canvas-busy .dashboard-preview::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 13px;
  padding: 2px;
  background: conic-gradient(from var(--glow-angle),
      var(--accent) 0%,
      rgba(var(--brand-primary-rgb), 0.15) 25%,
      var(--accent) 50%,
      rgba(var(--brand-primary-rgb), 0.15) 75%,
      var(--accent) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: canvasGlowSpin 2.5s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes canvasGlowSpin {
  to {
    --glow-angle: 360deg;
  }
}

/* Idle state: no border at all */
.dashboard-panel:not(.is-canvas-busy) .dashboard-preview {
  border-color: transparent;
}

.panel.chat.canvas-readonly-mode .dashboard-panel.is-canvas-selected.is-preview-mode {
  overflow: hidden;
}

.panel.chat.canvas-readonly-mode .dashboard-panel.is-canvas-selected.is-preview-mode .dashboard-preview {
  min-height: clamp(360px, 62vh, 760px);
}

.dashboard-editor-wrap {
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-elevated);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dashboard-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dashboard-editor-toolbar-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-editor-toolbar-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.dashboard-editor-toolbar-right .btn {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

#dashboardFileSelect {
  min-width: 160px;
}

.dashboard-editor {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  border: 1px solid var(--canvas-code-border);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  background: var(--canvas-code-bg);
  color: var(--canvas-code-fg);
}

.dashboard-editor-monaco {
  flex: 1 1 auto;
  min-height: 280px;
  padding: 0;
  resize: none;
  overflow: hidden;
}

.dashboard-editor-fallback {
  min-height: 340px;
  caret-color: var(--canvas-code-fg);
}

.dashboard-diff {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--canvas-code-border);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--canvas-code-bg);
  color: var(--canvas-code-fg);
  font-size: 12px;
  line-height: 1.45;
}

.drawer-pane-note {
  padding-top: 2px;
}

.preferences-pane {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 16px 14px 20px;
  min-height: 0;
  overflow-y: auto;
}

#skillsPane,
#instructionPane,
#mcpPane {
  overflow: hidden;
  /* Constrain pane to exactly the visible height of .settings-body-content
     so the inner list scrolls instead of pushing the settings panel down.
     100% resolves to the flex-calculated height of the parent. */
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#instructionPane .preferences-section {
  flex: 0 0 auto;
  min-height: 0;
}

#instructionPane .personalization-instruction-section {
  flex: 1 1 auto;
  min-height: 0;
}

.preferences-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preferences-section-title {
  margin: 0 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.preferences-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.preferences-card.instruction-card {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px;
  gap: 12px;
}

.instruction-textarea {
  width: 100%;
  flex: 1 1 auto;
  min-height: 220px;
  resize: none;
  border: 1px solid var(--line);
  background: var(--input-bg);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  font-family: inherit;
}

.instruction-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.instruction-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
}

@media (max-width: 760px) {
  #instructionPane {
    gap: 16px;
  }

  #instructionPane .preferences-section {
    gap: 6px;
  }
}

.preferences-card-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
}

.preferences-card-row.with-divider {
  border-bottom: 1px solid var(--line);
}

.preferences-card-row>label,
.preferences-card-row>.preferences-switch-label span {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.preferences-input-group {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.preferences-input-group input,
.preferences-input-group select {
  width: 100%;
  max-width: 220px;
  text-align: right;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 14px;
  font-family: inherit;
  box-shadow: none;
  transition: all 120ms ease;
}

.preferences-input-group input:focus,
.preferences-input-group select:focus,
.preferences-input-group input:hover,
.preferences-input-group select:hover {
  background: var(--panel-soft);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line);
  outline: none;
}

/* ---------- Appearance pill selector ---------- */

.appearance-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.appearance-pills button {
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 120ms ease;
  line-height: 1.4;
}

.appearance-pills button:hover {
  background: var(--panel-soft);
  color: var(--ink);
  border-color: var(--line-strong, var(--line));
}

.appearance-pills button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

html[data-theme="dark"] .appearance-pills button.active {
  color: #000;
}

.preferences-switch-label {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  cursor: pointer;
}

.preferences-switch-label input[type='checkbox'] {
  margin: 0;
}

.general-token-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.general-token-row label {
  font-size: 12px;
  color: var(--muted);
}

.general-token-row .btn {
  white-space: nowrap;
}

.switch.general-switch-row {
  width: 100%;
  justify-content: space-between;
  min-height: 34px;
  gap: 10px;
}

.switch.general-switch-row span {
  font-size: 12px;
  color: var(--muted);
}

.switch.general-switch-row input[type='checkbox'] {
  margin: 0;
}

.connector-settings-block {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.connector-settings-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.connector-settings-title {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-display);
}

.connector-settings-note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.connector-provider-card {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: color-mix(in srgb, var(--panel-soft) 64%, var(--panel));
}

.connector-provider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.connector-provider-status {
  font-size: 12px;
  color: var(--muted);
}

.connector-provider-status.is-configured {
  color: var(--ok);
}

.connector-provider-grid {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 6px 8px;
  align-items: center;
}

.connector-provider-grid label {
  font-size: 12px;
  color: var(--muted);
}

.connector-provider-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.connector-provider-actions .btn {
  min-height: 34px;
}

#instructionInput {
  width: 100%;
}

.skills-workspace {
  display: grid;
  grid-template-columns: minmax(180px, 36%) minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.skills-list-pane {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(175deg, color-mix(in srgb, var(--panel-soft) 64%, var(--panel)), var(--panel));
}

.skills-list-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.skills-list-title {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: var(--font-display);
  color: var(--muted);
}

.skills-list-head .btn {
  min-height: 34px;
  padding: 6px 10px;
}

#newSkillBtn {
  margin-left: auto;
  color: var(--accent);
  border-color: var(--accent-border);
}

.skills-list {
  padding: 8px;
  gap: 7px;
}

.skills-list .session-item {
  border-radius: 9px;
}

.skill-editor-pane {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(176deg, color-mix(in srgb, var(--panel-elevated) 90%, var(--surface) 10%), var(--panel-elevated));
  padding: 10px;
  overflow: hidden;
}

.skill-editor-pane.is-busy {
  opacity: 0.9;
}

.skill-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.skill-mode-badge {
  text-transform: uppercase;
}

.skill-editor-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.skill-switch-confirm {
  border: 1px solid var(--warn-border);
  border-radius: 6px;
  background: color-mix(in srgb, var(--warn-bg) 56%, var(--panel));
  padding: 8px;
  display: grid;
  gap: 7px;
}

.skill-switch-confirm-text {
  font-size: 12px;
  color: var(--warn-fg);
}

.skill-switch-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  flex: 1 1 auto;
}

.skill-form-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

#skillDescriptionInput {
  min-height: 86px;
  resize: vertical;
}

#skillMarkdownInput {
  flex: 1 1 auto;
  min-height: 220px;
  resize: vertical;
  font-family: var(--font-mono);
  line-height: 1.45;
}

.skill-delete-confirm {
  border: 1px solid var(--tool-error-line);
  border-radius: 6px;
  background: var(--tool-error-bg);
  padding: 8px;
  display: grid;
  gap: 7px;
}

.skill-delete-confirm-text {
  font-size: 12px;
  color: var(--danger);
}

.skill-delete-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.skill-form-actions .btn {
  min-height: 36px;
}

/* ── Skills Mode Switch ── */

.skills-mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel-soft) 78%, var(--panel));
}

.skills-mode-btn {
  min-height: 28px;
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.skills-mode-btn.is-active {
  color: var(--ink);
  border-color: var(--accent-border, var(--line-strong));
  background: var(--panel);
  font-weight: 600;
}

/* ── Marketplace Search ── */

.marketplace-search-wrap {
  padding: 8px 10px 0;
}

.marketplace-search-wrap input {
  width: 100%;
  min-height: 32px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 10px;
  background: var(--panel);
  color: var(--ink);
  box-sizing: border-box;
}

/* ── Marketplace List ── */

.marketplace-group-header {
  padding: 4px 4px 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-display);
  user-select: none;
}

.marketplace-group-header:not(:first-child) {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.marketplace-list .marketplace-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.marketplace-card-main {
  min-width: 0;
  flex: 1 1 auto;
  text-align: left;
}

.marketplace-card-title {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.01em;
  line-height: 1.35;
}

.marketplace-card-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.marketplace-card-indicator {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
  opacity: 0.5;
  transition: background 200ms ease, opacity 200ms ease;
}

.marketplace-card-indicator.is-on {
  background: var(--accent, #3b82f6);
  opacity: 1;
}

.marketplace-card.is-enabled {
  border-left: 2px solid var(--accent, #3b82f6);
}

.session-item.is-disabled-skill {
  opacity: 0.55;
}

/* ── Marketplace Detail Pane ── */

.marketplace-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.marketplace-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.marketplace-detail-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.marketplace-detail-author {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.marketplace-detail-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}

.marketplace-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.marketplace-detail-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-soft, var(--panel));
  color: var(--muted);
  font-size: 11px;
}

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

.marketplace-detail-actions .btn {
  min-height: 34px;
}

.marketplace-detail-preview {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
}

.marketplace-skill-preview {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft, var(--panel));
  padding: 10px 12px;
  font-size: 12px;
  font-family: var(--font-mono, monospace);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

#customSkillEditor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.marketplace-empty-hint {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* ── Marketplace: Load More + Community badge ── */

.marketplace-load-more-btn {
  display: block;
  width: calc(100% - 16px);
  margin: 6px 8px 10px;
  padding: 7px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.marketplace-load-more-btn:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-color: var(--accent);
}

.marketplace-load-more-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.marketplace-card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.marketplace-card-title-row .marketplace-card-title {
  flex: 1 1 auto;
  min-width: 0;
}

.marketplace-community-badge {
  flex: 0 0 auto;
  font-size: 10px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.marketplace-detail-tag--community {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  font-weight: 600;
}

.marketplace-empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 16px 12px;
  text-align: center;
}

.marketplace-empty-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
  background: color-mix(in srgb, var(--panel-soft) 72%, var(--panel));
}

.marketplace-empty-icon svg {
  width: 20px;
  height: 20px;
  opacity: 0.78;
}

.marketplace-empty-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.marketplace-empty-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 42ch;
}

/* ── MCP Pane ── */

.mcp-workspace {
  display: grid;
  grid-template-columns: minmax(180px, 36%) minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  flex: 1 1 auto;
}

.mcp-list-pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(175deg, color-mix(in srgb, var(--panel-soft) 64%, var(--panel)), var(--panel));
}

.mcp-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.mcp-list-title {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: var(--font-display);
  color: var(--muted);
}

.mcp-list-head .btn {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--accent);
  border-color: var(--accent-border);
}

.mcp-list {
  padding: 8px;
  gap: 7px;
}

.mcp-list .session-item {
  border-radius: 9px;
}

.mcp-editor-pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(176deg, color-mix(in srgb, var(--panel-elevated) 90%, var(--surface) 10%), var(--panel-elevated));
  padding: 10px;
}

.mcp-editor-pane.is-busy {
  opacity: 0.9;
}

.mcp-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mcp-mode-badge {
  text-transform: uppercase;
}

.mcp-editor-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.mcp-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  flex: 1 1 auto;
}

.mcp-form-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

#mcpDescriptionInput {
  min-height: 68px;
  resize: vertical;
}

.mcp-delete-confirm {
  border: 1px solid var(--tool-error-line);
  border-radius: 6px;
  background: var(--tool-error-bg);
  padding: 8px;
  display: grid;
  gap: 7px;
}

.mcp-delete-confirm-text {
  font-size: 12px;
  color: var(--danger);
}

.mcp-delete-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mcp-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.mcp-form-actions .btn {
  min-height: 36px;
}


.toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-row label {
  font-size: 12px;
  color: var(--muted);
}

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

input,
textarea,
select {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--input-bg);
  color: var(--ink);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent) 10%, transparent);
}

#tokenInput {
  min-width: 0;
}

#modelSelect {
  width: 170px;
}

.model-capability-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

#reasoningEffortSelect {
  width: 130px;
}

#reasoningSummarySelect {
  width: 130px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pending-approval-bar {
  margin: 10px 14px 0;
  border: 1px solid var(--warn-border);
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-fg);
  padding: 9px 10px;
  display: grid;
  gap: 7px;
}

.pending-approval-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pending-approval-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.pending-approval-count {
  font-size: 11px;
  color: color-mix(in srgb, var(--warn-fg) 78%, var(--muted));
}

.pending-approval-tool {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.pending-approval-meta {
  font-size: 12px;
  line-height: 1.4;
  color: color-mix(in srgb, var(--warn-fg) 85%, var(--muted));
  word-break: break-word;
}

.pending-approval-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pending-approval-remember {
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: color-mix(in srgb, var(--warn-fg) 86%, var(--muted));
}

.pending-approval-footer {
  font-size: 11px;
  color: color-mix(in srgb, var(--warn-fg) 82%, var(--muted));
}

.pending-approval-details {
  border: 1px solid color-mix(in srgb, var(--warn-border) 68%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--warn-bg) 90%, var(--panel));
  padding: 6px 8px;
}

.pending-approval-details>summary {
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.pending-approval-details>pre {
  margin: 8px 0 0;
  max-height: 180px;
  overflow: auto;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.pending-approval-request {
  font-size: 11px;
  color: color-mix(in srgb, var(--warn-fg) 76%, var(--muted));
  word-break: break-word;
}

.request-user-input-card {
  margin-top: 12px;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--border));
  border-radius: 16px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 88%, white) 0%, var(--panel) 100%);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.request-user-input-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.request-user-input-kicker,
.request-user-input-count {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.request-user-input-kicker {
  color: color-mix(in srgb, var(--brand) 72%, var(--text));
}

.request-user-input-count {
  color: var(--muted);
}

.request-user-input-title {
  font-size: 17px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text);
}

.request-user-input-description {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.request-user-input-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.request-user-input-progress-text {
  font-size: 12px;
  font-weight: 700;
  color: color-mix(in srgb, var(--brand) 72%, var(--text));
}

.request-user-input-progress-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.request-user-input-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 82%, var(--brand));
  transition: transform .18s ease, background-color .18s ease;
}

.request-user-input-progress-dot.is-complete {
  background: color-mix(in srgb, var(--brand) 54%, var(--border));
}

.request-user-input-progress-dot.is-current {
  width: 22px;
  background: color-mix(in srgb, var(--brand) 84%, var(--text));
}

.request-user-input-body {
  display: grid;
  gap: 12px;
}

.request-user-input-question {
  display: grid;
  gap: 8px;
}

.request-user-input-question-label {
  font-size: 12px;
  font-weight: 700;
  color: color-mix(in srgb, var(--text) 85%, var(--muted));
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.request-user-input-question-prompt {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.request-user-input-options {
  display: grid;
  gap: 8px;
}

.request-user-input-option {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--border) 82%, var(--brand));
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 90%, white);
  padding: 10px 12px;
  text-align: left;
  display: grid;
  gap: 4px;
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.request-user-input-option:hover:not(:disabled),
.request-user-input-option:focus-visible {
  border-color: color-mix(in srgb, var(--brand) 58%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
  transform: translateY(-1px);
}

.request-user-input-option.is-selected {
  border-color: color-mix(in srgb, var(--brand) 78%, var(--border));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand) 16%, var(--panel)) 0%, color-mix(in srgb, var(--brand) 10%, var(--panel)) 100%);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent),
    0 10px 20px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.request-user-input-option-label-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.request-user-input-option-label-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.request-user-input-option-check {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 84%, var(--text));
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  flex: 0 0 auto;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--brand) 26%, transparent);
}

.request-user-input-option-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.request-user-input-option.is-selected .request-user-input-option-label {
  color: color-mix(in srgb, var(--brand) 72%, var(--text));
}

.request-user-input-option-badges {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.request-user-input-option-badge {
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 12%, white);
  color: color-mix(in srgb, var(--brand) 72%, var(--text));
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.request-user-input-option-badge.is-selected {
  background: color-mix(in srgb, var(--brand) 86%, black 4%);
  color: white;
}

.request-user-input-option-badge.is-recommended {
  background: color-mix(in srgb, var(--brand) 14%, white);
  color: color-mix(in srgb, var(--brand) 76%, var(--text));
}

.request-user-input-option-description {
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.request-user-input-other {
  display: grid;
  gap: 8px;
  border: 1px dashed color-mix(in srgb, var(--border) 78%, var(--brand));
  border-radius: 12px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--panel) 92%, white);
}

.request-user-input-other.is-selected {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--border));
  background: color-mix(in srgb, var(--brand) 7%, var(--panel));
}

.request-user-input-other-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.request-user-input-other-select {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  padding: 0;
}

.request-user-input-other-text {
  width: 100%;
  resize: vertical;
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 96%, white);
  color: var(--text);
  padding: 10px 11px;
  font: inherit;
}

.request-user-input-other-text:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--brand) 62%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}

.request-user-input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.request-user-input-actions-left,
.request-user-input-actions-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.request-user-input-actions-right {
  justify-content: flex-end;
}

.request-user-input-footer {
  font-size: 12px;
  color: var(--muted);
}

.chat-log {
  flex: 1;
  overflow: auto;
  padding: calc(var(--chat-log-pad-top) + var(--chat-header-h)) 16px calc(var(--chat-log-pad-bottom) + var(--composer-h));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-pane-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
}

/* Dual counter-rotating ring spinner */
.chat-pane-loading-spinner {
  position: relative;
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
}

.chat-pane-loading-ring-outer {
  position: absolute;
  inset: 0;
  border: 4px solid transparent;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: chatLoadSpin 1s linear infinite;
}

.chat-pane-loading-ring-inner {
  position: absolute;
  inset: 0;
  border: 4px solid transparent;
  border-right-color: rgba(var(--brand-primary-rgb), 0.5);
  border-radius: 50%;
  animation: chatLoadSpinReverse 1.2s linear infinite;
}

.chat-pane-loading-logo {
  position: absolute;
  inset: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  animation: chatLoadPulse 2s ease-in-out infinite;
}

.chat-pane-loading-text {
  font-size: 13px;
  color: var(--accent);
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: center;
  animation: chatLoadPulse 2s ease-in-out infinite;
}

/* Keep card style for error state fallback */
.chat-pane-loading.is-error {
  flex-direction: row;
}

.chat-pane-loading-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-soft) 76%, var(--panel));
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.chat-pane-loading-error {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--warn-fg);
}

.bubble {
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: linear-gradient(166deg, color-mix(in srgb, var(--panel-elevated) 88%, var(--surface) 12%), var(--panel-elevated));
  padding: 10px 12px;
  animation: fadeIn 220ms ease;
}

.bubble.user {
  align-self: flex-end;
  max-width: 90%;
  background: var(--bubble-user-bg);
  border-color: var(--bubble-user-line);
}

.bubble.assistant {
  align-self: flex-start;
  width: 100%;
}

.assistant-turn {
  align-self: flex-start;
  max-width: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.assistant-turn>.bubble.assistant {
  max-width: 100%;
}

.assistant-turn-footer {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding-left: 2px;
}

.assistant-turn-footer[hidden] {
  display: none !important;
}

/* ── Bubble hover timestamp ─────────────────────────────────── */
.bubble-timestamp {
  font-size: 11px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.assistant-bubble-timestamp {
  padding-left: 0;
}

.assistant-turn:hover>.bubble-timestamp,
.assistant-turn:hover .assistant-bubble-timestamp {
  opacity: 1;
}

.user-turn:hover .bubble-timestamp {
  opacity: 1;
}

.user-turn-footer-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.bubble .role {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-display);
  color: var(--muted);
  margin-bottom: 6px;
}

.bubble.user .role {
  text-transform: none;
  letter-spacing: 0.02em;
}

.content {
  line-height: 1.55;
  word-break: break-word;
}

.user-attachments {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.user-attachment-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-soft) 72%, var(--panel));
}

.user-attachment-thumb {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 46px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.user-attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-attachment-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.user-attachment-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-attachment-meta {
  font-size: 11px;
  color: var(--muted);
}

.user-attachment-path {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content-empty-hint {
  color: var(--muted);
  font-style: italic;
}

.bubble-loading {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.bubble-loading-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.24;
  animation: bubbleDotPulse 1.15s ease-in-out infinite;
}

.bubble-loading-dot:nth-child(2) {
  animation-delay: 160ms;
}

.bubble-loading-dot:nth-child(3) {
  animation-delay: 320ms;
}

.assistant-bubble-actions {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.assistant-version-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-soft) 72%, var(--panel));
  padding: 2px;
}

.assistant-version-label {
  min-width: 56px;
  padding: 0 4px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.assistant-version-nav-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.assistant-version-nav-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.assistant-version-nav-btn:disabled {
  opacity: 0.42;
  cursor: default;
}

.assistant-downloads {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: color-mix(in srgb, var(--panel-soft) 72%, var(--panel));
}

.assistant-downloads-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.assistant-downloads-list {
  margin: 0;
  padding-left: 16px;
  display: grid;
  gap: 5px;
}

.assistant-download-item {
  display: grid;
  gap: 1px;
}

.assistant-download-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.12em;
  width: fit-content;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.assistant-download-meta {
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.assistant-download-meta.is-expired {
  color: var(--danger);
  font-weight: 600;
}

.assistant-degraded-summary {
  margin-top: 8px;
  border: 1px solid color-mix(in srgb, var(--warning) 26%, var(--line));
  border-radius: 6px;
  padding: 8px;
  background: color-mix(in srgb, var(--warning) 10%, var(--panel));
}

.assistant-degraded-summary-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--warning) 70%, var(--muted));
  margin-bottom: 6px;
}

.assistant-degraded-summary-list {
  margin: 0;
  padding-left: 16px;
  display: grid;
  gap: 6px;
}

.assistant-degraded-item {
  display: grid;
  gap: 2px;
}

.assistant-degraded-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.assistant-degraded-message {
  font-size: 12px;
  color: var(--text);
  opacity: 0.86;
}

.assistant-degraded-meta {
  font-size: 11px;
  color: var(--muted);
}

.assistant-audio-outputs {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: color-mix(in srgb, var(--panel-soft) 72%, var(--panel));
}

.assistant-audio-outputs-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.assistant-audio-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.assistant-audio-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--panel-soft));
}

.assistant-audio-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.assistant-audio-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.assistant-audio-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.assistant-audio-meta {
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.assistant-audio-player {
  width: 100%;
  margin-top: 6px;
}

.assistant-audio-download-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--muted);
  transition: color 150ms ease, background 150ms ease;
}

.assistant-audio-download-icon:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.assistant-audio-fallback {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.assistant-plots {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: color-mix(in srgb, var(--panel-soft) 72%, var(--panel));
}

.assistant-plots-inline-anchor {
  margin: 6px 0;
  border: 0;
  padding: 0;
  background: transparent;
}

.assistant-plots-inline-anchor .assistant-plots-list {
  gap: 8px;
}

.assistant-plots-inline-anchor .assistant-plot-item {
  border: 0;
  padding: 0;
  background: transparent;
}

.assistant-plots-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.assistant-plots-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.assistant-plot-item {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--panel-soft));
  display: grid;
  gap: 6px;
}

.assistant-plot-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, var(--panel-soft));
  overflow: hidden;
  resize: vertical;
}

.assistant-plot-frame::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--muted);
  opacity: 0.28;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.assistant-plot-frame:hover::after {
  opacity: 0.48;
}

.assistant-plot-canvas,
.assistant-plot-snapshot {
  width: 100%;
  height: 100%;
  display: block;
}

/* Move Plotly's built-in modebar to top-left so it doesn't overlap our action buttons */
.assistant-plot-canvas .modebar-container {
  left: 0 !important;
  right: auto !important;
}

.assistant-plot-canvas .modebar-container .modebar {
  justify-content: flex-start !important;
}

.assistant-plot-snapshot {
  object-fit: contain;
  background: color-mix(in srgb, var(--panel) 92%, var(--panel-soft));
}

.assistant-plot-loading {
  position: absolute;
  left: 10px;
  top: 8px;
  font-size: 11px;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}

.assistant-plot-actions {
  position: absolute;
  right: 10px;
  top: 8px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 4px;
}

.assistant-plot-export-btn {
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 150ms ease;
}

.assistant-plot-export-btn:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--panel) 92%, var(--accent));
}

.assistant-plot-export-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 1px;
}

.assistant-plot-pin-btn {
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 150ms ease;
}

.assistant-plot-pin-btn:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--panel) 92%, var(--accent));
}

.assistant-plot-pin-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 1px;
}

/* ── Widget Board ── */

.board-grid {
  display: grid;
  --board-grid-row-height: 72px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: var(--board-grid-row-height);
  gap: 18px;
  padding: 0 18px 18px;
  align-items: stretch;
  position: relative;
}

.board-grid.is-dragging-layout {
  cursor: grabbing;
}

.board-grid.is-resizing-layout {
  cursor: nwse-resize;
}

.board-grid.is-dragging-layout .board-widget-card {
  transition: none;
}

.board-grid.is-resizing-layout .board-widget-card {
  transition: none;
}

.board-grid.is-dragging-layout .board-widget-card:hover {
  border-color: var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.board-grid.is-resizing-layout .board-widget-card:hover {
  border-color: var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.board-grid.is-layout-saving {
  opacity: 0.76;
  pointer-events: none;
}

.board-grid-drop-target {
  position: absolute;
  left: 0;
  top: 0;
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
  pointer-events: none;
  z-index: 2;
}

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 0;
}

.board-header-title-wrap {
  min-width: 0;
}

.board-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.board-title-btn,
.board-widget-title-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
}

.board-title-btn {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.board-title-btn:hover,
.board-widget-title-btn:hover {
  color: var(--accent);
}

.board-title-input,
.board-widget-title-input {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 94%, white);
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
}

.board-title-input {
  min-width: min(520px, calc(100vw - 80px));
  font-size: 18px;
  font-weight: 700;
}

.board-section {
  padding-top: 12px;
}

.board-section-title {
  padding: 0 16px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.board-widget-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 94%, var(--panel-soft));
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  transition: box-shadow 200ms ease, border-color 200ms ease;
  height: 100%;
  min-height: 0;
}

.board-widget-card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.board-widget-card.is-dragging {
  z-index: 3;
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
}

.board-widget-card.is-drag-origin {
  opacity: 0.38;
  border-style: dashed;
}

.board-widget-card.is-resize-origin {
  opacity: 0.52;
  border-style: dashed;
}

.board-widget-card.is-refreshing {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.board-widget-drag-preview {
  position: fixed;
  left: 0;
  top: 0;
  margin: 0;
  pointer-events: none;
  z-index: 1200;
  opacity: 0.96;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
  transition: none !important;
}

.board-widget-drag-preview .board-widget-menu {
  display: none !important;
}

.board-widget-drag-preview .board-widget-resize-handle {
  display: none !important;
}

.board-widget-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-soft) 60%, var(--panel));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset;
}

.board-widget-card-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.board-widget-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-widget-title-btn {
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-widget-title-input {
  min-width: 180px;
  max-width: 320px;
  font-size: 13px;
  font-weight: 600;
}

.board-widget-drag-handle {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  padding: 4px 2px;
  cursor: grab;
}

.board-widget-drag-handle:hover {
  color: var(--accent);
}

.board-widget-drag-handle:active {
  cursor: grabbing;
}

.board-widget-resize-handle {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: nwse-resize;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease, color 150ms ease, background 150ms ease;
  z-index: 3;
  touch-action: none;
}

.board-widget-resize-handle::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  opacity: 0.9;
  transform: skew(-8deg, -8deg);
}

.board-widget-resize-handle:hover,
.board-widget-resize-handle:focus-visible {
  color: var(--accent);
  background: color-mix(in srgb, var(--panel) 82%, var(--accent) 18%);
  opacity: 1;
}

.board-widget-resize-handle:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 1px;
}

.board-grid.is-resizing-layout .board-widget-resize-handle {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: hover) and (pointer: fine) {

  .board-widget-card:hover .board-widget-resize-handle,
  .board-widget-card:focus-within .board-widget-resize-handle {
    opacity: 0.92;
    pointer-events: auto;
  }
}

@media (hover: none),
(pointer: coarse) {
  .board-widget-resize-handle {
    display: none;
  }
}

.board-widget-badge {
  font-size: 10px;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel-soft) 72%, var(--panel));
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.board-widget-card-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: transparent;
}

.board-widget-card-body .assistant-plot-item {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  gap: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.board-widget-card-body .assistant-plot-frame {
  flex: 1 1 auto;
  min-height: 200px;
  border: 0;
  border-radius: 0;
  background: transparent;
  resize: none;
}

.board-widget-card-body .assistant-plot-canvas,
.board-widget-card-body .assistant-plot-snapshot {
  min-height: 0;
}

.board-widget-card-body .assistant-plot-snapshot {
  background: transparent;
}

.board-widget-card-body .assistant-plot-canvas .plot-container,
.board-widget-card-body .assistant-plot-canvas .svg-container,
.board-widget-card-body .assistant-plot-canvas .main-svg,
.board-widget-card-body .assistant-plot-canvas .js-plotly-plot,
.board-widget-card-body .assistant-plot-canvas .bglayer .bg,
.board-widget-card-body .assistant-plot-canvas .cartesianlayer .bg {
  background: transparent !important;
  border-radius: 0 !important;
}

.board-widget-card-body .assistant-plot-canvas .bglayer .bg,
.board-widget-card-body .assistant-plot-canvas .cartesianlayer .bg {
  fill: transparent !important;
  rx: 0 !important;
  ry: 0 !important;
}

.board-widget-card-body .assistant-plot-frame::after {
  display: none;
}

.board-widget-card-body .board-widget-no-data {
  flex: 1 1 auto;
  padding: 18px;
}

.board-loading,
.board-empty,
.board-error,
.board-widget-no-data {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  font-size: 13px;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.board-loading-shell {
  width: min(100%, 980px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.board-loading-shell-route {
  max-width: 1040px;
}

.board-loading-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-top-color: var(--accent);
  animation: board-loading-spin 0.9s linear infinite;
}

.board-loading-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.board-loading-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.board-loading-skeleton-grid {
  width: min(100%, 920px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.board-loading-skeleton-card {
  min-height: 180px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-soft) 66%, var(--panel)), color-mix(in srgb, var(--panel) 92%, transparent));
  position: relative;
  overflow: hidden;
}

.board-loading-skeleton-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.06) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: board-loading-shimmer 1.5s ease-in-out infinite;
}

.board-loading-skeleton-card-wide {
  grid-column: 1 / -1;
  min-height: 72px;
}

@keyframes board-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes board-loading-shimmer {
  to {
    transform: translateX(100%);
  }
}

.dashboard-board-preview.is-board-reloading {
  cursor: progress;
}

.board-error {
  color: var(--danger);
}

.canvas-brand-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 100%);
  margin: 22px auto 8px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-align: center;
  color: color-mix(in srgb, var(--muted) 88%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
}

.board-brand-footer {
  width: 100%;
  max-width: none;
}

.board-widget-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

body.plotly-focus-fallback-open {
  overflow: hidden;
}

body.plotly-focus-fallback-open::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1800;
  background: rgba(12, 15, 22, 0.42);
  backdrop-filter: blur(20px) saturate(130%);
  -webkit-backdrop-filter: blur(20px) saturate(130%);
}

@media (max-width: 900px) {
  .board-title-input {
    min-width: 0;
    width: 100%;
  }

  .board-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .board-widget-card {
    grid-column: auto !important;
    grid-row: auto !important;
  }
}

.board-widget-badge-stale {
  color: color-mix(in srgb, var(--warning) 70%, var(--text));
  border-color: color-mix(in srgb, var(--warning) 30%, var(--line));
  background: color-mix(in srgb, var(--warning) 12%, var(--panel));
}

.board-widget-badge-warning {
  color: color-mix(in srgb, var(--danger) 72%, var(--text));
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  background: color-mix(in srgb, var(--danger) 12%, var(--panel));
}

.board-widget-warning {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 12px 12px 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 26%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--danger) 10%, var(--panel));
  color: color-mix(in srgb, var(--danger) 76%, var(--text));
  font-size: 12px;
  line-height: 1.45;
}

.board-widget-warning strong {
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.board-widget-warning-detail {
  color: var(--muted);
}

.board-widget-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.board-ai-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.board-pause-badge {
  font-size: 10px;
  font-weight: 600;
  color: color-mix(in srgb, var(--warning) 72%, var(--muted));
  background: color-mix(in srgb, var(--warning) 10%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--warning) 24%, var(--line));
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.board-widget-focus-btn,
.board-widget-more-btn {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: all 150ms ease;
}

.board-widget-focus-btn .btn-icon,
.board-widget-more-btn .btn-icon {
  width: 16px;
  height: 16px;
}

.board-widget-focus-btn:hover,
.board-widget-focus-btn[aria-pressed="true"],
.board-widget-more-btn:hover,
.board-widget-menu-wrap.is-open .board-widget-more-btn,
.board-ai-menu-wrap.is-open .board-widget-more-btn {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--button-bg));
  color: var(--text);
}

.board-widget-focus-btn:focus-visible,
.board-widget-more-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 1px;
}

.board-widget-card.is-plotly-focus-fallback {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border-radius: 0;
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 12%, transparent), transparent 32%),
    color-mix(in srgb, var(--panel) 97%, var(--panel-soft));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

.board-widget-card.is-plotly-focus-fallback {
  position: fixed;
  inset: 12px;
  width: auto;
  height: auto;
  margin: 0;
  z-index: 1801;
}

.board-widget-card.is-plotly-focus-fallback .board-widget-card-header {
  padding: 12px 18px;
  background: color-mix(in srgb, var(--panel) 86%, var(--panel-soft));
}

.board-widget-card.is-plotly-focus-fallback .board-widget-card-title-wrap {
  gap: 10px;
}

.board-widget-card.is-plotly-focus-fallback .board-widget-title-btn,
.board-widget-card.is-plotly-focus-fallback .board-widget-title-input {
  font-size: 15px;
}

.board-widget-card.is-plotly-focus-fallback .board-widget-card-body,
.board-widget-card.is-plotly-focus-fallback .assistant-plot-item,
.board-widget-card.is-plotly-focus-fallback .assistant-plot-frame,
.board-widget-card.is-plotly-focus-fallback .assistant-plot-canvas,
.board-widget-card.is-plotly-focus-fallback .assistant-plot-snapshot {
  min-height: 0;
  height: 100%;
}

.board-widget-card.is-plotly-focus-fallback .board-widget-card-body {
  flex: 1 1 auto;
}

.board-widget-card.is-plotly-focus-fallback .board-widget-drag-handle,
.board-widget-card.is-plotly-focus-fallback .board-widget-resize-handle {
  display: none !important;
}

@media (max-width: 720px) {
  .board-widget-card.is-plotly-focus-fallback {
    inset: 0;
  }
}

.board-widget-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 156px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--menu-bg);
  box-shadow: var(--menu-shadow);
  z-index: 12;
}

.board-widget-menu-btn {
  border: 1px solid transparent;
  background: var(--menu-bg);
  color: var(--ink);
  text-align: left;
  padding: 7px 8px;
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
}

.board-widget-menu-btn:hover {
  background: var(--panel-soft);
}

.board-widget-menu-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.board-widget-trace {
  margin: 12px 6px 6px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.board-widget-trace-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.board-widget-trace-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.board-widget-trace-chipline {
  font-size: 11px;
  color: var(--muted);
}

.board-widget-trace-pre {
  margin: 0;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 88%, var(--panel-soft));
  color: var(--text);
  font-size: 11px;
  line-height: 1.45;
  overflow: auto;
}

.board-widget-trace-code summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
}

.board-widget-trace-empty {
  font-size: 12px;
  color: var(--muted);
}

.board-filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 16px 16px 0;
}

.board-filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

.board-saved-view-field {
  min-width: 180px;
}

.board-filter-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.board-filter-field input,
.board-filter-field select {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 94%, var(--panel-soft));
  color: var(--text);
}

.board-filter-field select[multiple] {
  min-height: 96px;
}

.board-filters-clear-btn {
  min-height: 36px;
}

.plotly-pin-dialog {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
}

.plotly-pin-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.plotly-pin-card {
  position: relative;
  width: min(680px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.plotly-pin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.plotly-pin-title {
  margin: 0;
  font-size: 20px;
  color: var(--text);
}

.plotly-pin-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.plotly-pin-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plotly-pin-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.plotly-pin-search {
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 98%, var(--panel-soft));
  color: var(--text);
}

.plotly-pin-board-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.plotly-pin-board-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 96%, var(--panel-soft));
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.plotly-pin-board-option:hover,
.plotly-pin-board-option:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  background: color-mix(in srgb, var(--accent) 9%, var(--panel));
  transform: translateY(-1px);
}

.plotly-pin-board-option.is-selected {
  border-color: var(--accent-border);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

.plotly-pin-board-option-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plotly-pin-board-option-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.plotly-pin-board-option-meta {
  font-size: 12px;
  color: var(--muted);
}

.plotly-pin-board-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
}

.plotly-pin-create-btn {
  align-self: flex-start;
}

.plotly-pin-create-btn.is-active {
  border-color: var(--accent-border);
  color: var(--accent);
}

.plotly-pin-empty-state {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 14px;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 94%, var(--panel-soft));
}

.plotly-pin-error {
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--danger) 26%, var(--line));
  background: color-mix(in srgb, var(--danger) 10%, var(--panel));
  color: var(--danger);
  padding: 10px 12px;
  font-size: 13px;
}

.plotly-pin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.app-dialog {
  position: fixed;
  inset: 0;
  z-index: 124;
  display: grid;
  place-items: center;
}

.app-dialog-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.42);
  cursor: pointer;
}

.app-dialog-card {
  position: relative;
  width: min(520px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.app-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.app-dialog-title {
  margin: 0;
  font-size: 20px;
  color: var(--text);
}

.app-dialog-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.app-dialog-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-dialog-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.app-dialog-input {
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 98%, var(--panel-soft));
  color: var(--text);
}

.app-dialog-error {
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--danger) 24%, var(--line));
  background: color-mix(in srgb, var(--danger) 10%, var(--panel));
  color: var(--danger);
  font-size: 13px;
  padding: 10px 12px;
}

.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.canvas-share-modal {
  position: fixed;
  inset: 0;
  z-index: 122;
  display: grid;
  place-items: center;
}

.canvas-share-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.42);
  cursor: pointer;
}

.canvas-share-card {
  position: relative;
  width: min(560px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 97%, transparent);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.canvas-share-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.canvas-share-title {
  margin: 0;
  font-size: 20px;
  color: var(--text);
}

.canvas-share-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.canvas-share-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.canvas-share-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.canvas-share-status-row,
.canvas-share-link-row,
.canvas-share-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.canvas-share-status-row {
  justify-content: space-between;
}

.canvas-share-row-title {
  font-weight: 700;
  color: var(--text);
}

.canvas-share-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--line) 92%, transparent);
  background: color-mix(in srgb, var(--panel-soft) 78%, var(--panel));
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.canvas-share-badge.is-active {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background: color-mix(in srgb, var(--accent) 14%, var(--panel));
}

.canvas-share-badge.is-expired {
  border-color: color-mix(in srgb, var(--warn-fg) 32%, var(--line));
  background: color-mix(in srgb, var(--warn-fg) 14%, var(--panel));
}

.canvas-share-row-note,
.canvas-share-status-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.canvas-share-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.canvas-share-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.canvas-share-field input,
.canvas-share-field select {
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 98%, var(--panel-soft));
  color: var(--text);
}

.canvas-share-link-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.canvas-share-actions {
  justify-content: space-between;
}

.canvas-share-error {
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--danger) 24%, var(--line));
  background: color-mix(in srgb, var(--danger) 10%, var(--panel));
  color: var(--danger);
  font-size: 13px;
  padding: 10px 12px;
}

.board-config-drawer {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  z-index: 110;
}

.board-config-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.36);
  cursor: pointer;
}

.board-config-panel {
  position: relative;
  width: min(720px, 100%);
  height: 100%;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  overflow: auto;
}

.board-config-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.board-config-title {
  margin: 0;
  font-size: 20px;
  color: var(--text);
}

.board-config-subtitle,
.board-config-help {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.board-config-error {
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--danger) 24%, var(--line));
  background: color-mix(in srgb, var(--danger) 10%, var(--panel));
  color: var(--danger);
  padding: 10px 12px;
  font-size: 13px;
}

.board-config-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.board-refresh-panel {
  width: min(560px, 100%);
}

.board-refresh-mode-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.board-refresh-mode-btn.is-active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--button-bg));
  color: var(--text);
}

.board-refresh-inline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.board-refresh-weekday-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.board-refresh-weekday-row[hidden] {
  display: none !important;
}

.board-refresh-weekday-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.board-refresh-weekday-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.board-refresh-weekday-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.board-refresh-weekday-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.board-config-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.board-config-section-head h5 {
  margin: 0;
  font-size: 15px;
  color: var(--text);
}

.board-config-list,
.board-config-slots {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.board-config-filter-row,
.board-config-slot-card,
.board-config-binding-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, var(--panel-soft));
}

.board-config-filter-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
  gap: 10px;
  padding: 12px;
  align-items: end;
}

.board-config-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.board-config-field label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.board-config-field input,
.board-config-field select,
.board-config-field textarea {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 98%, var(--panel-soft));
  color: var(--text);
  width: 100%;
}

.board-config-field textarea {
  min-height: 74px;
  resize: vertical;
}

.board-config-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  font-size: 12px;
  color: var(--text);
}

.board-config-remove-btn {
  align-self: start;
}

.board-config-slot-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.board-config-slot-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.board-config-slot-meta {
  font-size: 12px;
  color: var(--muted);
}

.board-config-slot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.board-config-bindings {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.board-config-binding-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  align-items: end;
}

.board-config-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .plotly-pin-card {
    width: min(100%, calc(100% - 16px));
    max-height: calc(100vh - 16px);
    padding: 16px;
  }

  .board-config-filter-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board-config-binding-row,
  .board-config-slot-grid,
  .board-refresh-inline-row {
    grid-template-columns: 1fr;
  }

  .board-config-panel {
    width: 100%;
  }
}

.assistant-plot-info {
  position: relative;
}

.assistant-plot-info-trigger {
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  padding: 0;
}

.assistant-plot-info-trigger:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.assistant-plot-info-trigger:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 1px;
}

.assistant-plot-info-tooltip {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  display: none;
  width: min(360px, calc(100vw - 64px));
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, var(--panel-soft));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  padding: 8px;
  font-size: 11px;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.assistant-plot-info:hover .assistant-plot-info-tooltip,
.assistant-plot-info:focus-within .assistant-plot-info-tooltip {
  display: block;
}

.assistant-plot-info-line+.assistant-plot-info-line {
  margin-top: 6px;
}

.assistant-plot-error {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  font-size: 11px;
  color: var(--danger);
  background: color-mix(in srgb, var(--tool-error-bg) 88%, var(--panel));
  border: 1px solid var(--tool-error-line);
  border-radius: 8px;
  padding: 6px 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.assistant-plot-summary {
  font-size: 11px;
  color: var(--muted);
  white-space: pre-wrap;
}

.assistant-plot-meta {
  font-size: 11px;
  color: var(--muted);
}

.assistant-canvases {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: color-mix(in srgb, var(--panel-soft) 72%, var(--panel));
}

.assistant-canvases-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.assistant-canvases-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.assistant-canvas-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--panel-soft));
}

.assistant-canvas-main {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.assistant-canvas-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.assistant-canvas-meta {
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.assistant-canvas-open-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Automation cards (chat bubble) ── */

.assistant-automations {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: color-mix(in srgb, var(--panel-soft) 72%, var(--panel));
}

.assistant-automations-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.assistant-automations-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.assistant-automation-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--panel-soft));
}

.automation-icon {
  flex: 0 0 auto;
  font-size: 16px;
  line-height: 1;
}

.assistant-automation-main {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.assistant-automation-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-automation-meta {
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.assistant-automation-open-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Canvas thumbnail (shared by chat cards and artifact rows) ── */
.canvas-thumb {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 46px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.canvas-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.canvas-thumb-fallback {
  background: linear-gradient(135deg, var(--panel-soft) 0%, var(--panel) 100%);
}

.canvas-thumb-fallback::after {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
  opacity: 0.3;
  background: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cpath d='M3 9h18'/%3E%3Cpath d='M9 21V9'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cpath d='M3 9h18'/%3E%3Cpath d='M9 21V9'/%3E%3C/svg%3E");
  mask-size: contain;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
}

.assistant-feedback-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.assistant-feedback-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
}

.assistant-feedback-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.assistant-feedback-btn.assistant-feedback-btn-down:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
}

.assistant-feedback-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--panel-soft) 42%, var(--accent) 16%);
}

.assistant-feedback-btn.assistant-feedback-btn-down.is-active {
  border-color: var(--danger);
  color: var(--danger);
  background: color-mix(in srgb, var(--panel-soft) 42%, var(--danger) 14%);
}

.assistant-feedback-btn:disabled {
  opacity: 0.56;
  cursor: default;
}

.assistant-retry-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
}

.assistant-retry-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.assistant-retry-btn[hidden] {
  display: none !important;
}

.markdown-body> :first-child {
  margin-top: 0;
}

.markdown-body> :last-child {
  margin-bottom: 0;
}

.markdown-body p {
  margin: 0 0 0.55em;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 0.5em 0 0.4em;
  line-height: 1.35;
}

.markdown-body h1 {
  font-size: 1.08rem;
}

.markdown-body h2 {
  font-size: 1.02rem;
}

.markdown-body h3 {
  font-size: 0.98rem;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0.35em 0 0.65em 1.2em;
  padding: 0;
}

.markdown-body li {
  margin: 0.2em 0;
}

.markdown-body blockquote {
  margin: 0.45em 0;
  padding: 0.3em 0.8em;
  border-left: 3px solid var(--line);
  border-radius: 8px;
  background: var(--reasoning-bg);
  color: var(--muted);
}

.markdown-body hr {
  margin: 0.75em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.08em 0.35em;
}

.markdown-body pre {
  margin: 0.55em 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--code-bg);
  overflow: auto;
}

.markdown-body pre code {
  border: 0;
  padding: 0;
  background: transparent;
}

.markdown-code-block {
  position: relative;
  margin: 0.55em 0;
}

.markdown-code-block pre {
  margin: 0;
}

.markdown-code-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
  pointer-events: none;
}

.markdown-code-copy-btn {
  margin-top: 6px;
  margin-right: 10px;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-elevated);
  color: var(--muted);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 160ms ease, color 160ms ease, border-color 160ms ease, background 160ms ease, opacity 160ms ease;
}

.markdown-code-copy-btn:hover {
  color: var(--text);
  border-color: rgba(var(--brand-primary-rgb), 0.26);
}

.markdown-code-copy-btn:active {
  transform: translateY(1px) scale(0.98);
}

.markdown-code-copy-btn .btn-icon {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.markdown-code-copy-icon,
.markdown-code-copy-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  grid-area: 1 / 1;
  transition: opacity 160ms ease, transform 160ms ease;
}

.markdown-code-copy-btn {
  display: inline-grid;
}

.markdown-code-copy-check {
  opacity: 0;
  transform: scale(0.72);
}

.markdown-code-copy-btn[data-copied="1"] {
  color: var(--accent);
  border-color: rgba(var(--brand-primary-rgb), 0.34);
}

.markdown-code-copy-btn[data-copied="1"] .markdown-code-copy-icon {
  opacity: 0;
  transform: scale(0.72);
}

.markdown-code-copy-btn[data-copied="1"] .markdown-code-copy-check {
  opacity: 1;
  transform: scale(1);
}

pre code.hljs {
  display: block;
  color: var(--code-fg);
  background: transparent;
}

pre code.hljs .hljs-comment,
pre code.hljs .hljs-quote {
  color: var(--code-comment);
  font-style: italic;
}

pre code.hljs .hljs-keyword,
pre code.hljs .hljs-selector-tag,
pre code.hljs .hljs-literal,
pre code.hljs .hljs-section,
pre code.hljs .hljs-link {
  color: var(--code-keyword);
}

pre code.hljs .hljs-string,
pre code.hljs .hljs-regexp,
pre code.hljs .hljs-attr,
pre code.hljs .hljs-template-tag,
pre code.hljs .hljs-template-variable {
  color: var(--code-string);
}

pre code.hljs .hljs-number,
pre code.hljs .hljs-symbol,
pre code.hljs .hljs-bullet,
pre code.hljs .hljs-variable,
pre code.hljs .hljs-addition {
  color: var(--code-number);
}

pre code.hljs .hljs-title,
pre code.hljs .hljs-title.class_,
pre code.hljs .hljs-title.function_ {
  color: var(--code-title);
}

pre code.hljs .hljs-built_in,
pre code.hljs .hljs-type,
pre code.hljs .hljs-params {
  color: var(--code-built-in);
}

pre code.hljs .hljs-meta,
pre code.hljs .hljs-meta .hljs-keyword,
pre code.hljs .hljs-meta .hljs-string {
  color: var(--code-meta);
}

pre code.hljs .hljs-subst,
pre code.hljs .hljs-punctuation {
  color: var(--code-fg);
}

pre code.hljs .hljs-deletion {
  color: var(--danger);
}

.markdown-body .mermaid {
  margin: 0.6em 0;
  padding: 12px;
  text-align: center;
  overflow-x: auto;
}

.markdown-body .mermaid[data-mermaid-pending] {
  /* Show raw definition before Mermaid.js loads */
  text-align: left;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--muted);
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.markdown-body .mermaid svg {
  max-width: 100%;
  height: auto;
}

.markdown-body .katex-display {
  margin: 0.6em 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.markdown-body .markdown-math-block {
  margin: 0.75rem 0;
  white-space: pre-wrap;
}

.markdown-body .katex {
  font-size: 1em;
}

.markdown-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.markdown-body img.markdown-inline-img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 8px 0;
  display: block;
}

.assistant-citation-inline {
  display: inline-flex;
  align-items: baseline;
  margin-left: 0.32em;
  vertical-align: baseline;
}

.assistant-citation-tag {
  display: inline-flex;
  align-items: center;
  max-width: min(46ch, 78vw);
  padding: 0.08em 0.52em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.76em;
  line-height: 1.35;
  text-decoration: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.8;
  transition: all 150ms ease;
}

.assistant-citation-tag:hover,
.assistant-citation-tag:focus-visible {
  border-color: var(--line-strong);
  color: var(--text-std);
  text-decoration: none !important;
  opacity: 1;
}

/* ── Compact superscript citation ref [N] ── */
.assistant-citation-ref-wrap {
  position: relative;
  display: inline;
}

.assistant-citation-ref {
  font-size: 0.72em;
  line-height: 1;
  vertical-align: super;
  margin-left: 1px;
}

.assistant-citation-ref-link {
  color: var(--accent);
  text-decoration: none !important;
  font-weight: 600;
  opacity: 0.8;
  transition: opacity 150ms ease;
}

.assistant-citation-ref-link:hover,
.assistant-citation-ref-link:focus-visible {
  opacity: 1;
  text-decoration: underline !important;
}

/* ── Citation hover card ── */
.citation-card {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  width: max-content;
  max-width: min(320px, 80vw);
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--panel-strong, #2a2a2e);
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms ease;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
}

@media (hover: hover) and (pointer: fine) {
  .assistant-citation-ref-wrap:hover>.citation-card {
    display: block;
    opacity: 1;
  }
}

@media (hover: none),
(pointer: coarse) {
  .citation-card {
    display: none !important;
    opacity: 0 !important;
  }
}

.citation-card-domain {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.citation-card-title {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.citation-card-snippet {
  font-size: 12px;
  color: var(--text-dim);
  display: block;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Citation sources list (bottom of message) ── */
.assistant-citation-sources {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--panel-soft) 72%, var(--panel));
}

.assistant-citation-sources-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.assistant-citation-sources-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.assistant-citation-source-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  line-height: 1.4;
}

.assistant-citation-source-num {
  flex-shrink: 0;
  color: var(--accent);
  font-weight: 600;
  font-size: 11px;
}

.assistant-citation-source-link {
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(60ch, 80vw);
}

.assistant-citation-source-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.markdown-table-wrap {
  margin: 0.55em 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.markdown-body table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
}

.markdown-body th,
.markdown-body td {
  padding: 7px 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.markdown-body th:last-child,
.markdown-body td:last-child {
  border-right: 0;
}

.markdown-body tbody tr:last-child td {
  border-bottom: 0;
}

.markdown-body th {
  text-align: left;
  font-weight: 600;
  background: var(--reasoning-bg);
}

.reasoning {
  margin-bottom: 8px;
  border: 1px dashed var(--reasoning-line);
  background: var(--reasoning-bg);
  border-radius: 6px;
  padding: 8px;
}

.reasoning summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--accent-2);
  font-weight: 600;
}

.reasoning-timer {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.reasoning-markdown {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.4;
}

.reasoning-markdown> :last-child {
  margin-bottom: 0;
}

.assistant-activity {
  margin: 0 0 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assistant-thinking {
  margin: 0 0 10px;
  border: 1px dashed var(--reasoning-line);
  background: var(--reasoning-bg);
  border-radius: 6px;
  padding: 8px;
}

.assistant-thinking>summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  font-size: 12px;
  color: var(--accent-2);
  font-weight: 600;
}

.assistant-thinking-summary-label {
  min-width: 0;
}

.assistant-thinking>summary::-webkit-details-marker {
  display: none;
}

.assistant-thinking>summary::marker {
  content: '';
}

.assistant-thinking>.assistant-activity {
  margin: 8px 0 0;
}

.system-activity {
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  padding: 8px;
}

.system-activity-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.system-activity-meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.system-activity-body {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

.system-activity-details {
  margin-top: 4px;
}

.system-activity-details summary {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.todo-activity {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 8px;
}

.todo-activity-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-2);
}

.todo-activity-meta {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
}

.todo-activity-context {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

.todo-activity-items {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.todo-item input[type='checkbox'] {
  margin-top: 1px;
}

.todo-item-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.todo-item-content {
  font-size: 12px;
  color: var(--text);
  word-break: break-word;
}

.todo-item-meta {
  font-size: 11px;
  color: var(--muted);
}

.todo-item-focus .todo-item-content {
  font-weight: 600;
  color: var(--accent);
}

.todo-activity-empty {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.reasoning.reasoning-activity {
  margin-bottom: 0;
}

.reasoning-activity-head {
  font-size: 12px;
  color: var(--accent-2);
  font-weight: 600;
}

/* ========== Thinking Process – New 3-Layer UI ========== */

@keyframes thinking-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

@keyframes thinking-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes thinking-step-pop {
  0% {
    transform: scale(0.8);
    opacity: 0.5;
  }

  60% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes thinking-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

@keyframes thinking-skeleton {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* --- Thinking Container --- */

.thinking-container {
  margin: 8px 0;
}

.assistant-segment {
  display: block;
  margin: 8px 0;
}

.assistant-segment-thinking .thinking-container {
  margin: 0;
}

/* --- Layer 1: Status Capsule --- */

.thinking-capsule {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: 20px;
  background: linear-gradient(90deg,
      var(--thinking-base) 0%,
      var(--thinking-shimmer) 40%,
      var(--thinking-base) 80%);
  background-size: 200% 100%;
  animation: thinking-shimmer 2.4s ease-in-out infinite;
  cursor: pointer;
  user-select: none;
  transition: opacity 300ms ease;
  margin-bottom: 8px;
}

.thinking-capsule[data-done="true"] {
  animation: none;
  background: var(--thinking-summary-bg);
  cursor: pointer;
  transition: background 600ms ease, opacity 300ms ease;
}

.thinking-capsule-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--thinking-accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: thinking-spin 1.2s linear infinite;
  flex-shrink: 0;
}

.thinking-capsule[data-done="true"] .thinking-capsule-spinner {
  display: none;
}

.thinking-capsule-icon-done {
  display: none;
  font-size: 13px;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  background: var(--thinking-complete);
  color: #fff;
  font-weight: bold;
}

.thinking-capsule[data-done="true"] .thinking-capsule-icon-done {
  display: inline-block;
}

.thinking-capsule-text-wrapper {
  position: relative;
  min-width: 120px;
  height: 18px;
  overflow: hidden;
}

.thinking-capsule-text {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
  transition: opacity 150ms ease;
}

.thinking-capsule-text.fade-out {
  opacity: 0;
}

.thinking-capsule-text.fade-in {
  opacity: 1;
}

.thinking-capsule-timer {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 28px;
  text-align: right;
}

.thinking-capsule-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--muted);
  opacity: 0.6;
  margin-left: 2px;
}

.thinking-capsule-expand-label {
  justify-content: flex-start;
}

.thinking-capsule-expand-icon {
  width: 10px;
  min-width: 10px;
}

.thinking-toggle-chevron {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform-origin: 50% 50%;
  transform: rotate(45deg) translateY(-1px);
}

.thinking-toggle-chevron[data-direction="up"] {
  transform: rotate(-135deg) translateY(-1px);
}

/* --- Layer 2: Step Timeline --- */

.thinking-timeline {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 350ms ease-out, opacity 350ms ease-out;
  margin-bottom: 0;
}

.thinking-timeline.open {
  max-height: 2000px;
  opacity: 1;
  margin-bottom: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.thinking-timeline.open.scrolled {
  box-shadow: inset 0 6px 8px -4px var(--thinking-scroll-shadow);
}

.thinking-timeline.open::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.thinking-timeline-inner {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.thinking-timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.thinking-timeline-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.thinking-timeline-collapse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
}

.thinking-timeline-collapse:hover {
  color: var(--text);
}

.thinking-timeline-collapse .thinking-toggle-chevron {
  width: 7px;
  height: 7px;
}

/* --- Steps --- */

.thinking-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.thinking-step {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  animation: thinking-fade-in 450ms ease-out both;
}

/* After the initial fade-in completes, remove the animation so that
   DOM re-parenting (e.g. during incremental patching) does not cause
   the step to "flash" by replaying the fade-in. */
.thinking-step.entered {
  animation: none;
}

.thinking-step-gutter {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 20px;
  flex-shrink: 0;
}

.thinking-step-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.thinking-step-icon.status-complete {
  color: var(--thinking-complete);
}

.thinking-step-icon.status-complete.pop {
  animation: thinking-step-pop 250ms cubic-bezier(.16, 1, .3, 1);
}

.thinking-step-icon.status-complete.pop.entered {
  animation: none;
}

.thinking-step-icon.status-active {
  color: var(--thinking-accent);
}

.thinking-step-icon.status-active .thinking-step-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--thinking-accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: thinking-spin 1.2s linear infinite;
}

.thinking-step-icon.status-pending {
  color: var(--thinking-pending);
}

.thinking-step-line {
  flex: 1;
  width: 2px;
  border-left: 2px dashed var(--line);
  min-height: 8px;
}

.thinking-step:last-child .thinking-step-line {
  display: none;
}

.thinking-step-body {
  flex: 1;
  min-width: 0;
}

.thinking-step-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.thinking-step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.thinking-step-duration {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.thinking-step-batch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  background: rgba(var(--brand-primary-rgb), 0.10);
  color: var(--accent);
  border: 1px solid rgba(var(--brand-primary-rgb), 0.18);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

html[data-theme="dark"] .thinking-step-batch {
  background: rgba(var(--brand-primary-rgb), 0.12);
  border-color: rgba(var(--brand-primary-rgb), 0.22);
}

.thinking-step-summary {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.25s ease, margin-top 0.25s ease;
}

.thinking-step-summary-reasoning {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  overflow: hidden;
  position: relative;
}

.thinking-step[data-step-status="active"] .thinking-step-summary-reasoning {
  max-height: 220px;
  overflow-y: auto;
  scroll-behavior: smooth;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.thinking-step[data-step-status="active"] .thinking-step-summary-reasoning::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.thinking-timeline.open .thinking-step[data-step-status="complete"] .thinking-step-summary-reasoning {
  max-height: 220px;
}

/* Expanded state: remove max-height limit */
.thinking-step-summary-reasoning.expanded {
  max-height: none !important;
  overflow: visible;
}

/* Gradient fade overlay when content overflows */
.thinking-step-summary-reasoning.overflowing::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: linear-gradient(to bottom, transparent, var(--panel));
  pointer-events: none;
  border-radius: 0 0 4px 4px;
  z-index: 1;
}

/* Top gradient fade: only visible when scrolled past the top */
.thinking-step-summary-reasoning.scrolled-top::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: linear-gradient(to top, transparent, var(--panel));
  pointer-events: none;
  border-radius: 4px 4px 0 0;
  z-index: 1;
}

.thinking-step-summary-reasoning.expanded::after,
.thinking-step-summary-reasoning.expanded::before {
  display: none;
}

/* Expand / collapse toggle button */
.thinking-reasoning-expand-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 2px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--thinking-accent, #7c6bff);
  background: none;
  border: 1px solid color-mix(in srgb, var(--thinking-accent, #7c6bff) 25%, transparent);
  border-radius: 8px;
  cursor: pointer;
  align-self: flex-start;
  position: relative;
  z-index: 2;
  transition: background 0.15s ease, color 0.15s ease;
}

.thinking-reasoning-expand-btn:hover {
  background: color-mix(in srgb, var(--thinking-accent, #7c6bff) 8%, transparent);
}

.thinking-step-summary-reasoning.overflowing+.thinking-reasoning-expand-btn,
.thinking-step-summary-reasoning.expanded+.thinking-reasoning-expand-btn {
  display: inline-flex;
}

.thinking-reasoning-preview {
  color: var(--muted);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 2px;
  word-break: break-word;
  white-space: normal;
}

.thinking-reasoning-line {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

/* Group chips from the same tool call together */
.thinking-call-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Active step: summary is expanded and prominent */
.thinking-step[data-step-status="active"] .thinking-step-summary {
  max-height: 200px;
  opacity: 1;
  margin-top: 6px;
}

/* Completed step: summary collapses to save space */
.thinking-step[data-step-status="complete"] .thinking-step-summary {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

/* When the timeline is expanded (user clicked), show all summaries */
.thinking-timeline.open .thinking-step[data-step-status="complete"] .thinking-step-summary {
  max-height: 200px;
  opacity: 1;
  margin-top: 4px;
}

/* Active step title stays default text color (no accent highlight) */

/* Tag chips for keywords, params, etc. */
.thinking-chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 18px;
  background: var(--line);
  color: var(--muted);
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thinking-chip-keyword {
  background: rgba(124, 107, 255, 0.12);
  color: var(--thinking-accent);
}

.thinking-chip-overflow {
  background: transparent;
  color: var(--muted);
  opacity: 0.7;
  padding: 1px 4px;
  font-size: 10px;
}

.thinking-chip-count {
  background: rgba(34, 197, 94, 0.1);
  color: var(--thinking-complete);
}

/* Query-like inline element */
.thinking-param-query {
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.thinking-param-query::before {
  content: '\201C';
  opacity: 0.5;
}

.thinking-param-query::after {
  content: '\201D';
  opacity: 0.5;
}

/* URL/path element */
.thinking-param-path {
  display: inline-block;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--thinking-accent);
  opacity: 0.8;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* Code snippet element */
.thinking-param-code {
  display: inline-block;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--muted);
  background: var(--line);
  padding: 1px 6px;
  border-radius: 3px;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.thinking-step-files {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.thinking-step-file {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.thinking-step-file::before {
  content: '└ ';
  color: var(--thinking-pending);
}

/* --- Skeleton shimmer bar for active step --- */

.thinking-skeleton-bar {
  height: 12px;
  width: 60%;
  border-radius: 6px;
  margin-top: 4px;
  background: linear-gradient(90deg,
      var(--thinking-base) 25%,
      var(--thinking-shimmer) 50%,
      var(--thinking-base) 75%);
  background-size: 200% 100%;
  animation: thinking-skeleton 2.4s ease-in-out infinite;
}

/* --- Parallel Branches --- */

.thinking-branches {
  margin-top: 4px;
  margin-left: 0;
  padding-left: 0;
}

.thinking-branch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0 3px 12px;
  border-left: 2px solid var(--line);
  position: relative;
  animation: thinking-fade-in 450ms ease-out both;
}

.thinking-branch:last-child {
  border-left-color: transparent;
}

.thinking-branch::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 50%;
  width: 10px;
  height: 0;
  border-bottom: 2px solid var(--line);
}

.thinking-branch:last-child::before {
  border-left: 2px solid var(--line);
  height: 50%;
  top: 0;
}

.thinking-branch-icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}

.thinking-branch-icon.status-complete {
  color: var(--thinking-complete);
}

.thinking-branch-icon.status-active .thinking-branch-spinner {
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--thinking-accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: thinking-spin 1.2s linear infinite;
}

.thinking-branch-icon.status-pending {
  color: var(--thinking-pending);
}

.thinking-branch-title {
  font-size: 12px;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.thinking-branch-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--thinking-base);
  color: var(--thinking-accent);
  flex-shrink: 0;
}

.thinking-branch-duration {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* --- Summary Card (done state of capsule) --- */

.thinking-capsule .thinking-summary-content {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.thinking-capsule[data-done="true"] .thinking-summary-content {
  display: flex;
}

.thinking-capsule[data-done="true"] .thinking-capsule-text-wrapper,
.thinking-capsule[data-done="true"] .thinking-capsule-timer {
  display: none;
}

.thinking-summary-stats {
  font-size: 13px;
  color: var(--muted);
}

.thinking-summary-expand {
  font-size: 12px;
  color: var(--thinking-accent);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
}

.thinking-summary-expand:hover {
  text-decoration: underline;
}

/* --- Debug mode: keep old behavior --- */

.thinking-debug-content {
  margin-bottom: 8px;
}

margin: 0 0 10px;
border: 1px solid var(--line-strong);
border-radius: 11px;
background: linear-gradient(180deg, color-mix(in srgb, var(--panel-soft) 58%, var(--panel)), var(--panel));
padding: 8px;
}

.tool-calls-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
}

.tool-calls-inline-title {
  font-weight: 700;
  color: var(--accent-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-display);
}

.tool-calls-inline-meta {
  color: var(--muted);
  font-size: 11px;
}

.tool-calls-inline-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.tool-event.inline {
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--line-strong) 68%, var(--line));
  border-radius: 6px;
  background: linear-gradient(165deg, color-mix(in srgb, var(--surface) 80%, var(--panel-elevated) 20%), var(--panel-elevated));
}

.tool-event.tool-event-card {
  padding: 0;
  overflow: hidden;
}

.tool-event.tool-event-card>summary {
  list-style: none;
  cursor: pointer;
  padding: 8px;
}

.tool-event.tool-event-card>summary::-webkit-details-marker {
  display: none;
}

.tool-event.tool-event-card>summary::marker {
  content: '';
}

.tool-inline-body {
  padding: 0 8px 8px;
}

.tool-inline-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.tool-inline-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.tool-inline-dot.running {
  background: #f6c66a;
  border-color: #e0ac45;
  box-shadow: 0 0 0 3px rgba(233, 182, 87, 0.16);
}

.tool-inline-dot.ok {
  background: #6ec58f;
  border-color: #51a971;
}

.tool-inline-dot.error {
  background: #db6464;
  border-color: #b94c4c;
}

.tool-inline-meta {
  grid-column: 1 / span 3;
  margin-top: 2px;
  margin-left: 14px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-inline-core-params {
  grid-column: 1 / span 3;
  margin-top: 4px;
  margin-left: 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  word-break: break-word;
}

.tool-inspector-head {
  padding: 8px;
}

.tool-inspector-body {
  padding-top: 0;
}

/* --- Iterative tool collapse group --- */
.tool-iteration-group {
  margin: 4px 0;
  border-left: 2px solid var(--line);
  padding-left: 8px;
  border-radius: 0;
}

.tool-iteration-summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85em;
  color: var(--text-muted);
  padding: 2px 0;
  list-style: none;
}

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

.tool-iteration-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.tool-iteration-label {
  flex: 1;
}

.tool-iteration-body {
  padding: 4px 0;
  opacity: 0.75;
}

.assistant-collapse-toggle,
.tool-collapse-toggle {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.assistant-collapse-toggle:hover,
.tool-collapse-toggle:hover {
  background: color-mix(in srgb, var(--panel-soft) 60%, var(--panel));
}

.assistant-collapse-toggle:focus-visible,
.tool-collapse-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.tool-inline-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  word-break: break-word;
}

.tool-inline-preview {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.tool-inline-grid {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tool-inline-kv {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: flex-start;
  gap: 6px;
}

.tool-inline-k {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.2px;
  text-transform: lowercase;
}

.tool-inline-v {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.tool-inline-v a {
  color: var(--accent);
}

.tool-inline-tags {
  margin-left: 90px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tool-inline-tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 2px 7px;
  font-size: 11px;
  line-height: 1.2;
  word-break: break-word;
}

.tool-block.inline {
  margin-top: 7px;
}

.tool-calls-inline.compact .tool-event.inline {
  padding: 7px 8px;
}

.tool-calls-inline.compact .tool-event.inline.tool-event-card {
  padding: 0;
}

.tool-calls-inline.compact .tool-event.inline.tool-event-card>summary {
  padding: 7px 8px;
}

.composer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  border-top: 1px solid var(--line);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: rgba(10, 10, 10, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

html[data-theme="light"] .composer {
  background: transparent;
}

.composer-task-plan {
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: rgba(23, 23, 23, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 9px 10px 8px;
}

html[data-theme="light"] .composer-task-plan {
  background: rgba(244, 244, 245, 0.8);
}

.composer-task-plan[hidden] {
  display: none;
}

.composer.has-task-plan #promptInput {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.composer.has-task-plan #sendBtn {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.composer-task-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}

.composer-task-plan-head:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.composer-task-plan-head-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.composer-task-plan-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.composer-task-plan-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-2);
}

.composer-task-plan-meta {
  font-size: 11px;
  color: var(--muted);
}

.composer-task-plan-close {
  height: 20px;
  min-width: 52px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.composer-task-plan-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.composer-task-plan-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.composer-task-plan-close.is-armed {
  border-color: color-mix(in srgb, var(--danger) 70%, var(--line-strong));
  color: var(--danger);
  background: color-mix(in srgb, var(--panel-soft) 70%, var(--danger) 12%);
}

.composer-task-plan-close.is-armed:hover {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--panel-soft) 62%, var(--danger) 16%);
}

.composer-task-plan-close.is-armed:focus-visible {
  outline-color: var(--danger);
}

.composer-task-plan-toggle {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.composer-task-plan-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.composer-task-plan-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.composer-task-plan-body[hidden] {
  display: none;
}

.composer-task-plan-context {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

.composer-task-plan-items {
  margin-top: 7px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 2px;
}

.composer-task-plan-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.composer-task-plan-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  min-width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.composer-task-plan-item.is-completed .composer-task-plan-check {
  border-color: var(--accent);
  background: rgba(54, 138, 84, 0.16);
  color: var(--accent);
}

.composer-task-plan-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.composer-task-plan-content {
  font-size: 12px;
  color: var(--text);
  word-break: break-word;
}

.composer-task-plan-item.is-focus .composer-task-plan-content {
  font-weight: 600;
  color: var(--accent);
}

.composer-task-plan-item.is-completed .composer-task-plan-content {
  text-decoration: line-through;
  text-decoration-thickness: from-font;
  color: var(--muted);
}

.composer-task-plan-item-meta {
  font-size: 11px;
  color: var(--muted);
}

.composer-task-plan-empty {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.composer-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

.composer-context-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.composer-context-ref {
  width: min(100%, 520px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  background: color-mix(in srgb, var(--accent) 6%, var(--panel-muted));
}

.composer-context-ref-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.composer-context-ref-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.composer-context-ref-remove {
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--button-bg);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1;
}

.composer-context-ref-chip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.composer-context-ref-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  background: color-mix(in srgb, var(--accent) 14%, var(--panel));
  color: color-mix(in srgb, var(--accent) 72%, var(--text));
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.composer-context-ref-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.composer-context-ref-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-context-ref-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-message-context-ref {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--bubble-user-line));
  background: color-mix(in srgb, var(--bubble-user-bg) 70%, var(--panel));
}

.user-message-context-ref-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.user-message-context-ref-chip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.user-message-context-ref-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--bubble-user-line));
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: color-mix(in srgb, var(--accent) 72%, var(--text));
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.user-message-context-ref-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.user-message-context-ref-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-message-context-ref-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-uploads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.composer-upload-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(100%, 420px);
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-muted);
  color: var(--ink);
}

.composer-upload-item.is-failed {
  border-color: var(--stop-border);
  background: color-mix(in srgb, var(--stop-grad-2) 18%, var(--panel-muted));
}

.composer-upload-item.is-blocked {
  border-color: var(--warn-border);
  background: color-mix(in srgb, var(--warn-bg) 40%, var(--panel-muted));
}

.composer-upload-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.composer-upload-main.is-image {
  gap: 1px;
}

.composer-upload-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-upload-name.is-subtle {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.composer-upload-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-upload-meta-primary {
  font-size: 12px;
  color: var(--ink);
}

.composer-upload-meta-warning {
  color: var(--warn-fg);
}

.composer-upload-remove {
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--button-bg);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1;
}

.upload-progress-ring {
  --progress: 0;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
}

.upload-progress-ring svg {
  width: 24px;
  height: 24px;
  transform: rotate(-90deg);
}

.upload-progress-ring-track {
  fill: none;
  stroke: color-mix(in srgb, var(--line) 90%, transparent);
  stroke-width: 2.2;
}

.upload-progress-ring-bar {
  fill: none;
  stroke: var(--accent-grad-2);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 56.55;
  stroke-dashoffset: calc(56.55 - (56.55 * var(--progress)));
  transition: stroke-dashoffset 120ms linear;
}

.composer-upload-item.is-failed .upload-progress-ring-bar,
.composer-upload-item.is-blocked .upload-progress-ring-bar {
  stroke: var(--stop-grad-2);
}

.composer-upload-thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
}

.composer-upload-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.composer-upload-thumb.is-empty {
  background: color-mix(in srgb, var(--panel-soft) 78%, var(--panel));
}

.composer-upload-thumb-fallback {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.btn-attach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
}

.btn-attach .btn-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#promptInput {
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  line-height: 1.45;
  min-height: calc(1.45em + 18px);
  max-height: calc(4.35em + 18px);
  overflow-y: hidden;
}

#promptInput:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.btn {
  border: 1px solid var(--line-strong);
  background: var(--button-bg);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--button-hover-shadow);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  border-color: var(--accent-border);
  background: var(--accent-grad-1);
  color: var(--accent-text);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.btn-danger {
  border-color: var(--tool-error-line);
  background: linear-gradient(145deg, var(--stop-grad-1), var(--stop-grad-2));
  color: var(--stop-text);
}

#sendBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
}

#sendBtn .btn-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

#sendBtn .send-line-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#sendBtn.is-stop {
  border-color: var(--stop-border);
  background: linear-gradient(145deg, var(--stop-grad-1), var(--stop-grad-2));
  color: var(--stop-text);
}

#sendBtn.is-busy {
  opacity: 0.82;
  cursor: progress;
  box-shadow: none;
  transform: none;
}

#sendBtn.is-pending-send {
  cursor: progress;
}

#sendBtn .send-pending-spinner {
  transform-origin: 50% 50%;
  animation: composerSendSpin 0.9s linear infinite;
}

@keyframes composerSendSpin {
  to {
    transform: rotate(360deg);
  }
}

.btn-jump-bottom {
  position: absolute;
  right: 16px;
  bottom: 98px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 999px;
  border-color: var(--accent-border);
  background: var(--accent-grad-1);
  color: var(--accent-text);
  box-shadow: 0 10px 20px rgba(10, 24, 17, 0.2);
}

.btn-jump-bottom .btn-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-jump-bottom[hidden] {
  display: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--badge-bg);
  color: var(--muted);
  font-size: 11px;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  padding: 4px 9px;
}

.debug-meta {
  padding: 0 14px 12px;
  display: grid;
  gap: 8px;
}

.debug-meta>div {
  display: grid;
  grid-template-columns: 68px 1fr;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.debug-meta code {
  display: block;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 6px;
  overflow: auto;
}

.tool-timeline {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-event {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  background: var(--panel-elevated);
  font-size: 12px;
}

.tool-name {
  font-weight: 700;
  word-break: break-word;
}

.tool-meta {
  color: var(--muted);
  margin-top: 2px;
}

.tool-block {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.tool-block summary {
  cursor: pointer;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--muted);
}

.tool-block pre {
  margin: 0;
  padding: 0 8px 8px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.tool-results {
  margin-top: 6px;
  display: grid;
  gap: 6px;
}

.tool-result-item {
  border-left: 2px solid var(--line);
  padding-left: 8px;
}

.tool-result-item-focus {
  border-left-color: var(--accent-border);
}

.tool-result-title {
  font-weight: 600;
}

.tool-result-url,
.tool-result-snippet {
  margin-top: 2px;
  color: var(--muted);
  word-break: break-word;
}

.tool-result-url a {
  color: var(--accent);
}

.assistant-connector-auth-callout {
  margin-top: 8px;
}

.connector-auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 600;
}

.connector-auth-icon {
  width: 18px;
  height: 14px;
  display: block;
  flex: 0 0 auto;
}

.connector-auth-icon-x {
  width: 16px;
  height: 16px;
}

.tool-screenshot-preview {
  margin-top: 6px;
  width: 100%;
  max-height: min(42vh, 340px);
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.tool-audio-player {
  margin-top: 6px;
  width: 100%;
}

.tool-event.error {
  border-color: var(--tool-error-line);
  background: var(--tool-error-bg);
}

.tool-event.approval-pending {
  border-color: var(--accent-border);
}

.tool-event.approval-focus {
  box-shadow: 0 0 0 2px rgba(38, 141, 126, 0.4), var(--shadow);
}

.tool-approval {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 8px;
}

.tool-approval-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-2);
}

.tool-approval-remember {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.tool-approval-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.tool-approval-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

@keyframes bubbleDotPulse {

  0%,
  80%,
  100% {
    opacity: 0.24;
    transform: translateY(0);
  }

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

@keyframes chatLoadSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes chatLoadSpinReverse {
  to {
    transform: rotate(-360deg);
  }
}

@keyframes chatLoadPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

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

@keyframes sessionTitleShimmer {
  from {
    background-position: 180% 0;
  }

  to {
    background-position: -40% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bubble-loading-dot {
    animation: none;
    opacity: 0.52;
    transform: none;
  }

  .session-title.running {
    animation: none;
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--accent);
  }
}

@media (max-width: 1024px) {
  .app-shell {
    padding: 12px;
  }

  .panel.chat {
    min-height: calc(100vh - 24px);
    min-height: calc(100dvh - 24px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }

}

@media (max-width: 820px) {
  .app-shell {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top-extra: 0px;
    --push-drawer-width: clamp(146px, 44vw, 260px);
    padding: calc(8px + var(--safe-top) + var(--safe-top-extra)) 8px calc(8px + var(--safe-bottom));
    gap: 8px;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .panel.chat {
    border-radius: 14px;
    min-height: calc(100vh - 16px - var(--safe-top) - var(--safe-bottom) - var(--safe-top-extra));
    min-height: calc(100dvh - 16px - var(--safe-top) - var(--safe-bottom) - var(--safe-top-extra));
    max-height: calc(100vh - 16px - var(--safe-top) - var(--safe-bottom) - var(--safe-top-extra));
    max-height: calc(100dvh - 16px - var(--safe-top) - var(--safe-bottom) - var(--safe-top-extra));
  }

  .workspace-canvas-pane {
    min-width: 0;
    border-left: 0;
  }

  .workspace-splitter {
    display: none !important;
  }

  .panel.chat.workspace-mobile-canvas .workspace-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .panel.chat.workspace-mobile-canvas .workspace-canvas-pane {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
  }

  .panel.chat.workspace-mobile-canvas .dashboard-panel {
    padding: 10px;
    flex: 1 1 auto;
    min-height: 0;
  }

  .panel.chat.workspace-mobile-canvas.canvas-readonly-mode .dashboard-panel.is-canvas-selected.is-preview-mode .dashboard-preview {
    min-height: 0;
    height: 100%;
  }

  .dashboard-route-loading-shell {
    padding: 16px;
  }

  .board-loading-skeleton-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .dashboard-panel-head {
    position: relative;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
  }

  .dashboard-panel-heading-wrap {
    width: 100%;
    flex: 1 1 100%;
    padding-right: 44px;
  }

  .dashboard-panel-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  .dashboard-view-switch {
    order: 1;
    margin-right: auto;
  }

  #dashboardOpenWindowBtn {
    order: 2;
  }

  #mobileCanvasCloseBtn {
    position: absolute;
    top: 0;
    right: 0;
    order: 0;
    z-index: 1;
  }

  .chat-header {
    padding: 10px;
  }

  .chat-title {
    font-size: 15px;
  }

  .sessions-drawer {
    width: min(94vw, 340px);
  }

  .sessions-drawer .panel-head {
    padding-top: calc(12px + var(--safe-top) + var(--safe-top-extra));
  }

  /* Keep session "..." button always visible on mobile */
  .session-more-btn {
    opacity: 1;
    pointer-events: auto;
  }

  /* Settings modal: full-screen on mobile */
  .settings-modal {
    padding: 0;
  }

  .settings-modal-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
  }

  .settings-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    gap: 2px;
    min-width: 0;
  }

  .settings-nav::-webkit-scrollbar {
    display: none;
  }

  .settings-nav-title {
    display: none;
  }

  .settings-nav-item {
    flex: 1 1 0;
    min-width: 0;
    padding: 7px 8px;
    font-size: 12px;
    white-space: nowrap;
    justify-content: center;
    text-align: center;
  }

  .settings-nav-icon {
    display: none;
  }

  .muted {
    padding: 0 12px 8px;
  }

  .sessions-list,
  .chat-log,
  .tool-timeline {
    padding-left: 10px;
    padding-right: 10px;
  }

  .pending-approval-bar {
    margin: 8px 10px 0;
    padding: 8px 9px;
  }

  .pending-approval-actions {
    gap: 6px;
  }

  .request-user-input-card {
    padding: 12px;
    border-radius: 14px;
  }

  .request-user-input-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .toolbar-row>label {
    min-width: 56px;
  }

  #modelSelect {
    width: 130px;
  }

  .model-capability-badge {
    min-height: 32px;
    font-size: 10px;
    padding: 0 8px;
  }

  #reasoningEffortSelect {
    width: 112px;
  }

  #reasoningSummarySelect {
    width: 112px;
  }

  #tokenInput {
    min-width: 0;
  }

  .general-token-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .general-token-row .btn {
    justify-self: start;
  }

  .connector-provider-grid {
    grid-template-columns: 1fr;
  }

  .connector-provider-actions .btn {
    width: 100%;
  }

  .switch {
    min-height: 36px;
  }

  .skills-workspace,
  .mcp-workspace {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .skills-workspace {
    /* Keep detail pane on-screen when empty state uses absolute positioning. */
    grid-template-rows: minmax(0, 36vh) minmax(0, 1fr);
    align-content: stretch;
  }

  .mcp-workspace {
    align-content: start;
  }

  .skills-list-pane,
  .mcp-list-pane {
    max-height: 36vh;
  }

  .skill-editor-pane,
  .mcp-editor-pane {
    min-height: 0;
    max-height: none;
  }

  #skillMarkdownInput {
    min-height: 170px;
  }

  .skill-form-actions,
  .skill-delete-confirm-actions,
  .skill-switch-confirm-actions,
  .mcp-form-actions,
  .mcp-delete-confirm-actions {
    justify-content: flex-start;
  }

  .bubble {
    max-width: 100%;
    padding: 10px;
  }

  .tool-calls-inline {
    padding: 7px;
  }

  .tool-inline-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px;
  }

  .tool-inline-meta {
    grid-column: 1 / span 3;
    margin-left: 14px;
  }

  .tool-inline-core-params {
    grid-column: 1 / span 3;
    margin-left: 14px;
  }

  .tool-inline-sub {
    margin-left: 14px;
  }

  .tool-inline-kv {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .tool-inline-tags {
    margin-left: 82px;
  }

  .composer {
    padding: 10px;
  }

  .composer-task-plan {
    padding: 8px 9px 7px;
  }

  .composer-task-plan-items {
    max-height: 148px;
  }

  .composer-input-wrap {
    width: 100%;
  }

  #promptInput {
    padding-right: 10px;
  }

  #sendBtn {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .btn-jump-bottom {
    right: 12px;
    bottom: calc(126px + var(--safe-bottom));
    width: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .debug-meta {
    padding: 0 10px 10px;
  }

  .debug-meta>div {
    grid-template-columns: 58px 1fr;
  }
}

@supports (-webkit-touch-callout: none) {
  @media (max-width: 820px) {
    .app-shell {
      --safe-top-extra: 12px;
    }
  }
}

@media (max-width: 420px) {
  .toolbar-row label {
    font-size: 11px;
  }

  .chat-title {
    font-size: 14px;
  }

  .panel-head h2 {
    font-size: 16px;
  }
}

/* ── Automations Hub ──────────────────────────────────────────────── */
.automations-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.automations-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.automations-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.automations-hub {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.automations-list-pane,
.automations-right-pane {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 14px;
}

.automations-right-pane.auto-right-pane-empty {
  justify-content: center;
}

.automations-list-pane {
  border-right: 1px solid var(--line);
}

.auto-add-btn {
  margin-top: auto;
  width: 100%;
  padding: 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  flex-shrink: 0;
}

.auto-add-btn:hover {
  background: var(--panel-hover, rgba(128, 128, 128, 0.06));
  border-color: var(--accent);
}

.automations-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.automations-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auto-empty {
  padding: 20px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.auto-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--panel-elevated);
  transition: border-color 120ms ease;
  cursor: pointer;
}

.auto-card:hover {
  border-color: var(--accent);
}

.auto-card.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel-elevated));
}

.auto-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auto-card-status {
  font-size: 14px;
  line-height: 1;
}

.auto-status-active {
  color: var(--accent);
}

.auto-status-paused {
  color: #d4a72c;
}

.auto-status-disabled {
  color: var(--muted);
}

.auto-card-name {
  font-weight: 600;
  font-size: 13px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auto-card-delete,
.auto-card-pause,
.auto-card-resume {
  opacity: 0;
  transition: opacity 120ms ease;
}

.auto-card-delete {
  color: var(--danger);
}

.auto-card-pause {
  color: #d4a72c;
}

.auto-card-resume {
  color: var(--accent);
}

.auto-card:hover .auto-card-delete,
.auto-card:hover .auto-card-pause,
.auto-card:hover .auto-card-resume {
  opacity: 1;
}

.auto-card-lifecycle-label {
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.03em;
}

.auto-card-meta {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

#automationOutputView {
  flex: 0 1 auto;
}

/* Output timeline (right pane) */
.auto-output-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.auto-output-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.auto-output-name {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auto-output-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.auto-output-meta-badge {
  font-weight: 600;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--badge-bg);
}

.auto-output-meta-badge.active {
  color: var(--accent);
}

.auto-output-meta-badge.paused {
  color: #d4a72c;
}

.auto-output-meta-badge.disabled {
  color: var(--muted);
}

.auto-output-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auto-output-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.auto-output-item:last-child {
  border-bottom: none;
}

.auto-output-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.auto-output-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.auto-output-dot.succeeded {
  background: var(--accent);
}

.auto-output-dot.failed {
  background: var(--danger);
}

.auto-output-dot.running {
  background: #d4a72c;
  animation: pulse-dot 1.2s infinite;
}

.auto-output-time {
  font-size: 12px;
  color: var(--muted);
  min-width: 130px;
}

.auto-output-summary {
  flex: 1;
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auto-output-chevron {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
}

.auto-output-body {
  margin-top: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
}

.auto-output-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 4px;
}

/* Create modal */
.automation-modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.automation-modal[hidden] {
  display: none !important;
}

.automation-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: color-mix(in srgb, var(--scrim) 92%, transparent);
  cursor: pointer;
}

.automation-modal-card {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 18px 46px color-mix(in srgb, #000 28%, transparent);
  padding: 14px;
}

.automation-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.automation-modal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.automation-modal-close {
  border-radius: 6px;
}

.automation-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auto-form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.automation-form input,
.automation-form textarea,
.automation-form select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  background: var(--input-bg);
  color: var(--ink);
  font-family: var(--font-sans);
  resize: vertical;
}

.automation-form input:focus,
.automation-form textarea:focus,
.automation-form select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.auto-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auto-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auto-form-help {
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}

.auto-form-help.is-warning {
  color: #9b6a03;
}

html[data-theme='dark'] .auto-form-help.is-warning {
  color: #e8be62;
}

.auto-weekday-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.auto-weekday-label {
  flex-shrink: 0;
}

.auto-weekday-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.auto-weekday-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auto-weekday-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.auto-weekday-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.auto-weekday-row[hidden] {
  display: none !important;
}

.auto-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* Automation detail panel */
.auto-detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.auto-detail-title {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 0;
}

.auto-detail-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.auto-detail-meta-badge {
  font-weight: 600;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--badge-bg);
}

.auto-detail-meta-badge.active {
  color: var(--accent);
}

.auto-detail-meta-badge.paused {
  color: #d4a72c;
}

.auto-detail-meta-badge.disabled {
  color: var(--muted);
}

/* Run history timeline */
.auto-detail-runs {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auto-run-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 4px;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.1s;
}

.auto-run-row:hover {
  background: var(--panel-hover, rgba(128, 128, 128, 0.06));
}

.auto-run-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.auto-run-dot.succeeded {
  background: var(--accent);
}

.auto-run-dot.failed {
  background: var(--danger);
}

.auto-run-dot.running {
  background: #d4a72c;
  animation: pulse-dot 1.2s infinite;
}

.auto-run-dot.skipped {
  background: var(--muted);
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.auto-run-time {
  color: var(--muted);
  min-width: 120px;
}

.auto-run-status {
  font-weight: 600;
  min-width: 70px;
}

.auto-run-status.succeeded {
  color: var(--accent);
}

.auto-run-status.failed {
  color: var(--danger);
}

.auto-run-status.running {
  color: #d4a72c;
}

.auto-run-duration {
  color: var(--muted);
  min-width: 40px;
}

.auto-run-chevron {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
}

/* Run detail expanded */
.auto-run-detail {
  padding: 8px 12px 8px 20px;
  font-size: 12px;
  line-height: 1.5;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
}

.auto-run-detail-section {
  margin-bottom: 6px;
}

.auto-run-detail-section-title {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.auto-run-error {
  color: var(--danger);
  font-weight: 600;
}

/* Run artifact badge */
.auto-run-artifacts {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* Artifact items */
.auto-artifact-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.auto-artifact-item:last-child {
  border-bottom: none;
}

.auto-artifact-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.auto-artifact-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.auto-artifact-type {
  font-size: 10px;
  color: var(--muted);
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--badge-bg);
}

.auto-artifact-view {
  font-size: 11px;
  padding: 2px 8px;
}

.auto-artifact-viewer {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.auto-artifact-md h2,
.auto-artifact-md h3,
.auto-artifact-md h4 {
  color: var(--text);
}

.auto-artifacts-container {
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (max-width: 768px) {
  .automations-hub {
    grid-template-columns: 1fr;
  }

  .automations-list-pane {
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: 200px;
  }

  .automations-right-pane {
    align-items: stretch;
    align-content: flex-start;
    justify-content: flex-start;
    padding-top: 4px;
  }

  .automations-right-pane>* {
    flex-shrink: 0;
  }

  .automation-modal {
    padding: 10px;
    align-items: flex-end;
  }

  .automation-modal-card {
    width: 100%;
    max-height: min(90vh, 840px);
    border-radius: 8px;
    padding: 12px;
  }

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

/* ── Knowledge Base ──────────────────────────────────────────────── */
.knowledge-panel {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.kb-create-modal-card {
  width: min(460px, 100%);
  max-height: min(70vh, 420px);
}

.knowledge-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

.knowledge-sidebar {
  border-right: 1px solid var(--line);
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  gap: 10px;
}

.knowledge-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.knowledge-title {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

/* ── KB Create Modal ──────────────────────────────────────────── */
.kb-create-modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.kb-create-modal[hidden] {
  display: none !important;
}

.kb-create-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: color-mix(in srgb, var(--scrim) 92%, transparent);
  cursor: pointer;
}

.kb-create-modal-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 18px 46px color-mix(in srgb, #000 28%, transparent);
  padding: 14px;
}

html[data-theme="dark"] .plotly-pin-card,
html[data-theme="dark"] .app-dialog-card,
html[data-theme="dark"] .canvas-share-card,
html[data-theme="dark"] .board-config-panel,
html[data-theme="dark"] .automation-modal-card,
html[data-theme="dark"] .kb-create-modal-card {
  background: rgba(12, 12, 14, 0.84);
  border-color: rgba(255, 255, 255, 0.08);
}

.kb-create-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.kb-create-modal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.kb-create-modal-close {
  border-radius: 6px;
}

.kb-create-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kb-create-form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.kb-create-form input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  background: var(--input-bg);
  color: var(--ink);
  font-family: var(--font-sans);
}

.kb-create-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.kb-create-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.knowledge-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  min-height: 0;
  padding-right: 2px;
}

.knowledge-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--panel-elevated);
  width: 100%;
  text-align: left;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.knowledge-item.active {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
}

.knowledge-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.knowledge-item-name {
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}

.knowledge-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.knowledge-main {
  min-height: 0;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.knowledge-main-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.knowledge-main-head>div:first-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.knowledge-main-title {
  font-size: 16px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-main-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.knowledge-main-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.knowledge-section-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-top: 6px;
}

.knowledge-docs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  flex: 1 1 auto;
  min-height: 120px;
  border: 2px dashed transparent;
  border-radius: 8px;
  transition: border-color 200ms ease, background 200ms ease;
}

.knowledge-docs-list.kb-drop-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.knowledge-docs-list.kb-drop-active::after {
  content: 'Drop files here to upload';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--panel) 85%, transparent);
  border-radius: 6px;
  pointer-events: none;
  z-index: 5;
}

.knowledge-doc-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--panel-elevated);
}

.knowledge-doc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.knowledge-doc-name {
  font-size: 13px;
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-doc-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.knowledge-doc-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  flex: 0 0 auto;
}

.knowledge-doc-status.pending {
  animation: kb-pulse 1.5s ease-in-out infinite;
}

.knowledge-doc-status.queued {
  color: #999;
  border-color: color-mix(in srgb, #999 45%, var(--line));
  background: color-mix(in srgb, #999 8%, transparent);
}

.knowledge-doc-status.indexing {
  color: #f0b232;
  border-color: color-mix(in srgb, #f0b232 45%, var(--line));
  background: color-mix(in srgb, #f0b232 10%, transparent);
}

.knowledge-doc-status.ready {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.knowledge-doc-status.failed {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  background: color-mix(in srgb, var(--danger) 9%, transparent);
}

.knowledge-doc-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.knowledge-doc-error {
  margin-top: 6px;
  color: var(--danger);
  font-size: 11px;
  line-height: 1.45;
}

.knowledge-doc-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.knowledge-doc-actions .btn,
.knowledge-main-actions .btn {
  white-space: nowrap;
  text-decoration: none;
}

/* ── KB & Document delete buttons (hover-reveal) ────────────── */

.kb-item-rename {
  opacity: 0;
  transition: opacity 120ms ease;
  color: var(--text-dim);
  flex-shrink: 0;
  padding: 2px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.kb-item-rename:hover {
  color: var(--text-std);
}

.knowledge-item:hover .kb-item-rename {
  opacity: 1;
}

.kb-item-delete {
  opacity: 0;
  transition: opacity 120ms ease;
  color: var(--danger);
  margin-left: auto;
  flex-shrink: 0;
}

.knowledge-item:hover .kb-item-delete {
  opacity: 1;
}

.kb-doc-delete {
  opacity: 0;
  transition: opacity 120ms ease;
  color: var(--danger);
}

.knowledge-doc-item:hover .kb-doc-delete {
  opacity: 1;
}

.btn-danger-outline {
  border: 1px solid var(--danger);
  color: var(--danger);
  background: transparent;
}

.btn-danger-outline:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.knowledge-empty {
  padding: 14px 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.knowledge-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  user-select: none;
}

.knowledge-toggle input {
  margin: 0;
}

@keyframes kb-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

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

  .knowledge-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: 46vh;
  }
}

.user-turn {
  align-self: flex-end;
  max-width: 90%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.user-turn>.bubble.user {
  max-width: 100%;
}

.user-turn-footer {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  opacity: 0;
  transition: opacity 150ms ease;
  min-height: 20px;
  width: 100%;
}

.user-turn:hover .user-turn-footer {
  opacity: 1;
}

.user-edit-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
}

.user-edit-btn:hover {
  background: var(--surface-hover);
  color: var(--text-std);
}

.user-edit-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-edit-textarea {
  width: 100%;
  min-height: 80px;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: inherit;
  border: none;
  outline: none;
  font: inherit;
  line-height: 1.55;
  margin: 0;
  padding: 0;
}

.user-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.user-edit-actions button {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-std);
  cursor: pointer;
  font-size: 13px;
  transition: all 150ms ease;
}

.user-edit-actions button:hover {
  background: var(--surface-hover);
}

.user-edit-actions button.primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.user-edit-actions button.primary:hover {
  background: var(--accent);
}

/* On mobile, user-turn might take 95% */
@media (max-width: 768px) {
  .user-turn {
    max-width: 95%;
  }

  .dashboard-artifacts-list.is-gallery {
    grid-template-columns: 1fr;
  }
}

.app-shell:not(.drawer-mode-push) .user-turn-footer {
  opacity: 1;
}

.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--panel-elevated);
  color: var(--text-std);
  border: 1px solid var(--line-strong);
  padding: 8px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.copy-bubble-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
}

.copy-bubble-btn:hover {
  background: var(--surface-hover);
  color: var(--text-std);
}

.assistant-turn-footer .copy-bubble-btn {
  padding: 4px 6px;
  border-radius: 4px;
}

/* ==========================================================================
   MESSAGE THEME SYSTEM
   Alternative message layout activated via data-msg-theme on <body>.
   - "soft-cards"     : Claude-inspired, warm cards with dividers
   ========================================================================== */

/* ---------- Shared theme overrides ---------- */
[data-msg-theme="soft-cards"] {
  --msg-content-max-w: 720px;
}

/* ==========================================================================
   THEME — Soft Cards (Claude-style)
   ========================================================================== */

[data-msg-theme="soft-cards"] {
  --sc-max-w: 760px;
  --sc-gap: 20px;
  --sc-user-bg: rgba(var(--brand-primary-rgb), 0.08);
  --sc-user-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  --sc-user-radius-tl: 18px;
  --sc-user-radius-tr: 18px;
  --sc-user-radius-br: 5px;
  --sc-user-radius-bl: 18px;
  --sc-tag-bg: var(--panel-soft);
  --sc-divider: var(--line);
}

html[data-theme="dark"] [data-msg-theme="soft-cards"] {
  --sc-user-bg: rgba(var(--brand-primary-rgb), 0.18);
  --sc-user-shadow: 0 1px 5px rgba(0, 0, 0, 0.22);
  --sc-tag-bg: rgba(255, 255, 255, 0.06);
}

[data-msg-theme="soft-cards"] .chat-log {
  gap: var(--sc-gap);
  align-items: center;
  padding-left: 24px;
  padding-right: 24px;
}

[data-msg-theme="soft-cards"] .user-turn {
  align-self: center;
  width: 100%;
  max-width: var(--sc-max-w);
}

[data-msg-theme="soft-cards"] .assistant-turn {
  align-self: center;
  width: 100%;
  max-width: var(--sc-max-w);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--sc-divider);
}

[data-msg-theme="soft-cards"] .assistant-turn:last-child {
  border-bottom: none;
}

[data-msg-theme="soft-cards"] .bubble {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

[data-msg-theme="soft-cards"] .bubble.user {
  max-width: 85%;
  background: var(--sc-user-bg);
  border-radius: var(--sc-user-radius-tl) var(--sc-user-radius-tr) var(--sc-user-radius-br) var(--sc-user-radius-bl);
  padding: 14px 18px;
  box-shadow: var(--sc-user-shadow);
}

[data-msg-theme="soft-cards"] .bubble.assistant {
  width: 100%;
  max-width: 100%;
  background: transparent;
  padding: 4px 0 8px;
}

/* Assistant role → small tag badge */
[data-msg-theme="soft-cards"] .bubble.assistant .role {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 3px 9px;
  background: var(--sc-tag-bg);
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 8px;
}

/* User role hidden — implied by position */
[data-msg-theme="soft-cards"] .bubble.user .role {
  display: none;
}

[data-msg-theme="soft-cards"] .assistant-turn-footer {
  padding-left: 0;
  margin-top: 6px;
}

[data-msg-theme="soft-cards"] .user-turn-footer {
  padding-right: 8px;
}

/* ======================================================================
   Empty State: Chat Suggestions
   ====================================================================== */

.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 24px;
  min-height: 50vh;
  text-align: center;
  animation: emptyStateFadeIn 0.35s ease-out;
}

@keyframes emptyStateFadeIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

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

.chat-empty-greeting {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.chat-empty-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
}

.chat-empty-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 10px;
  width: 100%;
  max-width: 640px;
  text-align: left;
}

.chat-empty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 640px;
  width: 100%;
}

@media (max-width: 640px) {
  .chat-empty-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .chat-empty-state {
    padding: 32px 16px 16px;
    min-height: 40vh;
  }

  .chat-empty-greeting {
    font-size: 18px;
  }
}

.chat-empty-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--panel-elevated);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  outline: none;
  line-height: 1.45;
}

.chat-empty-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.chat-empty-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

html[data-theme="dark"] .chat-empty-card:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.chat-empty-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.chat-empty-card-icon {
  color: var(--accent);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.chat-empty-card-icon svg {
  width: 16px;
  height: 16px;
}

.chat-empty-card-category {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.chat-empty-card-text {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.45;
}

/* ======================================================================
   Empty State: Automations (rich)
   ====================================================================== */

.auto-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  text-align: center;
}

.auto-empty-header {
  margin-bottom: 22px;
}

.auto-empty-icon {
  margin-bottom: 10px;
  display: flex;
  justify-content: center;
}

.auto-empty-icon svg {
  opacity: 0.45;
}

.auto-empty-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
}

.auto-empty-desc {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.auto-empty-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 10px;
  text-align: left;
}

.auto-empty-templates {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

@media (max-width: 480px) {
  .auto-empty-templates {
    grid-template-columns: 1fr;
  }
}

.auto-template-card {
  display: flex;
  flex-direction: column;
  background: var(--panel-elevated);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease;
  font-family: inherit;
  color: inherit;
  outline: none;
}

.auto-template-card:hover {
  border-color: var(--accent);
}

.auto-template-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.auto-template-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
}

.auto-template-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 8px;
}

.auto-template-action {
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
}

.auto-empty-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 12px;
}

.auto-empty-divider::before,
.auto-empty-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--line);
}

.auto-empty-custom {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.auto-empty-example {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin: 2px 0 10px;
  opacity: 0.75;
}

.auto-empty-create-btn {
  margin-top: 4px;
}

/* ======================================================================
   Empty State: Knowledge Base (rich)
   ====================================================================== */

.knowledge-empty-state {
  padding: 28px 16px;
  text-align: center;
}

.kb-empty-header {
  margin-bottom: 18px;
}

.kb-empty-header svg {
  opacity: 0.45;
}

.kb-empty-header h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin: 10px 0 4px;
}

.kb-empty-header p {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.kb-empty-formats {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 18px;
  opacity: 0.75;
}

.kb-empty-scenarios {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

@media (max-width: 480px) {
  .kb-empty-scenarios {
    grid-template-columns: 1fr;
  }
}

.kb-scenario-card {
  display: flex;
  flex-direction: column;
  background: var(--panel-elevated);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease;
  font-family: inherit;
  color: inherit;
  outline: none;
}

.kb-scenario-card:hover {
  border-color: var(--accent);
}

.kb-scenario-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.kb-scenario-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
}

.kb-scenario-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.kb-empty-tip {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
  opacity: 0.75;
}

/* ── User Avatar & Popover ──────────────────────────────────────────────── */
.user-avatar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--panel-elevated);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
}

.user-avatar-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar-popover {
  position: absolute;
  bottom: 100%;
  left: 12px;
  margin-bottom: 8px;
  background: var(--menu-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--menu-shadow);
  width: 240px;
  z-index: 100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.popover-user-info {
  padding: 16px;
}

.popover-email {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  word-break: break-all;
}

.popover-divider {
  height: 1px;
  background: var(--line);
  margin: 0;
}

.popover-menu-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.popover-menu-item:hover {
  background: var(--panel-elevated);
  color: var(--ink);
}

.popover-icon {
  width: 18px;
  height: 18px;
  margin-right: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* ── Auth Modal ──────────────────────────────────────────────── */
.auth-modal-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(420px, calc(100vw - 48px));
  max-height: min(90vh, 700px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  animation: authCardIn 280ms cubic-bezier(0.22, 0.68, 0, 1.1);
}

html[data-theme="dark"] .auth-modal-card {
  background: rgba(16, 16, 16, 0.92);
  border-color: rgba(255, 255, 255, 0.08);
}

@keyframes authCardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }

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

.auth-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 150ms, color 150ms;
}

.auth-close-btn:hover {
  background: var(--line);
  color: var(--ink);
}

.auth-close-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.auth-modal-body {
  padding: 40px 36px 36px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Header */
.auth-header-section {
  text-align: center;
  margin-bottom: 28px;
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
  font-family: var(--font-display);
}

.auth-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* Tabs */
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--line);
  border-radius: 6px;
  padding: 3px;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 0;
  border-radius: 8px;
  transition: all 180ms ease;
  position: relative;
}

.auth-tab.is-active {
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] .auth-tab.is-active {
  background: rgba(255, 255, 255, 0.1);
}

.auth-tab.is-active::after {
  display: none;
}

.auth-tab:hover:not(.is-active) {
  color: var(--ink);
}

/* Forms */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form:not(.is-active) {
  display: none;
}

/* Floating label input group */
.auth-input-group {
  position: relative;
}

.auth-input-group>.auth-input {
  width: 100%;
  padding: 16px 14px 8px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--ink);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 180ms ease, box-shadow 180ms ease;
  outline: none;
  box-sizing: border-box;
}

.auth-input-group>.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.12);
}

html[data-theme="dark"] .auth-input-group>.auth-input:focus {
  box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.15);
}

.auth-input-group>label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--muted);
  pointer-events: none;
  transition: all 180ms ease;
  transform-origin: left center;
  background: transparent;
}

.auth-input-group>.auth-input:focus+label,
.auth-input-group>.auth-input:not(:placeholder-shown)+label {
  top: 10px;
  transform: translateY(0);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
}

/* Code row (email + send button) */
.auth-code-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.auth-code-email-wrap {
  flex: 1;
  min-width: 0;
}

.auth-send-code-btn {
  white-space: nowrap;
  padding: 0 18px;
  height: auto;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
}

.auth-send-code-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.auth-send-code-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Submit button */
.auth-submit-btn {
  width: 100%;
  margin-top: 4px;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-grad-1), var(--accent-grad-2));
  color: var(--accent-text);
  cursor: pointer;
  transition: all 180ms ease;
  text-align: center;
  letter-spacing: 0.01em;
}

.auth-submit-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 12px rgba(var(--brand-primary-rgb), 0.25);
}

.auth-submit-btn:active {
  transform: scale(0.98);
}

/* Error message */
.auth-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  min-height: 0;
  line-height: 1.4;
}

.auth-error:not(:empty) {
  min-height: 18px;
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 24px 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--line);
}

.auth-divider span {
  padding: 0 14px;
}

/* Google button */
.auth-google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 13px;
  border: 1.5px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
}

.auth-google-btn:hover {
  border-color: var(--line-strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  background: var(--panel-elevated);
}

html[data-theme="dark"] .auth-google-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Logged-in account email in Settings */
.auth-logged-in-status {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-align: right;
  font-family: 'IBM Plex Mono', var(--font-mono);
  letter-spacing: 0.01em;
}

/* Responsive */
@media (max-width: 480px) {
  .auth-modal-card {
    width: calc(100vw - 32px);
    border-radius: 8px;
  }

  .auth-modal-body {
    padding: 32px 24px 28px;
  }

  .auth-title {
    font-size: 22px;
  }
}

/* ======================================================================
   Billing Panel
   ====================================================================== */

.billing-overview-card {
  padding: 20px !important;
}

.billing-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 14px;
}

.billing-stat-row:last-child {
  margin-bottom: 0;
}

.billing-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.billing-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.billing-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.billing-stat-value.tok {
  font-size: 17px;
  font-weight: 600;
}

.billing-stat-value.period {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

/* Layout / tabs */
.billing-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.billing-tab-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-elevated) 82%, transparent);
  border: 1px solid var(--line);
}

.billing-tab-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.billing-tab-btn:hover {
  color: var(--ink);
}

.billing-tab-btn.is-active {
  background: linear-gradient(135deg, var(--accent-grad-1), var(--accent-grad-2));
  color: #fff;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 20%, transparent);
}

.billing-main-pane,
.billing-sub-pane {
  display: block;
}

.billing-stacked-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.billing-group-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.billing-group-item:first-child {
  padding-top: 0;
}

.billing-group-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.billing-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.billing-cat-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.billing-group-title {
  font-weight: 600;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.billing-group-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.billing-group-chip,
.billing-tok {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--panel-elevated);
  padding: 2px 6px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.billing-group-chip.is-refresh {
  color: color-mix(in srgb, var(--accent) 85%, #0f172a);
}

.billing-bar-track {
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.billing-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-grad-1), var(--accent-grad-2));
  transition: width 400ms cubic-bezier(0.22, 0.68, 0, 1.1);
  min-width: 2px;
}

.billing-recent-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 360px;
  overflow-y: auto;
}

.billing-recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.billing-recent-item:last-child {
  border-bottom: none;
}

.billing-recent-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.billing-recent-label {
  color: var(--ink);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

.billing-recent-mid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.billing-tok {
  border-radius: 999px;
}

.billing-recent-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.billing-recent-credits {
  font-weight: 700;
  color: var(--accent);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.billing-recent-time {
  font-size: 11px;
  color: var(--muted);
}

/* Empty / actions */
.billing-empty {
  text-align: center;
  padding: 20px;
  font-size: 13px;
  color: var(--muted);
}

.billing-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0;
}

.billing-toolbar .billing-actions {
  margin-left: auto;
}

@media (max-width: 600px) {
  .billing-stat-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .billing-stat-value {
    font-size: 18px;
  }

  .billing-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .billing-tab-group {
    width: 100%;
    justify-content: stretch;
  }

  .billing-tab-btn {
    flex: 1 1 0;
    text-align: center;
  }

  .billing-group-head,
  .billing-recent-item {
    align-items: flex-start;
  }

  .billing-recent-item {
    flex-direction: column;
  }

  .billing-recent-right {
    align-items: flex-start;
  }
}

/* ======================================================================
   Search Chats Modal
   ====================================================================== */

.search-chats-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: min(18vh, 140px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.search-chats-modal[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.search-chats-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  border: none;
  cursor: default;
}

html[data-theme="dark"] .search-chats-backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.search-chats-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(640px, calc(100vw - 48px));
  max-height: min(72vh, 540px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  animation: searchCardIn 220ms cubic-bezier(0.22, 0.68, 0, 1.1);
  overflow: hidden;
}

html[data-theme="dark"] .search-chats-card {
  background: rgba(20, 20, 22, 0.95);
  border-color: rgba(255, 255, 255, 0.08);
}

@keyframes searchCardIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.97);
  }

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

.search-chats-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.search-chats-input-wrap svg {
  width: 20px;
  height: 20px;
  stroke: var(--muted);
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}

.search-chats-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-family: inherit;
  line-height: 1.4;
}

.search-chats-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.search-chats-close-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms, color 120ms;
}

.search-chats-close-btn:hover {
  background: var(--line);
  color: var(--ink);
}

.search-chats-close-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.search-chats-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 80px;
}

.search-chats-result-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms ease;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: inherit;
}

.search-chats-result-item:hover {
  background: var(--panel-elevated);
}

.search-chats-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-chats-result-snippet {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-chats-result-date {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
}

.search-chats-highlight {
  color: var(--accent);
  font-weight: 600;
  background: rgba(var(--brand-primary-rgb), 0.1);
  border-radius: 2px;
  padding: 0 1px;
}

html[data-theme="dark"] .search-chats-highlight {
  background: rgba(var(--brand-primary-rgb), 0.15);
}

.search-chats-empty,
.search-chats-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.search-chats-kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.65;
  margin-left: auto;
  padding-left: 10px;
}

.search-chats-kbd kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 11px;
  font-family: inherit;
  background: var(--panel-elevated);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  line-height: 1.3;
}

@media (max-width: 480px) {
  .search-chats-modal {
    padding-top: 10vh;
  }

  .search-chats-card {
    width: calc(100vw - 24px);
    max-height: 80vh;
    border-radius: 14px;
  }
}
