*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #0f172a;
    background: linear-gradient(135deg, #f5f5f5, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    /* Учет safe area insets для Telegram Web App */
    padding-top: max(24px, env(safe-area-inset-top, 24px));
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
    padding-left: max(16px, env(safe-area-inset-left, 16px));
    padding-right: max(16px, env(safe-area-inset-right, 16px));
}
textarea{
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    padding: 10px 14px;
    font-size: 14px;
    background-color: #f9fafb;
    color: #0f172a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
@supports (min-height: 100dvh) {
    body {
        min-height: 100dvh;
    }
}

/* Использование CSS переменной для высоты viewport в Telegram Web App */
body {
    min-height: var(--tg-vh, 100vh);
}

.page {
    width: 100%;
    max-width: 630px;
    margin: 0 auto;
}

.card {
    width: 100%;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(18px);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.18);
    padding: 26px 20px 22px;
}

@media (min-width: 640px) {
    .card {
        padding: 32px 34px 26px;
    }
}
.status{
    color: red;
}
.card-heading {
    margin: 0 0 18px;
    font-size: 24px;
    line-height: 1.15;
    font-weight: 600;
    color: #111827;
    text-align: center;
}

@media (min-width: 640px) {
    .card-heading {
        font-size: 28px;
        margin-bottom: 22px;
    }
}

.badge {
    margin: 0 0 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: #6b7280;
    font-weight: 600;
}

.subtitle {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
    max-width: 420px;
}

.login-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    white-space: nowrap;
    justify-content: center;
    margin-top: 6px;
}

.login-link span {
    color: #6b7280;
}

