* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f5fff7;
    --panel: #ffffff;
    --soft-green: #eef8f0;
    --soft-green-2: #e4f3e7;
    --green: #2e7d32;
    --dark-green: #1b5e20;
    --text: #263238;
    --muted: #6b7280;
    --border: #dcefe0;
    --shadow: 0 8px 24px rgba(46, 125, 50, 0.08);
}

body {
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 16px;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

header {
    background: var(--panel);
    padding: 18px 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

.motivation-bar {
    display: grid;
    gap: 6px;
    padding: 8px 24px 10px;
    border-bottom: 1px solid var(--border);
    background: #f8fcf9;
}

.motivation-leaderboards {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.motivation-board {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 72px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--dark-green);
    font-size: 13px;
    font-weight: 700;
}

.motivation-avatars {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.motivation-avatar,
.motivation-empty-avatar {
    width: 60px;
    height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #b8d9bf;
    border-radius: 50%;
    background: #eef8f0;
    color: var(--dark-green);
    font-size: 18px;
    font-weight: 900;
    position: relative;
}

.motivation-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.motivation-avatar small {
    position: absolute;
    right: -6px;
    bottom: -6px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ffffff;
    border-radius: 999px;
    background: var(--green);
    color: #ffffff;
    font-size: 12px;
    line-height: 1;
}

.motivation-message {
    min-height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--dark-green);
    font-size: 14px;
    font-weight: 400;
    text-align: center;
    line-height: 1.25;
    overflow: hidden;
}

.motivation-message-avatar {
    width: 60px;
    height: 60px;
    flex: 0 0 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #b8d9bf;
    border-radius: 50%;
    background: #eef8f0;
    color: var(--dark-green);
    font-size: 18px;
    font-weight: 900;
    overflow: hidden;
}

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

.motivation-message-text {
    display: inline-block;
    animation: motivationSlideIn 0.45s ease both;
}

.motivation-message-text.appointment {
    font-size: inherit;
    font-weight: inherit;
    animation: appointmentPopIn 0.55s ease both;
}

.motivation-message.empty {
    color: var(--muted);
    font-weight: 400;
}

@keyframes motivationSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes appointmentPopIn {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }

    60% {
        opacity: 1;
        transform: translateY(0) scale(1.02);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.header-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.house-icon {
    font-size: 46px;
}

.logo h1 {
    color: var(--green);
    font-size: 30px;
}

.logo p {
    color: var(--muted);
    font-size: 15px;
}

#logout-btn {
    position: absolute;
    right: 0;
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    background: #eef2f0;
    color: var(--dark-green);
    font-size: 18px;
    line-height: 1;
    z-index: 3;
}

.header-actions {
    position: absolute;
    right: 56px;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 48px;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.sidebar-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 18px;
    min-width: 0;
}

.sidebar-actions .header-action-btn,
.sidebar-actions .telegram-linked-badge {
    width: 100%;
    justify-content: center;
}

.sidebar-actions .header-phone-editor {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
}

.sidebar-actions .header-phone-editor input {
    width: 100%;
    min-width: 0;
}

.header-action-btn {
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #eef2f0;
    color: var(--dark-green);
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.profile-btn {
    height: 40px;
    width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #eef2f0;
    color: var(--dark-green);
    font-weight: 900;
    cursor: pointer;
    position: relative;
    flex: 0 0 40px;
    z-index: 2;
}

.profile-btn-label,
.logout-btn-label {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    transform: translateY(-6px);
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #ffffff;
    color: var(--dark-green);
    box-shadow: var(--shadow);
    white-space: nowrap;
    pointer-events: none;
    transition: max-width 0.18s ease, opacity 0.18s ease, padding 0.18s ease, transform 0.18s ease;
    font-size: 13px;
    line-height: 1.2;
}

.profile-btn:hover .profile-btn-label,
.profile-btn:focus-visible .profile-btn-label,
#logout-btn:hover .logout-btn-label,
#logout-btn:focus-visible .logout-btn-label {
    max-width: 220px;
    opacity: 1;
    padding: 8px 10px;
    border-color: var(--border);
    transform: translateY(0);
}

.profile-avatar {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #b8dbc0;
    background: #ffffff;
    color: var(--dark-green);
    font-size: 16px;
    line-height: 1;
}

.profile-avatar-telegram-linked {
    border-color: #2e7d32;
    box-shadow: 0 0 0 2px #e8f5e9;
}

.profile-avatar-telegram-missing {
    border-color: #dc2626;
    box-shadow: 0 0 0 2px #fdecec;
}

.profile-avatar-empty {
    font-size: 17px;
}

.logout-action-btn {
    min-width: 62px;
}

.header-phone-editor {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.header-phone-editor input {
    width: 150px;
    height: 40px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: white;
    color: var(--dark-green);
    font-weight: 800;
}

.header-phone-editor input[readonly] {
    background: #f8fcf9;
    color: var(--muted);
}

.telegram-linked-badge {
    height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #e8f5e9;
    color: #1b5e20;
    font-weight: 900;
    white-space: nowrap;
}

.telegram-linked-badge-success {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #1b5e20;
}

.telegram-linked-badge-error {
    background: #fdecec;
    border-color: #f3b5b5;
    color: #a12020;
}

.telegram-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 7px;
    border-radius: 50%;
    background: currentColor;
    color: #ffffff;
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
}

.feedback-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(18, 34, 25, 0.35);
}

.feedback-modal {
    width: min(520px, 100%);
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: white;
    box-shadow: var(--shadow);
}

.feedback-modal-header,
.feedback-modal-actions,
.feedback-type-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.feedback-modal-header {
    justify-content: space-between;
}

.feedback-modal-header button {
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--soft-green-2);
    color: var(--dark-green);
    font-weight: 800;
    cursor: pointer;
}

