* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 72px 0 0 0;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
    color: #111827;
    background-color: #FAFAFA;
}

a {
    color: inherit;
}

.topbar {
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    right: 0;
    min-height: 70px;
    background-color: rgba(255, 255, 255, 0.96);
    border-bottom: solid 1px #E5E7EB;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
    font-size: 10.5pt;
    color: #111827;
    backdrop-filter: blur(10px);
}

.topbar::after {
    content: "";
    display: block;
    clear: both;
}

.topbar ul {
    list-style: none;
}

.topbar ul.top-left {
    width: 20%;
    float: left;
    margin: 0;
    padding: 0;
}

.topbar ul.top-left li {
    display: block;
}

.topbar ul.top-left li img {
    height: 50px;
    width: 50px;
    border-radius: 100%;
    margin: 10px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
}

.topbar ul.top-main {
    display: flex;
    gap: 4px;
    width: 44%;
    float: left;
    margin: 0 0 0 8%;
    padding: 11px 0;
}

.topbar ul.top-main a {
    flex: 1 1 auto;
    text-decoration: none;
}

.topbar ul.top-main li {
    width: auto;
    flex: 1 1 auto;
    min-height: 48px;
    float: none;
    text-align: center;
    display: block;
    color: #111827;
    border-radius: 8px;
    line-height: 48px;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.topbar ul.top-main li:hover,
.topbar ul.top-main li.selected {
    background-color: #E8EEF8;
    color: #174EA6;
}

.topbar ul.top-right {
    width: 20%;
    float: right;
    margin: 0;
    padding: 11px 10px 0 0;
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
}

.topbar ul.top-right a {
    text-decoration: none;
}

.topbar ul.top-right li {
    display: block;
    float: none;
    min-width: 110px;
    padding: 0 14px;
    text-align: center;
    color: #111827;
    border: solid 1px #E5E7EB;
    border-radius: 8px;
    line-height: 46px;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

.topbar ul.top-right li:hover {
    background-color: #F4F5F7;
    border-color: #D1D5DB;
}

.topbar ul.top-right li.profile-menu {
    position: relative;
    min-width: 0;
    padding: 0;
    border: none;
    line-height: 1;
    background-color: transparent;
}

.topbar ul.top-right li.top-ai-credit {
    position: relative;
    min-width: 0;
    margin-right: 10px;
    padding: 0;
    border: none;
    line-height: 1;
    background-color: transparent;
}

.topbar ul.top-right li.profile-menu:hover {
    background-color: transparent;
    border-color: transparent;
}

.topbar ul.top-right li.top-ai-credit:hover {
    background-color: transparent;
    border-color: transparent;
}

.profile-menu details {
    position: relative;
}

.top-ai-credit details {
    position: relative;
}

.profile-menu summary {
    width: 46px;
    height: 46px;
    display: block;
    border: solid 1px #E5E7EB;
    border-radius: 100%;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.top-ai-credit summary {
    min-width: 88px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: solid 1px #DDE7F8;
    border-radius: 14px;
    padding: 0 14px;
    cursor: pointer;
    background: linear-gradient(180deg, #F8FBFF 0%, #EDF4FF 100%);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.profile-menu summary::-webkit-details-marker {
    display: none;
}

.top-ai-credit summary::-webkit-details-marker {
    display: none;
}

.profile-menu summary::marker {
    content: "";
}

.top-ai-credit summary::marker {
    content: "";
}

.profile-menu summary:hover,
.profile-menu details[open] summary {
    border-color: #B8C5E4;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.18);
}

.top-ai-credit summary:hover,
.top-ai-credit details[open] summary {
    border-color: #B8C5E4;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
    transform: translateY(-1px);
}

.profile-menu summary img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.top-ai-credit summary .top-ai-credit-label {
    color: #6B7280;
    font-size: 9pt;
    font-weight: bold;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.top-ai-credit summary strong {
    color: #174EA6;
    font-size: 11.5pt;
    font-weight: 800;
    line-height: 1;
}

.profile-menu-list {
    position: absolute;
    z-index: 20;
    top: 56px;
    right: 0;
    min-width: 180px;
    padding: 6px;
    border: solid 1px #E5E7EB;
    border-radius: 10px;
    background-color: #FFF;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}

.profile-menu-list a {
    display: block;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    line-height: 38px;
    text-align: left;
    text-decoration: none;
    color: #111827;
    white-space: nowrap;
}

.profile-menu-list a:hover {
    background-color: #F4F5F7;
}

.top-ai-credit-panel {
    position: absolute;
    z-index: 20;
    top: 56px;
    right: 0;
    min-width: 240px;
    padding: 12px 14px;
    border: solid 1px #DDE7F8;
    border-radius: 12px;
    background-color: #FFF;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
    display: none;
}

.top-ai-credit details:hover .top-ai-credit-panel,
.top-ai-credit details:focus-within .top-ai-credit-panel,
.top-ai-credit details[open] .top-ai-credit-panel {
    display: grid;
    gap: 4px;
}

.top-ai-credit-panel strong {
    color: #111827;
    font-size: 10.5pt;
}

.top-ai-credit-panel span {
    color: #6B7280;
    font-size: 9.5pt;
}

.main {
    width: min(950px, calc(100% - 32px));
    margin: 38px auto 50px auto;
}

.main h1 {
    margin: 0 0 22px 0;
    font-size: clamp(22px, 4vw, 34px);
    line-height: 1.2;
}

.main ul.posts {
    margin: 0;
    padding: 0;
}

.main ul.posts a {
    text-decoration: none;
}

.main ul.posts li {
    background-color: #FFF;
    border: solid 1px #E5E7EB;
    border-radius: 10px;
    padding: 20px;
    margin: 12px 0;
    color: #111827;
    width: 100%;
    display: block;
    font-size: 11pt;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.main ul.posts a:hover li {
    border-color: #C7D2FE;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.09);
    transform: translateY(-1px);
}

.main ul.posts li div {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 10pt;
    margin-bottom: 14px;
    color: #6B7280;
}

.main ul.posts li div span {
    flex: 0 0 auto;
    float: none;
    color: #374151;
    font-weight: bold;
}

.main ul.categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
}

.main ul.categories a {
    text-decoration: none;
    color: #111827;
}

.main ul.categories li {
    background-color: #FFF;
    border: solid 1px #E5E7EB;
    border-radius: 10px;
    padding: 18px 20px;
    margin: 0;
    color: #111827;
    width: auto;
    min-height: 64px;
    float: none;
    display: flex;
    align-items: center;
    font-size: 11pt;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.main ul.categories a:hover li {
    border-color: #C7D2FE;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.09);
    transform: translateY(-1px);
}

.main div.searchbox {
    background-color: #FFF;
    border: solid 1px #E5E7EB;
    border-radius: 12px;
    padding: 20px;
    margin: 0 0 22px 0;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.main div.searchbox form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.main div.searchbox br {
    display: none;
}

.main div.searchbox input {
    height: 52px;
    width: 100%;
    border: solid 1px #D1D5DB;
    border-radius: 8px;
    font-size: 12pt;
    flex: 0 0 100%;
    margin: 0 0 6px 0;
    padding: 0 16px;
    text-align: center;
    color: #111827;
}

.main div.searchbox input:focus {
    outline: none;
    border-color: #2266DD;
    box-shadow: 0 0 0 3px rgba(34, 102, 221, 0.14);
}

.main div.searchbox button {
    flex: 1 1 0;
    width: auto;
    min-height: 42px;
    margin: 0;
    padding: 8px 10px;
    background-color: #F4F5F7;
    border: solid 1px #D1D5DB;
    border-radius: 8px;
    cursor: pointer;
    font-size: 10pt;
    color: #111827;
}

.main div.searchbox button:hover {
    background-color: #E8EEF8;
    border-color: #B8C5E4;
}

.content {
    background-color: #FFF;
    border: solid 1px #E5E7EB;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.account-settings {
    display: grid;
    gap: 14px;
}

.account-section h2 {
    margin: 0 0 16px 0;
    font-size: 15pt;
}

.account-message {
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 10.5pt;
}

.account-message.success {
    color: #166534;
    background-color: #DCFCE7;
    border: solid 1px #BBF7D0;
}

.account-message.error {
    color: #991B1B;
    background-color: #FEF2F2;
    border: solid 1px #FECACA;
}

.account-message.info {
    color: #1E40AF;
    background-color: #EFF6FF;
    border: solid 1px #BFDBFE;
}

.account-summary {
    display: grid;
    gap: 10px;
    margin: 0;
}

.account-summary div {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: solid 1px #EEF2F7;
}

.account-summary div:last-child {
    border-bottom: none;
}

.account-summary dt {
    color: #6B7280;
    font-size: 10pt;
}

.account-summary dd {
    margin: 0;
    color: #111827;
    font-weight: bold;
}

.account-status {
    display: inline-block;
    min-width: 68px;
    border-radius: 999px;
    padding: 4px 10px;
    text-align: center;
    font-size: 10pt;
}

.account-status.active {
    color: #166534;
    background-color: #DCFCE7;
}

.account-status.passive {
    color: #991B1B;
    background-color: #FEF2F2;
}

.account-form {
    display: grid;
    gap: 8px;
    max-width: 420px;
}

.account-form label {
    color: #374151;
    font-size: 10pt;
    font-weight: bold;
}

.account-form input {
    height: 44px;
    border: solid 1px #D1D5DB;
    border-radius: 8px;
    padding: 0 12px;
    font-size: 11pt;
}

.account-form input:focus {
    outline: none;
    border-color: #2266DD;
    box-shadow: 0 0 0 3px rgba(34, 102, 221, 0.14);
}

.account-form button {
    width: max-content;
    min-height: 42px;
    margin-top: 6px;
    border: none;
    border-radius: 8px;
    padding: 0 16px;
    color: #FFF;
    background-color: #111827;
    cursor: pointer;
    font-size: 10.5pt;
    font-weight: bold;
}

.subscription-offer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-color: #C7D7F5;
    background: linear-gradient(135deg, #F8FBFF, #FFF);
}

.subscription-offer h2 {
    margin-bottom: 8px;
}

.subscription-offer p {
    margin: 0;
    color: #4B5563;
}

.subscription-offer .subscription-price {
    margin-top: 12px;
    color: #111827;
    font-size: 18pt;
    font-weight: bold;
}

.subscription-offer .subscription-price span {
    color: #6B7280;
    font-size: 10pt;
    font-weight: normal;
}

.subscription-offer .subscription-note {
    margin-top: 8px;
    font-size: 9.5pt;
}

.subscription-offer button {
    min-height: 44px;
    border: none;
    border-radius: 8px;
    padding: 0 18px;
    color: #FFF;
    background-color: #111827;
    cursor: pointer;
    font-size: 10.5pt;
    font-weight: bold;
    white-space: nowrap;
}

button.noprint {
    border-radius: 8px;
    margin: 0 0 10px 10px;
}

.ai-main {
    width: 100%;
}

.ai-page {
    height: 100vh;
    overflow: hidden;
}

.ai-page .ai-main {
    height: calc(100vh - 72px);
    margin: 0;
    padding: 0;
}

.ai-page .footer {
    display: none;
}

.ai-shell {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: 280px 1fr;
    background-color: #FFF;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

.ai-sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    min-height: 0;
    padding: 14px;
    border-right: solid 1px #E5E7EB;
    background-color: #F8FAFC;
}

.ai-new-chat {
    width: 100%;
    min-height: 42px;
    border: solid 1px #D1D5DB;
    border-radius: 10px;
    padding: 0 14px;
    font-size: 10.5pt;
    font-weight: bold;
    color: #111827;
    background-color: #FFF;
    cursor: pointer;
}

.ai-new-chat:hover {
    background-color: #E8EEF8;
    border-color: #B8C5E4;
}

.ai-history {
    flex: 1 1 auto;
    overflow-y: auto;
}

.ai-history p {
    margin: 8px 4px;
    color: #6B7280;
    font-size: 10pt;
}

.ai-history a {
    display: block;
    margin-bottom: 6px;
    padding: 10px;
    border-radius: 10px;
    text-decoration: none;
    color: #111827;
}

.ai-history a:hover,
.ai-history a.selected {
    background-color: #E8EEF8;
}

.ai-history span,
.ai-history small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-history span {
    font-size: 10.5pt;
}

.ai-history small {
    margin-top: 3px;
    color: #6B7280;
    font-size: 9pt;
}

.ai-chat {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.ai-chat-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.ai-locked .ai-sidebar,
.ai-locked .ai-chat-content {
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
}

.ai-new-chat:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.ai-lock-overlay {
    position: absolute;
    z-index: 5;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-color: rgba(255, 255, 255, 0.7);
}

.ai-lock-card {
    width: min(420px, 100%);
    padding: 28px;
    border: solid 1px #D8DEE8;
    border-radius: 16px;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

.ai-lock-icon {
    margin-bottom: 8px;
    font-size: 26pt;
}

.ai-lock-card h2 {
    margin: 0 0 10px 0;
    color: #111827;
    font-size: 16pt;
}

.ai-lock-card p {
    margin: 0 0 18px 0;
    color: #6B7280;
    font-size: 10.5pt;
    line-height: 1.5;
}

.ai-lock-card a {
    display: inline-block;
    min-height: 42px;
    border-radius: 8px;
    padding: 12px 18px;
    color: #FFF;
    background-color: #111827;
    text-decoration: none;
    font-size: 10.5pt;
    font-weight: bold;
}

.subscription-lock-overlay {
    position: fixed;
    z-index: 1000;
    top: 72px;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-color: rgba(255, 255, 255, 0.62);
    -webkit-backdrop-filter: blur(7px);
    backdrop-filter: blur(7px);
}

.subscription-lock-card {
    width: min(420px, 100%);
    padding: 28px;
    border: solid 1px #D8DEE8;
    border-radius: 16px;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

.subscription-lock-icon {
    margin-bottom: 8px;
    font-size: 26pt;
}

.subscription-lock-card h2 {
    margin: 0 0 10px 0;
    color: #111827;
    font-size: 16pt;
}

.subscription-lock-card p {
    margin: 0 0 18px 0;
    color: #6B7280;
    font-size: 10.5pt;
    line-height: 1.5;
}

.subscription-lock-card a {
    display: inline-block;
    min-height: 42px;
    border-radius: 8px;
    padding: 12px 18px;
    color: #FFF;
    background-color: #111827;
    text-decoration: none;
    font-size: 10.5pt;
    font-weight: bold;
}

.subscription-locked-placeholder {
    display: grid;
    gap: 14px;
}

.subscription-placeholder-block {
    min-height: 118px;
    border-radius: 12px;
    background: linear-gradient(110deg, #E5E7EB 8%, #F3F4F6 18%, #E5E7EB 33%);
    background-size: 200% 100%;
    filter: blur(4px);
}

.subscription-placeholder-block.short {
    min-height: 54px;
}

.ai-chat-actions {
    position: absolute;
    z-index: 2;
    top: 12px;
    right: 12px;
}

.ai-more {
    position: relative;
}

.ai-more > button {
    width: 38px;
    height: 38px;
    border: solid 1px #E5E7EB;
    border-radius: 10px;
    color: #374151;
    background-color: #FFF;
    cursor: pointer;
    font-size: 16pt;
    line-height: 1;
}

.ai-more > button:hover,
.ai-more:focus-within > button {
    background-color: #F4F5F7;
    border-color: #D1D5DB;
}

.ai-more-menu {
    position: absolute;
    top: 44px;
    right: 0;
    min-width: 150px;
    display: none;
    padding: 6px;
    border: solid 1px #E5E7EB;
    border-radius: 10px;
    background-color: #FFF;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}

.ai-more:hover .ai-more-menu,
.ai-more:focus-within .ai-more-menu {
    display: block;
}

.ai-more-menu a,
.ai-more-menu button {
    display: block;
    width: 100%;
    min-height: 36px;
    border: none;
    border-radius: 8px;
    padding: 0 10px;
    text-align: left;
    background-color: transparent;
    cursor: pointer;
    font-size: 10pt;
}

.ai-more-menu a {
    color: #174EA6;
    text-decoration: none;
    line-height: 36px;
}

.ai-more-menu button {
    color: #991B1B;
}

.ai-more-menu form {
    margin-block-end: 0;
}

.ai-more-menu a:hover {
    background-color: #EFF6FF;
}

.ai-more-menu button:hover {
    background-color: #FEF2F2;
}

.ai-thread {
    flex: 1 1 auto;
    min-height: 0;
    padding: 56px 24px;
    overflow-y: auto;
}

.ai-empty {
    max-width: 560px;
    margin: auto;
    text-align: center;
}

.ai-empty h1 {
    margin: 0 0 10px 0;
    font-size: clamp(28px, 5vw, 44px);
    line-height: 1.12;
}

.ai-empty p {
    margin: 0;
    color: #6B7280;
    font-size: 12pt;
}

.ai-messages {
    width: min(760px, 100%);
    margin: 0 auto;
}

.ai-message {
    display: flex;
    margin: 0 0 18px 0;
}

.ai-message > div {
    max-width: 82%;
    border: solid 1px #E5E7EB;
    border-radius: 14px;
    padding: 13px 15px;
    font-size: 11pt;
    line-height: 1.55;
    white-space: normal;
}

.ai-message.user {
    justify-content: flex-end;
}

.ai-message.user > div {
    color: #FFF;
    background-color: #111827;
    border-color: #111827;
}

.ai-message.assistant {
    justify-content: flex-start;
}

.ai-message.assistant > div {
    color: #111827;
    background-color: #F8FAFC;
}

.ai-message sup {
    color: #174EA6;
    font-weight: bold;
}

.ai-message.loading > div {
    color: #6B7280;
    font-style: italic;
}

.ai-literature,
.ai-reference-box {
    margin-top: 14px;
    padding: 12px 13px;
    border: solid 1px #D8DEE8;
    border-left: solid 4px #174EA6;
    border-radius: 8px;
    color: #1F2937;
    background-color: #FFF;
    font-size: 10pt;
}

.ai-literature > strong,
.ai-reference-box > strong {
    display: block;
    margin-bottom: 7px;
    color: #174EA6;
}

.ai-literature > div,
.ai-reference-box > div {
    line-height: 1.5;
}

.ai-case-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-case-links a,
.ai-case-links span {
    display: block;
    color: #174EA6;
    text-decoration: none;
    font-weight: 700;
    line-height: 1.45;
}

.ai-case-links a:hover {
    text-decoration: underline;
}

.ai-case-index {
    color: #6B7280;
    font-weight: 800;
    margin-right: 4px;
}

.ai-composer {
    flex: 0 0 auto;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding: 14px;
    border-top: solid 1px #E5E7EB;
    background-color: #FAFAFA;
}

.ai-composer textarea {
    flex: 1 1 auto;
    min-height: 52px;
    max-height: 160px;
    resize: none;
    border: solid 1px #D1D5DB;
    border-radius: 12px;
    padding: 15px 16px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11pt;
    line-height: 1.4;
    color: #111827;
    background-color: #FFF;
}

.ai-composer textarea:focus {
    outline: none;
    border-color: #2266DD;
    box-shadow: 0 0 0 3px rgba(34, 102, 221, 0.14);
}

.ai-composer button {
    min-height: 52px;
    border: none;
    border-radius: 12px;
    padding: 0 20px;
    font-size: 10.5pt;
    font-weight: bold;
    color: #FFF;
    background-color: #111827;
    cursor: pointer;
}

.ai-composer textarea:disabled,
.ai-composer button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.footer {
    width: min(950px, calc(100% - 32px));
    margin: 0 auto 50px auto;
    text-align: center;
    color: #6B7280;
}

.footer a {
    display: inline-block;
    text-decoration: none;
    color: #444;
    font-size: 10pt;
    padding: 5px 2px;
}

.footer a:hover {
    color: #174EA6;
}

.clear {
    clear: both;
}

@media (max-width: 760px) {
    body {
        padding-top: 128px;
    }

    .subscription-lock-overlay {
        top: 128px;
    }

    .topbar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        min-height: 112px;
    }

    .topbar ul.top-left {
        order: 1;
        width: 64px;
        float: none;
    }

    .topbar ul.top-left li img {
        height: 44px;
        width: 44px;
        margin: 10px;
    }

    .topbar ul.top-right {
        order: 2;
        width: calc(100% - 64px);
        float: none;
        padding: 9px 12px 0 0;
    }

    .topbar ul.top-right li {
        min-width: 0;
        line-height: 40px;
        padding: 0 12px;
    }

    .topbar ul.top-right li.top-ai-credit {
        margin-right: 0;
    }

    .top-ai-credit summary {
        min-width: 0;
        height: 40px;
        padding: 0 10px;
    }

    .top-ai-credit summary .top-ai-credit-label {
        display: none;
    }

    .top-ai-credit-panel {
        min-width: 220px;
    }

    .topbar ul.top-main {
        order: 3;
        clear: both;
        width: 100%;
        float: none;
        margin: 0;
        padding: 6px 10px 10px 10px;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .topbar ul.top-main li {
        width: auto;
        min-width: max-content;
        float: none;
        display: inline-block;
        min-height: 38px;
        padding: 0 12px;
        line-height: 38px;
    }

    .topbar ul.top-main a {
        flex: 0 0 auto;
    }

    .main {
        width: calc(100% - 24px);
        margin-top: 24px;
    }

    .main ul.posts li {
        padding: 16px;
        font-size: 10.5pt;
    }

    .main ul.posts li div {
        display: block;
        margin-bottom: 10px;
    }

    .main ul.posts li div span {
        display: block;
        margin-top: 4px;
    }

    .main div.searchbox {
        padding: 14px;
    }

    .main div.searchbox button {
        flex: 0 0 100%;
        width: 100%;
        margin: 6px 0 0 0;
    }

    .content {
        padding: 16px;
    }

    .account-summary div {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .account-form {
        max-width: none;
    }

    .account-form button {
        width: 100%;
    }

    .subscription-offer {
        display: grid;
        gap: 16px;
    }

    .subscription-offer button {
        width: 100%;
    }

    button.noprint,
    .fr {
        width: 100%;
        float: none;
        margin: 0 0 8px 0;
    }

    .footer {
        width: calc(100% - 24px);
        margin-bottom: 32px;
        line-height: 1.8;
    }

    .ai-main {
        width: 100%;
    }

    .ai-page .ai-main {
        height: calc(100vh - 128px);
        margin-top: 0;
        padding: 0;
    }

    .ai-shell {
        height: 100%;
        min-height: 0;
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
        border-radius: 0;
    }

    .ai-sidebar {
        min-height: 0;
        max-height: 180px;
        border-right: none;
        border-bottom: solid 1px #E5E7EB;
        overflow: hidden;
    }

    .ai-history {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .ai-history a {
        flex: 0 0 190px;
    }

    .ai-thread {
        min-height: 0;
        padding: 40px 18px;
    }

    .ai-message > div {
        max-width: 92%;
    }

    .ai-composer {
        display: block;
    }

    .ai-composer textarea,
    .ai-composer button {
        width: 100%;
    }

    .ai-composer button {
        margin-top: 8px;
    }
}

@media (max-width: 520px) {
    body {
        padding-top: 174px;
    }

    .subscription-lock-overlay {
        top: 174px;
    }

    .topbar {
        min-height: 160px;
    }

    .ai-page .ai-main {
        height: calc(100vh - 174px);
    }

    .topbar ul.top-main {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        overflow: visible;
        white-space: normal;
    }

    .topbar ul.top-main a {
        width: 100%;
    }

    .topbar ul.top-main li {
        width: 100%;
        min-width: 0;
        padding: 0 8px;
        font-size: 10pt;
    }

    .top-ai-credit-panel {
        right: -6px;
        min-width: 210px;
    }
}

@media (max-width: 360px) {
    body {
        padding-top: 226px;
    }

    .subscription-lock-overlay {
        top: 226px;
    }

    .topbar {
        min-height: 212px;
    }

    .ai-page .ai-main {
        height: calc(100vh - 226px);
    }

    .topbar ul.top-main {
        grid-template-columns: 1fr 1fr;
    }

    .topbar ul.top-main li {
        padding: 0 8px;
    }
}
