.ah-action {
    margin-left: auto;
    border: none;
    background: var(--app-surface);
    color: var(--accent);
    font-size: 16px;
    font-weight: 600;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 17px;
    cursor: pointer;
    font-family: var(--font);
}

.text-input {
    width: 100%;
    border: none;
    outline: none;
    background: var(--app-surface);
    color: var(--app-text);
    font-size: 15.5px;
    font-family: var(--font);
    padding: 12px 14px;
    border-radius: 12px;
}
.text-input::placeholder { color: var(--app-text-dim); }

.search-input { margin: 4px 0 6px; }

.form-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 6px 0;
}

.form-error {
    color: var(--red);
    font-size: 13px;
    min-height: 18px;
    padding: 4px 2px;
}

.primary-btn {
    width: 100%;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 15.5px;
    font-weight: 600;
    font-family: var(--font);
    padding: 13px;
    border-radius: 13px;
    cursor: pointer;
    margin-top: 6px;
}
.primary-btn:active { filter: brightness(0.85); }

.empty-state {
    text-align: center;
    color: var(--app-text-dim);
    font-size: 14px;
    padding: 46px 20px;
}

.ui-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
}

.list-row.danger .row-label { color: var(--red); }

.confirm-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: flex-end;
    padding: 14px;
    z-index: 85;
}
.confirm-sheet {
    width: 100%;
    background: var(--app-surface);
    border-radius: 16px;
    padding: 16px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: sheetup 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes sheetup {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.confirm-text {
    text-align: center;
    color: var(--app-text);
    font-size: 14.5px;
    padding-bottom: 6px;
}
.confirm-btn {
    border: none;
    background: var(--app-surface-2);
    color: var(--app-text);
    font-size: 15.5px;
    font-weight: 600;
    font-family: var(--font);
    padding: 12px;
    border-radius: 11px;
    cursor: pointer;
}
.confirm-btn.confirm-danger {
    background: var(--red);
    color: #fff;
}
.confirm-btn.confirm-primary {
    background: var(--accent);
    color: #fff;
}

.drop-scanning {
    text-align: center;
    color: var(--app-text-dim);
    font-size: 13.5px;
    padding: 26px 0 10px;
}
.drop-scanning::before {
    content: '';
    display: block;
    width: 34px;
    height: 34px;
    margin: 0 auto 12px;
    border-radius: 50%;
    border: 3px solid var(--app-surface-2);
    border-top-color: var(--accent);
    animation: dropspin 0.9s linear infinite;
}
@keyframes dropspin { to { transform: rotate(360deg); } }

.contact-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    cursor: pointer;
    position: relative;
}
.contact-row:active { background: var(--app-surface-2); }
.contact-row + .contact-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: 66px;
    right: 0;
    height: 1px;
    background: var(--app-separator);
}
.cr-info { flex: 1; min-width: 0; }
.cr-name { font-size: 15.5px; font-weight: 600; }
.cr-number { font-size: 13px; color: var(--app-text-dim); }
.cr-star { color: var(--orange); font-size: 15px; }
.cr-blocked {
    color: var(--red);
    font-size: 11.5px;
    font-weight: 600;
    background: color-mix(in srgb, var(--red) 14%, transparent);
    padding: 3px 8px;
    border-radius: 9px;
}

.contact-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 0 16px;
}
.ch-name { font-size: 21px; font-weight: 700; margin-top: 6px; }
.ch-number { font-size: 14px; color: var(--app-text-dim); }
.contact-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.contact-action {
    border: none;
    background: var(--app-surface);
    color: var(--accent);
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--font);
    padding: 9px 18px;
    border-radius: 12px;
    cursor: pointer;
}
.contact-action:active { background: var(--app-surface-2); }