.feedback-modal-header .modal-close-icon-btn {
    width: 34px;
    padding: 0;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
}

.feedback-type-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    color: var(--dark-green);
}

.feedback-modal textarea {
    width: 100%;
    min-height: 130px;
    padding: 12px;
    border: 1px solid #cfded3;
    border-radius: 10px;
    font: inherit;
    resize: vertical;
}

.profile-modal {
    width: min(560px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
}

.profile-main-row {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.profile-photo-column {
    display: grid;
    justify-items: center;
    gap: 6px;
}

.profile-photo-column .profile-avatar {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
    font-size: 28px;
}

.profile-photo-remove-btn {
    height: auto;
    padding: 2px 4px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.profile-contact-column {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.profile-contact-column > input {
    min-width: 0;
    width: 100%;
}

.profile-field {
    display: grid;
    gap: 6px;
    color: var(--dark-green);
    font-weight: 800;
}

.profile-field input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #cfded3;
    border-radius: 10px;
    font: inherit;
}

.profile-field textarea {
    width: 100%;
    min-height: 170px;
    padding: 12px;
    border: 1px solid #cfded3;
    border-radius: 10px;
    font: inherit;
    resize: vertical;
    line-height: 1.45;
}

.profile-tabs,
.profile-subtabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.profile-tabs button,
.profile-subtabs button {
    height: 38px;
    border: 1px solid #cfded3;
    border-radius: 10px;
    background: #f7faf8;
    color: var(--dark-green);
    font-weight: 900;
    cursor: pointer;
}

.profile-tabs button.active,
.profile-subtabs button.active {
    border-color: var(--green);
    background: #e8f5e9;
    color: var(--green);
}

.profile-tab-panel {
    display: grid;
    gap: 14px;
}

.profile-ready-message-panel {
    padding-top: 4px;
}

.profile-phone-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.telegram-linked-badge-compact {
    height: 34px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
}

.telegram-linked-badge-compact .telegram-status-icon {
    width: 16px;
    height: 16px;
    margin-right: 5px;
    font-size: 11px;
}

.profile-password-box {
    display: grid;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.profile-warning {
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff8e1;
    color: #7a4d00;
    font-weight: 800;
    line-height: 1.35;
}

main {
    min-height: calc(100vh - 100px);
    padding: 24px;
}

#login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-card {
    width: 360px;
    background: var(--panel);
    padding: 32px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.login-card h2 {
    margin-bottom: 22px;
    text-align: center;
    font-size: 26px;
    color: var(--dark-green);
}

.login-card input {
    width: 100%;
    padding: 14px;
    margin-bottom: 14px;
    border: 1px solid #cfded3;
    border-radius: 12px;
    font-size: 16px;
}

.remember-me-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px 2px;
    color: var(--muted);
    font-weight: 700;
}

.remember-me-option input {
    width: auto;
    margin: 0;
}

.login-card button,
.primary-btn,
.secondary-btn {
    height: 46px;
    padding: 0 18px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.login-card button,
.primary-btn {
    background: var(--green);
    color: white;
}

.login-secondary-btn {
    width: 100%;
    margin-top: 10px;
}

.login-submit-btn {
    width: 100%;
}

.auth-link-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}

.link-btn {
    height: auto !important;
    padding: 4px 0 !important;
    border: none !important;
    background: transparent !important;
    color: var(--dark-green) !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    text-decoration: underline;
}

.auth-status-message {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #eef8f0;
    color: var(--dark-green);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
}

.auth-status-message.error {
    background: #fdecec;
    color: #a12020;
}

.auth-status-message.success {
    background: #e8f5e9;
    color: #1b5e20;
}


.extension-install-box {
    margin-top: 18px;
    padding: 14px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: #f8fcf9;
}

.extension-install-box a {
    display: block;
    color: var(--dark-green);
    font-weight: 800;
    text-decoration: none;
    margin-bottom: 8px;
}

.extension-install-box p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.secondary-btn {
    background: var(--soft-green-2);
    color: var(--dark-green);
}

.admin-screen-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.admin-screen-tabs button {
    height: 42px;
    padding: 0 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
    color: var(--dark-green);
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.admin-screen-tabs button.active {
    background: var(--green);
    color: white;
    border-color: var(--green);
}

.tab-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #dc2626;
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.user-management-panel {
    display: grid;
    gap: 12px;
}

.user-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 150px 110px 120px 170px;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f8fcf9;
}

.master-user-row {
    background: var(--soft-green);
}

.user-info {
    display: grid;
    gap: 6px;
}

.user-info .user-full-name-editor {
    display: grid;
    gap: 4px;
    align-items: stretch;
}

.user-full-name-editor span {
    font-size: 12px;
    color: var(--muted);
}

.user-full-name-editor input {
    width: 100%;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #cfded3;
    border-radius: 10px;
    background: white;
    color: var(--text);
    font-weight: 800;
}

.user-info span {
    color: var(--muted);
    font-size: 14px;
}

.user-info small {
    color: var(--muted);
    font-size: 13px;
}

.user-row select {
    height: 42px;
    padding: 0 10px;
    border: 1px solid #cfded3;
    border-radius: 10px;
    background: white;
}

.user-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.user-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.user-actions button {
    width: 100%;
}

.user-telegram-match {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 180px;
    gap: 8px;
}

.user-telegram-match input {
    height: 42px;
    padding: 0 10px;
    border: 1px solid #cfded3;
    border-radius: 10px;
}

.user-actions button:disabled,
.user-row select:disabled,
.user-row input:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.permission-empty {
    padding: 16px;
    border: 1px dashed var(--border);
    border-radius: 14px;
    background: #f8fcf9;
    color: var(--muted);
    font-weight: 700;
}

.telegram-settings-panel {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 220px auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f8fcf9;
}

.telegram-settings-panel div {
    display: grid;
    gap: 4px;
}

.telegram-settings-panel strong {
    display: flex;
    align-items: center;
    gap: 8px;
}

.telegram-help-btn {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: white;
    color: var(--dark-green);
    font-weight: 900;
    cursor: pointer;
}

.telegram-settings-panel span {
    color: var(--muted);
    font-size: 13px;
}

.telegram-settings-panel input {
    height: 42px;
    padding: 0 12px;
    border: 1px solid #cfded3;
    border-radius: 10px;
}

.telegram-guide-panel {
    margin-bottom: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: white;
}

.telegram-guide-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.telegram-guide-header button {
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--soft-green-2);
    color: var(--dark-green);
    font-weight: 800;
    cursor: pointer;
}

.telegram-guide-panel ol {
    padding-left: 20px;
    display: grid;
    gap: 7px;
}

.telegram-guide-panel p {
    margin-top: 12px;
    color: var(--muted);
    line-height: 1.45;
}

.bug-report-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--muted);
    font-weight: 800;
}

