/*
 * defnd.email Dashboard — Secure Terminal Aesthetic
 * Clean, information-dense, security-focused
 */

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */

.dash-body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
}

.dash-layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */

.dash-sidebar {
    width: 260px;
    background: var(--color-bg-elevated);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
}

@media (min-width: 1024px) {
    .dash-sidebar {
        position: sticky;
        transform: translateX(0);
    }
}

.dash-sidebar-open {
    transform: translateX(0);
}

.dash-sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--color-border-subtle);
}

.dash-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 17px;
    color: var(--color-text);
    text-decoration: none;
}

.dash-logo svg {
    color: var(--color-accent);
}

.dash-logo:hover {
    opacity: 0.8;
}

/* ============================================
   NAVIGATION
   ============================================ */

.dash-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.dash-nav-section {
    margin-bottom: 24px;
}

.dash-nav-section:last-child {
    margin-bottom: 0;
}

.dash-nav-label {
    padding: 0 12px;
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-subtle);
}

.dash-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.15s ease;
    margin-bottom: 2px;
}

.dash-nav-link:hover {
    color: var(--color-text);
    background: var(--color-surface);
}

.dash-nav-link.active {
    color: var(--color-text);
    background: var(--color-accent-subtle);
}

.dash-nav-link.active svg {
    color: var(--color-accent);
}

.dash-nav-link svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.dash-nav-link:hover svg,
.dash-nav-link.active svg {
    opacity: 1;
}

.dash-nav-badge {
    margin-left: auto;
    padding: 2px 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    background: var(--dash-status-secure);
    color: var(--dash-status-secure-text);
    border-radius: 10px;
}

/* ============================================
   SIDEBAR FOOTER / USER
   ============================================ */

.dash-sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--color-border-subtle);
    display: flex;
    align-items: center;
    gap: 12px;
}

.dash-user {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dash-user-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent-subtle);
    color: var(--color-accent);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    border-radius: 8px;
    flex-shrink: 0;
}

.dash-user-info {
    min-width: 0;
}

.dash-user-email {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-user-plan {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--color-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dash-logout-form {
    margin: 0;
}

.dash-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.dash-logout-btn:hover {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-text-subtle);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.dash-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

@media (min-width: 1024px) {
    .dash-main {
        margin-left: 0;
    }
}

.dash-content {
    flex: 1;
    padding: 24px;
}

@media (min-width: 768px) {
    .dash-content {
        padding: 32px 40px;
    }
}

/* ============================================
   MOBILE HEADER
   ============================================ */

.dash-mobile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--color-bg-elevated);
    border-bottom: 1px solid var(--color-border-subtle);
}

@media (min-width: 1024px) {
    .dash-mobile-header {
        display: none;
    }
}

.dash-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    cursor: pointer;
}

.dash-mobile-title {
    flex: 1;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
}

.dash-theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-muted);
    cursor: pointer;
}

/* ============================================
   OVERLAY
   ============================================ */

.dash-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

@media (min-width: 1024px) {
    .dash-overlay {
        display: none !important;
    }
}

/* ============================================
   PAGE HEADER
   ============================================ */

.dash-page-header {
    margin-bottom: 32px;
}

.dash-page-title {
    font-family: var(--font-display);
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 700;
    margin-bottom: 8px;
}

.dash-page-subtitle {
    font-size: 15px;
    color: var(--color-text-muted);
    max-width: 600px;
}

/* ============================================
   STATS GRID
   ============================================ */

.dash-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

@media (min-width: 768px) {
    .dash-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

.dash-stat {
    padding: 20px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    transition: border-color 0.15s ease;
}

.dash-stat:hover {
    border-color: var(--color-text-subtle);
}

.dash-stat-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-subtle);
    margin-bottom: 8px;
}

.dash-stat-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
}

.dash-stat-change {
    margin-top: 8px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.dash-stat-change-up {
    color: var(--dash-status-secure);
}

.dash-stat-change-down {
    color: #ef4444;
}

/* ============================================
   CARDS
   ============================================ */

.dash-card {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
}

.dash-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border-subtle);
}

.dash-card-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
}

.dash-card-action {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-accent);
    text-decoration: none;
}

.dash-card-action:hover {
    text-decoration: underline;
}

.dash-card-body {
    padding: 20px;
}

.dash-card-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--color-text-muted);
}

.dash-card-empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    border-radius: 12px;
    color: var(--color-text-subtle);
}

.dash-card-empty-text {
    font-size: 14px;
    margin-bottom: 16px;
}

/* ============================================
   TABLES
   ============================================ */

.dash-table {
    width: 100%;
    border-collapse: collapse;
}

.dash-table th {
    padding: 12px 16px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-subtle);
    text-align: left;
    border-bottom: 1px solid var(--color-border-subtle);
}

