/* System Setup CSS - Redesigned to match multi_day_picker.css style */

/* ===================================================================
   OVERLAY AND CONTAINER - Matching multi_day_picker.css pattern
   =================================================================== */

.system-setup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.system-setup-overlay * {
    font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
    font-feature-settings: "kern" 1;
    text-rendering: optimizeLegibility;
}

.setup-popup {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: fit-content;
    max-width: 90%;
    max-height: 85vh;
    height: fit-content;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease;
    position: relative;
}

.setup-popup.dragging {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    cursor: move;
    user-select: none;
}

/* ===================================================================
   HEADER - Matching multi_day_picker.css green header
   =================================================================== */

.setup-header {
    background-color: #0D882C;
    color: white;
    padding: 15px 20px;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-radius: 8px 8px 0 0;
    cursor: move;
    user-select: none;
}

.setup-header:hover {
    background-color: #0b7a26;
}

/* Prevent text selection during drag */
.setup-popup.dragging * {
    user-select: none !important;
}

.setup-header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.setup-header h2 {
    margin: 0 0 0.25rem 0;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
}

.version_info {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    font-weight: 400;
}

.setup-version-status {
    display: block;
    margin-top: 3px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
}

.setup-version-status--update {
    display: block;
    margin-top: 5px;
    font-size: 0.78rem;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.25);
    color: #FFE566;
    border-left: 3px solid #FFE566;
    border-radius: 0 4px 4px 0;
    padding: 3px 8px;
    width: fit-content;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.user-info-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-name {
    font-weight: 500;
    color: white;
    font-size: 14px;
}

.user-oucare-id {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    font-family: 'Courier New', Monaco, monospace;
}

.admin-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    background: #ef4444;
    color: white;
    font-weight: 500;
}

.hr-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    background: #3b82f6;
    color: white;
    font-weight: 500;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
    padding: 4px 8px;
    margin-left: 1rem;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* ===================================================================
   CONTENT LAYOUT - Two column design
   =================================================================== */

.setup-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background-color: #f8f9fa;
}

.setup-menu {
    width: fit-content;
    min-width: 200px;
    flex-shrink: 0;
    background: white;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
}

.setup-menu-item {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    color: #495057;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.setup-menu-item:hover:not(.disabled) {
    background: #e9ecef;
    color: #0D882C;
}

.setup-menu-item.active {
    background: #d4edda;
    color: #0D882C;
    font-weight: bold;
    border-left: 3px solid #0D882C;
}

.setup-menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #6b7280;
}

.menu-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.disabled-text {
    font-size: 11px;
    color: #6b7280;
    margin-left: auto;
    font-style: italic;
}

/* ===================================================================
   PANELS - Right side content area
   =================================================================== */

.setup-panels {
    flex: 0 1 auto;
    width: fit-content;
    min-width: 400px;
    max-width: 800px; 
    padding: 16px;
    overflow-y: auto;
    background-color: #f8f9fa;
}

.setup-panel {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 16px;
}

.setup-panel.hidden {
    display: none;
}

.setup-panel h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: bold;
    color: #495057;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
}

.setup-panel h4 {
    margin: 12px 0 10px 0;
    font-size: 14px;
    font-weight: bold;
    color: #495057;
}

/* ===================================================================
   FORM ELEMENTS - Matching multi_day_picker.css input styles
   =================================================================== */

.form-group {
    margin-bottom: 12px;
}

.form-group:last-of-type {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #495057;
    margin-bottom: 6px;
}

.form-input,
.form-select {
    width: 100%;
    max-width: 400px;  
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    color: #495057;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #0D882C;
    box-shadow: 0 0 0 2px rgba(13, 136, 44, 0.1);
}

.form-input::placeholder {
    color: #adb5bd;
    font-style: italic;
}

/* Password input container with toggle button */
.input-container {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-container .form-input {
    flex: 1;
}

/* Only change the password panel (avoid affecting login dialog) */
#change-password-panel .input-container {
    position: relative;   /* already true, keep it */
    display: inline-block; /* shrink to input width instead of stretching */
}