.bug-report-icon-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: white;
    color: var(--dark-green);
    font-weight: 900;
    cursor: pointer;
}

.bug-report-form {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f8fcf9;
}

.bug-report-form input,
.bug-report-form textarea {
    width: 100%;
    border: 1px solid #cfded3;
    border-radius: 10px;
    padding: 12px;
    font: inherit;
}

.bug-report-form textarea {
    min-height: 100px;
    resize: vertical;
}

.bug-report-form div {
    display: flex;
    gap: 10px;
}

.bug-report-list {
    display: grid;
    gap: 12px;
}

.bug-report-filter-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.bug-report-filter-bar select {
    height: 42px;
    padding: 0 12px;
    border: 1px solid #cfded3;
    border-radius: 10px;
    background: white;
    color: var(--dark-green);
    font-weight: 800;
}

.feedback-type-pill {
    width: fit-content;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--soft-green-2);
    color: var(--dark-green) !important;
    font-weight: 800;
}

.bug-report-row {
    display: grid;
    grid-template-columns: minmax(180px, 240px) 170px 1fr 150px;
    gap: 12px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f8fcf9;
}

.bug-report-row.bug-report-resolved {
    opacity: 0.72;
    background: #f3f4f6;
}

.bug-report-row div {
    display: grid;
    gap: 4px;
}

