*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 520px;
    padding: 32px;
    transition: box-shadow .2s;
}

.card:hover {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.card h1 {
    font-size: 22px;
    font-weight: 700;
    color: #1c1e21;
    margin-bottom: 4px;
}

.card .sub {
    font-size: 14px;
    color: #65676b;
    margin-bottom: 24px;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1c1e21;
    margin-bottom: 6px;
}

textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 14px;
    font-size: 15px;
    border: 1px solid #ccd0d5;
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
    transition: border-color .2s;
}

textarea:focus {
    outline: none;
    border-color: #1877f2;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.15);
}

.upload-area {
    margin-top: 16px;
    border: 2px dashed #ccd0d5;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    position: relative;
}

.upload-area:hover {
    border-color: #1877f2;
    background: #f5f8ff;
}

.upload-area.has-file {
    border-color: #31a24c;
    background: #f0fff4;
}

.upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-area .icon {
    font-size: 28px;
}

.upload-area .hint {
    font-size: 13px;
    color: #65676b;
    margin-top: 6px;
}

.upload-area .filename {
    font-size: 13px;
    color: #31a24c;
    font-weight: 600;
    margin-top: 4px;
    display: none;
}

.upload-area.has-file .filename {
    display: block;
}

.upload-area.has-file .hint {
    display: none;
}

.btn {
    margin-top: 20px;
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: #1877f2;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s, opacity .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover:not(:disabled) {
    background: #166fe5;
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.btn.loading .spinner {
    display: inline-block;
}

.btn.loading .label-text {
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.status {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 8px;
}

.status.visible {
    display: flex;
}

.status.info {
    background: #e7f3ff;
    color: #004080;
}

.status.success {
    background: #e6f9ed;
    color: #1a6b31;
}

.status.error {
    background: #ffe6e6;
    color: #b30000;
}

.accounts-section {
    margin-top: 16px;
}

.accounts-section>.hint {
    font-size: 12px;
    color: #65676b;
    margin-bottom: 8px;
}

.account-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    align-items: center;
}

.account-input {
    flex: 1;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #ccd0d5;
    border-radius: 6px;
}

.account-input:focus {
    outline: none;
    border-color: #1877f2;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.15);
}

.btn-remove {
    width: 32px;
    height: 32px;
    border: none;
    background: #f0f2f5;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-remove:hover {
    background: #ffe6e6;
    color: #b30000;
}

.btn-add {
    width: 100%;
    padding: 8px;
    border: 1px dashed #ccd0d5;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    color: #1877f2;
    cursor: pointer;
    margin-top: 4px;
}

.btn-add:hover {
    background: #f5f8ff;
    border-color: #1877f2;
}

.btn-oauth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: #1877f2;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s;
}

.btn-oauth:hover {
    background: #166fe5;
}

.btn-connect {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: #1877f2;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s;
}

.btn-connect:hover {
    background: #166fe5;
}

.btn-reconnect {
    background: #e41e3f;
}

.btn-reconnect:hover {
    background: #c91a36;
}

.badge-expired {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1.4;
    background: #ffe6e6;
    color: #b30000;
}

.account-name-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #ccd0d5;
    border-radius: 6px;
}

.account-name-input:focus {
    outline: none;
    border-color: #1877f2;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.15);
}

.account-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1.4;
}

.account-badge.type-user {
    background: #e7f3ff;
    color: #1877f2;
}

.account-badge.type-page {
    background: #e6f9ed;
    color: #1a6b31;
}

.account-badge.type-group {
    background: #fff3e6;
    color: #b85c00;
}

.badge-pending {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1.4;
    background: #fff3cd;
    color: #856404;
}

.btn-small {
    width: auto;
    padding: 8px 16px;
    margin-top: 0;
    font-size: 13px;
    flex-shrink: 0;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    text-align: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1c1e21;
    margin-bottom: 8px;
}

.modal-text {
    font-size: 14px;
    color: #65676b;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-cancel {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #ccd0d5;
    background: #fff;
    color: #1c1e21;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s;
}

.btn-cancel:hover {
    background: #f0f2f5;
}

.btn-confirm-delete {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    background: #e41e3f;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s;
}

.btn-confirm-delete:hover {
    background: #c91a36;
}