.login-link a {
    color: #111827;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.login-link a:hover {
    color: #020617;
}

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

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 1090px) {
    .form-grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (min-width: 1090px) {
    .form-grid-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
select{
    width: 100%;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    padding: 10px 14px;
    font-size: 14px;
    background-color: #f9fafb;
    color: #0f172a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
label {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

.required {
    color: #ef4444;
    margin-left: 2px;
}

.optional {
    font-size: 12px;
    color: #9ca3af;
}

.helper {
    margin: 2px 0 0;
    font-size: 11px;
    color: #9ca3af;
}

input[type="text"],
input[type="number"],
input[type="tel"],
input[type="email"],
input[type="password"] {
    width: 100%;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    padding: 10px 14px;
    font-size: 14px;
    background-color: #f9fafb;
    color: #0f172a;
    transition:
            border-color 0.15s ease,
            box-shadow 0.15s ease,
            background-color 0.15s ease;
}

input::placeholder {
    color: #9ca3af;
}

input:focus {
    outline: none;
    border-color: #111827;
    background-color: #e5e7eb;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.18);
}

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    padding: 0 12px;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
}

.password-toggle:hover {
    color: #111827;
}

.sms-block {
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px dashed #e5e7eb;
}

.actions {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    border: none;
    border-radius: 999px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background: #111827;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
    cursor: pointer;
    transition:
            transform 0.12s ease,
            box-shadow 0.12s ease,
            background 0.12s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    background: #020617;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.22);
}

.btn-secondary {
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background-color: #e5e7eb;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    cursor: pointer;
    transition:
            background-color 0.12s ease,
            border-color 0.12s ease;
}

.btn-secondary:hover {
    background-color: #d4d4d8;
    border-color: #9ca3af;
}

.hidden {
    display: none !important;
}

.status {
    margin-top: 8px;
    font-size: 14px;
    border-radius: 12px;
    padding: 8px 12px;
    border: 1px solid transparent;
}
#callbtn{
    justify-content: center;
    display: flex;
}

.call-btn{
    text-decoration: auto;
    justify-content: center;
    display: flex;
    align-items: center;
    border: 1px solid black;
    border-radius: 999px;
    padding: 10px 50px;
    font-size: 14px;
    font-weight: 600;
    color: #000000;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.status-info {
    background-color: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.status>a{
    font-weight: bold;
    color: #9a3412;
    text-decoration: auto;
}
.status-success {
    background-color: #ecfdf3;
    border-color: #bbf7d0;
    color: #166534;
}

.status-error {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.consent {
    margin-top: 10px;
    font-size: 13px;
    color: #4b5563;
}

.consent-label {
    display: inline-flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

.consent-label input[type="checkbox"] {
    margin-top: 2px;
}

.login-subtitle {
    margin: -6px 0 16px;
    text-align: center;
    font-size: 13px;
    color: #6b7280;
}

.actions-login {
    margin-top: 12px;
}

.actions-login .btn-primary {
    width: 100%;
}

@media (min-width: 480px) {
    .actions-login {
        flex-direction: row;
    }

    .actions-login .btn-primary {
        width: auto;
    }
}

.login-secondary {
    text-decoration: none;
}

.link-button {
    border: none;
    background: transparent;
    padding: 0;
    font-size: 13px;
    color: #4b5563;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.link-button:hover {
    color: #111827;
}

@media (max-width: 400px) {
    body {
        padding: 16px 10px;
        display: block;
    }

    .card {
        border-radius: 20px;
        padding: 22px 16px 18px;
    }

    .card-title h1 {
        font-size: 22px;
    }
}

@media (max-height: 600px) {
    body {
        align-items: flex-start;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .card {
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
    }
}

/* ====== КАБИНЕТ ====== */

.cabinet-body {
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f5f5, #e5e7eb);
    display: block;
}

.cabinet-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.cabinet-content {
    flex: 1;
    display: flex;
    align-items: stretch;
}

/* Шапка */
.cabinet-header {
    background: #111827;
    color: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.25);
    position: sticky;
    top: 0;
    z-index: 100;
}

.cabinet-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.header-burger {
    display: none;
    border: none;
    background: transparent;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.header-burger span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background-color: #e5e7eb;
}

.header-burger span + span {
    margin-top: 3px;
}

.header-burger:hover {
    background: rgba(15, 23, 42, 0.55);
}

.cabinet-header-left,
.cabinet-header-center,
.cabinet-header-right {
    display: flex;
    align-items: center;
}

.cabinet-header-left {
    flex: 1;
    column-gap: 8px;
}

.cabinet-header-center {
    flex: 0 0 auto;
    justify-content: center;
}

.cabinet-header-right {
    flex: 1;
    justify-content: flex-end;
}

.header-metrics {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-metric {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(31, 41, 55, 0.85);
    font-size: 11px;
    white-space: nowrap;
}

.header-metric .metric-label {
    opacity: 0.9;
}

.header-metric .metric-value {
    font-weight: 600;
}

.header-metric-fixed {
    border: 1px solid rgba(148, 163, 184, 0.7);
}

.header-metric-extended {
    border: 1px solid rgba(148, 163, 184, 0.7);
}

.curator-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.curator-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.curator-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.curator-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-end;
}

.curator-main {
    display: flex;
    align-items: center;
    gap: 4px;
}

.curator-role {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.85);
}

.curator-name {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.curator-contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    font-size: 12px;
}

.curator-contacts-compact {
    justify-content: flex-end;
    font-size: 11px;
}

.contacts-separator {
    color: rgba(255, 255, 255, 0.7);
}

.contact-item {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.contact-item:hover {
    color: white;
    text-decoration: underline;
}

.logout-btn {
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Навигация */
.cabinet-nav {
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 12px;
    min-width: 200px;
    max-width: 240px;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-extra {
    display: none;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.nav-metrics {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 0;
}

.nav-metrics .header-metric {
    background: transparent;
    border-radius: 0;
    padding: 2px 0;
    justify-content: space-between;
}

.nav-metrics .header-metric-fixed,
.nav-metrics .header-metric-extended {
    border: none;
}

.nav-metrics .metric-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
}

.nav-metrics .metric-value {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.nav-curator {
    font-size: 13px;
    color: #374151;
}

.nav-curator-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.nav-curator-contact a {
    font-size: 13px;
    color: #111827;
    text-decoration: none;
}

.nav-curator-contact a:hover {
    text-decoration: underline;
}

.nav-item {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.nav-item:hover {
    background: #f3f4f6;
    color: #111827;
}

.nav-item.active {
    background: #e5e7eb;
    color: #111827;
    font-weight: 600;
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-item-logout {
    margin-top: auto;
    color: #b91c1c;
}

.nav-item-logout:hover {
    color: #ffffff;
    background: #ef4444;
}

/* Основной контент */
.cabinet-main {
    flex: 1;
    padding: 32px 32px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 28px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.section-header-main {
    flex: 1;
}

.section-title {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 700;
    color: #111827;
}

.section-subtitle {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

.section-action-btn {
    white-space: nowrap;
    padding-inline: 14px;
    padding-block: 8px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cabinet-body .btn-secondary.section-action-btn {
    background-color: #111827;
    border-color: #111827;
    color: #f9fafb;
    gap: 6px;
}

.cabinet-body .btn-secondary.section-action-btn:hover {
    background-color: #020617;
    border-color: #020617;
    color: #ffffff;
}

.section-action-icon {
    flex-shrink: 0;
}

/* Список клиентов */
.clients-list {
    width: 100%;
    overflow-x: auto;
}

.clients-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

.clients-table thead {
    background: #f9fafb;
}

.clients-table th,
.clients-table td {
    padding: 12px 16px;
    font-size: 14px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

.clients-table th {
    font-weight: 600;
    color: #6b7280;
}

.clients-table tbody tr:last-child td {
    border-bottom: none;
}

.clients-table tbody tr:hover {
    background-color: #f9fafb;
}

.client-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
    position: relative;
}

.client-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.client-datetime {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 10px;
}

.client-datetime svg {
    flex-shrink: 0;
}

.client-name {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.client-phone {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 14px;
}

.client-phone svg {
    flex-shrink: 0;
}

/* Выравнивание контента в строках таблицы клиентов */
.clients-table .client-datetime,
.clients-table .client-name,
.clients-table .client-phone {
    margin-bottom: 0;
}

@media (max-width: 1090px) {
    /* В таблице клиентов на мобильных: компактный вид */
    .clients-table .client-datetime svg {
        display: none;
    }

    .clients-table td:nth-child(3),
    .clients-table .client-phone {
        white-space: nowrap;
    }

    .clients-table .status-badge {
        padding: 4px 8px;
        font-size: 11px;
    }
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}
.loading-fix{
    border: 1px solid !important;
    border-color: #111827 !important;
    color: #111827 !important;
    background-color: #ffffff !important;
}
.status-active {
    background: #e3efe7;
    color: #14532d;
}

.status-extended {
    background: #e3e8f5;
    color: #1e3a8a;
}

.status-expired {
    background: #f5e4e4;
    color: #7f1d1d;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #9ca3af;
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    margin: 0;
    font-size: 16px;
}

/* Форма фиксации */
.fixation-form {
    display: grid;
    gap: 16px;
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}
#registerForm{
    display: grid;
    gap: 16px;
}
.btn-fixate {
    margin-top: 16px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    font-size: 15px;
    width: auto;
}

.btn-fixate svg {
    flex-shrink: 0;
}

/* Адаптивность */
@media (max-width: 1090px) {
    .cabinet-header {
        padding: 10px 16px;
        gap: 8px;
    }

    .cabinet-header-center {
        display: none;
    }

    .cabinet-header-right {
        flex: 0 0 auto;
        display: none;
    }

    .header-burger {
        display: inline-flex;
    }

    .cabinet-title {
        font-size: 16px;
    }

    .curator-contacts-compact {
        display: none;
    }

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

    .cabinet-nav {
        position: fixed;
        top: 56px;
        left: 0;
        bottom: 0;
        flex-direction: column;
        justify-content: space-between;
        border-right: 1px solid #e5e7eb;
        border-bottom: none;
        padding: 16px 12px;
        min-width: 240px;
        max-width: 260px;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 90;
    }

    .nav-extra {
        display: flex;
    }

    .cabinet-layout.nav-open .cabinet-nav {
        transform: translateX(0);
    }

    .cabinet-main {
        padding: 20px 16px;
    }

    .section-title {
        font-size: 24px;
    }

    .fixation-form {
        padding: 24px 20px;
    }
}

@media (max-width: 480px) {
    .curator-avatar {
        width: 48px;
        height: 48px;
    }

    .curator-name {
        font-size: 16px;
    }

    .curator-contacts {
        font-size: 12px;
    }

    .nav-item {
        font-size: 13px;
        padding: 8px 16px;
    }

    .nav-item svg {
        width: 16px;
        height: 16px;
    }

    .section-title {
        font-size: 22px;
    }

    .client-card {
        padding: 16px;
    }

    .fixation-form {
        padding: 20px 16px;
    }
}

@media (min-width: 1200px) {
    .clients-list {
        grid-template-columns: repeat(3, 1fr);
    }
}