.bug-report-controls {
    display: grid;
    gap: 8px;
}

.bug-report-controls label {
    display: grid;
    gap: 4px;
    color: var(--dark-green);
    font-size: 12px;
    font-weight: 800;
}

.bug-report-controls select {
    height: 34px;
    padding: 0 8px;
    border: 1px solid #cfded3;
    border-radius: 8px;
    background: white;
    color: var(--dark-green);
    font-weight: 800;
}

.bug-report-resolved-toggle {
    grid-template-columns: auto 1fr;
    align-items: center;
}

.bug-report-resolved-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--green);
}

.bug-report-row span,
.bug-report-row time {
    color: var(--muted);
    font-size: 13px;
}

.bug-report-row p {
    line-height: 1.45;
}

#welcome-screen {
    width: 100%;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(260px, 300px) 10px minmax(0, 1fr);
    gap: 0;
    max-width: 1700px;
    margin: 0 auto;
    min-width: 0;
    align-items: stretch;
}

.dashboard-layout.search-sidebar-hidden {
    grid-template-columns: 10px minmax(0, 1fr);
}

.sidebar-panel,
.content-panel,
.dashboard-card {
    background: var(--panel);
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.sidebar-panel {
    padding: 20px;
    min-height: 720px;
    min-width: 0;
    overflow: hidden;
}

.sidebar-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.sidebar-title-row .panel-title {
    margin-bottom: 0;
}

.sidebar-edge-toggle {
    position: sticky;
    top: 84px;
    z-index: 3;
    width: 10px;
    min-height: calc(100vh - 124px);
    height: 100%;
    align-self: stretch;
    padding: 0;
    border: 1px solid #cfded3;
    border-radius: 999px;
    background: #f7faf8;
    color: var(--dark-green);
    box-shadow: 0 8px 18px rgba(12, 43, 21, 0.08);
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}

.sidebar-edge-toggle:hover {
    border-color: var(--green);
    background: #e8f5e9;
}

.content-panel {
    padding: 20px;
    min-width: 0;
    margin-left: 12px;
}

.panel-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--dark-green);
    margin-bottom: 14px;
}

.search-profile-card {
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--soft-green);
    border: 1px solid var(--border);
    margin-bottom: 6px;
    cursor: pointer;
    min-width: 0;
}

.search-profile-card:hover {
    background: var(--soft-green-2);
}

.search-profile-name {
    font-size: 15px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-profile-meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 15px;
    background: #f8fcf9;
    border-radius: 18px;
    border: 1px solid var(--border);
}

.dashboard-toolbar input,
.dashboard-toolbar select {
    min-width: 0;
    height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid #cfded3;
    font-size: 16px;
    background: white;
}

