* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f4f4f9;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 16px;
}

.form-container {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 500px;
}

h2 {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
    font-size: 1.5rem;
}

form label {
    display: block;
    margin-top: 16px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
}

form input, 
form select {
    width: 100%;
    padding: 12px;
    margin-top: 6px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background-color: #fff;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

/* Увеличенный размер для удобного нажатия на телефоне */
form input:focus,
form select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

form button {
    margin-top: 24px;
    width: 100%;
    padding: 14px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.05s;
}

form button:active {
    transform: scale(0.98);
    background-color: #0056b3;
}

/* Стили для дата-пикера на телефонах */
input[type="date"] {
    position: relative;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    padding: 8px;
    cursor: pointer;
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .form-container {
        padding: 16px;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    form input, 
    form select {
        padding: 14px;
        font-size: 16px;
    }
    
    form button {
        padding: 16px;
        font-size: 18px;
    }
}

/* Убираем увеличение шрифта на iPhone при повороте */
@media screen and (max-width: 768px) {
    input, select, button {
        font-size: 16px;
    }
}

/* === Базовые стили (сохранены из исходного файла) === */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f4f4f9;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 16px;
}

.app-container {
    width: 100%;
    max-width: 600px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 20px;
}

h2 {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
    font-size: 1.5rem;
}

/* === Меню === */
.menu-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.menu-btn {
    padding: 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.05s;
    text-align: center;
}

.menu-btn:active {
    transform: scale(0.98);
    background-color: #0056b3;
}

/* === Страницы === */
.page-container {
    animation: fadeIn 0.2s;
}

.page-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.back-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px 12px;
    margin-right: 8px;
    color: #007bff;
    font-weight: bold;
}

.back-btn:hover {
    opacity: 0.7;
}

.page-header h2 {
    margin: 0;
    flex: 1;
}

/* Заглушка */
.stub-content {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 18px;
}

/* Чат ЖКХ подменю */
.chat-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-sub-btn {
    padding: 14px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.chat-sub-btn:hover {
    background-color: #e0e0e0;
}

/* Форма задачи */
.task-form label {
    display: block;
    margin-top: 16px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
}

.task-form input,
.task-form select,
.task-form textarea {
    width: 100%;
    padding: 12px;
    margin-top: 6px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background-color: #fff;
    transition: border-color 0.2s;
}

.task-form input:focus,
.task-form select:focus,
.task-form textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.task-form button[type="submit"] {
    margin-top: 24px;
    width: 100%;
    padding: 14px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.task-form button[type="submit"]:hover {
    background-color: #218838;
}

.task-form button[type="submit"]:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* Автодополнение адреса */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-items {
    position: absolute;
    border: 1px solid #d4d4d4;
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border-radius: 0 0 8px 8px;
}

.autocomplete-item {
    padding: 10px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #f0f0f0;
}

.autocomplete-item:hover {
    background-color: #e9e9e9;
}

.form-status {
    margin-top: 12px;
    text-align: center;
    font-weight: 500;
}

.form-status.success {
    color: #28a745;
}

.form-status.error {
    color: #dc3545;
}

/* Анимация */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Адаптация */
@media (max-width: 480px) {
    .app-container {
        padding: 16px;
    }
}

/* Предпросмотр */
.preview-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-file {
    text-align: center;
    border: 1px dashed #ccc;
    border-radius: 12px;
    padding: 16px;
    background: #fafafa;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.preview-file img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    object-fit: contain;
}

.preview-file .file-icon {
    font-size: 48px;
    color: #007bff;
}

.preview-details p {
    margin: 8px 0;
    line-height: 1.5;
    word-break: break-word;
}

.preview-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.preview-btn {
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.preview-btn:active {
    opacity: 0.8;
}

.edit-btn {
    background-color: #6c757d;
    color: white;
}

.submit-btn {
    background-color: #28a745;
    color: white;
}

.cancel-btn {
    background-color: #dc3545;
    color: white;
}

.preview-file {
    text-align: center;
    border: 1px dashed #ccc;
    border-radius: 12px;
    padding: 16px;
    background: #fafafa;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: auto; /* на случай выхода за границы */
}

.preview-file img {
    max-width: 100%;
    max-height: 60vh; /* ограничение по высоте экрана */
    width: auto;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* Блок с информацией о пользователе в главном меню */
.menu-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.user-info {
    font-size: 12px;
    color: #666;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 16px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-info span {
    white-space: nowrap;
}

/* Страница отказа в доступе */
.access-denied-content {
    text-align: center;
    padding: 20px;
    color: #333;
    line-height: 1.5;
}

.access-denied-content h2 {
    color: #dc3545;
    margin-bottom: 20px;
}

.access-denied-content ul {
    text-align: left;
    display: inline-block;
    margin: 15px auto;
}

.access-denied-content p {
    margin: 12px 0;
}

.user-info span {
    white-space: nowrap;
}

/* Часы делаем жирными */
#clockDisplay {
    font-weight: bold;
    color: #333;
}