html,
body {
    width: 100%;
    overflow-x: hidden;
}

body {
    padding: 10px;
    display: block;
    box-sizing: border-box;
}

body > h2,
.auth-shell,
.user-bar,
.mobile-app-shell {
    width: 100%;
    max-width: none;
}

#appShell {
    width: 100%;
    display: block !important;
}

.top-header {
    width: 100%;
    max-width: none;
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.top-header-title {
    margin: 0;
    text-align: left;
    font-size: 1.6rem;
    line-height: 1.3;
    color: var(--primary-color);
}

.top-header-side {
    display: none;
}

.top-header-side-right {
    display: block;
}

.user-bar {
    width: 100%;
}

.user-menu {
    width: 100%;
    display: flex;
    justify-content: flex-end;
}

.user-menu-toggle {
    width: 100%;
}

/* 只隐藏桌面内容，不隐藏整个 appShell，
   因为 mobileAppShell 就嵌套在 appShell 里面 */
#appShell > .patient-card,
#appShell > .config-bar,
#appShell > .grid-container,
#appShell > .footer-controls {
    display: none !important;
}

.mobile-app-shell {
    display: block !important;
    width: 100%;
}

.user-bar {
    margin-bottom: 10px;
}

.user-menu {
    width: 100%;
    display: flex;
    justify-content: flex-end;
}

.user-menu-panel {
    width: min(320px, calc(100vw - 20px));
}

.auth-card,
.mobile-card,
.modal-content {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.auth-card,
.mobile-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border-left: 5px solid var(--accent-color);
    padding: 14px;
    margin-bottom: 12px;
}

.auth-grid {
    grid-template-columns: 1fr;
}

.auth-tabs {
    flex-wrap: wrap;
}

.auth-actions .config-btn {
    width: 100%;
}

.card-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 14px;
}

.mobile-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.mobile-field label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
    font-weight: 600;
}

.mobile-field select,
.mobile-field input[type="text"],
.mobile-field input[type="number"] {
    width: 100%;
    padding: 11px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
    background: #fff;
}

.mobile-field select:focus,
.mobile-field input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(52,152,219,0.2);
}

.mobile-gender-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mobile-gender-option {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid #dcdfe6;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    color: #333;
    font-weight: 600;
}

.mobile-gender-option input {
    margin-right: 6px;
}

.mobile-nav-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 4px;
}

.mobile-nav-row .btn-field-action {
    margin-top: 0;
    min-width: 0;
    padding-left: 6px;
    padding-right: 6px;
    font-size: 0.88rem;
}

.mobile-progress {
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 12px;
    word-break: break-word;
}

.mobile-actions-stack,
.mobile-footer-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-actions-stack .config-btn,
.mobile-footer-stack > button {
    width: 100%;
}

.mobile-grid-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
    margin-bottom: 12px;
}

.mobile-grid-container .btn {
    width: 100%;
    height: 72px;
    min-height: 72px;
    box-sizing: border-box;
}

.btn-field-action,
.start-btn,
.btn-name-copy,
.nav-btn-moved {
    width: 100%;
    min-width: 0;
    height: 44px;
    margin-top: 10px;
    box-sizing: border-box;
}

.footer-controls,
.config-bar,
.grid-container {
    display: none !important;
}

@media (max-width: 420px) {
    .mobile-nav-row {
        grid-template-columns: 1fr;
    }

    .mobile-gender-group {
        grid-template-columns: 1fr;
    }

    .mobile-nav-row .btn-field-action {
        font-size: 0.95rem;
    }
}