* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    font-size: 1rem;
    background: #0b0e14;
    background-image: radial-gradient(circle at 20% 30%, #1a2a1a 0%, #0b0e14 80%);
    min-height: 100vh;
    min-height: 100dvh;
    padding: 12px;
    color: #e2e8f0;
    display: flex;
    justify-content: center;
    touch-action: auto;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}
body.font-large { font-size: 18px; }
body.font-extra-large { font-size: 20px; }
body.font-large .card h2, body.font-large .analysis-result .title { font-size: 1.2rem; }
body.font-extra-large .card h2, body.font-extra-large .analysis-result .title { font-size: 1.4rem; }
.app-container {
    max-width: 720px;
    width: 100%;
    max-width: 100vw;
    margin: 0 auto;
    padding-bottom: 20px;
    overflow-x: hidden;
    word-break: break-word;
}
.card {
    background: rgba(22, 28, 38, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 16px 14px;
    border-radius: 22px;
    margin-bottom: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 16px 32px -12px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #4ade80;
    text-align: center;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: opacity 0.2s;
    user-select: none;
}
h1 small {
    display: block;
    font-size: 0.8rem;
    font-weight: 400;
    color: #94a3b8;
    margin-top: 2px;
}
.header-subtitle {
    font-size: 1rem;
    font-weight: 600;
    color: #fbbf24;
    margin-top: 2px;
    letter-spacing: 0.3px;
}
.header-price {
    color: #4ade80;
    background: #1a3a2a;
    padding: 2px 10px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}
.hidden {
    display: none !important;
}
h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #f0f4fa;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 8px;
}
label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #94a3b8;
    display: block;
    margin-top: 8px;
    margin-bottom: 3px;
}
input, select, button, textarea {
    width: 100%;
    padding: 11px 12px;
    margin: 4px 0;
    border-radius: 14px;
    border: 1px solid #2d3748;
    background: #10161e;
    color: #f1f5f9;
    font-size: 0.95rem;
    transition: 0.2s;
    outline: none;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    border-color: #4ade80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
    background: #181f2b;
}
.flex {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.flex>* {
    flex: 1 1 0;
    margin: 0;
    min-width: 70px;
}
button {
    background: #1e293b;
    border: 1px solid #334155;
    font-weight: 700;
    color: #4ade80;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: 0.15s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    min-height: 48px;
    touch-action: manipulation;
}
button:hover {
    background: #2d3b4f;
    border-color: #4ade80;
}
button:active {
    transform: scale(0.97);
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-gold {
    background: #4a3a1a;
    border-color: #fbbf24;
    color: #fbbf24;
}
.btn-gold:hover {
    background: #5a4a2a;
}
.btn-danger {
    background: #4a2a2a;
    border-color: #f87171;
    color: #f87171;
}
.btn-danger:hover {
    background: #5a3a3a;
}
.btn-admin {
    background: #1a1a3a;
    border-color: #a78bfa;
    color: #a78bfa;
    display: none !important;
}
.btn-share {
    background: #2a3a2a;
    border-color: #4a8a4a;
    color: #6aca6a;
}
.btn-share:hover {
    background: #3a4a3a;
}
.btn-history {
    background: #1a2a3a;
    border-color: #4a7a9a;
    color: #94c8e8;
}
.btn-history:hover {
    background: #2a3a5a;
}
.btn-gps {
    background: #1a2a1a;
    border-color: #4a7a4a;
    color: #6aca6a;
}
.btn-gps.active {
    background: #2a4a2a;
    border-color: #4ade80;
    color: #4ade80;
}
.btn-delete-account {
    background: #4a1a1a;
    border-color: #8a2a2a;
    color: #f87171;
    font-size: 0.7rem;
    padding: 4px 12px;
    min-height: 30px;
    width: auto;
}
.btn-delete-account:hover {
    background: #6a2a2a;
}
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.active {
    display: flex;
}
.modal {
    background: #1a2a2a;
    border-radius: 22px;
    padding: 24px;
    max-width: 520px;
    width: 100%;
    border: 1px solid #2d3f52;
    max-height: 90vh;
    overflow-y: auto;
}
.modal h3 {
    color: #4ade80;
    margin-bottom: 12px;
    font-size: 1.2rem;
}
.modal .close-btn {
    float: right;
    background: none;
    border: none;
    color: #f87171;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 8px;
    min-height: auto;
}
.modal .close-btn:hover {
    color: #ff6b6b;
}
.legal-modal-content {
    background: #0f1a1a;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.6;
    margin-top: 10px;
}
.modal .phone-number {
    font-size: 1.3rem;
    color: #fbbf24;
    text-align: center;
    padding: 12px;
    background: #0f1a1a;
    border-radius: 14px;
    margin: 8px 0;
}
.modal .copy-btn {
    background: #1a3a2a;
    border-color: #4ade80;
    color: #4ade80;
    padding: 6px 16px;
    min-height: auto;
    font-size: 0.8rem;
    width: auto;
}
.auth-box {
    text-align: center;
    padding: 10px 0;
}
.auth-box .balance {
    font-size: 1.2rem;
    color: #fbbf24;
    cursor: default;
}
.auth-box .user-name {
    color: #4ade80;
    font-weight: 600;
}
.auth-box .user-country {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 2px;
}
.admin-panel {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #2d3f52;
}
.admin-panel.active {
    display: block;
}
.admin-table {
    width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
}
.admin-table th {
    background: #1a2a3a;
    color: #94a3b8;
    padding: 6px;
    text-align: left;
}
.admin-table td {
    padding: 6px;
    border-bottom: 1px solid #1a2a2a;
    vertical-align: middle;
}
.admin-table .balance-cell {
    cursor: pointer;
    color: #fbbf24;
}
.login-form {
    display: none;
}
.login-form.active {
    display: block;
}
.register-form {
    display: block;
}
.register-form.hidden {
    display: none;
}
.toggle-link {
    color: #4ade80;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
    opacity: 0.7;
    transition: 0.2s;
}
.toggle-link:hover {
    opacity: 1;
}
.preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0;
    justify-content: center;
}
.preview-item {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #2d3f52;
}
.preview-item img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    display: block;
}
.preview-item .preview-name {
    font-size: 0.65rem;
    color: #94a3b8;
    text-align: center;
    padding: 3px 4px;
    background: rgba(0,0,0,0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}
.preview-item .remove-photo {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #4a2a2a;
    border: none;
    color: #f87171;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
    cursor: pointer;
    min-height: auto;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.preview-item .remove-photo:hover {
    background: #6a3a3a;
}
.analysis-result {
    background: #1a2a2a;
    border-radius: 14px;
    padding: 12px;
    margin: 6px 0;
    border-left: 4px solid #4ade80;
}
.analysis-result .title {
    font-weight: 600;
    color: #4ade80;
    font-size: 1.25rem;
}
.analysis-result .detail {
    color: #cbd5e1;
    font-size: 0.85rem;
    margin-top: 4px;
    line-height: 1.5;
}
.analysis-result .detail strong {
    color: #4ade80;
}
.analysis-result .section {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #2d3f52;
}
.analysis-result .section-title {
    color: #94a3b8;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.analysis-result .advice {
    background: #0f1f1a;
    padding: 8px 10px;
    border-radius: 8px;
    margin-top: 2px;
    border-left: 3px solid #4ade80;
    font-size: 0.85rem;
    white-space: pre-wrap;
}
.badge-type {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 0.6rem;
    font-weight: 600;
    margin-right: 3px;
}
.badge-danger {
    background: #4a2a2a;
    color: #f87171;
}
.badge-warning {
    background: #4a3a1a;
    color: #fbbf24;
}
.badge-success {
    background: #1a3a2a;
    color: #4ade80;
}
.badge-info {
    background: #1a2a3a;
    color: #60a5fa;
}
.badge-cost {
    background: #1a2a3a;
    color: #fbbf24;
    font-size: 0.65rem;
    padding: 1px 8px;
    border-radius: 20px;
    display: inline-block;
}
.badge-gps {
    background: #1a2a1a;
    color: #6aca6a;
    font-size: 0.6rem;
    padding: 1px 8px;
    border-radius: 20px;
    display: inline-block;
    border: 1px solid #4a7a4a;
}
.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #2d3f52;
    border-top: 2px solid #4ade80;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.file-btn {
    background: #1a2a3a;
    border-color: #4a7a9a;
    color: #94c8e8;
}
.file-btn:hover {
    background: #2a3a5a;
}
#camera-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 9998;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
#camera-container.active {
    display: flex;
}
#camera-container video {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 16px;
    background: #000;
    transform: scaleX(-1);
}
#camera-container .cam-controls {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    width: 100%;
    max-width: 400px;
}
#camera-container .cam-controls button {
    flex: 1;
    font-size: 1.2rem;
    padding: 14px;
    min-height: 60px;
}
#camera-container .cam-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #4a2a2a;
    border: none;
    color: #f87171;
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
#camera-container .cam-close:hover {
    background: #6a3a3a;
}
.history-item .h-cost {
    font-size: 0.65rem;
    color: #fbbf24;
    margin-left: 6px;
}
.history-item .h-delete-btn {
    position: absolute;
    top: 6px;
    right: 40px;
    background: #3a1a1a;
    border: 1px solid #7a2a2a;
    color: #f87171;
    font-size: 0.55rem;
    padding: 1px 8px;
    border-radius: 10px;
    cursor: pointer;
    min-height: 20px;
    width: auto;
    opacity: 0.6;
    transition: 0.2s;
}
.history-item .h-delete-btn:hover {
    opacity: 1;
    background: #5a2a2a;
}
.history-item .h-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #4ade80;
    cursor: pointer;
    margin-top: 2px;
}
.badge {
    display: inline-block;
    background: #1a3a2a;
    color: #4ade80;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 0.65rem;
    margin-left: 6px;
}
.badge-rb {
    background: #2a1a1a;
    color: #fbbf24;
}
.badge-admin {
    background: #2a1a3a;
    color: #a78bfa;
}
.progress-bar {
    width: 100%;
    height: 4px;
    background: #1a2a2a;
    border-radius: 4px;
    margin: 6px 0;
    overflow: hidden;
}
.progress-bar .fill {
    height: 100%;
    background: #4ade80;
    border-radius: 4px;
    transition: width 0.3s;
    width: 0%;
}
.cost-info {
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 6px;
    padding: 4px 10px;
    background: #0f1a1a;
    border-radius: 20px;
    display: inline-block;
    border: 1px solid #2a3a3a;
}
.cost-info .byn {
    color: #4ade80;
    font-weight: 700;
}
.cost-info .cost-detail {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-top: 2px;
}
.scale-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 0.55rem;
    font-weight: 600;
    margin-left: 3px;
}
.scale-garden {
    background: #4a3a1a;
    color: #fbbf24;
}
.scale-field {
    background: #1a3a4a;
    color: #60a5fa;
}
.doc-type-badge {
    display: inline-block;
    background: #2a1a3a;
    color: #a78bfa;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    border: 1px solid #4a2a5a;
    margin-bottom: 4px;
}
/* Модал истории — на всю высоту, прижат к верху */
#history-modal.active {
    align-items: flex-start;
    padding: 0;
}

