:root {
    --bg-page: #0e1621;
    --bg-card: #17212b;
    --bg-elevated: #242f3d;
    --border: #0f1a24;
    --divider: #101921;
    --text-primary: #ffffff;
    --text-secondary: #6c7883;
    --accent: #5288c1;
    --accent-hover: #4a79ac;
    --bubble-out: #2b5278;
    --bubble-in: #182533;
    --online: #4dcd5e;
    --row-hover: #1c2733;
    --row-active: #2b5278;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    width: 340px;
}

.auth-card h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 24px;
    color: var(--accent);
}

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.field input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn {
    width: 100%;
    padding: 10px 12px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn:hover {
    background: var(--accent-hover);
}

.error {
    background: rgba(220, 60, 60, 0.15);
    border: 1px solid rgba(220, 60, 60, 0.4);
    color: #f2a3a3;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.tg-app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.tg-rail {
    width: 60px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-right: 1px solid var(--divider);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
}

.tg-rail-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
}

.tg-rail-icon {
    color: var(--text-secondary);
    font-size: 20px;
    text-decoration: none;
    line-height: 1;
    display: block;
}

.tg-rail-icon:hover {
    color: var(--text-primary);
}

.tg-list {
    width: 340px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-right: 1px solid var(--divider);
    display: flex;
    flex-direction: column;
}

.tg-list-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--divider);
}

.tg-search {
    width: 100%;
    background: var(--bg-elevated);
    border: none;
    border-radius: 20px;
    padding: 9px 16px;
    color: var(--text-primary);
    font-size: 14px;
}

.tg-search::placeholder {
    color: var(--text-secondary);
}

.tg-search:focus {
    outline: none;
}

.tg-items {
    flex: 1;
    overflow-y: auto;
}

.tg-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
}

.tg-item:hover {
    background: var(--row-hover);
}

.tg-item.active {
    background: var(--row-active);
}

.tg-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
    position: relative;
}

.tg-avatar .status-dot {
    position: absolute;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--online);
    border: 2px solid var(--bg-card);
    bottom: 0;
    right: 0;
}

.tg-avatar.c1 { background: #e17076; }
.tg-avatar.c2 { background: #7bc862; }
.tg-avatar.c3 { background: #e5ca77; }
.tg-avatar.c4 { background: #65aadd; }
.tg-avatar.c5 { background: #a695e7; }
.tg-avatar.c6 { background: #ee7aae; }
.tg-avatar.c7 { background: #6ec9cb; }
.tg-avatar.c8 { background: #f2955f; }

.tg-item-body {
    flex: 1;
    min-width: 0;
}

.tg-item-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.tg-item-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tg-item-time {
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-left: 8px;
}

.tg-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2px;
}

.tg-item-preview {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tg-badge {
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    flex-shrink: 0;
    margin-left: 8px;
}

.tg-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-page);
    min-width: 0;
}

.tg-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--divider);
}

.tg-chat-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.tg-chat-status {
    font-size: 13px;
    color: var(--text-secondary);
}

.tg-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tg-bubble {
    max-width: 60%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
}

.tg-bubble.in {
    align-self: flex-start;
    background: var(--bubble-in);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.tg-bubble.out {
    align-self: flex-end;
    background: var(--bubble-out);
    color: var(--text-primary);
    border-bottom-right-radius: 4px;
}

.tg-bubble-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-align: right;
}

.tg-input-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-card);
    border-top: 1px solid var(--divider);
}

.tg-input-bar input {
    flex: 1;
    background: var(--bg-elevated);
    border: none;
    border-radius: 20px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 14px;
}

.tg-input-bar input:focus {
    outline: none;
}

.tg-icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 19px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.tg-icon-btn:hover {
    color: var(--text-primary);
}

.tg-items::-webkit-scrollbar,
.tg-messages::-webkit-scrollbar {
    width: 6px;
}

.tg-items::-webkit-scrollbar-thumb,
.tg-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
.page-wrap {
    min-height: 100vh;
    padding: 32px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.page-header {
    width: 100%;
    max-width: 480px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.page-header a {
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
}

.account-list {
    width: 100%;
    max-width: 480px;
    margin-bottom: 24px;
}

.account-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
}

.account-row .name {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
}

.account-row .phone {
    font-size: 13px;
    color: var(--text-secondary);
}

.account-row .status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(77, 205, 94, 0.15);
    color: var(--online);
}

.step {
    display: none;
}

.step.active {
    display: block;
}

.hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin: -8px 0 16px;
}