/* Letters Page Styles */

.letters-page {
    max-width: 2500px;
    margin: 0 auto;
    outline: none;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.page-title h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-title p {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* Status Tabs */
.status-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.status-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.status-tab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.5);
}

.status-tab.active {
    background: white;
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-count {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--border-primary);
    color: var(--text-muted);
}

.status-tab.active .tab-count {
    background: var(--color-primary-bg);
    color: var(--color-primary);
}

/* Highlighted tab count for non-zero approver-inbox badges — draws the eye
   immediately when a letter lands in the user's pending queue. Mirrors the
   Templates page's "My Approvals" highlight. */
.tab-count.highlight {
    background: var(--color-danger, #dc2626);
    color: #fff;
    font-weight: 600;
}

.status-tab.active .tab-count.highlight {
    background: var(--color-danger, #dc2626);
    color: #fff;
}

/* "Pending My Approval" tab: subtle accent so it reads as the approver inbox
   instead of yet-another-status tab. Icon + tab content stay aligned. */
.status-tab.pending-my-approval {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-tab.pending-my-approval .bi {
    font-size: 13px;
    color: var(--color-primary, #2563eb);
}

/* Filters Bar */
.filters-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
}

.filters-left {
    display: flex;
    gap: 12px;
}

.filters-right {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.filter-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
}

.filter-dropdown i {
    color: var(--text-placeholder);
    font-size: 14px;
}

.filter-dropdown select {
    border: none;
    background: transparent;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    padding-right: 20px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2.5 4.5l3.5 3.5 3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
}

.filter-dropdown select:focus {
    outline: none;
}

/* Letters Table */
.letters-table {
    background: white;
    border-radius: 16px;
    border: 1px solid var(--border-primary);
    overflow: visible;
}

.letters-page .table-header {
    display: grid;
    grid-template-columns: 48px minmax(77px, 0.69fr) 220px 65px minmax(59px, 0.4fr) 158px 140px 126px 180px 120px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-radius: 16px 16px 0 0;
    min-width: fit-content;
}

.letters-page .letter-row {
    display: grid;
    grid-template-columns: 48px minmax(77px, 0.69fr) 220px 65px minmax(59px, 0.4fr) 158px 140px 126px 180px 120px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--bg-tertiary);
    align-items: center;
    border-left: 4px solid transparent;
    transition: background 0.2s ease, border-left-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    min-width: fit-content;
}

.letter-row:hover {
    background: var(--bg-secondary);
    border-left-color: #f59e0b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    z-index: 1;
}

.letter-row:last-child {
    border-bottom: none;
}

.letter-row.selected {
    background: #eff6ff;
    border-left-color: #f59e0b;
}

/* Checkbox */
.col-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--text-faint);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox:hover {
    border-color: var(--text-placeholder);
}

.checkbox.checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox.checked::after {
    content: "";
    width: 10px;
    height: 6px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(-45deg) translate(1px, -1px);
}

/* Letter Info */
.letter-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.letter-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.letter-title a {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.15s;
}

.letter-title a:hover {
    color: var(--color-primary);
}

.ai-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: linear-gradient(135deg, #818cf8, #6366f1);
    color: white;
}

.letter-meta {
    font-size: 12px;
    color: var(--text-placeholder);
}

/* Batch Header */
.batch-header-row {
    cursor: pointer;
    background: #fafbfc;
    border-left-color: #e2e8f0 !important;
}

.batch-header-row:hover {
    background: #f1f5f9;
    border-left-color: #94a3b8 !important;
}

.batch-chevron {
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    width: 14px;
}

.batch-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 4px;
    background: #dbeafe;
    color: #1e40af;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.batch-recipient-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.batch-status-summary {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Client Cell */
.client-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.client-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: #4f46e5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.client-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.client-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-email {
    font-size: 12px;
    color: var(--text-placeholder);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* #152: signature-recipient list (up to 2 visible) with per-signer status icons */
.recipient-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.recipient-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.recipient-row > .bi {
    font-size: 13px;
    line-height: 1;
    margin-top: 3px;
    flex-shrink: 0;
}

.recipient-icon-signed { color: var(--color-success, #059669); }
.recipient-icon-viewed { color: var(--color-warning-text, #92400e); }
.recipient-icon-pending { color: var(--text-placeholder, #9ca3af); }

.recipient-text { min-width: 0; }

/* "+N more" chip — the remaining recipients are listed in the cell's hover tooltip */
.recipient-more {
    display: inline-block;
    width: fit-content;
    margin-left: 21px; /* align under the recipient text (icon width + gap) */
    font-size: 11px;
    font-weight: 600;
    color: var(--color-info-text, #1e40af);
    background: var(--color-info-bg, #dbeafe);
    border-radius: var(--radius-full, 9999px);
    padding: 0 7px;
    cursor: default;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap; /* keep multi-word statuses (e.g. "Pending Approval") on one line */
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.draft {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.status-badge.pending {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.status-badge.approved {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.status-badge.sent {
    background: var(--color-primary-bg);
    color: var(--color-info-text);
}

.status-badge.failed {
    background: var(--color-danger-bg);
    color: var(--color-danger-dark);
}

.status-badge.generating {
    background: var(--color-primary-bg);
    color: var(--color-primary);
}

/* External (redline) review — its own slot so "External Review" reads
   distinctly from pending/sent. Two words, so never let it wrap (#115). */
.status-badge.external-review {
    background: var(--color-info-bg);
    color: var(--color-info-text);
    white-space: nowrap;
}

/* External review link lapsed before the reviewer submitted — amber/warning so
   it reads as "needs attention", distinct from the active info-blue review (#115). */
.status-badge.review-expired {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    white-space: nowrap;
}

/* Reviewer submitted; ball is back with the internal team. Teal — distinct from
   External Review (blue), Review Expired (amber), and Approved (green). No design
   token exists for teal; this is the app's established teal accent (#115). */
.status-badge.internal-review {
    background: #ccfbf1;   /* teal-100 */
    color: #115e59;        /* teal-800 */
    white-space: nowrap;
}

/* Workflow is on the Send for Signature step — ready to send, not yet dispatched. Orange =
   "action needed", distinct from Sent (blue), Internal Review (teal), Review Expired (amber).
   Reads as the next action to take (#177). */
.status-badge.send-signature {
    background: #ffedd5;   /* orange-100 */
    color: #9a3412;        /* orange-800 */
    white-space: nowrap;
}

/* Status Badge Wrapper */
.status-badge-wrapper {
    position: relative;
    display: inline-block;
}

/* Center the Status column — header label and the badge in each row. */
.table-header .col-status,
.letter-row .col-status {
    text-align: center;
    justify-content: center;
}

/* Signed Checkmark */
.signed-check {
    position: absolute;
    top: -6px;
    right: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    color: #22c55e;
    text-decoration: none;
    transition: transform 0.15s;
    /* Button reset */
    appearance: none;
    -webkit-appearance: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font: inherit;
    line-height: 1;
    outline: none;
    box-shadow: none;
}

.signed-check:hover {
    transform: scale(1.15);
    color: var(--color-success-light);
    background: white;
}

.signed-check:focus {
    outline: none;
    box-shadow: none;
}

.signed-check i {
    font-size: 16px;
    line-height: 1;
}

/* Fetch PDF Button - shown when signature complete but PDF not yet downloaded */
.fetch-pdf-btn {
    position: absolute;
    top: -6px;
    right: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: #f59e0b;
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: all 0.15s;
    appearance: none;
    -webkit-appearance: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font: inherit;
    line-height: 1;
    outline: none;
    box-shadow: none;
}

.fetch-pdf-btn:hover:not(:disabled) {
    transform: scale(1.15);
    background: #d97706;
}

.fetch-pdf-btn:disabled {
    cursor: wait;
    opacity: 0.8;
}

.fetch-pdf-btn.fetching {
    background: var(--text-muted);
}

.fetch-pdf-btn i {
    font-size: 10px;
    line-height: 1;
}

.fetch-pdf-btn .spinner-border-sm {
    width: 10px;
    height: 10px;
    border-width: 1.5px;
}

/* Date Cell */
.date-cell {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Date + time render inline on one line (with year). */
.date-cell .datetime-line {
    white-space: nowrap;
}

.date-cell .time {
    font-size: 11px;
    color: var(--text-placeholder);
    margin-left: 5px;
}

/* #128: due-date pill in the date cell. Neutral by default; amber when due soon,
   red when overdue. Tokens only — no purple/indigo. */
.due-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding: 1px 7px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
    white-space: nowrap;
}

.due-pill i {
    font-size: 10px;
}

.due-pill.due-soon {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    border-color: var(--color-warning-bg);
}

.due-pill.overdue {
    background: var(--color-danger-bg);
    color: var(--color-danger-dark);
    border-color: var(--color-danger-border);
}

/* Action Dropdown */
.action-dropdown {
    position: relative;
}

.btn-action-menu {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-action-menu:hover {
    background: var(--bg-secondary);
    border-color: var(--text-faint);
}

.btn-action-menu i {
    font-size: 10px;
    color: var(--text-placeholder);
}

.action-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99;
}

.action-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    min-width: 160px;
    padding: 6px;
    z-index: 100;
}

.action-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}

.action-menu-item:hover {
    background: var(--bg-tertiary);
}

.action-menu-item i {
    width: 16px;
    color: var(--text-muted);
}

.action-menu-item.danger {
    color: var(--color-danger);
}

.action-menu-item.danger:hover {
    background: var(--color-danger-bg-subtle);
}

.action-menu-item.danger i {
    color: var(--color-danger);
}

.action-menu-divider {
    height: 1px;
    background: var(--border-primary);
    margin: 6px 0;
}

/* Table Footer & Pagination */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
    border-radius: 0 0 16px 16px;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination-info strong {
    color: var(--text-primary);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--border-primary);
    background: white;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.page-btn:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--text-faint);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.page-ellipsis {
    padding: 0 8px;
    color: var(--text-placeholder);
}

/* Quick Actions Panel */
.quick-actions {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background: #1f2937;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.selected-count {
    font-size: 13px;
    font-weight: 500;
    color: white;
    padding-right: 16px;
    border-right: 1px solid #4b5563;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-faint);
    cursor: pointer;
    transition: all 0.15s;
}

.quick-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.quick-action-btn i {
    font-size: 14px;
}

.quick-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    background: white;
    border-radius: 16px;
    border: 1px solid var(--border-primary);
    text-align: center;
}

.empty-state i {
    font-size: 48px;
    color: var(--text-faint);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Loading */
.loading-container {
    display: flex;
    justify-content: center;
    padding: 60px 0;
}

/* Modal */
.letters-page .modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.letters-page .modal.show {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    width: 480px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    z-index: 1001;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.letters-page .modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.letters-page .modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.letters-page .modal-close {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.letters-page .modal-close:hover {
    background: var(--border-primary);
    color: var(--text-secondary);
}

.letters-page .modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.letters-page .modal-body p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.letter-subject {
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.letters-page .warning-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-danger);
    padding: 12px;
    background: var(--color-danger-bg-subtle);
    border-radius: 8px;
}

.letters-page .warning-text i {
    font-size: 16px;
}

.letters-page .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-primary);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-secondary);
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.15s;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

/* Alerts */
.alert-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--color-danger-bg-subtle);
    border: 1px solid var(--color-danger-border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--color-danger);
    margin-top: 16px;
}

.alert-success {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--color-success-bg-subtle);
    border: 1px solid var(--color-success-border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--color-success-light);
    margin-top: 16px;
}

/* Buttons — see design-tokens.css for canonical button rules. */

/* Responsive */
@media (max-width: 1200px) {
    .letters-page .table-header,
    .letters-page .letter-row {
        grid-template-columns: 40px minmax(62px, 0.69fr) 190px 60px minmax(51px, 0.36fr) 144px 120px 108px 170px 110px;
    }
}

/* Client column */
.letter-row .col-client {
    font-size: 14px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-reference {
    font-weight: 500;
}

/* External ID Column */
.col-external {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.external-id-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.external-id {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.external-source {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #6366f1;
    background: #eef2ff;
    padding: 1px 4px;
    border-radius: 3px;
    width: fit-content;
}

@media (max-width: 768px) {
    .filters-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .filters-left {
        flex-wrap: wrap;
    }

    .status-tabs {
        flex-wrap: wrap;
    }

    .table-header {
        display: none;
    }

    .letter-row {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .col-checkbox {
        position: absolute;
        top: 16px;
        left: 16px;
    }

    .letter-row {
        position: relative;
        padding-left: 48px;
    }

    .col-actions {
        width: 100%;
    }

    .btn-action-menu {
        width: 100%;
        justify-content: center;
    }

    .action-menu {
        left: 0;
        right: 0;
    }

    .modal.show {
        width: 95vw;
    }

    .quick-actions {
        left: 16px;
        right: 16px;
        transform: none;
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Owner column */
.letter-row .col-owner {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.letter-row .col-owner.unassigned {
    color: var(--text-muted);
    font-style: italic;
}

/* Workflow assignee column — same visual rules as Owner so the two columns
   read as paired "people" columns. Italic em-dash when no active workflow. */
.letter-row .col-workflow-assignee {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.letter-row .col-workflow-assignee.unassigned {
    color: var(--text-muted);
    font-style: italic;
}

/* Mine-only toggle (admin filter) */
.letters-page .mine-only-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.letters-page .mine-only-toggle.active {
    background: var(--accent-primary, #4F8FF7);
    color: white;
    border-color: var(--accent-primary, #4F8FF7);
}

/* Workflow outcome banner — appears under the page header after a Submit/Approve/Reject
   redirects back from the Letter Review page with ?submitted=1 / ?rejected=1 / ?completed=1. */
.workflow-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 14px;
    line-height: 1.4;
}

.workflow-banner-success {
    background: var(--color-success-bg-subtle, #f0fdf4);
    color: var(--color-success-text, #065f46);
    border-color: var(--color-success-bg, #d1fae5);
}

.workflow-banner-warning {
    background: var(--color-warning-bg, #fef3c7);
    color: var(--color-warning-text, #92400e);
    border-color: var(--color-warning-text, #92400e);
    border-color: rgba(146, 64, 14, 0.2);
}

.workflow-banner-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.workflow-banner-text {
    flex: 1;
}

.workflow-banner-close {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0.6;
    font-size: 14px;
    line-height: 1;
}

.workflow-banner-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
}