#change-password-panel .input-container .form-input {
    padding-right: 82px;  /* room for the Show/Hide button */
}

/* Put the Show/Hide button at the end of the input field */
#change-password-panel .password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1;
}

/* Change Password: limit input width by character count */
#change-password-panel .form-input {
    width: 45ch;          /* exactly ~30 characters */
    max-width: 55ch;      /* hard stop */
    min-width: 20ch;      /* optional safety */
}

/* On small screens your media query makes .input-container column + full-width button.
   Override that behavior for the change-password panel so the suffix stays inside input. */
@media (max-width: 768px) {
    #change-password-panel .input-container {
        display: block;
    }
    #change-password-panel .password-toggle {
        width: auto;
    }
    #system-setup-dialog button,
    #system-setup-dialog .btn {
        width: auto;
    }
}

.password-toggle {
    padding: 6px 12px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.password-toggle:hover {
    background-color: #5a6268;
}

/* ===================================================================
   LANGUAGE SETTINGS - Specific styling
   =================================================================== */

.language-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.current-language-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 12px;
}

.current-language-info p {
    margin: 6px 0;
    font-size: 13px;
    color: #495057;
}

.current-language-info strong {
    color: #212529;
    font-weight: 600;
}

.language-preview {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    padding: 12px;
}

.language-preview h4 {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: bold;
    color: #856404;
}

/* Bold section headings */
.language-section .form-group label,
.current-language-info strong,
.language-preview h4 {
    font-weight: bold;
}

.preview-text {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #856404;
}

.preview-item .label {
    font-weight: 600;
}

/* ===================================================================
   ADMIN FUNCTIONS - Specific styling
   =================================================================== */

.admin-section {
    background: white;
}

.access-denied {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.access-denied-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.access-denied h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #495057;
}

.access-denied p {
    margin: 8px 0;
    font-size: 13px;
    color: #6c757d;
}

/* ===================================================================
   ERROR AND SUCCESS MESSAGES
   =================================================================== */

.error-message {
    color: #dc2626;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.3;
    margin: 4px 0 0 0;
    padding: 0;
    display: block;
    text-align: left;
    transition: opacity 0.2s ease;
}

.error-message:not(.show) {
    opacity: 0;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.error-message.show {
    opacity: 1;
    height: auto;
}

/* Main form errors (at bottom before buttons) */
#setup-change-password-error,
#admin-reset-error,
#language-error {
    margin-top: 8px;
    margin-bottom: 0;
    padding: 6px 10px;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    text-align: left;
    font-size: 0.8rem;
}

/* Completely collapse error messages when not shown */
#setup-change-password-error:not(.show),
#admin-reset-error:not(.show),
#language-error:not(.show) {
    display: none;
}

#setup-change-password-error.show ~ .button-group,
#admin-reset-error.show ~ .button-group,
#language-error.show ~ .button-group {
    margin-top: 12px;
}

.form-input.error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.success-message {
    color: #059669;
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    padding: 6px 10px;
    margin: 10px 0;
    text-align: left;
    font-size: 0.8rem;
    line-height: 1.3;
}

/* ===================================================================
   BUTTONS - Matching multi_day_picker.css button styles
   =================================================================== */

.button-group {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: normal;
    cursor: pointer;
    transition: background-color 0.2s ease;
    min-width: 80px;
}

.btn-primary {
    background-color: #0D882C;
    color: white;
}