.lead-view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid #cfded3;
    border-radius: 12px;
    background: #ffffff;
}

.lead-view-toggle button {
    height: 36px;
    padding: 0 12px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.lead-view-toggle button.active {
    background: var(--green);
    color: #ffffff;
}

.lead-export-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-left: 12px;
    border-left: 1px solid var(--border);
}

.lead-export-controls input[type="date"] {
    width: 150px;
}

.lead-export-btn {
    height: 46px;
}

.search-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.search-toolbar input,
.save-search-btn,
.search-action-row {
    width: 100%;
}

.search-action-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.search-action-row button {
    width: 100%;
    padding: 0 10px;
}

.close-after-import-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dcefe0;
    border-radius: 12px;
    background: #ffffff;
    color: var(--dark-green);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.close-after-import-option input {
    width: 16px;
    height: 16px;
    padding: 0;
    border-radius: 4px;
    accent-color: var(--green);
}

#lead-list {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    background: var(--panel);
    border-radius: 18px;
    overflow-x: auto;
    overflow-y: visible;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    min-width: 0;
}

.lead-list-table {
    width: 100%;
}

.lead-horizontal-scroll {
    display: none;
    width: 100%;
    height: 18px;
    margin-top: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #eef8f0;
}

.lead-horizontal-scroll div {
    height: 1px;
}

.lead-horizontal-scroll::-webkit-scrollbar {
    height: 12px;
}

.lead-horizontal-scroll::-webkit-scrollbar-track {
    background: #e4f3e7;
    border-radius: 999px;
}

.lead-horizontal-scroll::-webkit-scrollbar-thumb {
    background: #2e7d32;
    border-radius: 999px;
}

.daily-lead-list {
    background: #ffffff;
}

.daily-lead-group {
    border-bottom: 1px solid var(--border);
}

.daily-lead-group:last-child {
    border-bottom: none;
}

.daily-lead-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    background: #f8fcf9;
    color: var(--dark-green);
    border-bottom: 1px solid var(--border);
}

.daily-lead-title span {
    font-size: 18px;
    font-weight: 900;
}

.daily-lead-title small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.lead-header,
.lead-row {
    display: grid;
    grid-template-columns:
        92px
        58px
        minmax(145px, 0.85fr)
        minmax(120px, 0.7fr)
        minmax(168px, 0.95fr)
        minmax(118px, 0.6fr)
        minmax(185px, 1.05fr)
        minmax(150px, 0.85fr)
        92px
        30px;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    min-width: 1180px;
}

.lead-header {
    background: #f1f8f3;
    font-size: 16px;
    font-weight: 800;
    color: var(--dark-green);
    border-bottom: 2px solid var(--border);
}