#history-detail-modal.active {
    align-items: flex-start;
    padding: 0;
}

#history-detail-modal .detail-content {
    background: #0f1a1a;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 50vh;
    overflow-y: auto;
}
#history-detail-modal .detail-content strong {
    color: #4ade80;
}
#history-detail-modal .detail-photo {
    max-width: 100%;
    max-height: 50vh;
    border-radius: 10px;
    margin: 6px 0;
    border: 1px solid #2d3f52;
}
.api-key-input {
    background: #0f1a1a;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid #2a3a3a;
}
.api-key-input input {
    font-family: monospace;
    font-size: 0.8rem;
    background: #0a1212;
}
#country-select {
    background: #10161e;
    color: #f1f5f9;
    border: 1px solid #2d3748;
    border-radius: 14px;
    padding: 11px 12px;
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}
#country-select:focus {
    border-color: #4ade80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}
#country-select option {
    background: #10161e;
    color: #f1f5f9;
}
.phone-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}
.phone-wrapper .country-code {
    background: #0a1212;
    padding: 11px 8px;
    border-radius: 14px;
    border: 1px solid #2d3748;
    color: #94a3b8;
    font-size: 0.9rem;
    white-space: nowrap;
    min-width: 50px;
    text-align: center;
}
.phone-wrapper input {
    flex: 1;
}
.admin-link-mode {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #0f1a1a;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #2a3a3a;
    margin-bottom: 8px;
}
.admin-link-mode label {
    font-size: 0.7rem;
    margin: 0;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.admin-link-mode input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #4ade80;
    margin: 0;
    cursor: pointer;
}
.admin-link-mode input[type="text"] {
    flex: 1;
    min-width: 120px;
    padding: 6px 10px;
    font-size: 0.8rem;
    margin: 0;
}
.admin-link-mode button {
    min-height: 36px;
    padding: 6px 14px;
    font-size: 0.75rem;
    width: auto;
    background: #1a3a2a;
    border-color: #4ade80;
}
/* ============================================================
   ADVICE / RESULTS
   ============================================================ */