.btn-primary:hover {
    background-color: #0b6f23;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ===================================================================
   RESPONSIVE DESIGN
   =================================================================== */

@media (max-width: 768px) {
    .setup-popup {
        width: 95%;
        max-height: 90vh;
    }

    .setup-content {
        flex-direction: column;
    }

    .setup-menu {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
        max-height: 150px;
    }

    .setup-panels {
        padding: 15px;
    }

    .setup-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .setup-header-left {
        width: 100%;
    }

    .user-info {
        width: 100%;
        align-items: flex-start;
    }

    .close-btn {
        position: absolute;
        top: 10px;
        right: 10px;
        margin: 0;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .input-container {
        flex-direction: column;
        align-items: stretch;
    }

    .password-toggle {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .setup-popup {
        max-height: 95vh;
    }

    .setup-header,
    .setup-panels {
        padding: 12px;
    }

    .setup-panel {
        padding: 15px;
    }
}

/* ===================================================================
   DARK MODE - Matching application dark mode support
   =================================================================== */

@media (prefers-color-scheme: dark) {
    .setup-popup {
        background: #343a40;
        color: #f8f9fa;
    }

    .setup-header {
        background-color: #0D882C;
    }

    .setup-content {
        background-color: #495057;
    }

    .setup-menu {
        background: #343a40;
        border-right-color: #6c757d;
    }

    .setup-menu-item {
        color: #f8f9fa;
        border-bottom-color: #495057;
    }

    .setup-menu-item:hover:not(.disabled) {
        background: #495057;
    }

    .setup-menu-item.active {
        background: #0D882C;
        color: white;
    }

    .setup-panels {
        background-color: #495057;
    }

    .setup-panel {
        background: #343a40;
        border-color: #6c757d;
    }

    .setup-panel h3,
    .setup-panel h4 {
        color: #f8f9fa;
        border-bottom-color: #6c757d;
    }

    .form-group label {
        color: #f8f9fa;
    }

    .form-input,
    .form-select {
        background: #495057;
        border-color: #6c757d;
        color: #f8f9fa;
    }

    .current-language-info {
        background: #495057;
        border-color: #6c757d;
    }

    .current-language-info p {
        color: #f8f9fa;
    }

    .current-language-info strong {
        color: white;
    }

    .language-preview {
        background: #856404;
        border-color: #ffc107;
    }

    .language-preview h4,
    .preview-item {
        color: #fff3cd;
    }

    .access-denied {
        color: #adb5bd;
    }

    .access-denied h4 {
        color: #f8f9fa;
    }

    .access-denied p {
        color: #adb5bd;
    }

    .error-message {
        color: #fca5a5;
    }

    #setup-change-password-error,
    #admin-reset-error,
    #language-error {
        background-color: #431a1a;
        border-color: #7f1d1d;
    }

    .form-input.error {
        border-color: #dc2626;
        box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
    }

    .success-message {
        color: #6ee7b7;
        background-color: #064e3b;
        border-color: #047857;
    }
}

/* ===================================================================
   TW9900 RECOVERY - Specific styling
   =================================================================== */

.recovery-section {
    background: white;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
}

.recovery-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: normal;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    cursor: pointer;
}

.help-text {
    display: block;
    font-size: 11px;
    color: #6c757d;
    margin-top: 4px;
    font-style: italic;
}

.recovery-status-box,
.recovery-result-box {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #f8f9fa;
    font-size: 13px;
    max-height: 300px;
    overflow-y: auto;
}

.recovery-status-box.hidden,
.recovery-result-box.hidden {
    display: none;
}

.recovery-stat {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #dee2e6;
}

.recovery-stat:last-child {
    border-bottom: none;
}

.recovery-stat-label {
    font-weight: 600;
    color: #495057;
}

.recovery-stat-value {
    color: #6c757d;
}

.recovery-date-list {
    margin-top: 8px;
    padding-left: 20px;
    font-size: 12px;
    color: #6c757d;
}

.recovery-progress {
    margin-top: 12px;
    padding: 12px;
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
}

.recovery-success {
    color: #059669;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.recovery-warning {
    color: #f59e0b;
    background: #fffbeb;
    border-color: #fde68a;
}

.recovery-error {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fecaca;
}

/* ===================================================================
   DATE ACTIVITY TABLE
   =================================================================== */

.date-activity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 8px;
    background: white;
}

.date-activity-table thead {
    background: #f3f4f6;
    font-weight: 600;
}