.dash-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--color-border-subtle);
}

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

.dash-table tr:hover td {
    background: var(--color-surface);
}

/* ============================================
   STATUS BADGES
   ============================================ */

:root {
    --dash-status-secure: #22c55e;
    --dash-status-secure-bg: rgba(34, 197, 94, 0.1);
    --dash-status-secure-text: #16a34a;
    --dash-status-warning: #f59e0b;
    --dash-status-warning-bg: rgba(245, 158, 11, 0.1);
    --dash-status-warning-text: #d97706;
    --dash-status-error: #ef4444;
    --dash-status-error-bg: rgba(239, 68, 68, 0.1);
    --dash-status-error-text: #dc2626;
    --dash-status-pending: #6b7280;
    --dash-status-pending-bg: rgba(107, 114, 128, 0.1);
    --dash-status-pending-text: #6b7280;
}

[data-theme="dark"] {
    --dash-status-secure-text: #4ade80;
    --dash-status-warning-text: #fbbf24;
    --dash-status-error-text: #f87171;
    --dash-status-pending-text: #9ca3af;
}

.dash-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 6px;
}

.dash-badge-secure {
    background: var(--dash-status-secure-bg);
    color: var(--dash-status-secure-text);
}

.dash-badge-warning {
    background: var(--dash-status-warning-bg);
    color: var(--dash-status-warning-text);
}

.dash-badge-error {
    background: var(--dash-status-error-bg);
    color: var(--dash-status-error-text);
}

.dash-badge-pending {
    background: var(--dash-status-pending-bg);
    color: var(--dash-status-pending-text);
}

.dash-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ============================================
   BUTTONS
   ============================================ */

.dash-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.dash-btn-primary {
    background: var(--color-accent);
    color: var(--color-accent-text);
}

.dash-btn-primary:hover {
    background: var(--color-accent-hover);
    transform: translateY(-1px);
}

.dash-btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.dash-btn-secondary:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-text-subtle);
}

.dash-btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.dash-btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

/* ============================================
   FORMS (Dashboard specific)
   ============================================ */

.dash-input {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.dash-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

.dash-input-mono {
    font-family: var(--font-mono);
    font-size: 13px;
}

.dash-form-group {
    margin-bottom: 20px;
}

.dash-form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--color-text);
}

.dash-form-hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--color-text-subtle);
}

/* ============================================
   CODE BLOCKS (for API keys, etc)
   ============================================ */

.dash-code {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
}

.dash-code-value {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-code-copy {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.dash-code-copy:hover {
    background: var(--color-bg-elevated);
    color: var(--color-text);
    border-color: var(--color-text-subtle);
}

/* ============================================
   GRID LAYOUTS
   ============================================ */

.dash-grid {
    display: grid;
    gap: 24px;
}

.dash-grid-2 {
    grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
    .dash-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.dash-grid-3 {
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .dash-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* ============================================
   SECURITY INDICATOR
   ============================================ */

.dash-security {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--dash-status-secure-bg);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 12px;
    margin-bottom: 24px;
}

.dash-security-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dash-status-secure);
    border-radius: 10px;
    color: white;
}

.dash-security-text {
    flex: 1;
}

.dash-security-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--dash-status-secure-text);
    margin-bottom: 2px;
}

.dash-security-desc {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* ============================================
   QUICK ACTIONS
   ============================================ */

.dash-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
}

.dash-quick-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    transition: all 0.15s ease;
}

.dash-quick-action:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-subtle);
}

.dash-quick-action svg {
    color: var(--color-accent);
}

/* ============================================
   ACTIVITY LIST
   ============================================ */

.dash-activity {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dash-activity-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--color-border-subtle);
}

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

.dash-activity-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    border-radius: 8px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.dash-activity-content {
    flex: 1;
    min-width: 0;
}

.dash-activity-text {
    font-size: 14px;
    color: var(--color-text);
    margin-bottom: 4px;
}

.dash-activity-time {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-text-subtle);
}

/* ============================================
   EMPTY STATES
   ============================================ */

.dash-empty {
    padding: 60px 20px;
    text-align: center;
}

.dash-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    border-radius: 16px;
    color: var(--color-text-subtle);
}

.dash-empty-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.dash-empty-desc {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 24px;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   DNS RECORDS DISPLAY
   ============================================ */

.dash-dns-record {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 12px;
    padding: 14px 16px;
    background: var(--color-surface);
    border-radius: 8px;
    margin-bottom: 12px;
}

.dash-dns-record:last-child {
    margin-bottom: 0;
}

.dash-dns-type {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--color-accent);
    text-transform: uppercase;
}