/* ============================================================
   PARTNERS
   ============================================================ */
.partners-section {
    margin-top: 16px;
    border: 1px solid #3a5a3a;
    background: linear-gradient(135deg, #0f1a1a 0%, #1a2a1a 100%);
    border-radius: 12px;
    padding: 12px;
}

.partners-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}

.partner-card {
    background: #0a1a1a;
    border: 1px solid #2a4a3a;
    border-radius: 10px;
    padding: 12px;
    flex: 1 1 200px;
    min-width: 160px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.partner-logo {
    max-height: 50px;
    max-width: 140px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.partner-name {
    font-size: 0.85rem;
    color: #fbbf24;
    font-weight: 600;
    margin-bottom: 8px;
}

.partner-products {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.partner-product {
    background: #0f1a1a;
    border: 1px solid #2a3a3a;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
}

.product-name {
    color: #cbd5e1;
    font-weight: 500;
}

.product-price {
    color: #4ade80;
    font-weight: 600;
}

.order-btn {
    background: #1a3a2a;
    display: inline-block;
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #4ade80;
    color: #4ade80;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    min-height: 40px;
    transition: all 0.2s;
}

.recommendations-section {
    margin-top: 12px;
    border: 1px solid #3a4a2a;
    background: linear-gradient(135deg, #0f1a0f 0%, #1a2a0f 100%);
    border-radius: 12px;
    padding: 12px;
}

.recommendations-content {
    font-size: 0.85rem;
    color: #d4e8c8;
    line-height: 1.6;
}

/* ============================================================
   ПОЛНОЭКРАННЫЙ ОТЧЁТ
   ============================================================ */
.report-fullscreen {
    max-width: 800px;
    margin: 0 auto;
    padding: 8px 0;
}

.report-header {
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #2a3a3a;
    margin-bottom: 12px;
}

.report-photo-container {
    width: 100%;
    max-height: 70vh;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 12px;
    background: #0a0e12;
}

.report-photo {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    border-radius: 12px;
}

.report-gps {
    background: #0f1a1a;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: #6aca6a;
    border: 1px solid #2a4a3a;
}

.report-section {
    margin-bottom: 14px;
    padding: 10px 12px;
    background: #0f1a1a;
    border-radius: 10px;
    border: 1px solid #2a3a3a;
}

.report-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fbbf24;
    margin-bottom: 6px;
}

.report-diagnosis {
    font-size: 0.9rem;
    color: #4ade80;
    margin-bottom: 4px;
    font-weight: 500;
}

.report-stage {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 4px;
}

.report-content {
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.6;
    white-space: pre-wrap;
    margin-top: 6px;
}

.report-products {
    font-size: 0.85rem;
    color: #e2e8f0;
    line-height: 1.5;
    margin-top: 6px;
    padding: 8px;
    background: #0a1a0a;
    border-radius: 8px;
    border: 1px solid #2a4a2a;
}

.report-recommendations {
    font-size: 0.85rem;
    color: #d4e8c8;
    line-height: 1.5;
    margin-top: 6px;
    padding: 8px;
    background: #0f1a0f;
    border-radius: 8px;
    border: 1px solid #3a4a2a;
}

.report-footer {
    text-align: center;
    font-size: 0.7rem;
    color: #64748b;
    padding-top: 10px;
    border-top: 1px solid #2a3a3a;
    margin-top: 12px;
    line-height: 1.5;
}

/* Partner admin rows */
.partner-admin-item {
    background: #0a1a1a;
    border: 1px solid #2a3a3a;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 6px;
    font-size: 0.75rem;
    color: #cbd5e1;
}

/* Partner product rows in modal */
.partner-product-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.partner-product-row input {
    flex: 1;
    min-width: 80px;
    font-size: 0.75rem;
    padding: 4px 8px;
    background: #0a1a1a;
    border: 1px solid #2a3a3a;
    border-radius: 6px;
    color: #cbd5e1;
}
@media (max-width: 767px) {
    body { padding: 6px; font-size: 15px; }
    .app-container { max-width: 100%; }
    .card { padding: 10px 8px; border-radius: 16px; margin-bottom: 8px; }
    h1 { font-size: 1.05rem; }
    h1 small { font-size: 0.7rem; }
    h2 { font-size: 1.1rem; margin-bottom: 6px; padding-bottom: 6px; }
    .flex { gap: 5px; }
    .flex>* { min-width: 55px; }
    input, select, button, textarea { padding: 8px 9px; font-size: 0.85rem; border-radius: 12px; min-height: 40px; }
    button { min-height: 42px; }
    label { font-size: 0.65rem; margin-top: 5px; }
    .preview-item img { width: 70px; height: 70px; }
    .preview-item .preview-name { max-width: 70px; font-size: 0.55rem; }
    .analysis-result { padding: 8px; }
    .analysis-result .title { font-size: 0.9rem; }
    .analysis-result .detail { font-size: 0.78rem; }
    .analysis-result .advice { font-size: 0.78rem; padding: 6px 8px; }
    #camera-container .cam-controls button { font-size: 0.95rem; padding: 8px; min-height: 46px; }
    #camera-container .cam-close { width: 40px; height: 40px; font-size: 1.2rem; top: 10px; right: 10px; }
    .modal { padding: 14px; border-radius: 18px; max-width: 95%; }
    .modal h3 { font-size: 1rem; }
    .history-item { padding: 8px; gap: 8px; }
    .history-item .h-photo-wrapper { width: 56px; height: 56px; min-width: 56px; }
    .history-item .h-photo-placeholder { width: 56px; height: 56px; min-width: 56px; font-size: 1.2rem; }
    .history-item .h-title { font-size: 0.8rem; }
    .history-item .h-diagnosis { font-size: 0.7rem; }
    .history-item .h-delete-btn { right: 30px; font-size: 0.5rem; padding: 0px 5px; }
    .history-item .h-checkbox { width: 16px; height: 16px; }
    .phone-wrapper .country-code { font-size: 0.7rem; padding: 8px 5px; min-width: 36px; }
    .admin-link-mode { flex-wrap: wrap; }
    .admin-link-mode input[type="text"] { min-width: 100%; }
    .admin-table { font-size: 0.65rem; }
    .admin-table th, .admin-table td { padding: 3px 4px; }
    .badge { font-size: 0.55rem; padding: 1px 8px; }
    .badge-type { font-size: 0.55rem; }
    .cost-info { font-size: 0.7rem; }
    .auth-box .balance { font-size: 1rem; }
    .btn-delete-account { font-size: 0.6rem; padding: 3px 8px; min-height: 26px; }
    .toggle-link { font-size: 0.75rem; }
    #country-select { font-size: 0.85rem; padding: 8px 32px 8px 9px; background-size: 14px; }
}

/* ============================================================
   АДАПТИВНОСТЬ: Планшеты (768px – 1023px)
   ============================================================ */
@media (min-width: 768px) and (max-width: 1023px) {
    body { padding: 14px; font-size: 16px; }
    .app-container { max-width: 90%; }
    .card { padding: 18px 20px; border-radius: 24px; margin-bottom: 12px; }
    h1 { font-size: 1.2rem; }
    h2 { font-size: 1.15rem; }
    .flex>* { min-width: 100px; }
    input, select, button, textarea { padding: 10px 11px; font-size: 0.9rem; }
    button { min-height: 46px; }
    .preview-item img { width: 110px; height: 110px; }
    .preview-item .preview-name { max-width: 110px; }
    .analysis-result .title { font-size: 1.1rem; }
    .analysis-result .detail { font-size: 0.85rem; }
    .modal { max-width: 85%; padding: 20px; }
    .history-item .h-photo-wrapper { width: 50px; height: 50px; min-width: 50px; }
    .admin-table { font-size: 0.75rem; }
}

/* ============================================================
   АДАПТИВНОСТЬ: Компьютеры / ноутбуки (1024px и шире)
   ============================================================ */
@media (min-width: 1024px) {
    body { padding: 24px 40px; font-size: 17px; }
    .app-container { max-width: 900px; }
    .card { padding: 28px 36px; border-radius: 28px; margin-bottom: 18px; }
    h1 { font-size: 1.5rem; }
    h1 small { font-size: 0.85rem; }
    h2 { font-size: 1.35rem; margin-bottom: 14px; padding-bottom: 10px; }
    .flex { gap: 14px; }
    .flex>* { min-width: 140px; }
    input, select, button, textarea { padding: 12px 14px; font-size: 1rem; border-radius: 16px; }
    button { min-height: 50px; }
    label { font-size: 0.75rem; }
    .preview-item img { width: 160px; height: 160px; }
    .preview-item .preview-name { max-width: 160px; font-size: 0.7rem; }
    .analysis-result { padding: 16px; }
    .analysis-result .title { font-size: 1.3rem; }
    .analysis-result .detail { font-size: 0.9rem; }
    .analysis-result .advice { font-size: 0.9rem; }
    .modal { max-width: 560px; padding: 28px; }
    .modal h3 { font-size: 1.3rem; }
    .history-item { padding: 10px 14px; }
    .history-item .h-photo-wrapper { width: 60px; height: 60px; min-width: 60px; }
    .history-item .h-photo-placeholder { width: 60px; height: 60px; min-width: 60px; font-size: 1.3rem; }
    .history-item .h-title { font-size: 1rem; }
    .history-item .h-diagnosis { font-size: 0.85rem; }
    .history-item .h-date { font-size: 0.7rem; }
    .admin-table { font-size: 0.85rem; }
    .admin-table th, .admin-table td { padding: 8px 10px; }
    .auth-box .balance { font-size: 1.4rem; }
    .badge { font-size: 0.7rem; }
    .cost-info { font-size: 0.8rem; }
    #camera-container .cam-controls { max-width: 500px; }
    #camera-container .cam-controls button { font-size: 1.3rem; padding: 16px; min-height: 64px; }
    #camera-container .cam-close { width: 56px; height: 56px; font-size: 1.6rem; }
    .phone-wrapper .country-code { font-size: 0.95rem; padding: 12px 10px; }
}

/* ============================================================
   ПЕРЕКЛЮЧАТЕЛЬ ON/OFF ДЛЯ ССЫЛОК
   ============================================================ */
.link-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.link-toggle-label {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}
.link-toggle-label input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    pointer-events: none;
}
.link-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #3a3a4a;
    border-radius: 26px;
    transition: 0.3s;
    border: 1px solid rgba(255,255,255,0.08);
    pointer-events: none;
}
.link-toggle-slider:before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 2px;
    background: #e2e8f0;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.link-toggle-label input:checked + .link-toggle-slider {
    background: #4ade80;
    border-color: #3ab860;
}
.link-toggle-label input:checked + .link-toggle-slider:before {
    transform: translateX(20px);
    background: #fff;
}
.link-toggle-text {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 24px;
    text-align: center;
    color: #94a3b8;
    transition: 0.3s;
}
.link-toggle-text.on {
    color: #4ade80;
}
.link-toggle-text.off {
    color: #f87171;
}

