* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    margin-bottom: 30px;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 2rem;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.subtitle {
    color: #666;
    font-size: 0.95rem;
}

.logout-btn {
    padding: 8px 16px;
    background: #f5f5f5;
    color: #666;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #e0e0e0;
    color: #333;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.login-card h1 {
    font-size: 1.8rem;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.login-card .subtitle {
    margin-bottom: 24px;
}

.login-field {
    margin-bottom: 16px;
    text-align: left;
}

.login-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

.login-field input:focus {
    outline: none;
    border-color: #4a6cf7;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: #4a6cf7;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}

.login-btn:hover {
    background: #3a5ce5;
}

.login-error {
    background: #fce4ec;
    color: #c62828;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.form-section {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.form-section h2 {
    font-size: 1.1rem;
    margin-bottom: 14px;
    color: #333;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.flex-grow {
    flex: 1;
}

label {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: #444;
}

input[type="text"],
select,
textarea {
    padding: 10px 12px;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #4a6cf7;
}

textarea {
    resize: vertical;
}

.upload-hint {
    font-size: 0.82rem;
    color: #888;
    margin-bottom: 10px;
}

.file-drop-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    background: #fafafa;
}

.file-drop-area:hover,
.file-drop-area.drag-over {
    border-color: #4a6cf7;
    background: #f0f4ff;
}

.file-drop-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.drop-text {
    font-size: 0.95rem;
    color: #888;
    margin-bottom: 8px;
}

.file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #e3f2fd;
    color: #1565c0;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Funder Tiers */
.tier-card {
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
}

.tier-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
}

.tier-header h3 {
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tier-badge {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 6px;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
}

.tier-A .tier-header { background: #e8f5e9; }
.tier-A .tier-badge { background: #2e7d32; }
.tier-B .tier-header { background: #e3f2fd; }
.tier-B .tier-badge { background: #1565c0; }
.tier-C .tier-header { background: #fff3e0; }
.tier-C .tier-badge { background: #e65100; }
.tier-D .tier-header { background: #fce4ec; }
.tier-D .tier-badge { background: #c62828; }

.tier-count {
    font-size: 0.8rem;
    color: #666;
    font-weight: normal;
}

.select-all-btn {
    padding: 4px 12px;
    border: 1.5px solid #4a6cf7;
    background: transparent;
    color: #4a6cf7;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.select-all-btn:hover {
    background: #4a6cf7;
    color: #fff;
}

.select-all-btn.active {
    background: #4a6cf7;
    color: #fff;
}

.tier-body {
    padding: 8px 16px 12px;
    background: #fff;
}

.funder-item {
    display: flex;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.funder-item input[type="checkbox"] {
    margin-top: 3px;
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4a6cf7;
}

.funder-info {
    flex: 1;
}

.funder-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.funder-emails {
    font-size: 0.8rem;
    color: #666;
    margin-top: 2px;
}

.funder-notes {
    font-size: 0.78rem;
    color: #999;
    margin-top: 2px;
    font-style: italic;
}

.portal-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #ffecb3;
    color: #f57f17;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: 8px;
}

.funder-item.portal-only {
    opacity: 0.5;
}

/* Send Button */
.send-btn {
    display: block;
    width: 100%;
    padding: 16px;
    background: #4a6cf7;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.send-btn:hover:not(:disabled) {
    background: #3a5ce5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.3);
}

.send-btn:disabled {
    background: #b0bec5;
    cursor: not-allowed;
}

.send-btn.sending {
    background: #ff9800;
}

/* Status Section */
.status-section {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    margin-top: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.status-section h2 {
    margin-bottom: 14px;
    font-size: 1.1rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.status-funder {
    font-weight: 600;
    font-size: 0.9rem;
}

.status-emails {
    font-size: 0.78rem;
    color: #888;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.sent {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-badge.failed {
    background: #fce4ec;
    color: #c62828;
}

.status-badge.sending {
    background: #fff3e0;
    color: #e65100;
}

.status-badge.skipped {
    background: #f5f5f5;
    color: #999;
}

/* Responsive */
@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
    }
    .file-grid {
        grid-template-columns: 1fr;
    }
}