.dash-dns-value {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--color-text);
    word-break: break-all;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes dash-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dash-animate-in {
    animation: dash-fade-in 0.3s ease forwards;
}

.dash-animate-in-delay-1 { animation-delay: 0.05s; }
.dash-animate-in-delay-2 { animation-delay: 0.1s; }
.dash-animate-in-delay-3 { animation-delay: 0.15s; }
.dash-animate-in-delay-4 { animation-delay: 0.2s; }

/* ============================================
   COMPOSE OVERLAY
   ============================================ */

.compose-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
    opacity: 0;
    animation: compose-backdrop-in 0.2s ease-out forwards;
}

.compose-backdrop.hidden {
    display: none;
}

@keyframes compose-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.compose-overlay {
    position: fixed;
    inset: 0;
    z-index: 51;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px);
    animation: compose-enter 0.25s ease-out forwards;
}

.compose-overlay.hidden {
    display: none;
}

@media (min-width: 768px) {
    .compose-overlay {
        inset: 32px;
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(20px);
        max-width: 720px;
        width: calc(100% - 64px);
        max-height: calc(100vh - 64px);
        border-radius: 16px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    }
}

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

@media (min-width: 768px) {
    @keyframes compose-enter {
        from {
            opacity: 0;
            transform: translateX(-50%) translateY(20px) scale(0.98);
        }
        to {
            opacity: 1;
            transform: translateX(-50%) translateY(0) scale(1);
        }
    }
}

/* Compose Header */
.compose-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-elevated);
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .compose-header {
        padding: 16px 20px;
        border-radius: 16px 16px 0 0;
    }
}

.compose-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: var(--color-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.compose-close-btn:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

.compose-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}

.compose-draft-btn {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted);
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.compose-draft-btn:hover {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-text-subtle);
}

.compose-send-btn {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (min-width: 1024px) {
    .compose-send-btn {
        display: flex;
    }
}

.compose-send-btn:hover {
    background: var(--color-surface);
    border-color: var(--color-text-subtle);
}

.compose-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Compose Form */
.compose-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Recipients Section */
.compose-recipients-section {
    border-bottom: 1px solid var(--color-border);
}

.compose-field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    min-height: 44px;
}

.compose-field.hidden {
    display: none !important;
}

.compose-field:not(:last-child) {
    border-bottom: 1px solid var(--color-border-subtle);
}

.compose-label {
    flex-shrink: 0;
    width: 40px;
    font-size: 14px;
    color: var(--color-text-muted);
}

.compose-chips-container {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-height: 24px;
}

.compose-chips {
    display: contents;
}

.compose-chips-input {
    flex: 1;
    min-width: 120px;
    padding: 4px 0;
    font-size: 16px;
    background: none;
    border: none;
    color: var(--color-text);
    outline: none;
}

.compose-chips-input::placeholder {
    color: var(--color-text-subtle);
}

.compose-ccbcc-toggle {
    flex-shrink: 0;
    padding: 4px 10px;
    font-size: 13px;
    color: var(--color-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s;
}

.compose-ccbcc-toggle:hover {
    color: var(--color-text);
}

/* Recipient Chips */
.recipient-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px 4px 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    font-size: 13px;
    color: var(--color-text);
    animation: chip-in 0.15s ease-out;
}

@keyframes chip-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.recipient-chip.e2e {
    border-color: var(--color-e2e);
    background: rgba(16, 185, 129, 0.1);
}

.recipient-chip-icon {
    width: 14px;
    height: 14px;
    color: var(--color-e2e);
}

.recipient-chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 2px;
    border-radius: 50%;
    color: var(--color-text-subtle);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.recipient-chip-remove:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.recipient-chip-remove svg {
    width: 12px;
    height: 12px;
}

/* Subject Section */
.compose-subject-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border);
}

.compose-subject-input {
    flex: 1;
    padding: 4px 0;
    font-size: 16px;
    font-weight: 500;
    background: none;
    border: none;
    color: var(--color-text);
    outline: none;
}

.compose-subject-input::placeholder {
    color: var(--color-text-subtle);
    font-weight: 400;
}

/* Body Section */
.compose-body-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.compose-body-textarea {
    flex: 1;
    width: 100%;
    padding: 16px;
    font-size: 16px;
    line-height: 1.6;
    background: none;
    border: none;
    color: var(--color-text);
    resize: none;
    outline: none;
}

.compose-body-textarea::placeholder {
    color: var(--color-text-subtle);
}

/* Rich Text Toolbar */
.compose-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
    flex-shrink: 0;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.toolbar-btn:hover {
    background: var(--color-hover);
    color: var(--color-text);
}

.toolbar-btn.active {
    background: var(--color-primary-subtle);
    color: var(--color-primary);
}

.toolbar-btn svg {
    width: 16px;
    height: 16px;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--color-border);
    margin: 0 6px;
}