/* Исправление залипания на мобильных */
@media (max-width: 767px) {
    .link-toggle-label {
        width: 44px;
        height: 24px;
    }
    .link-toggle-slider:before {
        height: 18px;
        width: 18px;
        left: 2px;
        bottom: 2px;
    }
    .link-toggle-label input:checked + .link-toggle-slider:before {
        transform: translateX(20px);
    }
    .link-toggle-text {
        font-size: 0.6rem;
        min-width: 20px;
    }
}

@media (display-mode: standalone) {
    body { padding-top: env(safe-area-inset-top); }
}

/* Toggle Switch (админ-панель: подвал, текст регистрации) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2a3a3a;
    transition: 0.3s;
    border-radius: 26px;
    border: 1px solid #3a4a4a;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: #94a3b8;
    transition: 0.3s;
    border-radius: 50%;
}
.toggle-switch input:checked + .toggle-slider {
    background-color: #1a3a2a;
    border-color: #4ade80;
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
    background-color: #4ade80;
}

/* === История на весь экран === */
#history-modal, #history-detail-modal {
    background: #0b0e14 !important;
}

#history-container .history-item {
    cursor: pointer;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 12px 14px;
    margin-bottom: 8px;
    border-radius: 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: background 0.2s;
}

#history-container .history-item:hover {
    background: rgba(255,255,255,0.06);
}

