/* ---------------------------------------------------------------------------
   Mail toolbar & folder tabs
   --------------------------------------------------------------------------- */

.cp-mail-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

/* Diverges intentionally from .panel-tabs - pill-style sub-filter for mail folders. */
.cp-folder-tabs {
    display: flex;
    gap: var(--space-xs);
}

.cp-folder-tab {
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.38);
    font-size: var(--font-size-xs);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
    text-transform: capitalize;
}

.cp-folder-tab.active {
    background: rgba(197, 160, 89, 0.08);
    border-color: rgba(197, 160, 89, 0.28);
    color: var(--gold);
}

/* ---------------------------------------------------------------------------
   Mail list rows
   --------------------------------------------------------------------------- */

.cp-mail-list {
}

.cp-mail-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: 12px 0;
    cursor: pointer;
    content-visibility: auto;
    contain-intrinsic-size: auto 56px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.12s;
    border-radius: 4px;
    position: relative;
}

.cp-mail-row:hover {
    background: rgba(255, 255, 255, 0.02);
    padding-left: 6px;
}
.cp-mail-row--unread {
    background: rgba(197, 160, 89, 0.03);
}
.cp-mail-row--unread .cp-mail-from {
    color: rgba(255, 255, 255, 0.95);
}

.cp-mail-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(197, 160, 89, 0.1);
    border: 1px solid rgba(197, 160, 89, 0.2);
    color: var(--gold);
    font-weight: 700;
    font-size: var(--font-size-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.cp-mail-body {
    flex: 1;
    min-width: 0;
}

.cp-mail-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-sm);
    margin-bottom: 3px;
}

.cp-mail-from {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-mail-date {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.28);
    flex-shrink: 0;
}

.cp-mail-subject {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-mail-preview {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.28);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold);
    flex-shrink: 0;
    margin-top: 8px;
}

/* ---------------------------------------------------------------------------
   Mail thread / reading pane
   --------------------------------------------------------------------------- */

.cp-mail-thread-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.cp-thread-subject {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-mail-read-pane {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: 20px;
}

.cp-message-bubble {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 6px;
    padding: 14px 16px;
}

.cp-message-bubble--mine {
    background: rgba(197, 160, 89, 0.05);
    border-color: rgba(197, 160, 89, 0.14);
}

.cp-message-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: 10px;
}

.cp-message-author {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--gold);
}

.cp-message-date {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.28);
    margin-right: auto;
}

.cp-message-body {
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.cp-message-postage {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.18);
    margin-top: 10px;
    font-style: italic;
}

.cp-reply-bar {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* ---------------------------------------------------------------------------
   Compose form
   --------------------------------------------------------------------------- */

.cp-compose {
}

.cp-compose-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.cp-compose-title {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
}

.cp-compose-lock {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: rgba(200, 80, 80, 0.07);
    border: 1px solid rgba(200, 80, 80, 0.18);
    border-radius: 5px;
    color: rgba(220, 150, 150, 0.85);
    font-size: var(--font-size-sm);
    line-height: 1.45;
}

.cp-lock-icon {
    margin-right: 6px;
}

.cp-compose-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}
.cp-compose-form--locked {
    opacity: 0.55;
}

.cp-compose-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.cp-compose-label {
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.cp-compose-input,
.cp-compose-textarea {
    width: 100%;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.85);
    font-size: var(--font-size-base);
    font-family: inherit;
    box-sizing: border-box;
    resize: vertical;
}

.cp-compose-input:focus,
.cp-compose-textarea:focus {
    outline: none;
    border-color: rgba(197, 160, 89, 0.4);
}

.cp-compose-input::placeholder,
.cp-compose-textarea::placeholder {
    color: rgba(255, 255, 255, 0.18);
}

.cp-compose-input:disabled,
.cp-compose-textarea:disabled {
    opacity: 0.45;
    cursor: unset;
}

.cp-compose-charcount {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}

.cp-compose-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 6px;
}

.cp-compose-postage {
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.28);
    font-style: italic;
}

.task-modal-start-btn--disabled {
    opacity: 0.4;
    cursor: unset;
}

/* =============================================================================
   Lab 10 – mail split pane, thread list, read pane, compose helpers
   ============================================================================= */

/* ── Mail split pane ─────────────────────────────────────────────────────── */
.cl10-mail-split {
    display: grid;
    grid-template-columns: 38% 62%;
    border: var(--border-gold);
    border-radius: var(--radius-md);
    overflow: hidden;
    min-height: 380px;
}
.cl10-thread-list {
    overflow-y: auto;
    max-height: 380px;
    border-right: var(--border-gold);
    border-bottom: none;
}
.cl10-mail-read-col {
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
}

/* ── Right reading pane ──────────────────────────────────────────────────── */
.cl10-read-pane {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: var(--space-sm);
}
.cl10-read-sender {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid rgba(197, 160, 89, 0.1);
}
.cl10-read-sender-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.cl10-read-subject {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--gold);
    padding: var(--space-xs) 0;
}
.cl10-read-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.cl10-read-actions {
    display: flex;
    gap: 8px;
    padding-top: var(--space-sm);
    border-top: 1px solid rgba(197, 160, 89, 0.1);
    margin-top: auto;
}

/* ── Portrait size variants ──────────────────────────────────────────────── */
.cl10-portrait--md {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

/* ── Thread list items ───────────────────────────────────────────────────── */
.cl10-thread {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(197, 160, 89, 0.08);
    transition: background 0.12s;
}
.cl10-thread:hover {
    background: rgba(197, 160, 89, 0.04);
}
.cl10-thread--active {
    background: rgba(197, 160, 89, 0.06);
}
.cl10-thread--unread {
    background: rgba(197, 160, 89, 0.07);
    border-left: 3px solid var(--gold);
    padding-left: 9px;
}
.cl10-thread--unread.cl10-thread--active {
    background: rgba(197, 160, 89, 0.1);
}
.cl10-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold);
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(197, 160, 89, 0.65);
}
.cl10-unread-spacer {
    width: 7px;
    flex-shrink: 0;
}
.cl10-thread-meta {
    flex: 1;
    min-width: 0;
}
.cl10-thread-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.cl10-thread-sender {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}
.cl10-thread-sender--unread {
    font-weight: 600;
}
.cl10-thread-date {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    flex-shrink: 0;
}
.cl10-thread-subject {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cl10-thread-subject--unread {
    color: var(--text-primary);
    font-weight: 600;
}

.cp-folder-tab .cp-tab-count {
    margin-left: 4px;
    font-size: 0.75em;
    vertical-align: super;
    color: var(--gold);
}

/* ── Preview pane ────────────────────────────────────────────────────────── */
.cl10-preview {
    background: var(--surface-raised);
}
.cl10-preview-inner {
    padding: 18px 20px;
}
.cl10-preview-subject {
    font-family: var(--font-heading);
    font-size: var(--font-size-base);
    color: var(--gold);
    margin: 0 0 10px;
}
.cl10-preview-body {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0 0 18px;
}

/* ── Compose helpers ─────────────────────────────────────────────────────── */
.cl10-compose-tip {
    margin-bottom: 14px;
}
.cl10-compose-tip-icon {
    width: 13px;
    height: 13px;
    opacity: 0.65;
}
.cl10-compose-coin {
    width: 13px;
    height: 13px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 1px;
}

@media (max-width: 700px) {
    .cl10-mail-split {
        grid-template-columns: 1fr;
    }
    .cl10-thread-list {
        border-right: none;
        border-bottom: var(--border-gold);
        max-height: 200px;
    }
}