.thread-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    position: relative;
}
.thread-row:active { background: var(--app-surface-2); }
.thread-row + .thread-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: 70px;
    right: 0;
    height: 1px;
    background: var(--app-separator);
}
.tr-info { flex: 1; min-width: 0; }
.tr-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}
.tr-name {
    font-size: 15.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tr-when { font-size: 12px; color: var(--app-text-dim); flex-shrink: 0; }
.tr-preview {
    font-size: 13.5px;
    color: var(--app-text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}
.tr-unread {
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-title {
    font-size: 16px;
    font-weight: 700;
    flex: 1;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-scroller {
    flex: 1;
    overflow-y: auto;
    padding: 4px 16px;
}
.chat-send.ready, .dark-send { background: var(--accent); }
.tr-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    visibility: hidden;
}
.thread-row.unread .tr-dot { visibility: visible; }
.thread-row.unread .tr-name { font-weight: 800; }
.mr-info { flex: 1; min-width: 0; }
.mail-row { display: flex; gap: 10px; align-items: flex-start; }
.chat-scroller::-webkit-scrollbar { display: none; }
.chat-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    justify-content: flex-end;
    min-height: 100%;
}

.bubble-wrap { display: flex; flex-direction: column; margin-bottom: 6px; }
.bubble-wrap.stack { margin-bottom: 0; }
.bubble-wrap.mine   { align-items: flex-end; }
.bubble-wrap.theirs { align-items: flex-start; }
.bubble-sender {
    font-size: 11px;
    color: var(--app-text-dim);
    margin: 6px 12px 1px;
}
.bubble {
    position: relative;
    max-width: 76%;
    padding: 8px 13px;
    border-radius: 18px;
    font-size: 14.5px;
    line-height: 1.35;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.mine .bubble {
    background: var(--accent);
    color: #fff;
}
.theirs .bubble {
    background: var(--app-surface-2);
    color: var(--app-text);
}
.bubble-wrap.mine:not(.stack) .bubble::before {
    content: '';
    position: absolute;
    right: -7px;
    bottom: 0;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-bottom-left-radius: 15px 13px;
}
.bubble-wrap.mine:not(.stack) .bubble::after {
    content: '';
    position: absolute;
    right: -11px;
    bottom: 0;
    width: 11px;
    height: 20px;
    background: var(--app-bg);
    border-bottom-left-radius: 9px;
}
.bubble-wrap.theirs:not(.stack) .bubble::before {
    content: '';
    position: absolute;
    left: -7px;
    bottom: 0;
    width: 18px;
    height: 18px;
    background: var(--app-surface-2);
    border-bottom-right-radius: 15px 13px;
}
.bubble-wrap.theirs:not(.stack) .bubble::after {
    content: '';
    position: absolute;
    left: -11px;
    bottom: 0;
    width: 11px;
    height: 20px;
    background: var(--app-bg);
    border-bottom-right-radius: 9px;
}
.bubble-media::before, .bubble-media::after { display: none; }

.msg-datesep {
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--app-text-dim);
    margin: 12px 0 8px;
}
.msg-status {
    text-align: right;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--app-text-dim);
    margin: 2px 6px 0;
}

.imsg-head {
    display: grid;
    grid-template-columns: 72px 1fr 72px;
    align-items: end;
    padding: 50px 12px 8px;
    border-bottom: 1px solid var(--app-separator);
    flex-shrink: 0;
}
.imsg-head .ah-back {
    border: none;
    background: none;
    color: var(--accent);
    font-size: 14px;
    cursor: pointer;
    font-family: var(--font);
    padding: 4px 6px 4px 0;
    width: 72px;
    text-align: left;
}
.imsg-head .ah-action {
    border: none;
    background: none;
    color: var(--accent);
    font-size: 18px;
    cursor: pointer;
    font-family: var(--font);
    width: 72px;
    text-align: right;
}
.imsg-head-center {
    justify-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    border: none;
    background: none;
    color: inherit;
    font-family: var(--font);
    padding: 2px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: opacity 0.12s, transform 0.12s;
}
.imsg-head-center:active { opacity: 0.65; transform: scale(0.97); }
.imsg-head-name { font-size: 11.5px; font-weight: 500; }

.contact-sheet .cs-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 6px 0 14px;
}
.contact-sheet .cs-name { font-size: 17px; font-weight: 600; }
.contact-sheet .cs-num { font-size: 13px; color: var(--app-text-dim); }

.load-earlier {
    display: block;
    margin: 6px auto;
    border: none;
    background: var(--app-surface);
    color: var(--accent);
    font-size: 12.5px;
    font-weight: 600;
    font-family: var(--font);
    padding: 7px 14px;
    border-radius: 13px;
    cursor: pointer;
}

.chat-inputbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 22px;
    flex-shrink: 0;
}
.chat-input { flex: 1; border-radius: 19px; }
.chat-send {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: var(--app-surface-2);
    transition: background 0.15s;
    color: #fff;
    font-size: 19px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}
.chat-send:disabled { opacity: 0.5; }