#history-container .history-item:active {
    background: rgba(255,255,255,0.08);
}

#history-detail-content {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #cbd5e1;
}

#history-detail-content .result-photo-container,
#history-detail-content .detail-photo-container {
    max-height: 60vh;
    border-radius: 12px;
    overflow: hidden;
    background: #0a0e12;
    margin-bottom: 10px;
}

#history-detail-content .result-photo,
#history-detail-content .detail-photo {
    width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 12px;
}

/* === Фото под размер экрана === */

.result-photo-container {
    width: 100%;
    max-height: 70vh;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 10px;
    background: #0a0e12;
}

.result-photo {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    border-radius: 12px;
}

.detail-photo-container {
    width: 100%;
    max-height: 70vh;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 10px;
    background: #0a0e12;
}

.detail-photo {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    border-radius: 12px;
}

/* Фото в списке истории */
.h-photo-wrapper {
    width: 70px;
    height: 70px;
    min-width: 70px;
    overflow: hidden;
    border-radius: 10px;
    background: #0a0e12;
    flex-shrink: 0;
}

.h-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 10px;
}

.h-photo-placeholder {
    width: 70px;
    height: 70px;
    min-width: 70px;
    border-radius: 10px;
    background: #1a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* Обёртка для истории */
.history-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.06);
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.history-item:hover {
    background: rgba(255,255,255,0.06);
}

.h-info {
    flex: 1;
    min-width: 0;
    position: relative;
}