.lead-header span {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lead-row {
    grid-template-areas:
        "status score listing name phone property region price actions expand"
        "note note note note note note note note note note";
    background: #ffffff;
    border-bottom: 1px solid #eef4ef;
    font-size: 16px;
    row-gap: 8px;
}

.lead-row:hover {
    background: #fbfefc;
}

.lead-row span,
.lead-row a {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lead-row .listing-cell {
    overflow: visible;
}

.listing-cell {
    grid-area: listing;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.listing-link {
    min-width: 0;
    flex: 1;
    color: #2563eb;
    text-decoration: underline;
    font-weight: 800;
}

.copy-listing-btn {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border: 1px solid #b8d9bf;
    border-radius: 8px;
    background: #f8fcf9;
    color: var(--dark-green);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.copy-listing-btn:hover {
    background: #eaf7ed;
}

.lead-name {
    grid-area: name;
}

.lead-phone {
    grid-area: phone;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.lead-property-type {
    grid-area: property;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

a.lead-phone {
    color: #2563eb;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.lead-region {
    grid-area: region;
}

.lead-price {
    grid-area: price;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.lead-price > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.listing-type-badge {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.listing-type-sale {
    background: #2563eb;
}

.listing-type-rent {
    background: #d97706;
}

.status-cell {
    grid-area: status;
    min-width: 0;
    width: 100%;
    padding: 6px 8px;
    border-radius: 999px;
    background: #eef8f0;
    color: var(--dark-green);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.15;
    text-align: center;
    cursor: pointer;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

.score-cell {
    grid-area: score;
    width: 100%;
    padding: 6px 8px;
    border-radius: 999px;
    background: #fff8e1;
    color: #8a5a00;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.15;
    text-align: center;
}

.note-cell {
    grid-area: note;
    display: grid;
    grid-template-columns: 44px 1fr;
    align-items: start;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fcf9;
    font-size: 16px;
    color: #374151;
    cursor: pointer;
    white-space: normal !important;
    overflow: visible !important;
}

.note-cell strong {
    color: var(--dark-green);
    font-size: 13px;
}

.note-cell em {
    display: -webkit-box;
    overflow: hidden;
    color: #374151;
    font-style: normal;
    line-height: 1.35;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.note-cell input {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cfded3;
    border-radius: 10px;
    font-size: 16px;
}

.lead-row select {
    width: 100%;
    height: 42px;
    border-radius: 10px;
    border: 1px solid #cfded3;
    font-size: 16px;
    background: white;
}

.lead-actions {
    grid-area: actions;
    display: flex;
    gap: 6px;
}

.lead-actions button {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: var(--green);
    color: white;
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lead-actions button:hover,
.primary-btn:hover {
    background: #256628;
}

.lead-actions button svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.lead-actions .telegram-action-btn {
    background: #229ed9;
}

.lead-actions .telegram-action-btn:hover {
    background: #168ac0;
}

.lead-actions .whatsapp-action-btn {
    background: #25d366;
}

.lead-actions .whatsapp-action-btn:hover {
    background: #128c4a;
}

.lead-actions button:disabled {
    cursor: not-allowed;
    background: #d1d5db;
    color: #6b7280;
}

.expand-btn {
    grid-area: expand;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    font-size: 18px;
    color: var(--muted);
    transition: transform 0.2s ease;
}

.expand-btn:hover {
    color: var(--green);
}

.expand-btn.expanded {
    transform: rotate(90deg);
}

.history-panel {
    margin: 0 20px 14px 20px;
    padding: 14px 18px;
    background: #f8fcf9;
    border-left: 4px solid var(--green);
    border-radius: 0 14px 14px 0;
}

.history-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.history-item:last-child {
    border-bottom: none;
}

.history-date {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 4px;
}

.history-text {
    font-size: 16px;
}

@media (max-width: 1200px) {
    .header-container {
        justify-content: space-between;
    }

    .logo {
        flex: 0 1 auto;
        min-width: 0;
    }

    .header-actions {
        display: flex;
        right: 52px;
        max-width: 48px;
    }

    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .lead-header,
    .lead-row {
        grid-template-columns: 86px 54px 104px 96px 156px 112px 144px 130px 86px 28px;
        min-width: 1096px;
    }

    .lead-row {
        grid-template-areas:
            "status score listing name phone property region price actions expand"
            "note note note note note note note note note note";
    }
}

@media (max-width: 980px) {
    header {
        padding: 10px 14px;
    }

    .header-container {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .header-actions {
        display: flex;
        right: 50px;
        max-width: 48px;
    }

    .lead-header,
    .lead-row {
        grid-template-columns: 78px 50px 94px 84px 150px 108px 136px 124px 80px 26px;
        min-width: 1044px;
    }
}

@media (max-width: 760px) {
    header {
        padding: 8px 10px;
    }

    .header-container {
        flex-direction: row;
        gap: 6px;
    }

    .header-actions {
        display: flex;
        gap: 6px;
        right: 48px;
        max-width: 44px;
    }

    .motivation-bar {
        padding: 8px 10px;
    }

    .motivation-leaderboards {
        gap: 6px;
    }

    .motivation-board {
        flex: 1 1 100%;
        justify-content: space-between;
        border-radius: 12px;
    }

    .motivation-message {
        font-size: 13px;
    }

    .header-action-btn,
    .telegram-linked-badge {
        flex: 1 1 auto;
        justify-content: center;
        min-width: min(150px, 100%);
        padding: 0 10px;
        font-size: 13px;
        height: 36px;
    }

    .profile-main-row,
    .profile-phone-row {
        grid-template-columns: 1fr;
    }

    .profile-phone-row .telegram-linked-badge {
        width: 100%;
    }

    .header-phone-editor {
        width: 100%;
        justify-content: stretch;
    }

    .header-phone-editor input {
        flex: 1;
        min-width: 0;
        max-width: none;
        height: 36px;
    }

    .feedback-modal-actions,
    .feedback-type-group {
        flex-direction: column;
        align-items: stretch;
    }

    .feedback-modal-actions button {
        width: 100%;
    }

    .content-panel,
    .sidebar-panel {
        padding: 14px;
        border-radius: 14px;
    }

    .bug-report-row {
        grid-template-columns: 1fr;
    }

    .content-panel {
        margin-left: 8px;
    }

    main {
        padding: 8px 10px 38px;
    }

    .dashboard-layout {
        gap: 12px;
        width: 100%;
    }

    .sidebar-edge-toggle {
        top: 70px;
        width: 9px;
        min-height: calc(100vh - 96px);
        font-size: 14px;
    }

    .dashboard-toolbar {
        padding: 12px;
    }

    .dashboard-toolbar input,
    .dashboard-toolbar select,
    .dashboard-toolbar button {
        width: 100%;
    }

    .lead-export-controls {
        width: 100%;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--border);
        padding-top: 10px;
    }

    .admin-screen-tabs {
        flex-direction: column;
    }

    .admin-screen-tabs button {
        width: 100%;
    }

    .user-row {
        grid-template-columns: 1fr;
    }

    .telegram-settings-panel {
        grid-template-columns: 1fr;
    }

    .telegram-settings-panel button {
        width: 100%;
    }

    .telegram-help-btn {
        width: 24px;
        min-width: 24px;
    }

    .telegram-guide-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .bug-report-form div {
        flex-direction: column;
    }

    .bug-report-row {
        grid-template-columns: 1fr;
    }

    .user-actions {
        grid-template-columns: 1fr;
    }

    .user-telegram-match {
        grid-template-columns: 1fr;
    }

    .lead-view-toggle {
        width: 100%;
    }

    .lead-view-toggle button {
        flex: 1;
    }

    #lead-list {
        overflow-x: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        max-height: calc(100vh - 220px);
        scrollbar-gutter: stable both-edges;
    }

    .lead-horizontal-scroll {
        display: block;
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 8px;
        z-index: 40;
        width: auto;
        margin-top: 0;
        box-shadow: 0 8px 20px rgba(27, 94, 32, 0.18);
    }

    .lead-header {
        display: none;
    }

    .lead-row {
        grid-template-columns: 76px 46px minmax(0, 1fr) 78px 24px;
        grid-template-areas:
            "status score listing actions expand"
            "name name name name name"
            "phone phone property region price"
            "note note note note note";
        min-width: 0;
        align-items: start;
        gap: 8px;
        padding: 14px;
        font-size: 14px;
    }

    #lead-list.table-scroll-mode {
        overflow-x: auto;
        overflow-y: auto;
    }

    #lead-list.table-scroll-mode .lead-row {
        grid-template-columns: 72px 46px 88px 76px 148px 108px 124px 112px 76px 24px;
        grid-template-areas:
            "status score listing name phone property region price actions expand"
            "note note note note note note note note note note";
        min-width: 880px;
        white-space: nowrap;
    }

    #lead-list.table-scroll-mode .lead-row span,
    #lead-list.table-scroll-mode .lead-row a {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #lead-list.table-scroll-mode .lead-row .lead-phone {
        overflow: visible;
        text-overflow: clip;
    }

    .lead-row span,
    .lead-row a {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .lead-name {
        font-weight: 800;
    }

    .lead-phone,
    .lead-property-type,
    .lead-region,
    .lead-price {
        color: #4b5563;
        font-size: 13px;
    }

    .lead-price {
        text-align: right;
        font-weight: 800;
    }

    .status-cell {
        font-size: 12px;
        padding: 6px;
    }

    .score-cell {
        font-size: 12px;
        padding: 6px;
    }

    .lead-actions {
        justify-content: flex-end;
    }

    .lead-actions button {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .note-cell {
        grid-template-columns: 36px 1fr;
        font-size: 14px;
    }

}

@media (max-width: 430px) {
    .logo {
        gap: 10px;
    }

    .house-icon {
        font-size: 36px;
    }

    .logo h1 {
        font-size: 23px;
    }

    .logo p {
        font-size: 13px;
    }

    .login-card {
        width: 100%;
        padding: 22px;
        border-radius: 14px;
    }

    .header-phone-editor {
        flex-direction: column;
        align-items: stretch;
    }

    .header-phone-editor input {
        max-width: none;
        width: 100%;
    }

    .header-phone-editor button {
        width: 100%;
    }

    .daily-lead-title {
        align-items: flex-start;
        flex-direction: column;
        padding: 12px;
    }

    .lead-row {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "status actions"
            "score expand"
            "listing listing"
            "name name"
            "phone phone"
            "property property"
            "region region"
            "price price"
            "note note";
        padding: 12px;
    }

    .score-cell,
    .status-cell,
    .lead-price {
        text-align: left;
    }

    .lead-actions {
        justify-content: flex-end;
    }

    .listing-cell {
        width: 100%;
    }

    .note-cell {
        grid-template-columns: 1fr;
    }
}

.status-yeni {
    background: #e8f5e9;
    color: #1b5e20;
}

.status-arandi {
    background: #e3f2fd;
    color: #0d47a1;
}

.status-mesgul {
    background: #fff3e0;
    color: #e65100;
}

.status-mesaj-gonderildi {
    background: #e0f7fa;
    color: #006064;
}

.status-tekrar-ara {
    background: #fff8e1;
    color: #8a5a00;
}

.status-randevu {
    background: #f3e5f5;
    color: #6a1b9a;
}

.status-portfoye-eklendi {
    background: #e0f2f1;
    color: #00695c;
}

.status-satilmis {
    background: #dcfce7;
    color: #166534;
}

.status-kiralanmis {
    background: #dbeafe;
    color: #1e40af;
}

.status-pasif {
    background: #f3f4f6;
    color: #4b5563;
}

.status-reddetti {
    background: #ffebee;
    color: #b71c1c;
}

.status-takip {
    background: #ede7f6;
    color: #4527a0;
}

.status-baska-emlakcida {
    background: #eceff1;
    color: #37474f;
}

.search-profile-card.active-search-profile {
    background: #dff3e3;
    border: 2px solid #2e7d32;
}

.search-profile-meta {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bordered-btn {
    border: 1px solid #b8d9bf;
}

.pending-url-card {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    border-radius: 14px;
    background: #f8fcf9;
    border: 1px solid #dcefe0;
    color: #263238;
    text-align: left;
    cursor: pointer;
    font-size: 15px;
}

.pending-url-card:hover {
    background: #eaf7ed;
    border-color: #2e7d32;
}

.scan-page-card {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 12px;
    background: #f8fcf9;
    border: 1px solid #dcefe0;
    color: #263238;
    text-decoration: none;
    font-size: 14px;
    min-width: 0;
}

.scan-page-card:hover {
    background: #eaf7ed;
    border-color: #2e7d32;
}

.scan-page-card span {
    font-weight: 800;
    color: var(--dark-green);
}

.scan-page-card small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}

.pending-url-title {
    flex: 1;
    line-height: 1.35;
    min-width: 0;
}

.pending-url-title strong,
.pending-url-title small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pending-url-title small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.pending-url-status {
    white-space: nowrap;
    font-weight: 700;
    font-size: 13px;
    align-self: flex-start;
    padding: 4px 8px;
    border-radius: 999px;
    background: #fff8e1;
    color: #8a5a00;
}

.url-status-opened {
    background: #e3f2fd;
    color: #0d47a1;
}

.url-status-imported {
    background: #e8f5e9;
    color: #1b5e20;
}

.url-status-skipped {
    background: #ffebee;
    color: #b71c1c;
}

.scan-summary {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fcf9;
    color: var(--muted);
    font-size: 13px;
}

.scan-summary strong {
    color: var(--dark-green);
    font-size: 18px;
}

.scan-summary small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scan-summary-active {
    border-color: #2e7d32;
    background: #eaf7ed;
}