.date-activity-table th,
.date-activity-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.date-activity-table th {
    color: #374151;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.date-activity-table td {
    color: #6b7280;
}

.date-activity-table tbody tr:hover {
    background: #f9fafb;
}

/* Status-specific row styling */
.date-activity-table .status-today {
    background: #eff6ff;
}

.date-activity-table .status-complete {
    background: #f0fdf4;
}

.date-activity-table .status-suspicious {
    background: #fffbeb;
}

.date-activity-table .status-missing {
    background: #fef2f2;
}

/* Make date column monospace */
.date-activity-table td:first-child {
    font-family: 'Courier New', Monaco, monospace;
    font-weight: 500;
}

/* Right-align entry count */
.date-activity-table td:nth-child(2) {
    text-align: right;
    font-family: 'Courier New', Monaco, monospace;
}

/* Monospace for time */
.date-activity-table td:nth-child(3) {
    font-family: 'Courier New', Monaco, monospace;
}

/* Responsive table on small screens */
@media (max-width: 768px) {
    .date-activity-table {
        font-size: 11px;
    }
    
    .date-activity-table th,
    .date-activity-table td {
        padding: 4px 6px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .date-activity-table {
        background: #343a40;
    }
    
    .date-activity-table thead {
        background: #495057;
    }
    
    .date-activity-table th {
        color: #f8f9fa;
    }
    
    .date-activity-table td {
        color: #adb5bd;
        border-bottom-color: #495057;
    }
    
    .date-activity-table tbody tr:hover {
        background: #495057;
    }
    
    .date-activity-table .status-today {
        background: #1e3a5f;
    }
    
    .date-activity-table .status-complete {
        background: #0f3d25;
    }
    
    .date-activity-table .status-suspicious {
        background: #4d3a0f;
    }
    
    .date-activity-table .status-missing {
        background: #3d1414;
    }
}

/* ===================================================================
   PRINT STYLES
   =================================================================== */

@media print {
    .system-setup-overlay {
        display: none !important;
    }
}

.info-message {
    background-color: #e0f2fe;
    border: 1px solid #0ea5e9;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
    color: #0c4a6e;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: normal;
}

/* Only the message text should respect \n */
.info-message .temp-password-notice-text {
    white-space: pre-line;    /* respects \n but collapses indentation */
    margin: 0;
}

/* Prevent emoji icon from looking clipped */
.info-message .temp-password-notice-icon {
    line-height: 1;
    display: inline-block;
    margin-top: 2px;
}

/* In system_setup.css */

.info-message button.btn {
    margin-top: 0;
}

.error-message button.btn {
    background-color: #dc2626;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.error-message button.btn:hover {
    background-color: #b91c1c;
}

.error-message button.btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

/* System Setup dialog buttons: size to content */
#system-setup-dialog button,
#system-setup-dialog .btn {
    width: auto;
    min-width: unset;
    padding: 8px 16px;   /* consistent spacing around caption */
    white-space: nowrap;
}

/* Bottom action row: left-aligned buttons */
#system-setup-dialog .button-row,
#system-setup-dialog .form-actions,
#system-setup-dialog .dialog-footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
}

/* =========================================================
   System Setup: buttons should size to caption + padding
   and bottom row should be left-aligned
   (scoped by .system-setup-overlay)
   ========================================================= */

.system-setup-overlay .btn,
.system-setup-overlay button.btn,
.system-setup-overlay .setup-menu-item {
    width: auto;              /* override any width:100% */
    min-width: 0;             /* override .btn min-width:80px */
    padding: 6px 12px;        /* keep consistent spacing */
    white-space: nowrap;
}

/* Bottom action row: left align */
.system-setup-overlay .button-group {
    justify-content: flex-start;  /* override flex-end */
}

/* If you have any other button rows, keep them left too */
.system-setup-overlay .button-row,
.system-setup-overlay .form-actions,
.system-setup-overlay .dialog-footer {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
}