/* Tiptap Editor */
.compose-editor {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
}

.compose-editor .tiptap {
    padding: 16px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    outline: none;
    min-height: 100%;
}

.compose-editor .tiptap p {
    margin: 0 0 1em 0;
}

.compose-editor .tiptap p:last-child {
    margin-bottom: 0;
}

.compose-editor .tiptap p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    float: left;
    color: var(--color-text-subtle);
    pointer-events: none;
    height: 0;
}

.compose-editor .tiptap strong {
    font-weight: 600;
}

.compose-editor .tiptap em {
    font-style: italic;
}

.compose-editor .tiptap u {
    text-decoration: underline;
}

.compose-editor .tiptap s {
    text-decoration: line-through;
}

.compose-editor .tiptap code {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    background: var(--color-surface);
    border-radius: 4px;
}

.compose-editor .tiptap a {
    color: var(--color-primary);
    text-decoration: underline;
}

.compose-editor .tiptap ul,
.compose-editor .tiptap ol {
    margin: 0 0 1em 0;
    padding-left: 1.5em;
}

.compose-editor .tiptap li {
    margin-bottom: 0.25em;
}

.compose-editor .tiptap ul {
    list-style-type: disc;
}

.compose-editor .tiptap ol {
    list-style-type: decimal;
}

.compose-editor .tiptap blockquote {
    margin: 1em 0;
    padding-left: 1em;
    border-left: 3px solid var(--color-border);
    color: var(--color-text-muted);
}

.compose-editor .tiptap hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 1.5em 0;
}

/* Quote blocks for reply/forward */
.compose-editor .quote-header {
    color: var(--color-text-muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.compose-editor .email-quote {
    margin: 0;
    padding: 12px 16px;
    border-left: 3px solid var(--color-border);
    background: var(--color-surface);
    border-radius: 0 8px 8px 0;
}

.compose-editor .forward-header {
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 500;
}

.compose-editor .forward-meta {
    color: var(--color-text-muted);
    font-size: 13px;
    margin-top: 8px;
}

.compose-editor .forward-meta > div {
    margin-bottom: 4px;
}

/* Attachments */
.compose-attachments {
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
}

.compose-attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.compose-attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 13px;
}

.compose-attachment-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compose-attachment-size {
    color: var(--color-text-subtle);
    font-size: 12px;
}

.compose-attachment-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 4px;
    border-radius: 4px;
    color: var(--color-text-subtle);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.compose-attachment-remove:hover {
    background: var(--color-surface-hover);
    color: var(--color-error);
}

/* Footer */
.compose-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-elevated);
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .compose-footer {
        border-radius: 0 0 16px 16px;
    }
}

.compose-attach-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--color-text-muted);
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.compose-attach-btn:hover {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-text-subtle);
}

/* Password Protection Dropdown */
.compose-password-wrapper {
    position: relative;
}

.compose-password-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.compose-password-btn:hover {
    color: var(--color-text);
    background: var(--color-surface);
}

.compose-password-btn.active {
    color: var(--color-password);
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--color-password);
}

/* Dropdown panel */
.compose-password-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 260px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 100;
    animation: dropdownSlideUp 0.15s ease;
}

.compose-password-dropdown.show {
    display: block;
}

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

.compose-password-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.compose-password-dropdown-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.1s;
}

.compose-password-dropdown-close:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

.compose-password-dropdown-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.compose-password-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.compose-password-field label {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.compose-password-field input {
    padding: 8px 10px;
    font-size: 16px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.compose-password-field input::placeholder {
    color: var(--color-text-subtle);
}

.compose-password-field input:focus {
    border-color: var(--color-password);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

.compose-password-field input.error {
    border-color: var(--color-error);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
}

.compose-password-error {
    font-size: 12px;
    color: var(--color-error);
    min-height: 16px;
}

.compose-password-dropdown-footer {
    display: flex;
    justify-content: space-between;
    padding: 12px 14px;
    border-top: 1px solid var(--color-border);
    gap: 8px;
}

.compose-password-remove-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.compose-password-remove-btn:hover {
    color: var(--color-error);
    border-color: var(--color-error);
    background: rgba(239, 68, 68, 0.05);
}

.compose-password-apply-btn {
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    background: var(--color-password);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.compose-password-apply-btn:hover:not(:disabled) {
    background: #d97706;
}

.compose-password-apply-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.compose-encryption-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-e2e);
    transition: color 0.15s;
}

.compose-send-btn-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--color-bg-elevated);
    color: var(--color-text-muted);
    border: 2px solid var(--color-border);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.compose-send-btn-mobile:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
    transform: scale(1.05);
}

.compose-send-btn-mobile:active {
    transform: scale(0.95);
}