/* Mobile overrides: don't force full-width buttons in this dialog */
@media (max-width: 768px) {
    .system-setup-overlay .button-group {
        flex-direction: row;       /* override column */
        flex-wrap: wrap;           /* wrap if too many */
        align-items: center;
    }

    .system-setup-overlay .btn,
    .system-setup-overlay button.btn {
        width: auto;               /* override width:100% */
    }
}

/* =========================================================
   FORCE System Setup button sizing + left alignment
   (beats global .btn/.button-group rules from other CSS files)
   ========================================================= */

.system-setup-overlay .setup-popup .setup-panel .button-group {
    justify-content: flex-start !important;  /* left align */
    align-items: center !important;
}

/* Make ALL buttons in this dialog shrink-wrap to caption */
.system-setup-overlay .setup-popup button,
.system-setup-overlay .setup-popup .btn,
.system-setup-overlay .setup-popup .password-toggle {
    width: auto !important;
    min-width: 0 !important;          /* overrides your .btn min-width:80px  [oai_citation:1‡system_setup.css](sediment://file_00000000631c71fa844bc5bb9b907764) */
    flex: 0 0 auto !important;        /* prevents flex-grow stretching */
    white-space: nowrap !important;
}

/* Mobile: stop the dialog from forcing full-width buttons */
@media (max-width: 768px) {
    .system-setup-overlay .setup-popup .setup-panel .button-group {
        flex-direction: row !important;   /* overrides your column rule  [oai_citation:2‡system_setup.css](sediment://file_00000000631c71fa844bc5bb9b907764) */
        flex-wrap: wrap !important;
    }

    .system-setup-overlay .setup-popup .btn,
    .system-setup-overlay .setup-popup button {
        width: auto !important;           /* overrides your width:100% rule  [oai_citation:3‡system_setup.css](sediment://file_00000000631c71fa844bc5bb9b907764) */
    }
}

/* =================================================================
   MOBILE SHEET TREATMENT — must live at the very end of this file.
   The earlier @media (max-width: 768px) block (around line 631) shrinks
   .setup-popup to 95% / 90 vh, which is closer to a centred modal than
   to a full-screen sheet. The subsequent file-scope rules and the
   button overrides at the end of this file would otherwise win on
   source order and pull the sizing back. The full-screen overrides go
   here, after every other rule in this file, so they consistently win.
   ================================================================= */
@media (max-width: 768px) {
    .system-setup-overlay {
        padding: 0;
    }

    .setup-popup {
        width: 100%;
        max-width: none;
        min-width: 0;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .setup-header {
        position: sticky;
        top: 0;
        z-index: 1;
        border-radius: 0;
        cursor: default;
        flex-shrink: 0;
    }

    /* Drag is mouse-only and a no-op on touch; neutralize the
       desktop .dragging visual so a stray hover/tap doesn't paint
       the move cursor or the heavy shadow on a phone. */
    .setup-popup.dragging {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        cursor: default;
    }

    /* setup-content already becomes flex-direction: column on mobile
       (existing rule). Make sure it actually takes the remaining height
       between the sticky header and the bottom of the sheet so its
       inner scroll regions (.setup-menu / .setup-panels) work. */
    .setup-content {
        flex: 1;
        min-height: 0;
    }

    /* The desktop rule .setup-panels { min-width: 400px; max-width: 800px }
       forces the right pane wider than a phone viewport, so its right
       edge gets trimmed under the sheet's right edge. Drop the hard
       width constraints on mobile and let the pane fill its container. */
    .setup-panels {
        min-width: 0;
        max-width: none;
        width: 100%;
        box-sizing: border-box;
    }

    /* The Change Password input is sized in ch units on desktop
       (width: 45ch / max-width: 55ch). On a ~380 px phone that's wider
       than the viewport and pushes the right edge of the panel out of
       view. Cap to the parent's available width — the absolute-
       positioned Show/Hide button stays in place because it's
       positioned relative to .input-container, not to the input. */
    #change-password-panel .form-input {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
}
